Top Level Namespace
Instance Method Summary collapse
- #find_file(match) ⇒ Object
- #find_spec(match) ⇒ Object
- #nl ⇒ Object
- #run_cmd(cmd, match) ⇒ Object
- #run_spec(match) ⇒ Object
Instance Method Details
#find_file(match) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/sploek.watchr.rb', line 23 def find_file match path = match.to_s.sub('_spec', '').sub(/^spec\//, '') locations = [ File.join("app", path), File.join("lib", path), path ] if File.exist?(match.to_s) && match.to_s["_spec"].nil? match elsif path = locations.find {|x| File.exist?(x) } path end end |
#find_spec(match) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sploek.watchr.rb', line 38 def find_spec match locations = [ File.join("spec", match[1] + "_spec.rb"), File.join("spec", match[2] + "_spec.rb"), File.join("spec", match[1].sub(/^app/, '') + "_spec.rb") ] if match[1] =~ /_spec$/ match elsif specpath = locations.find {|x| File.exist?(x) } specpath end end |
#nl ⇒ Object
18 19 20 |
# File 'lib/sploek.watchr.rb', line 18 def nl "\n" end |