Class: EffectiveTestBot::Generators::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/effective_test_bot/install_generator.rb

Instance Method Summary collapse

Instance Method Details

#copy_initializerObject



47
48
49
# File 'lib/generators/effective_test_bot/install_generator.rb', line 47

def copy_initializer
  template "effective_test_bot.rb", "config/initializers/effective_test_bot.rb"
end

#explain_overwriteObject

def install_guard

return if File.exists?('Guardfile')
puts '[effective_test_bot] installing guard'
run 'bundle exec guard init'
puts ""

end



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/generators/effective_test_bot/install_generator.rb', line 29

def explain_overwrite
  puts '[effective_test_bot] Successfully installed/detected: minitest'
  puts ""
  puts 'Starting effective_test_bot specific installation tasks:'
  puts ""
  puts "You will be prompted to overwrite the default minitest configuration"
  puts "files with those packaged inside the effective_test_bot gem."
  puts ""
  puts "If you have very specific existing minitest configuration,"
  puts "you may want to skip (press 'n') to the following overwrites"
  puts "and refer to the GitHub documentation for this gem:"
  puts "https://github.com/code-and-effect/effective_test_bot"
  puts ""
  puts "Otherwise, press 'Y' to all the following prompts to automatically configure"
  puts "minitest-rails and capybara-webkit based effective_test_bot test coverage"
  puts ""
end

#install_minitestObject



10
11
12
13
14
# File 'lib/generators/effective_test_bot/install_generator.rb', line 10

def install_minitest
  return if File.exists?('test/test_helper.rb')
  puts '[effective_test_bot] installing minitest'
  run 'bundle exec rails generate minitest:install'
end

#overwrite_minitestObject



51
52
53
# File 'lib/generators/effective_test_bot/install_generator.rb', line 51

def overwrite_minitest
  template 'minitest/test_helper.rb', 'test/test_helper.rb'
end

#thank_youObject

def overwrite_rspec

template 'rspec/.rspec', '.rspec'
template 'rspec/rails_helper.rb', 'spec/rails_helper.rb'
template 'rspec/spec_helper.rb', 'spec/spec_helper.rb'

end



61
62
63
64
# File 'lib/generators/effective_test_bot/install_generator.rb', line 61

def thank_you
  puts "Thanks for using EffectiveTestBot"
  puts "Run tests by typing 'rake test:bot'"
end