Skip to content

Instantly share code, notes, and snippets.

@dharamgollapudi
Forked from barinek/app_builder.rb
Created January 25, 2013 09:50
Show Gist options
  • Save dharamgollapudi/4633183 to your computer and use it in GitHub Desktop.
Save dharamgollapudi/4633183 to your computer and use it in GitHub Desktop.
class AppBuilder < Rails::AppBuilder
include Thor::Actions
include Thor::Shell
def test
append_test_gems
rspec
cucumber
jasmine
end
def rspec
say("Installing rspec from generator", :yellow)
system('rails generate rspec:install')
create_file 'spec/lib/example_spec.rb', <<-DOC
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'spec_helper'))
describe "example_spec" do
pending
end
DOC
create_file 'spec/support/example.rb'
end
def cucumber
say("Installing cucumber from generator", :yellow)
system('rails generate cucumber:install')
end
def jasmine
say("Installing jasmine from generator", :yellow)
#system('rails generate jasmine:install')
end
def rvm_gemset
say("Installing rvm gemset from templates", :yellow)
create_file ".rvmrc", "rvm 1.8.7-p174@#{app_name}"
end
def ey_cloud_recipes
say("Installing ey_cloud_recipes from github.com", :yellow)
system('git clone http://github.com/engineyard/ey-cloud-recipes.git /tmp/ey-cloud-recipes')
directory "/tmp/ey-cloud-recipes/cookbooks", "cookbooks"
end
def cruise
say("Installing cruise from from github.com", :yellow)
system('git clone http://github.com/thoughtworks/cruisecontrol.rb.git /tmp/cruisecontrol')
copy_file "/tmp/cruisecontrol/config/cruise_config.rb.example", "cruise_config.rb"
copy_file "/tmp/cruisecontrol/tasks/cc_build.rake", 'lib/tasks/cruise.rake'
end
def newrelic
say("Installing newrelic from github.com", :yellow)
system('git clone http://github.com/smtlaissezfaire/newrelic_rpm.git /tmp/newrelic_rpm')
copy_file "/tmp/newrelic_rpm/newrelic.yml", 'config/newrelic_rpm.yml'
end
def hoptoad
say("Installing hoptoad", :yellow)
end
def append_test_gems
@generator.append_file 'Gemfile', <<-DOC
group :test do
gem "rspec-rails", '2.0.1'
gem "rspec", '2.0.1'
gem 'capybara', '0.4.0'
gem 'database_cleaner', '0.5.2'
gem 'cucumber-rails', '0.3.2'
gem 'cucumber', '0.9.3'
gem 'spork', '0.8.4'
gem 'launchy', '0.3.7'
#gem 'jasmine', :submodules => true
gem 'evergreen', '0.3.0', :submodules => true
end
DOC
end
def leftovers
#rvm_gemset
ey_cloud_recipes unless @options[:skip_ey_cloud_recipes]
cruise unless @options[:skip_cruise]
newrelic unless @options[:skip_newrelic]
hoptoad unless @options[:skip_hoptoad]
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment