frank-cucumber 1.1.4.pre1 → 1.1.5

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,4 +1,5 @@
1
1
  INSTALL_PATH = /./
2
2
 
3
3
  FRANK_LDFLAGS = -all_load -ObjC -framework CFNetwork -framework Security -lShelley <%= @without_http_server ? "" : "-lCocoaHTTPServer" %> -lFrank
4
+ FRANK_MAC_LDFLAGS = -all_load -ObjC -framework CFNetwork -framework Security -LFrank <%= @without_http_server ? "" : "-lCocoaHTTPServerMac" %> -lFrankMac
4
5
  GCC_PREPROCESSOR_DEFINITIONS_NOT_USED_IN_PRECOMPS = FRANKIFIED
Binary file
Binary file
Binary file
Binary file
@@ -1,12 +1,13 @@
1
- begin
1
+ begin
2
2
  require 'pry'
3
- rescue LoadError
3
+ rescue LoadError
4
4
  end
5
5
 
6
6
  require 'thor'
7
7
  require 'frank-cucumber/launcher'
8
8
  require 'frank-cucumber/console'
9
9
  require 'frank-cucumber/frankifier'
10
+ require 'frank-cucumber/mac_launcher'
10
11
 
11
12
  module Frank
12
13
  class CLI < Thor
@@ -36,7 +37,7 @@ module Frank
36
37
  desc "update", "updates the frank server components inside your Frank directory"
37
38
  long_desc "This updates the parts of Frank that are embedded inside your app (e.g. libFrank.a and frank_static_resources.bundle)"
38
39
  def update
39
- %w{libFrank.a libShelley.a}.each do |f|
40
+ %w{libFrank.a libCocoaHTTPServer.a libShelley.a libFrankMac.a libCocoaHTTPServerMac.a}.each do |f|
40
41
  copy_file f, File.join( 'Frank', f ), :force => true
41
42
  end
42
43
  directory( 'frank_static_resources.bundle', 'Frank/frank_static_resources.bundle', :force => true )
@@ -48,6 +49,7 @@ module Frank
48
49
  method_option option
49
50
  end
50
51
  method_option 'arch', :type => :string, :default => 'i386'
52
+ method_option 'mac', :type => :boolean, :default => false
51
53
  method_option :noclean, :type => :boolean, :default => false, :aliases => '--nc', :desc => "Don't clean the build directory before building"
52
54
  def build
53
55
  clean = !options['noclean']
@@ -75,22 +77,36 @@ module Frank
75
77
  build_steps = 'clean ' + build_steps
76
78
  end
77
79
 
78
- extra_opts = XCODEBUILD_OPTIONS.map{ |o| "-#{o} #{options[o]}" if options[o] }.compact.join(' ')
79
- extra_opts += " -arch #{options['arch']}"
80
+ extra_opts = XCODEBUILD_OPTIONS.map{ |o| "-#{o} \"#{options[o]}\"" if options[o] }.compact.join(' ')
80
81
 
81
- run %Q|xcodebuild -xcconfig Frank/frankify.xcconfig #{build_steps} #{extra_opts} -configuration Debug -sdk iphonesimulator DEPLOYMENT_LOCATION=YES DSTROOT="#{build_output_dir}" FRANK_LIBRARY_SEARCH_PATHS="\\"#{frank_lib_directory}\\""|
82
+ if options['mac']
83
+ run %Q|xcodebuild -xcconfig Frank/frankify.xcconfig #{build_steps} #{extra_opts} -configuration Debug DEPLOYMENT_LOCATION=YES DSTROOT="#{build_output_dir}" FRANK_LIBRARY_SEARCH_PATHS="\\"#{frank_lib_directory}\\""|
84
+ else
85
+ extra_opts += " -arch #{options['arch']}"
86
+
87
+ run %Q|xcodebuild -xcconfig Frank/frankify.xcconfig #{build_steps} #{extra_opts} -configuration Debug -sdk iphonesimulator DEPLOYMENT_LOCATION=YES DSTROOT="#{build_output_dir}" FRANK_LIBRARY_SEARCH_PATHS="\\"#{frank_lib_directory}\\""|
88
+ end
82
89
 
83
90
  app = Dir.glob("#{build_output_dir}/*.app").delete_if { |x| x =~ /\/#{app_bundle_name}$/ }
84
91
  app = app.first
85
92
  FileUtils.cp_r("#{app}/.", frankified_app_dir)
86
93
 
87
- fix_frankified_apps_bundle_identifier
94
+ if options['mac']
95
+ in_root do
96
+ FileUtils.cp_r(
97
+ File.join( 'Frank',static_bundle),
98
+ File.join( frankified_app_dir, "Contents", "Resources", static_bundle )
99
+ )
100
+ end
101
+ else
102
+ fix_frankified_apps_bundle_identifier
88
103
 
89
- in_root do
90
- FileUtils.cp_r(
91
- File.join( 'Frank',static_bundle),
92
- File.join( frankified_app_dir, static_bundle )
93
- )
104
+ in_root do
105
+ FileUtils.cp_r(
106
+ File.join( 'Frank',static_bundle),
107
+ File.join( frankified_app_dir, static_bundle )
108
+ )
109
+ end
94
110
  end
95
111
  end
96
112
 
@@ -102,7 +118,7 @@ module Frank
102
118
 
103
119
  desc "launch", "open the Frankified app in the simulator"
104
120
  method_option :debug, :type => :boolean, :default => false
105
- method_option :idiom, :banner => 'iphone|ipad', :type => :string, :default => (ENV['FRANK_SIM_IDIOM'] || 'iphone')
121
+ method_option :idiom, :banner => 'iphone|ipad|mac', :type => :string, :default => (ENV['FRANK_SIM_IDIOM'] || 'iphone')
106
122
  def launch
107
123
  $DEBUG = options[:debug]
108
124
  launcher = case options[:idiom].downcase
@@ -110,8 +126,10 @@ module Frank
110
126
  SimLauncher::DirectClient.for_iphone_app( frankified_app_dir )
111
127
  when 'ipad'
112
128
  SimLauncher::DirectClient.for_ipad_app( frankified_app_dir )
129
+ when 'mac'
130
+ Frank::MacLauncher.new( frankified_app_dir )
113
131
  else
114
- say "idiom must be either iphone or ipad. You supplied '#{options[:idiom]}'", :red
132
+ say "idiom must be either iphone, ipad, or mac. You supplied '#{options[:idiom]}'", :red
115
133
  exit 10
116
134
  end
117
135
 
@@ -138,15 +156,15 @@ module Frank
138
156
  desc 'console', "launch a ruby console connected to your Frankified app"
139
157
  def console
140
158
  # TODO: check whether app is running (using ps or similar), and launch it if it's not
141
-
159
+
142
160
  begin
143
161
  require 'pry'
144
162
  rescue LoadError
145
163
  say 'The Frank console requires the pry gem.'
146
164
  say 'Simply run `sudo gem install pry` (the `sudo` bit might be optional), and then try again. Thanks!'
147
- exit 41
165
+ exit 41
148
166
  end
149
-
167
+
150
168
  Frank::Cucumber::FrankHelper.use_shelley_from_now_on
151
169
  console = Frank::Console.new
152
170
  if console.check_for_running_app
@@ -163,7 +181,7 @@ module Frank
163
181
  def app_bundle_name
164
182
  "#{product_name}.app"
165
183
  end
166
-
184
+
167
185
  def frank_lib_directory
168
186
  File.expand_path "Frank"
169
187
  end
@@ -178,9 +196,9 @@ module Frank
178
196
 
179
197
  def fix_frankified_apps_bundle_identifier
180
198
  # as of iOS 6 the iOS Simulator locks up with a black screen if you try and launch an app which has the same
181
- # bundle identifier as a previously installed app but which is in fact a different app. This impacts us because our
199
+ # bundle identifier as a previously installed app but which is in fact a different app. This impacts us because our
182
200
  # Frankified app is different but has the same bundle identifier as the standard non-Frankified app which most users
183
- # will want to have installed in the simulator as well.
201
+ # will want to have installed in the simulator as well.
184
202
  #
185
203
  # We work around this by modifying the Frankified app's bundle identifier inside its Info.plist.
186
204
  inside frankified_app_dir do
@@ -4,6 +4,7 @@ require 'frank-cucumber/host_scripting'
4
4
  require 'frank-cucumber/wait_helper'
5
5
  require 'frank-cucumber/keyboard_helper'
6
6
  require 'frank-cucumber/scroll_helper'
7
+ require 'frank-cucumber/gesture_helper'
7
8
  require 'frank-cucumber/location_helper'
8
9
  require 'frank-cucumber/bonjour'
9
10
 
@@ -27,6 +28,7 @@ module FrankHelper
27
28
  include WaitHelper
28
29
  include KeyboardHelper
29
30
  include ScrollHelper
31
+ include GestureHelper
30
32
  include HostScripting
31
33
  include LocationHelper
32
34
 
@@ -41,7 +41,7 @@ class Frankifier
41
41
  projects.first
42
42
  else
43
43
  choice = ask_menu(
44
- "I found more than one .xcodeproj. Which is the main app project that you wish to Frankify?",
44
+ "I found more than one .xcodeproj. Which is the main app project that you wish to Frankify?",
45
45
  projects.map(&:basename)
46
46
  )
47
47
  projects[choice]
@@ -60,7 +60,7 @@ class Frankifier
60
60
  targets.first
61
61
  else
62
62
  choice = ask_menu(
63
- "I found more than one target in this project. Which is the main app target that you wish to Frankify?",
63
+ "I found more than one target in this project. Which is the main app target that you wish to Frankify?",
64
64
  targets.map(&:name)
65
65
  )
66
66
  targets.to_a[choice]
@@ -71,8 +71,19 @@ class Frankifier
71
71
  puts "Frankifying target [#{@target.name}] in project #{@xcodeproj_path.basename}"
72
72
  end
73
73
 
74
+ def target_is_mac
75
+ settings = @target.build_configurations.first.build_settings['SDKROOT'] \
76
+ || @project.build_configurations.first.build_settings['SDKROOT']
77
+
78
+ return settings.include? 'macosx'
79
+ end
80
+
74
81
  def add_linker_flag
75
- add_frank_entry_to_build_setting( 'OTHER_LDFLAGS', 'FRANK_LDFLAGS' )
82
+ if target_is_mac
83
+ add_frank_entry_to_build_setting( 'OTHER_LDFLAGS', 'FRANK_MAC_LDFLAGS' )
84
+ else
85
+ add_frank_entry_to_build_setting( 'OTHER_LDFLAGS', 'FRANK_LDFLAGS' )
86
+ end
76
87
  end
77
88
 
78
89
  def add_library_search_path
@@ -97,16 +108,16 @@ class Frankifier
97
108
  end
98
109
 
99
110
  def check_target_build_configuration_is_valid!
100
- unless @target.build_configuration_list.build_settings(@target_build_configuration)
111
+ unless @target.build_configuration_list.build_settings(@target_build_configuration)
101
112
  say %Q|I'm trying to Frankify the '#{@target_build_configuration}' build configuration, but I don't see it that build configuration in your XCode target. Here's a list of the build configurations I see:|
102
- @target.build_configuration_list.build_configurations.each do |bc|
113
+ @target.build_configuration_list.build_configurations.each do |bc|
103
114
  say " '#{bc.name}'"
104
115
  end
105
116
  say ''
106
117
  say %Q|Please specify one of those build configurations using the --build_configuration flag|
107
118
  exit
108
119
  end
109
-
120
+
110
121
  end
111
122
 
112
123
  def build_settings_to_edit
@@ -121,7 +132,7 @@ class Frankifier
121
132
  def ask_menu message, options
122
133
  option_lines = options.each_with_index.map{ |o,i| "#{i+1}: #{o}" }
123
134
  full_message = ([message,'']+option_lines+[">"]).join("\n")
124
-
135
+
125
136
  allowed_range = (1..options.length)
126
137
  valid_choice = nil
127
138
  until valid_choice
@@ -0,0 +1,68 @@
1
+ module Frank
2
+ module Cucumber
3
+ module GestureHelper
4
+
5
+ # Touch and hold the selector for a given duration
6
+ #
7
+ # @param [String] selector a view selector.
8
+ # @param [Number] duration the duration of the touch, the default is 1.
9
+ #
10
+ # @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
11
+ #
12
+ # @raise an expection if no views matched the selector
13
+ # @raise an expection if no views which matched the selector could be touched
14
+ def tap_and_hold( selector, duration = 1 )
15
+ touch_successes = frankly_map( selector, "touchAndHold:", duration )
16
+ raise "Could not find anything matching [#{selector}] to long touch" if touch_successes.empty?
17
+ raise "Some views could not be long touched (probably because they are not within the current viewport)" if touch_successes.include?(false)
18
+ end
19
+
20
+ # Touch and hold the selector at a specific point for a given duration
21
+ #
22
+ # @param [String] selector a view selector.
23
+ # @param [Number] duration the duration of the touch, the default is 1.
24
+ # @param [Number] x the x-coordinate to touch
25
+ # @param [Number] y the y-coordinate to touch
26
+ #
27
+ # @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
28
+ #
29
+ # @raise an expection if no views matched the selector
30
+ # @raise an expection if no views which matched the selector could be touched
31
+ def tap_and_hold_point( selector, x, y, duration = 1 )
32
+ touch_successes = frankly_map( selector, "touchAndHold:x:y:", duration, x, y )
33
+ raise "Could not find anything matching [#{selector}] to long touch" if touch_successes.empty?
34
+ raise "Some views could not be long touched (probably because they are not within the current viewport)" if touch_successes.include?(false)
35
+ end
36
+
37
+ # Double tap the selector
38
+ #
39
+ # @param [String] selector a view selector.
40
+ #
41
+ # @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
42
+ #
43
+ # @raise an expection if no views matched the selector
44
+ # @raise an expection if no views which matched the selector could be touched
45
+ def double_tap( selector )
46
+ touch_successes = frankly_map( selector, "doubleTap" )
47
+ raise "Could not find anything matching [#{selector}] to double tap" if touch_successes.empty?
48
+ raise "Some views could not be double tap (probably because they are not within the current viewport)" if touch_successes.include?(false)
49
+ end
50
+
51
+ # Double tap the selector at a specific point
52
+ #
53
+ # @param [String] selector a view selector.
54
+ # @param [Number] x the x-coordinate to touch
55
+ # @param [Number] y the y-coordinate to touch
56
+ #
57
+ # @return [Array<Boolean>] an array indicating for each view which matched the selector whether it was touched or not.
58
+ #
59
+ # @raise an expection if no views matched the selector
60
+ # @raise an expection if no views which matched the selector could be touched
61
+ def double_tap_point( selector, x, y )
62
+ touch_successes = frankly_map( selector, "doubleTapx:y:", x, y )
63
+ raise "Could not find anything matching [#{selector}] to double tap" if touch_successes.empty?
64
+ raise "Some views could not be double tap (probably because they are not within the current viewport)" if touch_successes.include?(false)
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,35 @@
1
+ require "timeout"
2
+
3
+ module Frank
4
+ class MacLauncher
5
+
6
+ def initialize(app_path)
7
+ @app_path = app_path
8
+ end
9
+
10
+ def launch
11
+ `open "#{@app_path}"`
12
+ end
13
+
14
+ def quit_if_running
15
+ pid = `ps -ax | grep "#{@app_path}" | grep -v grep`
16
+
17
+ if pid != ""
18
+ pid = pid.strip.split[0]
19
+ `kill #{pid}`
20
+ end
21
+
22
+ Timeout::timeout(60) {
23
+ while pid != ""
24
+ pid = `ps -ax | grep "#{@app_path}" | grep -v grep`
25
+ end
26
+ }
27
+
28
+ end
29
+
30
+ def relaunch
31
+ self.quit_if_running
32
+ self.launch
33
+ end
34
+ end
35
+ end
@@ -1,5 +1,5 @@
1
1
  module Frank
2
2
  module Cucumber
3
- VERSION = "1.1.4.pre1"
3
+ VERSION = "1.1.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: frank-cucumber
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4.pre1
5
- prerelease: 6
4
+ version: 1.1.5
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Pete Hodgson
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-17 00:00:00.000000000 Z
13
+ date: 2013-01-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: cucumber
@@ -240,7 +240,9 @@ files:
240
240
  - frank-skeleton/features/support/env.rb
241
241
  - frank-skeleton/frankify.xcconfig.tt
242
242
  - frank-skeleton/libCocoaHTTPServer.a
243
+ - frank-skeleton/libCocoaHTTPServerMac.a
243
244
  - frank-skeleton/libFrank.a
245
+ - frank-skeleton/libFrankMac.a
244
246
  - frank-skeleton/libShelley.a
245
247
  - lib/frank-cucumber.rb
246
248
  - lib/frank-cucumber/app_bundle_locator.rb
@@ -253,11 +255,13 @@ files:
253
255
  - lib/frank-cucumber/frank_localize.rb
254
256
  - lib/frank-cucumber/frankifier.rb
255
257
  - lib/frank-cucumber/gateway.rb
258
+ - lib/frank-cucumber/gesture_helper.rb
256
259
  - lib/frank-cucumber/host_scripting.rb
257
260
  - lib/frank-cucumber/keyboard_helper.rb
258
261
  - lib/frank-cucumber/launcher.rb
259
262
  - lib/frank-cucumber/localize.yml
260
263
  - lib/frank-cucumber/location_helper.rb
264
+ - lib/frank-cucumber/mac_launcher.rb
261
265
  - lib/frank-cucumber/rect.rb
262
266
  - lib/frank-cucumber/scroll_helper.rb
263
267
  - lib/frank-cucumber/version.rb
@@ -365,9 +369,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
365
369
  required_rubygems_version: !ruby/object:Gem::Requirement
366
370
  none: false
367
371
  requirements:
368
- - - ! '>'
372
+ - - ! '>='
369
373
  - !ruby/object:Gem::Version
370
- version: 1.3.1
374
+ version: '0'
371
375
  requirements: []
372
376
  rubyforge_project:
373
377
  rubygems_version: 1.8.24