frank-cucumber 0.7.1 → 0.7.3

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.
@@ -1,5 +1,28 @@
1
1
  Given /^I launch the app$/ do
2
2
 
3
+
4
+ app_path = ENV['APP_BUNDLE_PATH'] || (defined?(APP_BUNDLE_PATH) && APP_BUNDLE_PATH)
5
+
6
+ ####################
7
+ # once you're setting APP_BUNDLE_PATH correctly you can get rid
8
+ # of this detection/reporting code if you want
9
+ #
10
+ if app_path.nil?
11
+ require 'frank-cucumber/app_bundle_locator'
12
+ message = "APP_BUNDLE_PATH is not set. \n\nPlease set APP_BUNDLE_PATH (either an environment variable, or the ruby constant in support/env.rb) to the path of your Frankified target's iOS app bundle."
13
+ possible_app_bundles = Frank::Cucumber::AppBundleLocator.new.guess_possible_app_bundles_for_dir( Dir.pwd )
14
+ if possible_app_bundles && !possible_app_bundles.empty?
15
+ message << "\n\nBased on your current directory, you probably want to use one of the following paths for your APP_BUNDLE_PATH:\n"
16
+ message << possible_app_bundles.join("\n")
17
+ end
18
+
19
+ raise "\n\n"+("="*80)+"\n"+message+"\n"+("="*80)+"\n\n"
20
+ end
21
+ #
22
+ ####################
23
+
24
+
25
+
3
26
  # kill the app if it's already running, just in case this helps
4
27
  # reduce simulator flakiness when relaunching the app. Use a timeout of 5 seconds to
5
28
  # prevent us hanging around for ages waiting for the ping to fail if the app isn't running
@@ -8,10 +31,8 @@ Given /^I launch the app$/ do
8
31
  rescue Timeout::Error
9
32
  end
10
33
 
11
- require 'sim_launcher'
12
34
 
13
- app_path = ENV['APP_BUNDLE_PATH'] || APP_BUNDLE_PATH
14
- raise "APP_BUNDLE_PATH was not set. \nPlease set a APP_BUNDLE_PATH ruby constant or environment variable to the path of your compiled Frankified iOS app bundle" if app_path.nil?
35
+ require 'sim_launcher'
15
36
 
16
37
  if( ENV['USE_SIM_LAUNCHER_SERVER'] )
17
38
  simulator = SimLauncher::Client.for_iphone_app( app_path )
@@ -1 +1,5 @@
1
1
  require 'frank-cucumber'
2
+
3
+ # TODO: set this constant to the full path for your Frankified target's app bundle.
4
+ # See the "Given I launch the app" step definition in launch_steps.rb for more details
5
+ APP_BUNDLE_PATH = nil
@@ -0,0 +1,58 @@
1
+ module Frank module Cucumber
2
+ class XCode4Project
3
+ def initialize( workspace_path, derived_dir )
4
+ @workspace_path, @derived_dir = workspace_path, derived_dir
5
+ end
6
+
7
+ def derived_name
8
+ File.basename( @derived_dir )
9
+ end
10
+
11
+ def project_name
12
+ derived_name.split('-')[0]
13
+ end
14
+
15
+ def workspace_dir
16
+ File.dirname( @workspace_path )
17
+ end
18
+
19
+ def available_app_bundles
20
+ Dir.glob( File.join( @derived_dir, "Build", "Products", "*", "*.app" ) )
21
+ end
22
+
23
+ end
24
+
25
+ # utility class which will find all XCode4 projects which are using DerivedData to store their
26
+ # build output, and present information about those projects
27
+ class AppBundleLocator
28
+ def initialize
29
+ @projects = find_all_known_xcode_projects
30
+ end
31
+
32
+ def find_all_known_xcode_projects
33
+ require 'plist'
34
+
35
+ projects = []
36
+ Dir.glob( File.expand_path( "~/Library/Developer/Xcode/DerivedData/*/info.plist" ) ) do |plist_path|
37
+ workspace_path = Plist::parse_xml(plist_path)['WorkspacePath']
38
+ projects << XCode4Project.new( workspace_path, File.dirname(plist_path) )
39
+ end
40
+ projects
41
+ end
42
+
43
+ def guess_possible_app_bundles_for_dir( dir )
44
+ return [] if dir == '/'
45
+
46
+ project = @projects.find do |project|
47
+ project.workspace_dir == dir
48
+ end
49
+
50
+ if project.nil?
51
+ return guess_possible_app_bundles_for_dir( File.dirname(dir) )
52
+ end
53
+
54
+ return project.available_app_bundles
55
+ end
56
+
57
+ end
58
+ end end
@@ -90,7 +90,8 @@ module FrankHelper
90
90
 
91
91
  def frankly_current_orientation
92
92
  res = get_to_uispec_server( 'orientation' )
93
- JSON.parse( res )['orientation']
93
+ orientation = JSON.parse( res )['orientation']
94
+ puts "orientation reported as '#{orientation}'" if $DEBUG
94
95
  end
95
96
 
96
97
 
@@ -1,5 +1,5 @@
1
1
  module Frank
2
2
  module Cucumber
3
- VERSION = "0.7.1"
3
+ VERSION = "0.7.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 1
9
- version: 0.7.1
8
+ - 3
9
+ version: 0.7.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pete Hodgson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-13 00:00:00 -07:00
18
+ date: 2011-08-25 00:00:00 -07:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -147,6 +147,7 @@ files:
147
147
  - frank-skeleton/frank_static_resources.bundle/underscore.js
148
148
  - frank-skeleton/libFrank.a
149
149
  - lib/frank-cucumber.rb
150
+ - lib/frank-cucumber/app_bundle_locator.rb
150
151
  - lib/frank-cucumber/color_helper.rb
151
152
  - lib/frank-cucumber/core_frank_steps.rb
152
153
  - lib/frank-cucumber/frank_helper.rb