Class: RSpec::Core::CommandLineConfiguration::Autotest
- Defined in:
- lib/rspec/core/command_line_configuration.rb
Class Method Summary collapse
- .create_autotest_directory ⇒ Object
- .create_discover_file ⇒ Object
- .discover_file_exists? ⇒ Boolean
- .discover_file_path ⇒ Object
- .generate ⇒ Object
- .optionally_remove_discover_file ⇒ Object
Class Method Details
.create_autotest_directory ⇒ Object
34 35 36 |
# File 'lib/rspec/core/command_line_configuration.rb', line 34 def create_autotest_directory Dir.mkdir('autotest') unless File.exist?('autotest') end |
.create_discover_file ⇒ Object
38 39 40 41 42 43 |
# File 'lib/rspec/core/command_line_configuration.rb', line 38 def create_discover_file optionally_remove_discover_file if discover_file_exists? File.open(discover_file_path, 'w') do |file| file << 'Autotest.add_discovery { "rspec2" }' end end |
.discover_file_exists? ⇒ Boolean
51 52 53 |
# File 'lib/rspec/core/command_line_configuration.rb', line 51 def discover_file_exists? File.exist?(discover_file_path) end |
.discover_file_path ⇒ Object
55 56 57 |
# File 'lib/rspec/core/command_line_configuration.rb', line 55 def discover_file_path File.join('autotest', 'discover.rb') end |
.generate ⇒ Object
28 29 30 31 32 |
# File 'lib/rspec/core/command_line_configuration.rb', line 28 def generate create_autotest_directory create_discover_file puts "autotest/discover.rb has been added" end |
.optionally_remove_discover_file ⇒ Object
45 46 47 48 49 |
# File 'lib/rspec/core/command_line_configuration.rb', line 45 def optionally_remove_discover_file print "Discover file already exists, overwrite [y/N]? " exit if gets !~ /y/i FileUtils.rm_rf(discover_file_path) end |