Class: Guard::Spring::Runner
- Inherits:
-
Object
- Object
- Guard::Spring::Runner
- Defined in:
- lib/guard/spring/runner.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Runner
constructor
A new instance of Runner.
- #kill_spring ⇒ Object
- #launch_spring(action) ⇒ Object
- #run(paths) ⇒ Object
- #run_all ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Runner
Returns a new instance of Runner.
8 9 10 11 12 |
# File 'lib/guard/spring/runner.rb', line 8 def initialize( = {}) = @spring_cmd = get_spring_cmd UI.info 'Guard::Spring Initialized' end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/guard/spring/runner.rb', line 6 def end |
Instance Method Details
#kill_spring ⇒ Object
19 20 21 |
# File 'lib/guard/spring/runner.rb', line 19 def kill_spring stop_spring end |
#launch_spring(action) ⇒ Object
14 15 16 17 |
# File 'lib/guard/spring/runner.rb', line 14 def launch_spring(action) UI.info "#{action}ing Spring", :reset => true start_spring end |
#run(paths) ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/guard/spring/runner.rb', line 23 def run(paths) existing_paths = paths.uniq.select { |path| File.exist? "#{Dir.pwd}/#{path}" } rspec_paths = existing_paths.select { |path| path =~ /spec(\/\w+)*(\/\w+_spec\.rb)?/ } run_command "#@spring_cmd rspec", existing_paths.join(' ') unless rspec_paths.empty? # TBD: # testunit_paths = existing_paths.select { |path| path =~ /test(.*\.rb)?/ } # TBD: # run_command 'spring testunit', existing_paths.join(' ') unless testunit_paths.empty? end |
#run_all ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/guard/spring/runner.rb', line 32 def run_all if rspec? run(%w(spec)) elsif test_unit? run(Dir['test/**/*_test.rb']+Dir['test/**/test_*.rb']) end end |