guard-calabash-ios 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md CHANGED
@@ -22,6 +22,10 @@ When you're done, run following commands from project directory
22
22
 
23
23
  ## Guard options
24
24
 
25
- all_on_start - run all specs at first start, by default *true*
26
- device - iphone or ipad, by default *:iphone*
25
+ all_on_start - run all specs at first start, by default true
26
+ device - iphone or ipad, by default :iphone
27
+ project - project name, if not set, then gem will try to find it by *.xcodeproject expression
28
+ sdk - ios4, ios5, by default :ios5
29
+ target - calabash target, by default $project-cal
30
+ config - Debug/Release, by default Debug
27
31
 
@@ -3,25 +3,63 @@ module Guard
3
3
  attr_accessor :bundle_path
4
4
  attr_accessor :sdk
5
5
  attr_accessor :device
6
+ attr_accessor :project
7
+ attr_accessor :target
8
+ attr_accessor :config
6
9
  def initialize(options)
7
- devices = [:iphone, :ipad]
10
+ self.sdk = init_sdk(options)
11
+ self.device = init_device(options)
12
+ self.project = init_project(options)
13
+ self.target = init_target(options)
14
+ self.config = init_config(options)
15
+ self.bundle_path = init_bundle_path(options)
16
+ end
17
+
18
+ def init_sdk(options)
8
19
  sdks = [:ios4, :ios5]
20
+ if sdks.include? options[:sdk]
21
+ options[:sdk]
22
+ else
23
+ :ios5
24
+ end
25
+ end
26
+
27
+ def init_device(options)
28
+ devices = [:iphone, :ipad]
29
+ if devices.include? options[:device]
30
+ options[:device]
31
+ else
32
+ :iphone
33
+ end
34
+ end
35
+
36
+ def init_project(options)
9
37
  if options[:project].nil?
10
- project = Dir.glob("*.xcodeproj").first
11
- if project
12
- options[:project] = project.gsub(".xcodeproj","")
38
+ xproject = Dir.glob("*.xcodeproj").first
39
+ if xproject
40
+ xproject.gsub(".xcodeproj","")
13
41
  else
14
- UI.info "You must specify project name at your Guardfile."
42
+ UI.info "Could not find project"
43
+ nil
15
44
  end
45
+ else
46
+ options[:project]
16
47
  end
17
- self.bundle_path = bundle(options)
18
- self.sdk =:ios5
19
- if sdks.include? options[:sdk]
20
- self.sdk = options[:sdk]
48
+ end
49
+
50
+ def init_config(options)
51
+ if options[:config].nil?
52
+ "Debug"
53
+ else
54
+ options[:config]
21
55
  end
22
- self.device = :iphone
23
- if devices.include? options[:device]
24
- self.device = options[:device]
56
+ end
57
+
58
+ def init_target(options)
59
+ if options[:target].nil?
60
+ "#{self.project}-cal"
61
+ else
62
+ options[:target]
25
63
  end
26
64
  end
27
65
 
@@ -30,7 +68,7 @@ module Guard
30
68
  UI.info "Could not run Calabash. \n'#{self.bundle_path}' not found."
31
69
  return false
32
70
  end
33
- if features.eql?("features")
71
+ if features.eql?("features") or features.empty?
34
72
  start_message = "Run all features"
35
73
  else
36
74
  features = features.join(' ') if features.kind_of? Array
@@ -44,15 +82,22 @@ module Guard
44
82
  if features.kind_of? Array
45
83
  features = features.join(' ')
46
84
  end
47
- "APP_BUNDLE_PATH='#{self.bundle_path}' OS=#{self.sdk} DEVICE=#{self.device} cucumber #{features} --require features"
85
+ cmd = []
86
+ cmd << "APP_BUNDLE_PATH='#{self.bundle_path}'"
87
+ cmd << "OS=#{self.sdk}"
88
+ cmd << "DEVICE=#{self.device}"
89
+ cmd << "cucumber #{features} --require features"
90
+ cmd.join ' '
48
91
  end
49
92
 
50
- def bundle(options)
51
- pwd = Dir::pwd
52
- project = options[:project]
53
- target = options[:target] || "frankified"
54
- config = options[:config] || "Debug"
55
- bundle_path = "#{pwd}/DerivedData/#{project}/Build/Products/#{config}-iphonesimulator/#{project}-cal.app"
93
+ def init_bundle_path(options)
94
+ path = []
95
+ path << "#{Dir::pwd}/DerivedData/"
96
+ path << "#{self.project}/"
97
+ path << "Build/Products/"
98
+ path << "#{self.config}-iphonesimulator/"
99
+ path << "#{self.target}.app"
100
+ path.join
56
101
  end
57
102
  end
58
103
  end
@@ -1,6 +1,6 @@
1
1
  module Guard
2
2
  module CalabashiOSVersion
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: guard-calabash-ios
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alex Denisov
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-05-16 00:00:00 Z
18
+ date: 2012-05-20 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: guard