calabash-cucumber 0.18.0 → 0.18.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7beda75c6242b6bc7f82b44c1a61d3ed14a57a33
4
- data.tar.gz: 0753bd7f7c8bb00bf02f769300cd2308568f405d
3
+ metadata.gz: 858401fd6208b68bba5b454ead0fc6c0fb1cf096
4
+ data.tar.gz: 615e20e056d41bf5bac1617fd29c311213244a0b
5
5
  SHA512:
6
- metadata.gz: b9bbeb8638dc56f4cbba5d1a14ff8904265e049011245f083aa1746edd5d7440aa3b5921ecbcb407eb5987e4c291fe306e7c795aa54edf40b2269fe65e046aa8
7
- data.tar.gz: 91fd05fae2b029a11d7df9ce4645c2b9018cd5237a400bc692322d33ac350f7ddc56bfb53d9963330c68054e87785005387cd46dcfc32303b67b2459bee6eb8a
6
+ metadata.gz: 72c8518231bc1becf0ded6507d9f033d26639a8acdbb8f515c6c8626ba509cce2cd8987f2a4c5e8e4791f8a06d23a8d0d194bfeddcbb7f52b0421855dccc5055
7
+ data.tar.gz: ae4c2405c6b4091c5280f67ee0710d69838d76e1dcd007376a7350fa8bb446873188d343188d48ded4626f1be59d3903a6ffe9aafdb21e8b3d9ebacbea7326d7
@@ -229,55 +229,41 @@ def validate_setup(args)
229
229
  end
230
230
 
231
231
  def validate_ipa(ipa)
232
- require 'tmpdir'
233
- fail = false
234
- Dir.mktmpdir do |dir|
235
- if not system("unzip -C -K -o -q -d #{dir} #{ipa}")
236
- msg("Error") do
237
- puts "Unable to unzip ipa: #{ipa}"
238
- end
239
- Dir
240
- fail = true
241
- end
242
-
243
- app_dir = Dir.foreach("#{dir}/Payload").find {|d| /\.app$/.match(d)}
244
-
245
- res = `otool "#{File.expand_path(dir)}/Payload/#{app_dir}/"* -o 2> /dev/null | grep CalabashServer`
246
- msg("Info") do
247
- if /CalabashServer/.match(res)
248
- puts "Ipa: #{ipa} *contains* calabash.framework"
249
- else
250
- puts "Ipa: #{ipa} *does not contain* calabash.framework"
251
- end
252
- end
253
-
232
+ begin
233
+ version = RunLoop::Ipa.new(ipa).calabash_server_version
234
+ rescue => e
235
+ $stderr.puts(e.message)
236
+ exit(1)
254
237
  end
255
- if fail
238
+
239
+ if version
240
+ puts "Ipa: #{ipa} *contains* calabash.framework"
241
+ puts version.to_s
242
+ exit(0)
243
+ else
244
+ puts "Ipa: #{ipa} *does not contain* calabash.framework"
256
245
  exit(1)
257
246
  end
258
-
259
247
  end
260
248
 
261
249
  def validate_app(app)
262
- if not File.directory?app
263
- msg("Error") do
264
- puts "Path: #{app} is not a directory."
265
- end
266
- exit 1
250
+ begin
251
+ version = RunLoop::App.new(app).calabash_server_version
252
+ rescue => e
253
+ $stderr.puts(e.message)
254
+ exit(1)
267
255
  end
268
- out = `otool "#{File.expand_path(app)}"/* -o 2> /dev/null | grep CalabashServer`
269
256
 
270
- msg("Info") do
271
- if /CalabashServer/.match(out)
272
- puts "App: #{app} *contains* calabash.framework"
273
- else
274
- puts "App: #{app} *does not contain* calabash.framework"
275
- end
257
+ if version
258
+ puts "App: #{app} *contains* calabash.framework"
259
+ puts version.to_s
260
+ exit(0)
261
+ else
262
+ puts "App: #{app} *does not contain* calabash.framework"
263
+ exit(1)
276
264
  end
277
-
278
265
  end
279
266
 
280
-
281
267
  def update(args)
282
268
  if args.length > 0
283
269
  target = args[0]
Binary file
@@ -1,2 +1,19 @@
1
- require 'calabash-cucumber'
1
+ require "calabash-cucumber"
2
2
 
3
+ # Cucumber -d must pass, but support/env.rb is not eval'd on dry runs.
4
+ # We must detect that the user wants to use pre-defined steps.
5
+ dir = File.expand_path(File.dirname(__FILE__))
6
+ env = File.join(dir, "env.rb")
7
+
8
+ contents = File.read(env).force_encoding("UTF-8")
9
+
10
+ contents.split($-0).each do |line|
11
+
12
+ # Skip comments.
13
+ next if line.chars[0] == "#"
14
+
15
+ if line[/calabash-cucumber\/cucumber/, 0]
16
+ require "calabash-cucumber/calabash_steps"
17
+ break
18
+ end
19
+ end
@@ -9,7 +9,3 @@ require "calabash-cucumber/cucumber"
9
9
  # require "calabash-cucumber/wait_helpers"
10
10
  # require "calabash-cucumber/operations"
11
11
  # World(Calabash::Cucumber::Operations)
12
-
13
- # Uncomment this line if you want the Calabash::Formatters::Html formatter.
14
- # require "calabash-cucumber/formatters/html"
15
-
@@ -1,6 +1,5 @@
1
1
  require 'calabash-cucumber/wait_helpers'
2
2
  require 'calabash-cucumber/operations'
3
- require "calabash-cucumber/formatters/html"
4
3
 
5
4
  World(Calabash::Cucumber::Operations)
6
5
 
@@ -241,52 +241,32 @@ module Calabash
241
241
  msg << "Make sure you build for Simulator and that you're using the Calabash components"
242
242
  raise msg.join("\n")
243
243
  end
244
- if full_console_logging?
245
- puts('-'*37)
246
- puts "Auto detected APP_BUNDLE_PATH:\n\n"
247
-
248
- puts "APP_BUNDLE_PATH= '#{bundle_path}'\n\n"
249
- puts 'Please verify!'
250
- puts "If this is wrong please set it as APP_BUNDLE_PATH in features/support/01_launch.rb\n"
251
- puts('-'*37)
252
- end
253
244
  else
254
- bo_dir = build_output_dir_for_project
255
- sim_dirs = Dir.glob(File.join(bo_dir, '*-iphonesimulator', '*.app'))
256
-
257
- if sim_dirs.empty?
258
- msg = ['Unable to auto detect APP_BUNDLE_PATH.']
259
- msg << 'Have you built your app for simulator?'
260
- msg << "Searched dir: #{bo_dir}"
261
- msg << 'Please build your app from Xcode'
262
- msg << 'You should build the -cal target.'
263
- msg << ''
264
- msg << 'Alternatively, specify APP_BUNDLE_PATH in features/support/01_launch.rb'
265
- msg << "This should point to the location of your built app linked with calabash.\n"
266
- raise msg.join("\n")
267
- end
268
- preferred_dir = find_preferred_dir(sim_dirs)
269
- if preferred_dir.nil?
270
- msg = ['Error... Unable to find APP_BUNDLE_PATH.']
271
- msg << 'Cannot find a built app that is linked with calabash.framework'
272
- msg << 'Please build your app from Xcode'
273
- msg << 'You should build your calabash target.'
274
- msg << ''
275
- msg << 'Alternatively, specify APP_BUNDLE_PATH in features/support/01_launch.rb'
276
- msg << "This should point to the location of your built app linked with calabash.\n"
277
- raise msg.join("\n")
278
- end
279
- if full_console_logging?
280
- puts('-'*37)
281
- puts "Auto detected APP_BUNDLE_PATH:\n\n"
245
+ search_dir = build_output_dir_for_project || DERIVED_DATA
246
+ bundle_path = select_most_recent_bundle(search_dir)
247
+
248
+ if bundle_path.nil?
249
+ raise RuntimeError,
250
+ %Q{
251
+ Unable to auto detect a .app that is linked Calabash.
282
252
 
283
- puts "APP_BUNDLE_PATH=#{preferred_dir || sim_dirs[0]}\n\n"
284
- puts 'Please verify!'
285
- puts "If this is wrong please set it as APP_BUNDLE_PATH in features/support/01_launch.rb\n"
286
- puts('-'*37)
253
+ Searched: #{search_dir}
254
+
255
+ Have you built your app for simulator?
256
+
257
+ Please build your app from Xcode
258
+
259
+ Alternatively, specify APP in features/support/01_launch.rb
260
+ or as an environment variable:
261
+
262
+ $ APP=/path/to/Your.app bundle exec cucumber
263
+ }
287
264
  end
288
- bundle_path = sim_dirs[0]
289
265
  end
266
+
267
+ Calabash::Cucumber.log_debug("Auto detected app at path:")
268
+ Calabash::Cucumber.log_debug(bundle_path)
269
+ Calabash::Cucumber.log_debug("If this is incorrect, set the APP variable")
290
270
  bundle_path
291
271
  end
292
272
 
@@ -592,7 +572,46 @@ module Calabash
592
572
  _deprecated('0.9.169', 'check is now done in Launcher', :warn)
593
573
  raise(NotImplementedError, 'this method has been deprecated and will be removed')
594
574
  end
595
- end
596
575
 
576
+ private
577
+
578
+ # @!visibility private
579
+ def app(bundle_path)
580
+ RunLoop::App.new(bundle_path)
581
+ end
582
+
583
+ # @!visibility private
584
+ def lipo(bundle_path)
585
+ RunLoop::Lipo.new(bundle_path)
586
+ end
587
+
588
+ # @!visibility private
589
+ def collect_app_bundles(base_dir)
590
+ bundles = []
591
+
592
+ Dir.glob("#{base_dir}/**/*.app") do |bundle|
593
+ next if !RunLoop::App.valid?(bundle)
594
+
595
+ lipo = lipo(bundle)
596
+ arches = lipo.info
597
+ if arches.include?("x86_64") || arches.include?("i386")
598
+ app = app(bundle)
599
+ if app.calabash_server_version
600
+ bundles << bundle
601
+ end
602
+ end
603
+ end
604
+
605
+ bundles
606
+ end
607
+
608
+ # @!visibility private
609
+ def select_most_recent_bundle(base_dir)
610
+ bundles = collect_app_bundles(base_dir)
611
+ bundles.max do |a, b|
612
+ File.mtime(a) <=> File.mtime(b)
613
+ end
614
+ end
615
+ end
597
616
  end
598
617
  end
@@ -3,10 +3,10 @@ module Calabash
3
3
 
4
4
  # @!visibility public
5
5
  # The Calabash iOS gem version.
6
- VERSION = "0.18.0"
6
+ VERSION = "0.18.1"
7
7
 
8
8
  # @!visibility public
9
9
  # The minimum required version of the Calabash embedded server.
10
- MIN_SERVER_VERSION = "0.18.0"
10
+ MIN_SERVER_VERSION = "0.18.1"
11
11
  end
12
12
  end
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.18.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Krukow
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-02 00:00:00.000000000 Z
11
+ date: 2016-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -132,7 +132,7 @@ dependencies:
132
132
  requirements:
133
133
  - - ">="
134
134
  - !ruby/object:Gem::Version
135
- version: 2.0.5
135
+ version: 2.0.6
136
136
  - - "<"
137
137
  - !ruby/object:Gem::Version
138
138
  version: '3.0'
@@ -142,7 +142,7 @@ dependencies:
142
142
  requirements:
143
143
  - - ">="
144
144
  - !ruby/object:Gem::Version
145
- version: 2.0.5
145
+ version: 2.0.6
146
146
  - - "<"
147
147
  - !ruby/object:Gem::Version
148
148
  version: '3.0'
@@ -402,7 +402,6 @@ files:
402
402
  - lib/calabash-cucumber/environment.rb
403
403
  - lib/calabash-cucumber/environment_helpers.rb
404
404
  - lib/calabash-cucumber/failure_helpers.rb
405
- - lib/calabash-cucumber/formatters/html.rb
406
405
  - lib/calabash-cucumber/http_helpers.rb
407
406
  - lib/calabash-cucumber/ibase.rb
408
407
  - lib/calabash-cucumber/ipad_1x_2x.rb
@@ -528,6 +527,7 @@ files:
528
527
  - lib/calabash-cucumber/utils/xctools.rb
529
528
  - lib/calabash-cucumber/version.rb
530
529
  - lib/calabash-cucumber/wait_helpers.rb
530
+ - lib/calabash/formatters/html.rb
531
531
  - lib/frank-calabash.rb
532
532
  - scripts/.irbrc
533
533
  - scripts/calabash.xcconfig.erb