Class: UISpecRunner
- Inherits:
-
Object
- Object
- UISpecRunner
- Defined in:
- lib/uispecrunner.rb,
lib/uispecrunner/options.rb,
lib/uispecrunner/application.rb,
lib/uispecrunner/drivers/shell.rb,
lib/uispecrunner/xcode_builder.rb,
lib/uispecrunner/drivers/waxsim.rb,
lib/uispecrunner/drivers/osascript.rb
Defined Under Namespace
Classes: Application, Drivers, Options, XcodeBuilder
Instance Attribute Summary collapse
-
#app_path ⇒ Object
Run Options.
-
#build_dir ⇒ Object
Build Options.
-
#configuration ⇒ Object
Build Options.
-
#driver ⇒ Object
Run Options.
-
#env ⇒ Object
Run Options.
-
#example ⇒ Object
private.
-
#exit_on_finish ⇒ Object
Run Options.
-
#family ⇒ Object
Run Options.
-
#project ⇒ Object
Build Options.
-
#protocol ⇒ Object
private.
-
#run_mode ⇒ Object
private.
-
#scheme ⇒ Object
Build Options.
-
#sdk_version ⇒ Object
Build Options.
-
#securityd ⇒ Object
Run Options.
-
#skip_build ⇒ Object
Run Options.
-
#spec ⇒ Object
private.
-
#target ⇒ Object
Build Options.
-
#verbose ⇒ Object
Run Options.
-
#workspace ⇒ Object
Build Options.
Instance Method Summary collapse
- #app_executable_name ⇒ Object
- #app_executable_path ⇒ Object
- #cached_app_filename ⇒ Object
- #exit_on_finish? ⇒ Boolean
-
#initialize(options = {}) ⇒ UISpecRunner
constructor
A new instance of UISpecRunner.
- #read_cached_app_path ⇒ Object
- #run! ⇒ Object
- #run_all! ⇒ Object
- #run_protocol!(protocol_name) ⇒ Object
- #run_spec!(spec_name) ⇒ Object
- #run_spec_example!(spec_name, example_name) ⇒ Object
- #sdk_dir ⇒ Object
-
#verbose? ⇒ Boolean
Configuration Methods.
- #write_cached_app_path ⇒ Object
- #xcode_root ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ UISpecRunner
Returns a new instance of UISpecRunner.
23 24 25 26 27 28 29 30 31 |
# File 'lib/uispecrunner.rb', line 23 def initialize( = {}) .each { |k,v| self.send("#{k}=", v) } self.configuration ||= 'Debug' self.build_dir ||= './build' self.run_mode ||= :all self.driver ||= :waxsim self.exit_on_finish ||= true self.env ||= {} end |
Instance Attribute Details
#app_path ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def app_path @app_path end |
#build_dir ⇒ Object
Build Options
15 16 17 |
# File 'lib/uispecrunner.rb', line 15 def build_dir @build_dir end |
#configuration ⇒ Object
Build Options
15 16 17 |
# File 'lib/uispecrunner.rb', line 15 def configuration @configuration end |
#driver ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def driver @driver end |
#env ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def env @env end |
#example ⇒ Object
private
21 22 23 |
# File 'lib/uispecrunner.rb', line 21 def example @example end |
#exit_on_finish ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def exit_on_finish @exit_on_finish end |
#family ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def family @family end |
#project ⇒ Object
Build Options
15 16 17 |
# File 'lib/uispecrunner.rb', line 15 def project @project end |
#protocol ⇒ Object
private
21 22 23 |
# File 'lib/uispecrunner.rb', line 21 def protocol @protocol end |
#run_mode ⇒ Object
private
21 22 23 |
# File 'lib/uispecrunner.rb', line 21 def run_mode @run_mode end |
#scheme ⇒ Object
Build Options
15 16 17 |
# File 'lib/uispecrunner.rb', line 15 def scheme @scheme end |
#sdk_version ⇒ Object
Build Options
15 16 17 |
# File 'lib/uispecrunner.rb', line 15 def sdk_version @sdk_version end |
#securityd ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def securityd @securityd end |
#skip_build ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def skip_build @skip_build end |
#spec ⇒ Object
private
21 22 23 |
# File 'lib/uispecrunner.rb', line 21 def spec @spec end |
#target ⇒ Object
Build Options
15 16 17 |
# File 'lib/uispecrunner.rb', line 15 def target @target end |
#verbose ⇒ Object
Run Options
18 19 20 |
# File 'lib/uispecrunner.rb', line 18 def verbose @verbose end |
#workspace ⇒ Object
Build Options
15 16 17 |
# File 'lib/uispecrunner.rb', line 15 def workspace @workspace end |
Instance Method Details
#app_executable_name ⇒ Object
101 102 103 |
# File 'lib/uispecrunner.rb', line 101 def app_executable_name File.basename(app_path).gsub(/.app$/, '') end |
#app_executable_path ⇒ Object
105 106 107 |
# File 'lib/uispecrunner.rb', line 105 def app_executable_path File.join(app_path, app_executable_name) end |
#cached_app_filename ⇒ Object
82 83 84 |
# File 'lib/uispecrunner.rb', line 82 def cached_app_filename '.uispec.app' end |
#exit_on_finish? ⇒ Boolean
70 71 72 |
# File 'lib/uispecrunner.rb', line 70 def exit_on_finish? self.exit_on_finish end |
#read_cached_app_path ⇒ Object
86 87 88 |
# File 'lib/uispecrunner.rb', line 86 def read_cached_app_path File.read(cached_app_filename).chomp if File.exists?(cached_app_filename) end |
#run! ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/uispecrunner.rb', line 33 def run! case self.run_mode when :all run_all! when :spec run_spec!(self.spec) when :example run_spec_example!(self.spec, self.example) when :protocol run_protocol!(self.protocol) else raise ArgumentError, "Unknown run mode: #{config.run_mode}" end end |
#run_all! ⇒ Object
48 49 50 |
# File 'lib/uispecrunner.rb', line 48 def run_all! run_specs end |
#run_protocol!(protocol_name) ⇒ Object
52 53 54 |
# File 'lib/uispecrunner.rb', line 52 def run_protocol!(protocol_name) run_specs('UISPEC_PROTOCOL' => protocol_name) end |
#run_spec!(spec_name) ⇒ Object
56 57 58 |
# File 'lib/uispecrunner.rb', line 56 def run_spec!(spec_name) run_specs('UISPEC_SPEC' => spec_name) end |
#run_spec_example!(spec_name, example_name) ⇒ Object
60 61 62 |
# File 'lib/uispecrunner.rb', line 60 def run_spec_example!(spec_name, example_name) run_specs('UISPEC_SPEC' => spec_name, 'UISPEC_EXAMPLE' => example_name) end |
#sdk_dir ⇒ Object
78 79 80 |
# File 'lib/uispecrunner.rb', line 78 def sdk_dir "#{xcode_root}/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator#{self.sdk_version}.sdk" end |
#verbose? ⇒ Boolean
Configuration Methods
66 67 68 |
# File 'lib/uispecrunner.rb', line 66 def verbose? self.verbose end |
#write_cached_app_path ⇒ Object
90 91 92 93 94 95 |
# File 'lib/uispecrunner.rb', line 90 def write_cached_app_path if @app_path puts "Cached app path '#{app_path}'" unless File.exists?(cached_app_filename) File.open(cached_app_filename, 'w') { |f| f << @app_path } end end |
#xcode_root ⇒ Object
74 75 76 |
# File 'lib/uispecrunner.rb', line 74 def xcode_root @xcode_root ||= "#{`xcode-select -print-path`.chomp}" end |