uispecrunner 0.4.1 → 0.4.2

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.1
1
+ 0.4.2
data/lib/uispecrunner.rb CHANGED
@@ -15,7 +15,7 @@ class UISpecRunner
15
15
  attr_accessor :workspace, :scheme, :project, :target, :configuration, :sdk_version, :build_dir
16
16
 
17
17
  # Run Options
18
- attr_accessor :verbose, :securityd, :driver, :env, :exit_on_finish, :app_path
18
+ attr_accessor :verbose, :securityd, :driver, :env, :exit_on_finish, :app_path, :skip_build
19
19
 
20
20
  # private
21
21
  attr_accessor :run_mode, :spec, :example, :protocol
@@ -105,12 +105,12 @@ class UISpecRunner
105
105
  def run_specs(env = {})
106
106
  puts "Building project..."
107
107
  builder = UISpecRunner::XcodeBuilder.new(self)
108
- if builder.build!
108
+ if self.skip_build || builder.build! == 0
109
109
  @app_path ||= builder.app_path
110
110
  puts "Running specs via #{driver}..."
111
111
  env['UISPEC_EXIT_ON_FINISH'] = self.exit_on_finish? ? 'YES' : 'NO'
112
112
  driver = driver_class.new(self)
113
- driver.run_specs(env)
113
+ driver.run_specs(env.merge(self.env))
114
114
  # TODO: Exit with exit code from the process...
115
115
  else
116
116
  puts "Failed to build"
@@ -11,11 +11,18 @@ class UISpecRunner
11
11
  options[:show_help] = true
12
12
  end
13
13
 
14
- if options[:show_help]
14
+ if options[:command] == :help
15
15
  $stderr.puts options.opts
16
16
  return 1
17
17
  end
18
18
 
19
+ if options[:command] == :version
20
+ version_path = File.join(File.dirname(__FILE__), '..', '..', 'VERSION')
21
+ version = File.read(version_path)
22
+ $stdout.puts version
23
+ return 0
24
+ end
25
+
19
26
  # Read standard arguments from uispec.opts
20
27
  options_file = File.join(Dir.getwd, 'uispec.opts')
21
28
  if File.exists?(options_file)
@@ -20,6 +20,7 @@ class UISpecRunner
20
20
  self[:sdk_version] = '4.0'
21
21
  self[:driver] = :waxsim
22
22
  self[:exit_on_finish] = true
23
+ self[:env] = {}
23
24
 
24
25
  require 'optparse'
25
26
  @opts = OptionParser.new do |o|
@@ -47,6 +48,12 @@ class UISpecRunner
47
48
  o.separator ""
48
49
  o.separator "Environment options:"
49
50
 
51
+ o.on('-a', '--app [APP_PATH]',
52
+ 'Run the app at the specified path',
53
+ 'Default: auto-detect the app during the build') do |app_path|
54
+ self[:app_path] = app_path
55
+ end
56
+
50
57
  o.on('--project [PROJECT_FILE]',
51
58
  'Run the UISpec target in specified project',
52
59
  'Default: auto-detect project in current directory') do |project|
@@ -103,12 +110,26 @@ class UISpecRunner
103
110
  self[:exit_on_finish] = exit_on_finish
104
111
  end
105
112
 
113
+ o.on('-S', '--skip-build', 'Do not build the app, just run the specs') do |skip_build|
114
+ self[:skip_build] = skip_build
115
+ end
116
+
106
117
  o.on('-v', '--[no-]verbose', "Run verbosely") do |v|
107
118
  self[:verbose] = v
108
119
  end
109
120
 
121
+ o.on('-E', '--env [VARIABLE=VALUE]',
122
+ 'Specify an environment variable to pass to the application.') do |env|
123
+ key, value = env.split('=')
124
+ self[:env][key] = value
125
+ end
126
+
127
+ o.on('--version', 'Show version') do
128
+ self[:command] = :version
129
+ end
130
+
110
131
  o.on_tail('-h', '--help', 'Display this help and exit') do
111
- self[:show_help] = true
132
+ self[:command] = :help
112
133
  end
113
134
  end
114
135
 
data/uispecrunner.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{uispecrunner}
8
- s.version = "0.4.1"
8
+ s.version = "0.4.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Blake Watters"]
12
- s.date = %q{2011-03-12}
12
+ s.date = %q{2011-03-14}
13
13
  s.default_executable = %q{uispec}
14
14
  s.description = %q{Provides a simple Ruby interface for running UISpec iPhone tests}
15
15
  s.email = %q{blake@twotoasters.com}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uispecrunner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 1
10
- version: 0.4.1
9
+ - 2
10
+ version: 0.4.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Blake Watters
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-12 00:00:00 -05:00
18
+ date: 2011-03-14 00:00:00 -04:00
19
19
  default_executable: uispec
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency