Posts Tagged Gemfile
Heroku error with conditional rb-fsevent gem
Posted by John in Ruby and Rails on February 16, 2012
Using the guard gem to run tests etc in your Rails app normally requires some form of file system monitoring.
The monitoring will be OS dependant and rb-fsevent is the gem for OSX. This can be added to the Gemfile conditionally with:
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
Unfortunately when you next push to Heroku you are likely to get an error along the lines of:
This is due to Heroku not allowing conditions in the Gemfile, even in the dev group.
The alternative is to put the gem in it’s own group:
And on non Mac systems run bundle install --without darwin (this only needs to be run once, the without setting is remembered for future bundle installs). Then for Heroku run heroku config:add BUNDLE_WITHOUT="development test darwin"
Don’t forget to add –remote remote_name if you are pushing to a remote other than heroku (e.g. heroku config:add BUNDLE_WITHOUT="development test darwin" --remote staging) and don’t forget to merge your amended Gemfile into master before running git push heroku master.
Rails 3.1 on Heroku, TLDR Version
Posted by John in Ruby and Rails on December 13, 2011
Create the app
- If not installed, install PostgreSQL
rails new app_name -T -d=postgresqlcd app_name/rvm --create --rvmrc 1.9.2@app_namervm rvmrc trust- Edit .Gemfile
bundle installcreateuser -P -S -R -d app_name(no to ‘Superuser’ and ‘Create roles’, yes to ‘Create databases’)rake db:create- Create procfile in app root.
foreman startand check http://0.0.0.0:5000/
Push to Github
- Edit .gitignore
git flow initgit add .git commit -m 'Project skeleton'- Create app_name on Github
git remote add origin git@github.com:JohnPlummer/app_name.gitgit push -u origin developgit push -u origin master
Push to Heroku
heroku create app-name --stack cedargit flow release start '0.0.1'git flow release finish '0.0.1'git push --allgit push heroku masterheroku run rake db:seedheroku open