bwoken 2.0.0.beta.1 → 2.0.0.beta.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -22,6 +22,29 @@ $ bwoken test --focus some_test # runs this test on (iphone and ipad) OR (connec
22
22
  $ bwoken test --focus some_test --family iphone
23
23
  </code></pre>
24
24
 
25
+ ### structuring your test files
26
+ To add new coffeescript test, add those file to the /integration/coffeescript/iphone or /integration/coffeescript/ipad folder.
27
+ To add new javascript test, if the iphone and ipad folder don't exist in the /integration/javascript forlder, create them.
28
+ Then copy your test file inside those folder depending on your target.
29
+ Your file hierarchy should look something like this
30
+ <pre><code>
31
+ | integration
32
+ | coffeescript
33
+ | iphone
34
+ | exemple.coffee
35
+ | ipad
36
+ | example.coffee
37
+ | javascript
38
+ | iphone
39
+ | myTest.js
40
+ | ipad
41
+ | myiPadtest.js
42
+ |tmp
43
+ </code></pre>
44
+
45
+ Note that your test scripts inside the coffeescript and javascript folder will be copied to their equivalent folder in the /tmp folder(ie: /tmp/javascript/iphone/myTest.js),
46
+ so all your import statement should be relative to that location (ie: #import "../filetoImport.js" for file in the javascript folder)
47
+
25
48
  ### Simulator or Device?
26
49
 
27
50
  To run bwoken tests on your device, just plug it in! And if you want to run tests in the simulator, just unplug it!
@@ -80,15 +103,17 @@ Here's a list of all the switches that bwoken takes for the `test` command:
80
103
  <pre><code>
81
104
  $ bwoken test -h
82
105
  [...]
83
- --simulator Use simulator, even when an iDevice is connected
84
- --family Test only one device type, either ipad or iphone. Default is to test on both
85
- --scheme Specify a custom scheme
86
- --formatter Specify a custom formatter (e.g., --formatter=passthru)
87
- --focus Specify particular tests to run
88
- --clobber Remove any generated file
89
- --skip-build Do not build the iOS binary
90
- --verbose Be verbose
91
- -h, --help Display this help message.
106
+ --simulator Use simulator, even when an iDevice is connected
107
+ --family Test only one device type, either ipad or iphone. Default is to test on both
108
+ --scheme Specify a custom scheme
109
+ --product-name Specify a custom product name (e.g. --product-name="My Product"). Default is the name of of the xcodeproj file
110
+ --integration-path Specify a custom directory to store your test scripts in (e.g. --integration-path=uiautomation/path/dir). Note that this folder still expects the same directory structure as the one create by `bwoken init`.
111
+ --formatter Specify a custom formatter (e.g., --formatter=passthru)
112
+ --focus Specify particular tests to run
113
+ --clobber Remove any generated file
114
+ --skip-build Do not build the iOS binary
115
+ --verbose Be verbose
116
+ -h, --help Display this help message.
92
117
  </code></pre>
93
118
 
94
119
  ## In Your Code
@@ -149,7 +174,7 @@ $ bundle init
149
174
 
150
175
  This will create a <code>Gemfile</code>. Add bwoken to it and bundle:
151
176
 
152
- <pre><code>$ echo "gem 'bwoken'" &gt;&gt; Gemfile
177
+ <pre><code>$ echo "gem 'bwoken', '2.0.0.beta.1'" &gt;&gt; Gemfile
153
178
  $ bundle
154
179
  </code></pre>
155
180
 
@@ -164,6 +189,19 @@ Now, you can start <a href="#usage">using it!</a>
164
189
 
165
190
  Technically, you can skip this entire Installation section and just run `sudo gem install bwoken && bwoken init`. This is listed here for completeness, but you really shouldn't install gems this way.
166
191
 
192
+ ## Contributors
193
+
194
+ Special thank you goes out to everyone who's helped with bwoken. Here's a (probably incomplete) list of those folks:
195
+
196
+ * Brad Grzesiak ([listrophy](https://github.com/listrophy))
197
+ * Jaymes Waters ([jaym3s](https://github.com/jaym3s))
198
+ * Jonathan Penn ([jonathanpenn](https://github.com/jonathanpenn))
199
+ * Ryland Herrick ([rylnd](https://github.com/rylnd))
200
+ * Whitney Young ([wbyoung](https://github.com/wbyoung))
201
+ * David Gagnon ([mrdavidgagnon](https://github.com/mrdavidgagnon))
202
+ * [otusweb](https://github.com/otusweb)
203
+ * Alec Gorge ([alecgorge](https://github.com/alecgorge))
204
+
167
205
  ## Contributing
168
206
 
169
207
  1. Fork it
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  #
3
- # Copyright (c) 2012 Jonathan Penn (http://cocoamanifest.net)
3
+ # Copyright (c) 2013 Jonathan Penn (http://cocoamanifest.net)
4
4
  #
5
5
  # Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  # of this software and associated documentation files (the "Software"), to deal
@@ -47,7 +47,8 @@ run_instruments() {
47
47
  # to make this cleaner?
48
48
 
49
49
  output=$(mktemp -t unix-instruments)
50
- instruments $@ &> /dev/ttyvf & pid_instruments=$!
50
+ instruments "$@" &> /dev/ttyvf &
51
+ pid_instruments=$!
51
52
 
52
53
  # Cat the instruments output to tee which outputs to stdout and saves to
53
54
  # $output at the same time
@@ -72,7 +73,7 @@ get_error_status() {
72
73
  }
73
74
 
74
75
  trap cleanup_instruments EXIT
75
- function cleanup_instruments() {
76
+ cleanup_instruments() {
76
77
  # Because we fork instruments in this script, we need to clean up if it's
77
78
  # still running because of an error or the user pressed Ctrl-C
78
79
  if [[ $pid_instruments -gt 0 ]]; then
@@ -87,5 +88,5 @@ function cleanup_instruments() {
87
88
  if [[ $1 == "----test" ]]; then
88
89
  get_error_status
89
90
  else
90
- run_instruments $@
91
+ run_instruments "$@"
91
92
  fi
data/lib/bwoken.rb CHANGED
@@ -5,7 +5,15 @@ module Bwoken
5
5
  DEVICE_FAMILIES = %w(iphone ipad)
6
6
 
7
7
  def path
8
- File.join(project_path, 'integration')
8
+ File.join(project_path, integration_path)
9
+ end
10
+
11
+ def integration_path
12
+ @integration_path || 'integration'
13
+ end
14
+
15
+ def integration_path= new_integration_path
16
+ @integration_path = new_integration_path
9
17
  end
10
18
 
11
19
  def tmp_path
@@ -13,7 +21,11 @@ module Bwoken
13
21
  end
14
22
 
15
23
  def app_name
16
- File.basename(File.basename(workspace_or_project, '.xcodeproj'), '.xcworkspace')
24
+ @name || File.basename(File.basename(workspace_or_project, '.xcodeproj'), '.xcworkspace')
25
+ end
26
+
27
+ def app_name= name
28
+ @name = name
17
29
  end
18
30
 
19
31
  def project_path
data/lib/bwoken/cli.rb CHANGED
@@ -14,6 +14,7 @@ opts = Slop.parse :help => true do
14
14
 
15
15
  command 'init' do
16
16
  banner Bwoken::CLI::Init.help_banner
17
+ on :'integration-path=', 'Specify a custom directory to store your test scripts in (e.g. --integration-path=uiautomation/path/dir). Default: integration. If you use the non-default value here, you will need to always run bwoken with the `--integration-path=your/integration/dir` option.', :default => 'integration'
17
18
 
18
19
  run { ran_command = 'init' }
19
20
  end
@@ -26,12 +27,15 @@ opts = Slop.parse :help => true do
26
27
  on :family=, 'Test only one device type, either ipad or iphone. Default is to test on both',
27
28
  :match => /\A(?:ipad|iphone|all)\Z/i, :default => 'all'
28
29
  on :scheme=, 'Specify a custom scheme'
30
+ on :'product-name=', 'Specify a custom product name (e.g. --product-name="My Product"). Default is the name of of the xcodeproj file'
31
+ on :'integration-path=', 'Specify a custom directory to store your test scripts in (e.g. --integration-path=uiautomation/path/dir). Note that this folder still expects the same directory structure as the one create by `bwoken init`.', :default => 'integration'
29
32
  #on :flags=, 'Specify custom build flags (e.g., --flags="-arch=i386,foo=bar")', :as => Array, :default => [] # TODO: implement
30
33
  on :formatter=, 'Specify a custom formatter (e.g., --formatter=passthru)', :default => 'colorful'
31
34
  on :focus=, 'Specify particular tests to run', :as => Array, :default => []
32
35
  on :clobber, 'Remove any generated file'
33
36
  on :'skip-build', 'Do not build the iOS binary'
34
37
  on :verbose, 'Be verbose'
38
+ on :configuration=, 'The build configruation to use (e.g., --configuration=Release)', :default => 'Debug'
35
39
 
36
40
  run { ran_command = 'test' }
37
41
  end
@@ -18,29 +18,31 @@ BANNER
18
18
  end
19
19
 
20
20
  # opts - A slop command object (acts like super-hash)
21
- # There are currently no options available
21
+ # Only allowed option is 'integration-path' which should
22
+ # have defaulted to 'integration'
22
23
  def initialize opts
23
- # opts = opts.to_hash if opts.is_a?(Slop)
24
+ opts = opts.to_hash if opts.is_a?(Slop)
25
+ Bwoken.integration_path = opts[:'integration-path']
24
26
  end
25
27
 
26
28
  def run
27
- directory 'integration/coffeescript/iphone'
28
- directory 'integration/coffeescript/ipad'
29
- directory 'integration/javascript'
30
- directory 'integration/tmp/results'
31
- template 'integration/coffeescript/iphone/example.coffee'
32
- template 'integration/coffeescript/ipad/example.coffee'
33
- template 'integration/javascript/example_vendor.js'
29
+ directory "coffeescript/iphone"
30
+ directory "coffeescript/ipad"
31
+ directory "javascript"
32
+ directory "tmp/results"
33
+ template "coffeescript/iphone/example.coffee"
34
+ template "coffeescript/ipad/example.coffee"
35
+ template "javascript/example_vendor.js"
34
36
  end
35
37
 
36
38
  def directory dirname
37
- FileUtils.mkdir_p dirname
39
+ FileUtils.mkdir_p "#{Bwoken.integration_path}/#{dirname}"
38
40
  end
39
41
 
40
42
  def template filename
41
- FileUtils.cp \
42
- File.expand_path("../templates/#{filename}", __FILE__),
43
- filename
43
+ source = File.expand_path("../templates/#{filename}", __FILE__)
44
+ destination = "#{Bwoken.integration_path}/#{filename}"
45
+ FileUtils.cp source, destination
44
46
  end
45
47
 
46
48
  end
@@ -17,7 +17,7 @@ module Bwoken
17
17
  class Test
18
18
 
19
19
  def self.help_banner
20
- <<BANNER
20
+ <<-BANNER
21
21
  Run your tests. If you don't specify which tests, bwoken will run them all
22
22
 
23
23
  bwoken test --simulator # runs all tests in the simulator
@@ -38,15 +38,18 @@ BANNER
38
38
  attr_accessor :options
39
39
 
40
40
  # opts - A slop command object (acts like super-hash)
41
- # :clobber - remove all generated files, including iOS build
42
- # :family - enum of [nil, 'iphone', 'ipad'] (case-insensitive)
43
- # :flags - custom build flag array (default: []) TODO: not yet implmented
44
- # :focus - which tests to run (default: [], meaning "all")
45
- # :formatter - custom formatter (default: 'colorful')
46
- # :scheme - custom scheme (default: nil)
47
- # :simulator - should force simulator use (default: nil)
48
- # :skip-build - do not build the iOS binary
49
- # :verbose - be verbose
41
+ # :clobber - remove all generated files, including iOS build
42
+ # :family - enum of [nil, 'iphone', 'ipad'] (case-insensitive)
43
+ # :flags - custom build flag array (default: []) TODO: not yet implmented
44
+ # :focus - which tests to run (default: [], meaning "all")
45
+ # :formatter - custom formatter (default: 'colorful')
46
+ # :scheme - custom scheme (default: nil)
47
+ # :simulator - should force simulator use (default: nil)
48
+ # :skip-build - do not build the iOS binary
49
+ # :verbose - be verbose
50
+ # :integration-path - the base directory for all the integration files
51
+ # :product-name - the name of the generated .app file if it is different from the name of the project/workspace
52
+ # :configuration - typically "Debug" or "Release"
50
53
  def initialize opts
51
54
  opts = opts.to_hash if opts.is_a?(Slop)
52
55
  self.options = opts.to_hash.tap do |o|
@@ -55,6 +58,9 @@ BANNER
55
58
  o[:simulator] = use_simulator?(o[:simulator])
56
59
  o[:family] = o[:family]
57
60
  end
61
+
62
+ Bwoken.integration_path = options[:'integration-path']
63
+ Bwoken.app_name = options[:'product-name']
58
64
  end
59
65
 
60
66
  def run
@@ -71,14 +77,16 @@ BANNER
71
77
  b.formatter = options[:formatter]
72
78
  b.scheme = options[:scheme] if options[:scheme]
73
79
  b.simulator = options[:simulator]
80
+ b.configuration = options[:configuration]
74
81
  end.compile
75
82
  end
76
83
 
77
84
  def transpile
78
- coffeescripts = Rake::FileList['integration/coffeescript/**/*.coffee']
79
- compiled_coffee = coffeescripts.pathmap('%{^integration/coffeescript,integration/tmp/javascript}d/%n.js')
80
- javascripts = Rake::FileList['integration/javascript/**/*.js']
81
- copied_javascripts = javascripts.pathmap('%{^integration/javascript,integration/tmp/javascript}d/%f')
85
+ integration_dir = Bwoken.integration_path
86
+ coffeescripts = Rake::FileList["#{integration_dir}/coffeescript/**/*.coffee"]
87
+ compiled_coffee = coffeescripts.pathmap("%{^#{integration_dir}/coffeescript,#{integration_dir}/tmp/javascript}d/%n.js")
88
+ javascripts = Rake::FileList["#{integration_dir}/javascript/**/*.js"]
89
+ copied_javascripts = javascripts.pathmap("%{^#{integration_dir}/javascript,#{integration_dir}/tmp/javascript}d/%f")
82
90
 
83
91
  compiled_coffee.zip(coffeescripts).each do |target, source|
84
92
  containing_dir = target.pathmap('%d')
data/lib/bwoken/script.rb CHANGED
@@ -25,8 +25,8 @@ module Bwoken
25
25
 
26
26
  def env_variables
27
27
  {
28
- 'UIASCRIPT' => path,
29
- 'UIARESULTSPATH' => Bwoken.results_path
28
+ 'UIASCRIPT' => %Q|"#{path}"|,
29
+ 'UIARESULTSPATH' => %Q|"#{Bwoken.results_path}"|
30
30
  }
31
31
  end
32
32
 
@@ -35,12 +35,12 @@ module Bwoken
35
35
  end
36
36
 
37
37
  def cmd
38
- "#{File.expand_path('../../../bin', __FILE__)}/unix_instruments.sh \
38
+ %Q|"#{File.expand_path('../../../bin', __FILE__)}/unix_instruments.sh" \
39
39
  #{device_flag} \
40
- -D #{self.class.trace_file_path} \
41
- -t #{Bwoken.path_to_automation_template} \
42
- #{app_dir} \
43
- #{env_variables_for_cli}"
40
+ -D "#{self.class.trace_file_path}" \
41
+ -t "#{Bwoken.path_to_automation_template}" \
42
+ "#{app_dir}" \
43
+ #{env_variables_for_cli}|
44
44
  end
45
45
 
46
46
  def device_flag
@@ -11,7 +11,7 @@ module Bwoken
11
11
  end
12
12
 
13
13
  def self.update_device_family_in_plist action, args = nil
14
- system_cmd = lambda {|command| Kernel.system "#{plist_buddy} -c '#{command}' #{plist_file}" }
14
+ system_cmd = lambda {|command| Kernel.system "#{plist_buddy} -c '#{command}' \"#{plist_file}\"" }
15
15
 
16
16
  case action
17
17
  when :delete_array then system_cmd['Delete :UIDeviceFamily']
@@ -1,3 +1,3 @@
1
1
  module Bwoken
2
- VERSION = "2.0.0.beta.1" unless defined?(::Bwoken::VERSION)
2
+ VERSION = "2.0.0.beta.2" unless defined?(::Bwoken::VERSION)
3
3
  end
metadata CHANGED
@@ -1,16 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bwoken
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.beta.1
4
+ version: 2.0.0.beta.2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brad Grzesiak
9
- - Jaymes Waters
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2013-09-13 00:00:00.000000000 Z
12
+ date: 2013-11-01 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: coffee-script-source
@@ -143,7 +142,6 @@ dependencies:
143
142
  description: iOS UIAutomation Test Runner
144
143
  email:
145
144
  - brad@bendyworks.com
146
- - jaymes@bendyworks.com
147
145
  executables:
148
146
  - unix_instruments.sh
149
147
  - bwoken
@@ -156,9 +154,9 @@ files:
156
154
  - bin/unix_instruments.sh
157
155
  - lib/bwoken/build.rb
158
156
  - lib/bwoken/cli/init.rb
159
- - lib/bwoken/cli/templates/integration/coffeescript/ipad/example.coffee
160
- - lib/bwoken/cli/templates/integration/coffeescript/iphone/example.coffee
161
- - lib/bwoken/cli/templates/integration/javascript/example_vendor.js
157
+ - lib/bwoken/cli/templates/coffeescript/ipad/example.coffee
158
+ - lib/bwoken/cli/templates/coffeescript/iphone/example.coffee
159
+ - lib/bwoken/cli/templates/javascript/example_vendor.js
162
160
  - lib/bwoken/cli/test.rb
163
161
  - lib/bwoken/cli.rb
164
162
  - lib/bwoken/coffeescript/github_import_string.rb
@@ -190,9 +188,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
190
188
  - - ! '>='
191
189
  - !ruby/object:Gem::Version
192
190
  version: '0'
193
- segments:
194
- - 0
195
- hash: -2275845528582836031
196
191
  required_rubygems_version: !ruby/object:Gem::Requirement
197
192
  none: false
198
193
  requirements: