Class: Guard::CalabashiOS

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/calabash-ios.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ CalabashiOS

Initialize a Guard.

Parameters:

  • watchers (Array<Guard::Watcher>) (defaults to: [])

    the Guard file watchers

  • options (Hash) (defaults to: {})

    the custom Guard options



12
13
14
15
16
17
# File 'lib/guard/calabash-ios.rb', line 12

def initialize(watchers = [], options = {})
  super
  @options = {
      :all_on_start   => true,
  }.update(options)
end

Instance Method Details

#reloadObject

Called when ‘reload|r|z + enter` is pressed. This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…

Raises:

  • (:task_has_failed)

    when reload has failed



38
39
# File 'lib/guard/calabash-ios.rb', line 38

def reload
end

#run_allObject

Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…

Raises:

  • (:task_has_failed)

    when run_all has failed



44
45
46
# File 'lib/guard/calabash-ios.rb', line 44

def run_all
  run("features")
end

#run_on_changes(paths) ⇒ Object

Called on file(s) modifications that the Guard watches.

Parameters:

  • paths (Array<String>)

    the changes files or paths

Raises:

  • (:task_has_failed)

    when run_on_change has failed



51
52
53
# File 'lib/guard/calabash-ios.rb', line 51

def run_on_changes(paths)
  run(paths)
end

#run_on_removal(paths) ⇒ Object

Called on file(s) deletions that the Guard watches.

Parameters:

  • paths (Array<String>)

    the deleted files or paths

Raises:

  • (:task_has_failed)

    when run_on_change has failed



58
59
60
# File 'lib/guard/calabash-ios.rb', line 58

def run_on_removal(paths)
  super
end

#startObject

Call once when Guard starts. Please override initialize method to init stuff.

Raises:

  • (:task_has_failed)

    when start has failed



21
22
23
24
25
26
27
28
# File 'lib/guard/calabash-ios.rb', line 21

def start
  @runner = Runner.new @options
  if @runner.nil?
    @raise [:task_has_failed]
  end
  notify_start
  run_all if @options[:all_on_start]
end

#stopObject

Called when ‘stop|quit|exit|s|q|e + enter` is pressed (when Guard quits).

Raises:

  • (:task_has_failed)

    when stop has failed



32
33
# File 'lib/guard/calabash-ios.rb', line 32

def stop
end