calabash-cucumber 0.9.43 → 0.9.44

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.
@@ -7,7 +7,9 @@ module Calabash
7
7
 
8
8
  module SimulatorHelper
9
9
 
10
- DEFAULT_DERIVED_DATA = File.expand_path("~/Library/Developer/Xcode/DerivedData/*/info.plist")
10
+ DERIVED_DATA = File.expand_path("~/Library/Developer/Xcode/DerivedData")
11
+ DEFAULT_DERIVED_DATA_INFO = File.expand_path("#{DERIVED_DATA}/*/info.plist")
12
+
11
13
  MAX_PING_ATTEMPTS = 5
12
14
 
13
15
  def self.relaunch(path, sdk = nil, version = 'iphone')
@@ -26,7 +28,7 @@ module Calabash
26
28
  def self.derived_data_dir_for_project
27
29
  dir = project_dir
28
30
 
29
- info_plist = Dir.glob(DEFAULT_DERIVED_DATA).find { |plist_file|
31
+ info_plist = Dir.glob(DEFAULT_DERIVED_DATA_INFO).find { |plist_file|
30
32
  begin
31
33
  plist = CFPropertyList::List.new(:file => plist_file)
32
34
  hash = CFPropertyList.native_types(plist.value)
@@ -37,22 +39,56 @@ module Calabash
37
39
  false
38
40
  end
39
41
  }
42
+
40
43
  if not info_plist.nil?
41
- File.dirname(info_plist)
44
+ return File.dirname(info_plist)
42
45
  else
43
- msg = ["Unable to find your built app."]
44
- msg << "This means that Calabash can't automatically launch iOS simulator."
45
- msg << "Searched in Xcode 4.x default: #{DEFAULT_DERIVED_DATA}"
46
- msg << ""
47
- msg << "To fix there are a couple of options:\n"
48
- msg << "Option 1) Make sure you are running this command from your project directory, "
49
- msg << "i.e., the directory containing your .xcodeproj file."
50
- msg << "In Xcode, build your calabash target for simulator."
51
- msg << "Check that your app can be found in\n #{File.expand_path("~/Library/Developer/Xcode/DerivedData")}"
52
- msg << "\n\nOption 2). In features/support/launch.rb set APP_BUNDLE_PATH to"
53
- msg << "the path where Xcode has built your Calabash target."
54
- msg << "Alternatively you can use the environment variable APP_BUNDLE_PATH.\n"
55
- raise msg.join("\n")
46
+ res = Dir.glob("#{dir}/*.xcodeproj")
47
+ if res.empty?
48
+ raise "Unable to find *.xcodeproj in #{dir}"
49
+ elsif res.count > 1
50
+ raise "Unable to found several *.xcodeproj in #{dir}: #{res}"
51
+ end
52
+
53
+ xcode_proj_name = res.first.split(".xcodeproj")[0]
54
+
55
+ xcode_proj_name = File.basename(xcode_proj_name)
56
+
57
+ build_dirs = Dir.glob("#{DERIVED_DATA}/*").find_all do |xc_proj|
58
+ File.basename(xc_proj).start_with?(xcode_proj_name)
59
+ end
60
+
61
+ if (build_dirs.count == 0)
62
+ msg = ["Unable to find your built app."]
63
+ msg << "This means that Calabash can't automatically launch iOS simulator."
64
+ msg << "Searched in Xcode 4.x default: #{DEFAULT_DERIVED_DATA_INFO}"
65
+ msg << ""
66
+ msg << "To fix there are a couple of options:\n"
67
+ msg << "Option 1) Make sure you are running this command from your project directory, "
68
+ msg << "i.e., the directory containing your .xcodeproj file."
69
+ msg << "In Xcode, build your calabash target for simulator."
70
+ msg << "Check that your app can be found in\n #{File.expand_path("~/Library/Developer/Xcode/DerivedData")}"
71
+ msg << "\n\nOption 2). In features/support/launch.rb set APP_BUNDLE_PATH to"
72
+ msg << "the path where Xcode has built your Calabash target."
73
+ msg << "Alternatively you can use the environment variable APP_BUNDLE_PATH.\n"
74
+ raise msg.join("\n")
75
+
76
+ elsif (build_dirs.count > 1)
77
+ msg = ["Unable to auto detect APP_BUNDLE_PATH."]
78
+ msg << "You have several projects with the same name: #{xcode_proj_name} in #{DERIVED_DATA}:\n"
79
+ msg << build_dirs.join("\n")
80
+
81
+ msg << "\nThis means that Calabash can't automatically launch iOS simulator."
82
+ msg << "Searched in Xcode 4.x default: #{DEFAULT_DERIVED_DATA_INFO}"
83
+ msg << "\nIn features/support/launch.rb set APP_BUNDLE_PATH to"
84
+ msg << "the path where Xcode has built your Calabash target."
85
+ msg << "Alternatively you can use the environment variable APP_BUNDLE_PATH.\n"
86
+ raise msg.join("\n")
87
+ else
88
+ puts "Found potential build dir: #{build_dirs.first}"
89
+ puts "Checking..."
90
+ return build_dirs.first
91
+ end
56
92
  end
57
93
  end
58
94
 
@@ -179,4 +215,3 @@ module Calabash
179
215
 
180
216
  end
181
217
  end
182
-
@@ -1,6 +1,6 @@
1
1
  module Calabash
2
2
  module Cucumber
3
- VERSION = "0.9.43"
3
+ VERSION = "0.9.44"
4
4
  FRAMEWORK_VERSION = "0.9.43"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.43
4
+ version: 0.9.44
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-08 00:00:00.000000000 Z
12
+ date: 2012-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
16
- requirement: &70298053834840 !ruby/object:Gem::Requirement
16
+ requirement: &70316273929280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70298053834840
24
+ version_requirements: *70316273929280
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70298053834060 !ruby/object:Gem::Requirement
27
+ requirement: &70316273928640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70298053834060
35
+ version_requirements: *70316273928640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: CFPropertyList
38
- requirement: &70298053833120 !ruby/object:Gem::Requirement
38
+ requirement: &70316273926740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70298053833120
46
+ version_requirements: *70316273926740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: sim_launcher
49
- requirement: &70298053832320 !ruby/object:Gem::Requirement
49
+ requirement: &70316273925720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70298053832320
57
+ version_requirements: *70316273925720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: slowhandcuke
60
- requirement: &70298053831340 !ruby/object:Gem::Requirement
60
+ requirement: &70316273924200 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70298053831340
68
+ version_requirements: *70316273924200
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: net-http-persistent
71
- requirement: &70298053830720 !ruby/object:Gem::Requirement
71
+ requirement: &70316273922960 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70298053830720
79
+ version_requirements: *70316273922960
80
80
  description: calabash-cucumber drives tests for native iOS apps. You must link your
81
81
  app with calabash-ios-server framework to execute tests.
82
82
  email: