Skip to content

Commit

Permalink
Use a template for SimpleCov init
Browse files Browse the repository at this point in the history
  • Loading branch information
jferris authored and Dan Croak committed Oct 23, 2012
1 parent 44c51c1 commit 2787281
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lib/suspenders/app_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module Suspenders
class AppBuilder < Rails::AppBuilder
include Suspenders::Actions

SIMPLECOV_INIT = %{require 'simplecov'\nSimpleCov.start 'rails'\n\n}

def readme
template 'README.md.erb', 'README.md'
end
Expand Down Expand Up @@ -138,7 +136,7 @@ def configure_action_mailer
def generate_rspec
generate 'rspec:install'
inject_into_file '.rspec', " --drb", :after => '--color'
prepend_file 'spec/spec_helper.rb', SIMPLECOV_INIT
prepend_file 'spec/spec_helper.rb', simplecov_init
replace_in_file 'spec/spec_helper.rb',
'# config.mock_with :mocha', 'config.mock_with :mocha'
end
Expand All @@ -152,11 +150,13 @@ def configure_capybara_webkit
def generate_cucumber(options = {})
generate 'cucumber:install', '--rspec', '--capybara'
inject_into_file 'config/cucumber.yml',
' -drb -r features', :after => %{default: <%= std_opts %> features}
copy_file 'features_support_env.rb', 'features/support/env.rb',
' -drb -r features',
:after => %{default: <%= std_opts %> features}
copy_file 'features_support_env.rb',
'features/support/env.rb',
:force => true
prepend_file 'features/support/env.rb', simplecov_init

prepend_file 'features/support/env.rb', SIMPLECOV_INIT
if options[:webkit]
inject_into_file 'features/support/env.rb',
"\n Capybara.javascript_driver = :webkit",
Expand Down Expand Up @@ -275,5 +275,9 @@ def override_path_for_tests
"PATH=#{support_bin}:$PATH"
end
end

def simplecov_init
IO.read(find_in_source_paths('simplecov_init.rb'))
end
end
end
3 changes: 3 additions & 0 deletions templates/simplecov_init.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
require 'simplecov'
SimpleCov.start 'rails'

0 comments on commit 2787281

Please sign in to comment.