Class: XCTasks::TestTask
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- XCTasks::TestTask
- Extended by:
- Configuration::Delegations
- Includes:
- Rake::DSL
- Defined in:
- lib/xctasks/test_task.rb
Defined Under Namespace
Classes: Configuration, ConfigurationError, Destination, Subtask
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#namespace_name ⇒ Object
readonly
Returns the value of attribute namespace_name.
-
#prepare_dependency ⇒ Object
readonly
Returns the value of attribute prepare_dependency.
-
#subtasks ⇒ Object
Returns the value of attribute subtasks.
Instance Method Summary collapse
- #define_rake_tasks ⇒ Object
-
#initialize(namespace_name = :test) {|_self| ... } ⇒ TestTask
constructor
A new instance of TestTask.
- #subtask(name_options) {|subtask| ... } ⇒ Object
Methods included from Configuration::Delegations
Constructor Details
#initialize(namespace_name = :test) {|_self| ... } ⇒ TestTask
Returns a new instance of TestTask.
300 301 302 303 304 305 306 307 308 309 310 311 |
# File 'lib/xctasks/test_task.rb', line 300 def initialize(namespace_name = :test) @namespace_name = namespace_name @config = Configuration.new @subtasks = [] @namespace_name = namespace_name.kind_of?(Hash) ? namespace_name.keys.first : namespace_name @prepare_dependency = namespace_name.kind_of?(Hash) ? namespace_name.values.first : nil yield self if block_given? raise ConfigurationError, "A workspace must be configured" unless workspace raise ConfigurationError, "At least one subtask must be configured" if subtasks.empty? define_rake_tasks end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
297 298 299 |
# File 'lib/xctasks/test_task.rb', line 297 def config @config end |
#namespace_name ⇒ Object (readonly)
Returns the value of attribute namespace_name.
297 298 299 |
# File 'lib/xctasks/test_task.rb', line 297 def namespace_name @namespace_name end |
#prepare_dependency ⇒ Object (readonly)
Returns the value of attribute prepare_dependency.
297 298 299 |
# File 'lib/xctasks/test_task.rb', line 297 def prepare_dependency @prepare_dependency end |
#subtasks ⇒ Object
Returns the value of attribute subtasks.
297 298 299 |
# File 'lib/xctasks/test_task.rb', line 297 def subtasks @subtasks end |
Instance Method Details
#define_rake_tasks ⇒ Object
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
# File 'lib/xctasks/test_task.rb', line 327 def define_rake_tasks namespace self.namespace_name do task (prepare_dependency ? { prepare: prepare_dependency} : :prepare ) do fail "No such workspace: #{workspace}" unless File.exists?(workspace) fail "Invalid schemes directory: #{schemes_dir}" unless schemes_dir.nil? || File.exists?(schemes_dir) File.truncate(output_log, 0) if output_log && File.exists?(output_log) if schemes_dir FileUtils::Verbose.mkdir_p "#{workspace}/xcshareddata/xcschemes" FileUtils::Verbose.cp Dir.glob("#{schemes_dir}/*.xcscheme"), "#{workspace}/xcshareddata/xcschemes" end subtasks.each { |subtask| subtask.prepare } end subtasks.each { |subtask| subtask.define_rake_tasks } end subtask_names = subtasks.map { |subtask| subtask.name } desc "Run all tests (#{subtask_names.join(', ')})" task namespace_name => subtask_names.map { |subtask_name| "#{namespace_name}:#{subtask_name}" } do XCTasks::TestReport.instance.report end end |