Class: Rdm::SpecRunner::CommandGenerator
- Inherits:
-
Object
- Object
- Rdm::SpecRunner::CommandGenerator
- Defined in:
- lib/rdm/spec_runner/command_generator.rb
Instance Attribute Summary collapse
-
#package_name ⇒ Object
Returns the value of attribute package_name.
-
#package_path ⇒ Object
Returns the value of attribute package_path.
-
#spec_matcher ⇒ Object
Returns the value of attribute spec_matcher.
Instance Method Summary collapse
- #command ⇒ Object
- #generate ⇒ Object
-
#initialize(package_name:, package_path:, spec_matcher:, show_output: true) ⇒ CommandGenerator
constructor
A new instance of CommandGenerator.
- #spec_count ⇒ Object
Constructor Details
#initialize(package_name:, package_path:, spec_matcher:, show_output: true) ⇒ CommandGenerator
Returns a new instance of CommandGenerator.
3 4 5 6 7 8 |
# File 'lib/rdm/spec_runner/command_generator.rb', line 3 def initialize(package_name:, package_path:, spec_matcher:, show_output: true) @package_name = package_name @package_path = package_path @spec_matcher = spec_matcher @output = show_output ? '$stdout' : 'File::NULL' end |
Instance Attribute Details
#package_name ⇒ Object
Returns the value of attribute package_name.
2 3 4 |
# File 'lib/rdm/spec_runner/command_generator.rb', line 2 def package_name @package_name end |
#package_path ⇒ Object
Returns the value of attribute package_path.
2 3 4 |
# File 'lib/rdm/spec_runner/command_generator.rb', line 2 def package_path @package_path end |
#spec_matcher ⇒ Object
Returns the value of attribute spec_matcher.
2 3 4 |
# File 'lib/rdm/spec_runner/command_generator.rb', line 2 def spec_matcher @spec_matcher end |
Instance Method Details
#command ⇒ Object
14 15 16 17 18 19 |
# File 'lib/rdm/spec_runner/command_generator.rb', line 14 def command "print_message( '**** Package: #{package_name} *****') \\ && system('cd #{package_path} \\ && bundle exec rspec --color --tty #{spec_matcher}', out: #{@output.to_s}, err: :out)" end |
#generate ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/rdm/spec_runner/command_generator.rb', line 21 def generate Rdm::SpecRunner::CommandParams.new.tap do |cp| cp.package_name = package_name cp.package_path = package_path cp.command = command cp.spec_count = spec_count end end |
#spec_count ⇒ Object
10 11 12 |
# File 'lib/rdm/spec_runner/command_generator.rb', line 10 def spec_count Dir[File.join(package_path, 'spec/**/*_spec.rb')].size end |