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.
-
#config ⇒ Object
Returns the value of attribute config.
-
#project ⇒ Object
Returns the value of attribute project.
-
#target ⇒ Object
Returns the value of attribute target.
Instance Method Summary collapse
- #bundle(options) ⇒ Object
- #command(features) ⇒ Object
- #init_config(options) ⇒ Object
- #init_project(options) ⇒ Object
- #init_target(options) ⇒ Object
-
#initialize(options) ⇒ Runner
constructor
A new instance of Runner.
- #run(features) ⇒ Object
Constructor Details
#initialize(options) ⇒ Runner
Returns a new instance of Runner.
7 8 9 10 11 12 |
# File 'lib/guard/frank/runner.rb', line 7 def initialize() self.project = init_project() self.bundle_path = bundle() self.target = init_target() self.config = init_config() 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 |
#config ⇒ Object
Returns the value of attribute config.
6 7 8 |
# File 'lib/guard/frank/runner.rb', line 6 def config @config end |
#project ⇒ Object
Returns the value of attribute project.
4 5 6 |
# File 'lib/guard/frank/runner.rb', line 4 def project @project end |
#target ⇒ Object
Returns the value of attribute target.
5 6 7 |
# File 'lib/guard/frank/runner.rb', line 5 def target @target end |
Instance Method Details
#bundle(options) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/guard/frank/runner.rb', line 65 def bundle() pwd = Dir::pwd if File.exists?"Frank" Dir.chdir("Frank") end project = self.project target = self.target config = self.config device = "iphonesimulator" bundle_path = "#{pwd}/DerivedData/#{project}/Build/Products/#{config}-#{device}/#{target}.app" end |
#command(features) ⇒ Object
58 59 60 61 62 63 |
# File 'lib/guard/frank/runner.rb', line 58 def command(features) if features.kind_of? Array features = features.join(' ') end "APP_BUNDLE_PATH='#{self.bundle_path}' cucumber #{features} --require features" end |
#init_config(options) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/guard/frank/runner.rb', line 27 def init_config() if [:config].nil? "Debug" else [:config] end end |
#init_project(options) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/guard/frank/runner.rb', line 14 def init_project() if [:project].nil? Dir.chdir("..") xproject = Dir.glob("*.xcodeproj").first if xproject xproject.gsub(".xcodeproj","") else UI.info "You must specify project name at your Guardfile." nil end end end |
#init_target(options) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/guard/frank/runner.rb', line 35 def init_target() if [:target].nil? [:target] else "frankified" end end |
#run(features) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/guard/frank/runner.rb', line 43 def run(features) unless File.exists? self.bundle_path.to_s UI.info "Could not run Frank. \n'#{self.bundle_path}' not found." return false end if features.eql?("features") or features.empty? = "Run all features" else features = features.join(' ') if features.kind_of? Array = "Run #{features}" end UI.info system(command(features)) end |