Class: GuardianAngel

Inherits:
Object
  • Object
show all
Defined in:
lib/guardian_angel.rb

Overview

Author:

  • Vittorio Monaco

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configuration) ⇒ GuardianAngel

Creates a new instance given a GAConfiguration object

Parameters:

  • configuration (GAConfiguration)

    the configuration you want to use to run the tests (see #GAConfiguration)



10
11
12
13
# File 'lib/guardian_angel.rb', line 10

def initialize(configuration)
  @configuration=configuration
  @runner=XcodebuildRunner.new(configuration)
end

Class Method Details

.buildWithConfiguration(configuration) ⇒ Object

Convenience method to build tests in a stand-alone fashion

Parameters:

  • configuration (GAConfiguration)

    the configuration you want to use to run the tests (see #GAConfiguration)



18
19
20
21
# File 'lib/guardian_angel.rb', line 18

def self.buildWithConfiguration(configuration)
  watcher = GuardianAngel.new(configuration)
  watcher.buildTests()
end

Instance Method Details

#buildTestsObject

Note:

a configuration must be already setup for this method to work

Builds the tests target through xctool

(see #XctoolRunner)



27
28
29
# File 'lib/guardian_angel.rb', line 27

def buildTests()    
  @runner.build()
end

#watchObject

Note:

this uses the gem filewatcher

Starts watching for changes to .m or .swift files in the caller directory



34
35
36
37
# File 'lib/guardian_angel.rb', line 34

def watch()
  GALogger.log("Watching...")
  system("filewatcher '*.{m,swift}' 'xctestfile $FILENAME'", out: $stdout, err: :out)
end