Skip to content

Instantly share code, notes, and snippets.

@dotemacs
Created December 1, 2010 14:28
Show Gist options
  • Select an option

  • Save dotemacs/723552 to your computer and use it in GitHub Desktop.

Select an option

Save dotemacs/723552 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
# quick and dirty way to generate a rails app
my_gem_file =<<END
group :development, :test do
gem "rspec-rails"
gem "capybara"
gem "cucumber-rails"
end
END
if ARGV.length < 1
puts
puts "app name is required"
puts
puts "eg. #{$0} app-name"
exit 1
else
app = ARGV[0]
system "rails new #{app}"
Dir.chdir("#{app}") do
# add the gems
File.open("Gemfile", "a") {|f|
f.puts "#{my_gem_file}"
}
# install the gems
puts
puts "Running: bundle install..."
system "bundle install"
puts
puts "Generating specs ..."
system "script/rails generate rspec:install"
puts
puts "Generating cukes ..."
system "script/rails generate cucumber:install"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment