Class: XCTasks::TestTask::Configuration
- Inherits:
-
Object
- Object
- XCTasks::TestTask::Configuration
- Defined in:
- lib/xctasks/test_task.rb
Defined Under Namespace
Modules: Delegations
Constant Summary collapse
- SETTINGS =
[:workspace, :schemes_dir, :sdk, :runner, :xctool_path, :xcodebuild_path, :settings, :destinations, :actions, :scheme, :ios_versions, :output_log, :env, :redirect_stderr, :project]
- HELPERS =
[:destination, :xctool?, :xcpretty?, :xcodebuild?]
Instance Method Summary collapse
- #destination(specifier = {}) ⇒ Object
-
#dup ⇒ Object
Deep copy any nested structures.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #redirect_stderr=(redirect_stderr) ⇒ Object
- #runner=(runner) ⇒ Object
- #sdk=(sdk) ⇒ Object
- #validate! ⇒ Object
- #xcodebuild? ⇒ Boolean
- #xcpretty? ⇒ Boolean
- #xctool? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/xctasks/test_task.rb', line 118 def initialize @sdk = :iphonesimulator @schemes_dir = nil @xctool_path = '/usr/local/bin/xctool' @xcodebuild_path = '/usr/bin/xcodebuild' @runner = :xcodebuild @settings = {} @platform = 'iOS Simulator' @destinations = [] @actions = %w{clean build test} @env = {} @redirect_stderr = false end |
Instance Method Details
#destination(specifier = {}) ⇒ Object
151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/xctasks/test_task.rb', line 151 def destination(specifier = {}) if specifier.kind_of?(String) raise ArgumentError, "Cannot configure a destination via a block when a complete String specifier is provided" if block_given? @destinations << specifier.shellescape elsif specifier.kind_of?(Hash) destination = Destination.new(specifier) yield destination if block_given? @destinations << destination else raise ArgumentError, "Cannot configure a destination with a #{specifier}" end end |
#dup ⇒ Object
Deep copy any nested structures
181 182 183 184 185 186 |
# File 'lib/xctasks/test_task.rb', line 181 def dup copy = super copy.settings = settings.dup copy.destinations = destinations.dup return copy end |
#redirect_stderr=(redirect_stderr) ⇒ Object
143 144 145 146 147 148 149 |
# File 'lib/xctasks/test_task.rb', line 143 def redirect_stderr=(redirect_stderr) if redirect_stderr == true @redirect_stderr = '/dev/null' else @redirect_stderr = redirect_stderr end end |
#runner=(runner) ⇒ Object
132 133 134 135 136 |
# File 'lib/xctasks/test_task.rb', line 132 def runner=(runner) runner_bin = runner.to_s.split(' ')[0] raise ConfigurationError, "Must be :xcodebuild, :xctool or :xcpretty" unless %w{xctool xcodebuild xcpretty}.include?(runner_bin) @runner = runner end |
#sdk=(sdk) ⇒ Object
138 139 140 141 |
# File 'lib/xctasks/test_task.rb', line 138 def sdk=(sdk) raise ArgumentError, "Can only assign sdk from a String or Symbol" unless sdk.kind_of?(String) || sdk.kind_of?(Symbol) @sdk = sdk.to_sym end |
#validate! ⇒ Object
164 165 166 |
# File 'lib/xctasks/test_task.rb', line 164 def validate! raise ConfigurationError, "Cannot specify iOS versions with an SDK of :macosx" if sdk == :macosx && ios_versions end |
#xcodebuild? ⇒ Boolean
172 173 174 |
# File 'lib/xctasks/test_task.rb', line 172 def xcodebuild? runner =~ /^xcodebuild/ end |
#xcpretty? ⇒ Boolean
176 177 178 |
# File 'lib/xctasks/test_task.rb', line 176 def xcpretty? runner =~ /^xcpretty/ end |
#xctool? ⇒ Boolean
168 169 170 |
# File 'lib/xctasks/test_task.rb', line 168 def xctool? runner =~ /^xctool/ end |