Skip to content

Instantly share code, notes, and snippets.

@hbarrington
Forked from barinek/app_builder.rb
Last active December 22, 2015 02:18
Show Gist options
  • Save hbarrington/6402205 to your computer and use it in GitHub Desktop.
Save hbarrington/6402205 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
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 rvm_gemset
say("Installing rvm gemset from templates", :yellow)
create_file ".rvmrc", "rvm 1.8.7-p174@#{app_name}"
end
# airbreak?
# capistrano
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