Class: InfinityTest::Options
- Inherits:
-
Hash
- Object
- Hash
- InfinityTest::Options
- Defined in:
- lib/infinity_test/options.rb
Instance Method Summary collapse
-
#initialize(arguments) ⇒ Options
constructor
A new instance of Options.
- #parse_bacon(options) ⇒ Object
- #parse_bundler(options) ⇒ Object
-
#parse_patterns(options) ⇒ Object
def parse_cucumber(options) options.on(‘–cucumber’, ‘Run with the Cucumber too’) do self = true end end.
- #parse_rails(options) ⇒ Object
- #parse_rspec(options) ⇒ Object
- #parse_rubies(options) ⇒ Object
- #parse_rubygems(options) ⇒ Object
- #parse_test_unit(options) ⇒ Object
- #parse_verbose(options) ⇒ Object
- #parse_version(options) ⇒ Object
Constructor Details
#initialize(arguments) ⇒ Options
Returns a new instance of Options.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/infinity_test/options.rb', line 6 def initialize(arguments) super() @options = OptionParser.new do || [:test_unit, :rspec, :bacon, :rubygems, :rails, :rubies, :verbose, :patterns, :bundler, :version].each do |name| send("parse_#{name}", ) end . = [ "Usage: infinity_test [options]", "Starts a continuous test server."].join("\n") .on_tail("--help", "You're looking at it.") do print .help exit end end @options.parse!(arguments.clone) end |
Instance Method Details
#parse_bacon(options) ⇒ Object
33 34 35 36 37 |
# File 'lib/infinity_test/options.rb', line 33 def parse_bacon() .on('--bacon', 'Test Framework: Bacon') do self[:test_framework] = :bacon end end |
#parse_bundler(options) ⇒ Object
83 84 85 86 87 |
# File 'lib/infinity_test/options.rb', line 83 def parse_bundler() .on('--skip-bundler', "Bypass Infinity Test's Bundler support, even if a Gemfile is present") do self[:skip_bundler?] = true end end |
#parse_patterns(options) ⇒ Object
def parse_cucumber(options)
.on('--cucumber', 'Run with the Cucumber too') do
self[:cucumber] = true
end
end
77 78 79 80 81 |
# File 'lib/infinity_test/options.rb', line 77 def parse_patterns() .on('--heuristics', 'Show all defined heuristics and exit') do self[:show_heuristics?] = true end end |
#parse_rails(options) ⇒ Object
59 60 61 62 63 |
# File 'lib/infinity_test/options.rb', line 59 def parse_rails() .on('--rails', 'Application Framework: Rails') do self[:app_framework] = :rails end end |
#parse_rspec(options) ⇒ Object
21 22 23 24 25 |
# File 'lib/infinity_test/options.rb', line 21 def parse_rspec() .on('--rspec', 'Test Framework: RSpec') do self[:test_framework] = :rspec end end |
#parse_rubies(options) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/infinity_test/options.rb', line 39 def parse_rubies() .on('--rubies=rubies', 'Specify Ruby version(s) to test against') do |versions| rubies = [] self[:specific_options] = {} versions.split(",").each do |r| rubie = r.split('+')[0] params = r.split('+')[1] self[:specific_options][rubie] = params rubies << rubie end self[:rubies] = rubies.join(',') end end |
#parse_rubygems(options) ⇒ Object
65 66 67 68 69 |
# File 'lib/infinity_test/options.rb', line 65 def parse_rubygems() .on('--rubygems', 'Application Framework: Rubygems (Default)') do self[:app_framework] = :rubygems end end |
#parse_test_unit(options) ⇒ Object
27 28 29 30 31 |
# File 'lib/infinity_test/options.rb', line 27 def parse_test_unit() .on('--test-unit', 'Test Framework: Test Unit (Default)') do self[:test_framework] = :test_unit end end |
#parse_verbose(options) ⇒ Object
53 54 55 56 57 |
# File 'lib/infinity_test/options.rb', line 53 def parse_verbose() .on('--verbose', 'Print commands before executing them') do self[:verbose] = true end end |
#parse_version(options) ⇒ Object
89 90 91 92 93 94 |
# File 'lib/infinity_test/options.rb', line 89 def parse_version() .on("--version", "Show version and exit") do puts InfinityTest.version exit end end |