Class: Guard::Runner
- Inherits:
-
Object
- Object
- Guard::Runner
- Defined in:
- lib/guard/frank/runner.rb
Instance Attribute Summary collapse
-
#bundle_path ⇒ Object
Returns the value of attribute bundle_path.
Instance Method Summary collapse
- #bundle(options) ⇒ Object
- #command(features) ⇒ Object
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
- #run(features) ⇒ Object
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/guard/frank/runner.rb', line 4 def initialize() if [:project].nil? Dir.chdir("..") project = Dir.glob("*.xcodeproj").first if project [:project] = project.gsub(".xcodeproj","") else UI.info "You must specify project name at your Guardfile." end end self.bundle_path = bundle() end |
Instance Attribute Details
#bundle_path ⇒ Object
Returns the value of attribute bundle_path.
3 4 5 |
# File 'lib/guard/frank/runner.rb', line 3 def bundle_path @bundle_path end |
Instance Method Details
#bundle(options) ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/guard/frank/runner.rb', line 39 def bundle() pwd = Dir::pwd if File.exists?"Frank" Dir.chdir("Frank") end project = [:project] target = [:target] || "frankified" config = [:config] || "Debug" device = "iphonesimulator" bundle_path = "#{pwd}/DerivedData/#{project}/Build/Products/#{config}-#{device}/#{target}.app" end |
#command(features) ⇒ Object
32 33 34 35 36 37 |
# File 'lib/guard/frank/runner.rb', line 32 def command(features) if features.kind_of? Array features = features.join(' ') end "APP_BUNDLE_PATH='#{self.bundle_path}' cucumber #{features} --require features" end |
#run(features) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/guard/frank/runner.rb', line 17 def run(features) unless File.exists? self.bundle_path UI.info "Could not run Frank. \n'#{self.bundle_path}' not found." return false end if features.eql?("features") = "Run all features" else features = features.join(' ') if features.kind_of? Array = "Run #{features}" end UI.info system(command(features)) end |