guard-calabash-ios 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +6 -2
- data/lib/guard/calabash-ios/runner.rb +65 -20
- data/lib/guard/calabash-ios/version.rb +1 -1
- metadata +4 -4
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
|
26
|
-
device - iphone or ipad, by default
|
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
|
-
|
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
|
-
|
11
|
-
if
|
12
|
-
|
38
|
+
xproject = Dir.glob("*.xcodeproj").first
|
39
|
+
if xproject
|
40
|
+
xproject.gsub(".xcodeproj","")
|
13
41
|
else
|
14
|
-
UI.info "
|
42
|
+
UI.info "Could not find project"
|
43
|
+
nil
|
15
44
|
end
|
45
|
+
else
|
46
|
+
options[:project]
|
16
47
|
end
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
48
|
+
end
|
49
|
+
|
50
|
+
def init_config(options)
|
51
|
+
if options[:config].nil?
|
52
|
+
"Debug"
|
53
|
+
else
|
54
|
+
options[:config]
|
21
55
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
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
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
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
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 2
|
9
9
|
- 0
|
10
|
-
version: 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-
|
18
|
+
date: 2012-05-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: guard
|