rake preview generating site without styles - octopress

I've set up a vanilla Octopress blog & I am hosting on github pages, but am encountering some issues when using rake preview.
To help troubleshoot, here's a short list of changes I've made since setting up Octopress (that I can recall):
in _config.yml, changed the url to my domain
in _config.yml, changed root to "/"
in _config.yml, specified my github repo under 3rd party settings
added CNAME pointing to my domain in /public/github
added CNAMe pointing to my domain in /source/
made a post using rake new_post
Here's a description of the issues:
http://localhost:4000 yields a 404, however, I am able to see my site at http://localhost:4000/github/index.html
When previewing /github/index.html, most of the stylesheets/JS are returning a 404.
Here's what happens when I run rake generate, followed by rake preview:
Starting to watch source with Jekyll and Compass. Starting Rack on port 4000
Configuration from /Users/[redacted]/Documents/code/octopress/_config.yml
[2013-09-09 10:21:44] INFO WEBrick 1.3.1
[2013-09-09 10:21:44] INFO ruby 1.9.3 (2013-06-27) [x86_64-darwin11.4.2]
[2013-09-09 10:21:44] INFO WEBrick::HTTPServer#start: pid=39870 port=4000
Auto-regenerating enabled: source -> public/github
[2013-09-09 10:21:45] regeneration: 95 files changed
>>> Change detected at 10:21:45 to: screen.scss
identical public/github/stylesheets/screen.css
Dear developers making use of FSSM in your projects,
FSSM is essentially dead at this point. Further development will
be taking place in the new shared guard/listen project. Please
let us know if you need help transitioning! ^_^b
- Travis Tilley
>>> Compass is watching for changes. Press Ctrl-C to Stop.

You need Python 2.x. You should be able to check your Python version at the command prompt with python --version
If you don't have it then if you are on Windows, download and install Python 2.7.6 from http://www.python.org/download/
then add C:\Python27 (or the folder where you installed Python) to your path environment variable.

Did you change the destination setting in _config.yml. Default should be something like this:
root: /
permalink: /blog/:year/:month/:day/:title/
source: source
destination: public

Related

Jekyll installation isn't showing index page upon navigation

I have recently made a foray into the Jekyll world. I'm currently exploring this on a local Apache2 server running Bootstrap 3 with a simple responsive layout.
Installation Summary
I just installed ruby, ruby-dev, gcc, make and all appropriate gems. The Jekyll installation guide was great to get it installed and such. I went ahead and create a new blog, 'sudo jekyll new blog' in /var/www/html. Now as, /var/www/html/blog.
Installation Directory
about.md
_config.yaml
Gemfile
Gemfile.block
.gitignore
index.md
_posts
.sass-cache
_site/
Post Installation Configuration
I've edited the _config.yaml file to establish base directories and such, everything looks appropriate.
I fire up the Jekyll instance via: sudo exec jykll serve, which is currently producing.
WARN: Unresolved specs during Gem::Specification.reset:
jekyll-watch (~> 1.1)
rouge (~> 1.7)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Configuration file: /var/www/html/blog/_config.yml
Configuration file: /var/www/html/blog/_config.yml
Source: /var/www/html/blog
Destination: /var/www/html/blog/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 0.458 seconds.
Auto-regeneration: enabled for '/var/www/html/blog'
Configuration file: /var/www/html/blog/_config.yml
Server address: http://127.0.0.1:4000/blog/
Server running... press ctrl-c to stop.
Issue
The issue that I am having is that when I navigate to localhost/blog, instead of seeing a 'homepage' or index, all I'm seeing is the directory structure as noted above. It's as if the index file isn't rendering or such. However, if I click into _site/, I get something that looks a bit like a classic landing page for the sample post.
Question
What am I missing? Did I mis-configure something? Is this expected behavior?
Thanks!
The problem is that you are looking at the generated files without a web server.
You can run a webserver at the folder that contains _config.yml, just to see that everything goes fine, then you need a "real" web server to serve your pages: $ jekyll serve
After running jekyll serve you will be able to access your website at: http://localhost:4000

How can I restore my Rails 5 binstubs?

I'm working in a Rails 5 app on macOS Sierra and everything was going well until I was ready for production to a Digital Ocean VPS. I followed one of the most famous Deploy Rails app tutorial using Capistrano, I after some bugs finally my app came to live running on production.
Now in my local environment when I run rails server or rails console I got this warning and I don't know how to fix it or whats going wrong with that.
Looks like your app's ./bin/rails is a stub that was generated by Bundler.
In Rails 5, your app's bin/ directory contains executables that are versioned
like any other source code, rather than stubs that are generated on demand.
Here's how to upgrade:
bundle config --delete bin # Turn off Bundler's stub generator
rails app:update:bin # Use the new Rails 5 executables
git add bin # Add bin/ to source control
You may need to remove bin/ from your .gitignore as well.
When you install a gem whose executable you want to use in your app,
generate it and add it to source control:
bundle binstubs some-gem-name
git add bin/new-executable
=> Booting Puma
=> Rails 5.0.0.1 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.6.0 (ruby 2.3.1-p112), codename: Sleepy Sunday Serenity
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop
I have been searching whats this bug and how to fix it but I have no luck! And for reference it seems to be something with Capistrano but I have done what they said is the solution and it does not work or maybe I have not implement it in the right way:
The solution would be:
1.- remove bin from the linked_dirs (which was not my case)
2.- add set :bundle_binstubs, nil to your config/deploy.rb to generate the binstubs
Some articles I found:
https://github.com/capistrano/rails/issues/171
https://github.com/capistrano/capistrano/issues/1675
Rails 5 console not working when deploying with Capistrano
https://github.com/capistrano/bundler/issues/45
I really appreciate any type of help you could provide me.
Thanks in advance.
I know this comes a bit late, but I found that I could run $ rails app:update and it would restore/overwrite my binstubs... along with overwriting all the other configuration files you start out with. So be careful about that.
See the Upgrading Ruby on Rails guide for more on this task.

Using Live Reload with Jekyll

I'm getting started with Jekyll static site generator and I would like to use Live Reload with it. I know Jekyll has a generator and server commands, and Live Reload can run various compilers and custom commands. How do I configure these to work together?
LiveReload is built into Jekyll 3.7+.
jekyll serve --livereload
You can also set LiveReload's port, delay, and ignored files. See jekyll help serve.
UPDATE: As pointed out in other answers, LiveReload is built into Jekyll 3.7+.
jekyll serve --livereload
For older versions:
The simplest approach I've found that works is to use two terminal windows: One for jekyll serve --watch and one for guard.
I tried the guard-jekyll-plus approach suggested by Nobu but I had a bunch of errors.
As shumushin pointed out, Jekyll can handle the automatic rebuilding process, you simply launch it using jekyll serve --watch
Now to get LiveReload working run guard with guard-livereload in a second terminal window. This is basically the same as Jan Segre's answer, but without guard-jekyll.
My Guardfile looks like this:
guard 'livereload' do
watch(/^_site/)
end
And my Gemfile:
gem 'jekyll'
gem 'guard'
gem 'guard-livereload'
Note: You still need to include the livereload script in your index.html page; it is the "glue" that binds guard-livereload and the browser together.
<script src="http://localhost:35729/livereload.js"></script>
There's guard-livereload which you can use with guard-jekyll and centralize the watching process with guard, an example would be (I haven't tested it):
Install guard-jekyll, either through gem or bundler
Install guard-livereload, either through gem or bundler
Init guard-jekyll
guard init jekyll
Add this to your Guardfile:
guard 'livereload' do
watch(%r{_site/.+})
end
You can adapt the above to suit better your project, and
you probably already know you have to include the livereload
script on your page:
<script src="http://localhost:35729/livereload.js"></script>
Oh, and to start the whole watching mess:
guard
For jekyll 1.0+ use:
jekyll serve --watch
See Jekyll: Basic Usage for more details and options.
UPDATE: this no longer works with the latest version of Jekyll
cd your/site/folder
jekyll --server --auto
This post explains a cleaner way - Setting Up LiveReload With Jekyll
Gemfile:
gem 'jekyll'
gem 'guard'
gem 'guard-jekyll-plus'
gem 'guard-livereload'
Guardfile:
guard 'jekyll-plus', :serve => true do
watch /.*/
ignore /^_site/
end
guard 'livereload' do
watch /.*/
end
Install any LiveReload browser extension. Then run guard.
I wrote a Jekyll plugin called Hawkins that incorporates LiveReload into the Jekyll watch process. It works with Jekyll 3.1 and up.
Simply add
group :jekyll_plugins do
gem 'hawkins'
end
to your Gemfile (and then a bundle install). From there you can run jekyll liveserve. Hawkins will modify the head sections of your pages to include the necessary components for LiveReload, and when Jekyll detects a page change, Hawkins will push a message to your browser via WebSockets. Please note that you will need a browser that supports WebSockets. For very fast reloads, you can use Jekyll's new --incremental option that will only regenerate the changed pages.
Start by running jekyll normally in your site folder:
cd your/site/folder
jekyll
By default Jekyll generates a folder called _site inside it (your/site/folder/_site).
Tell LiveReload to watch that _site folder.
This command will open your website in the browser and uses jekyll built-in livereload server.
bundle exec jekyll serve -l -o
You need a latest jekyll version.
I just started using GitHub Pages today, and wanted to be able to use live reload with Jekyll. Got it working & written my first post on Creating GitHub Pages with Jekyll & LiveReload.
It uses Grunt with the grunt-contrib-watch plugin instead of Jekyll's serve command - works well for me. Hope it works for you as well.
You can use just jekyll serve -w, an option I prefer as I am lazy.
For Live Reload,
Remove Jekyll Admin from Gemfile in the root directory of your project and it works like charm.
If you're running it frequently, the Repla macOS app makes it easy to startup Jekyll so it automatically refreshes. After Repla is installed, you run it from the Jekyll blog's root directory and pass it the jekyll serve command. For example:
repla server "bundle exec jekyll serve --watch --drafts" -r "...done"
Repla will be configured to refresh each time ...done is printed in the console, which Jekyll prints when it finishes compiling your site.
Repla runs the Jekyll server process in a split below a browser split showing your site:
After Jekyll is running in Repla, you can also save the configuration to a file with ⌘S, shut it down by closing the window, and run it again just by double-clicking the file. In other words, you can start your Jekyll blog again next time just by opening the file, without involving the terminal at all.
Disclosure: I maintain the Repla app.

RVM, FSEvents, and CarbonCore on OS X

I'm setting up a project that uses SASS, which uses FSEvents to keep from polling the disk. It seems that this doesn't play nice with RVM, however. That means that when I run sass --watch I get this warning:
Warning: Unable to load CarbonCore. FSEvents will be unavailable.
I realize that it will still work, but I don't want to be polling my disk constantly. I want to get it working with FSEvents. The best information I could find about this was this thread:
http://groups.google.com/group/compass-users/browse_thread/thread/df7d9d0da9ec1eb1
I reinstalled my RVM Ruby (using 1.9.2) as described by Brandon Mathis and downloaded the linked RubyCocoa. However, I get an error on the first step of installing RubyCocoa:
[rvm 1.9.2] ~/Downloads/RubyCocoa-1.0.0 $ ruby install.rb config --build-universal=yes
install.rb: entering config phase...
create ext/rubycocoa/extconf.rb
create framework/GeneratedConfig.xcconfig
create framework/src/objc/Version.h
create tests/Makefile
---> framework
create /Users/xxx/Downloads/RubyCocoa-1.0.0/framework/src/objc/osx_ruby.h ...
config failed
hook /Users/xxx/Downloads/RubyCocoa-1.0.0/framework/post-config.rb failed:
No such file or directory - /Users/xxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/x86_64-darwin10.6.0/ruby.h
try 'ruby install.rb --help' for usage
It looks like the problem stems from this being an older version of RubyCocoa (I notice the missing file has 1.9.1 in the path), but in the Google Groups post, Brandon Mathis says specifically to use the version he links and not the newest one.
Does anyone know how to get this configured, or have a link to a recent, hopefully simpler and clearer guide to getting FSEvents working with RVM?
Versions in question:
RVM 1.2.0
Ruby 1.9.2 patch level 136 (installed via RVM)
Mac OS X 10.6.6
HAML gem 3.0.25 (SASS is part of HAML)
Thanks!
I wrote FSSM, which is what HAML/SASS/Compass use for their filesystem watching backend. While rubycocoa isn't supported in 1.9.x, the latest git version of FSSM has pretty solid support for rb-fsevent. This library currently has other limitations, like only being able to monitor one path (parent directory is a must here), but I'm working on it. ;)
I'd highly suggest installing rb-fsevent, and then FSSM from github: https://github.com/ttilley/fssm
If you have any problems, please don't hesitate to file an issue in the tracker. FSSM is a currently maintained project, and it was originally written to help Chris Eppstein out with providing watch functionality in compass (which was later adopted in sass itself). Ease of use via these libraries is my absolute top priority.
This is kind of a lost battle. You can copy the contents of the include/ruby folder from the Ruby source code to that location /Users/xxx/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/x86_64-darwin10.6.0/ which will let you run the config command, but after that you will get a lot of errors on the setup command and you won't be able to install it all. People say RubyCocoa doesn't work with 1.9.2 and I don't know if anyone managed to make it work.
I tried the FSSM method above, to no avail...
Gemfile now has:
group :development do
gem 'rb-fsevent'
gem 'fssm', :git => 'https://github.com/ttilley/fssm.git'
end
which installs:
fssm (0.2.6.1)
rb-fsevent (0.4.0)
Still getting this tho:
Warning: Unable to load CarbonCore. FSEvents will be unavailable.
Anyone have install steps to make FSSM work nicely?

No such file to load bundler error for Rails 3

I have a Rails 3 app ready for staging.
I haven't got a VPS host set up yet. As I was planning to have everything on shared host for the first few months.
Problem:
cd myapp
bundle check
result:
The Gemfile's dependencies are satisfied
Passenger error:
Error message:
no such file to load -- bundler
Exception class:
LoadError
Frustrating thing about shared hosts is that I have to add these lines on config.ru:
ENV['GEM_HOME'] = '/home/username/.gems'
ENV['GEM_PATH'] = '$GEM_HOME:/usr/lib/ruby/gems/1.8'
Still no luck. Same no such file to load bundler error appears.
Has anybody got this working? Rails 3, Debian, shared host (dreamhost)?
I could just go ahead and register on Slicehost/Fivebean but before I do, I'd like to know why that error is showing up.
Thanks.
The solution is here http://rvm.beginrescueend.com/integration/passenger/. You need to point your HTTP server to passenger_ruby wrapper instead of bin/ruby.
E.g. for RVM & Apache it should be something like that:
PassengerRuby /Users/username/.rvm/bin/passenger_ruby
Passenger doesn't read environment variables from config.ru until after it has loaded. Without your backtrace I can't be positive, but I suspect everything will work if you just run bundle lock. If you're still having trouble after that, there's a list of troubleshooting information at the bottom of the bundler README that I need to know exactly what's going on.
Rails hosting on shared hosts is already a minefield, but throwing in Rails 3 in all its pre-release goodness including Bundler reinventing the rubygems workflow is a recipe for pulling your hair out.
I host a few Rails sites on Dreamhost, but only the versions they officially support, otherwise it's just not worth the time. You can get a VPS now for almost as cheap as Dreamhost, and you will save hours and hours of your own time.
If you're looking for an easy answer, I'd suggest voting up the following and crossing your fingers:
Rails 3 on dreamhost?
For me, this turned out to be an issue with the passenger_ruby directive that passenger-install-nginx-module spits out at the end of installation. It was missing the gemset name in the path to the ruby.
This works: (the fix)
passenger_ruby /Users/dzello/.rvm/wrappers/ruby-1.9.2-p0#rails3/ruby;
This did not: (what passenger-install-nginx-module spits out)
passenger_ruby /Users/dzello/.rvm/rubies/ruby-1.9.2-p0/bin/ruby
Note the passenger_ruby line does not include the proper gem path - the #rails3 (rails3 is the gemset name) portion is missing, even though it got it right for passenger root.
Found some random blog. It had some lines that went in 'config.ru', that seemed to work for me.
ENV['GEM_HOME'] = '/home/farleyknight/.gems'
ENV['GEM_PATH'] = '$GEM_HOME:/usr/lib/ruby/gems/1.8'
require 'rubygems'
Gem.clear_paths
Maybe it will work for you..
I had this problem with vps plus rvm, rails3, capistrano and nginx.
Passenger was installed by root but the web site was installed by user fox. Nginx (root) was configured to run the app as fox. When logged in as fox, Bundler was installed but running gem list bundler as root showed no gem.
Passenger start would give error bundler was missing. Only cure for this was to install bundler as root AND fox. I'm guessing passenger checks for bundler while not under the user fox as configured in nginx.

Resources