A little “remember me later” for conditionally deploying a Rails 3 app running on Ruby 1.9 on Heroku.
$ruby_version = `ruby --version`.split[1].to_f
$heroku = ENV['USER'].match(/^repo\d+/)
source :rubygems
source 'http://gems.github.com'
gem 'rails', '3.0.0.beta4'
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'bson_ext', '~> 1.0.1'
gem 'decent_exposure'
gem 'haml'
gem 'mongoid', '>= 2.0.0.beta.9'
unless $heroku
if $ruby_version < 1.9
gem 'ruby-debug'
else
gem 'ruby-debug19'
end
group :development, :test do
gem 'rspec-rails', '>= 2.0.0.beta.17'
gem 'rails3-generators' #for HAML
end
end
The --without=test option isn’t (yet) being used on Heroku deploys, thus the :test group is in the unheroku block. Update: check if .bundle/config WITHOUT="" works.
Update: Mongoid changed gem versioning for lexicographical sorting (a “dot” between “beta” and the number
Update: Latest mongoid (beta.16 and something after beta.9) requires Rails 3.0.0.rc which doesn’t support Ruby 1.9.1 which isn’t yet on Heroku
Update: Heroku user doesn’t have “repo” in it anymore and USER env var isn’t available – find new mechanism if bundler config WITHOUT option doesn’t work
Also:
- Only the
--colo(u)rand--formatoptions work in the.rspecfile use_transactional_fixtures=falseinspec_helper.rb(talk to Chelimsky about transactional fixtures in non-ActiveRecord environments)- In application.rb:
require 'mongoid/railtie'require 'decent_exposure/railtie'g.orm :mongoidg.template-engine :hamlg.text_framework :rspec, :fixture => false, :views => false