Class: InfinityTest::Options

Inherits:
Hash
  • Object
show all
Defined in:
lib/infinity_test/options.rb

Instance Method Summary collapse

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 |options|
    [:test_unit, :rspec, :bacon, :rubygems, :rails, :rubies, :verbose, :patterns, :bundler, :version].each do |name|
      send("parse_#{name}", options)
    end
    options.banner = [ "Usage: infinity_test [options]", "Starts a continuous test server."].join("\n")
    options.on_tail("--help", "You're looking at it.") do
      print options.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(options)
  options.on('--bacon', 'Test Framework: Bacon') do
    self[:test_framework] = :bacon
  end
end

#parse_bundler(options) ⇒ Object



75
76
77
78
79
# File 'lib/infinity_test/options.rb', line 75

def parse_bundler(options)
  options.on('--skip-bundler', "InfinityTest try to use bundler if Gemfile is present. If you don't want to use this convention, set this option.") do
    self[:skip_bundler?] = true
  end
end

#parse_patterns(options) ⇒ Object

def parse_cucumber(options)

options.on('--cucumber', 'Run with the Cucumber too') do
  self[:cucumber] = true
end

end



69
70
71
72
73
# File 'lib/infinity_test/options.rb', line 69

def parse_patterns(options)
  options.on('--heuristics', 'Show all the Default Patterns and added by #heuristics method and EXIT.') do
    self[:show_heuristics?] = true
  end
end

#parse_rails(options) ⇒ Object



51
52
53
54
55
# File 'lib/infinity_test/options.rb', line 51

def parse_rails(options)
  options.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(options)
  options.on('--rspec', 'Test Framework: Rspec') do
    self[:test_framework] = :rspec
  end
end

#parse_rubies(options) ⇒ Object



39
40
41
42
43
# File 'lib/infinity_test/options.rb', line 39

def parse_rubies(options)
  options.on('--rubies=rubies', 'Specify the Ruby Versions for Testing with many Rubies') do |versions|
    self[:rubies] = versions
  end
end

#parse_rubygems(options) ⇒ Object



57
58
59
60
61
# File 'lib/infinity_test/options.rb', line 57

def parse_rubygems(options)
  options.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(options)
  options.on('--test-unit', 'Test Framework: Test Unit [Default]') do
    self[:test_framework] = :test_unit
  end
end

#parse_verbose(options) ⇒ Object



45
46
47
48
49
# File 'lib/infinity_test/options.rb', line 45

def parse_verbose(options)
  options.on('--verbose', 'The Infinity Test dont print the commands', 'To print the commands set this option!') do
    self[:verbose] = true
  end
end

#parse_version(options) ⇒ Object



81
82
83
84
85
86
# File 'lib/infinity_test/options.rb', line 81

def parse_version(options)
  options.on("--version", "Show version and exit") do
    puts InfinityTest.version
    exit
  end
end