Class: Aspec::CLI
- Inherits:
-
Object
- Object
- Aspec::CLI
- Defined in:
- lib/aspec/cli.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#working_dir ⇒ Object
readonly
Returns the value of attribute working_dir.
Instance Method Summary collapse
- #aspec_files ⇒ Object
- #aspec_helper_path ⇒ Object
-
#initialize(working_dir, args) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(working_dir, args) ⇒ CLI
Returns a new instance of CLI.
6 7 8 9 |
# File 'lib/aspec/cli.rb', line 6 def initialize(working_dir, args) @working_dir = working_dir @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
4 5 6 |
# File 'lib/aspec/cli.rb', line 4 def args @args end |
#working_dir ⇒ Object (readonly)
Returns the value of attribute working_dir.
4 5 6 |
# File 'lib/aspec/cli.rb', line 4 def working_dir @working_dir end |
Instance Method Details
#aspec_files ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/aspec/cli.rb', line 11 def aspec_files files = [] @args.each do |arg| arg = File.(arg, working_dir) if File.exist?(arg) if File.directory?(arg) files += Dir[arg + "**/*.aspec"] elsif arg =~ /.*\.aspec/ files << arg end end end files end |
#aspec_helper_path ⇒ Object
26 27 28 |
# File 'lib/aspec/cli.rb', line 26 def aspec_helper_path File.("aspec/aspec_helper.rb") end |
#run ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/aspec/cli.rb', line 30 def run bits = args[0].split(":") load aspec_helper_path if File.exist?(aspec_helper_path) @lines = bits[1..-1].map(&:to_i) is_verbose = args.include?("-v") Aspec.configure do |c| c.verbose = is_verbose c.slow = args.include?("--slow") c.formatter = args.include?("--junit") ? Formatter::JUnit.new(@file) : Formatter::Terminal.new(is_verbose) end TestRunner.new(Aspec.configuration, aspec_files).run(@lines) end |