Skip to content

Instantly share code, notes, and snippets.

@robmckinnon
Created January 6, 2010 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robmckinnon/270394 to your computer and use it in GitHub Desktop.
Save robmckinnon/270394 to your computer and use it in GitHub Desktop.
rails application template
file 'Gemfile', %{
# directory "vendor/rails", :glob => "{*/,}*.gemspec"
# git "git://github.com/rails/arel.git"
# git "git://github.com/rails/rack.git"
clear_sources
bundle_path "vendor/bundler_gems"
source 'http://gemcutter.org'
source 'http://gems.github.com'
disable_system_gems
gem 'rails', '#{Rails::VERSION::STRING}'
gem "haml"
gem "friendly_id"
gem "resource_controller"
gem "mysql"
only :test do
gem "rspec"
gem "rspec-rails"
gem "test-unit", "1.2.3"
gem "cucumber"
gem "cucumber-rails"
gem "database_cleaner"
gem "webrat"
gem "autotest-rails"
gem "spork"
end
}.strip
append_file '.gitignore', %{
bin
vendor/plugins
vendor/bundler_gems
test
config/database.yml
.DS_Store
doc
log
}
run 'gem bundle'
run 'rm -rf test'
run 'cp config/database.yml config/database.yml.example'
append_file '/config/preinitializer.rb', %{
require File.expand_path(File.join(File.dirname(__FILE__), "..", "vendor", "bundler_gems", "environment"))
}
gsub_file 'config/environment.rb', "require File.join(File.dirname(__FILE__), 'boot')", %{
require File.join(File.dirname(__FILE__), 'boot')
# Hijack rails initializer to load the bundler gem environment before loading the rails environment.
Rails::Initializer.module_eval do
alias load_environment_without_bundler load_environment
def load_environment
Bundler.require_env configuration.environment
load_environment_without_bundler
end
end
}
generate :friendly_id, "--skip-migration"
generate :rspec
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment