Class: Guard::Chef

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/chef.rb

Defined Under Namespace

Classes: Base

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Chef.



10
11
12
13
14
# File 'lib/guard/chef.rb', line 10

def initialize(watchers=[], options={})
  super
  @base_dir = ::File.expand_path('../../../',  __FILE__)
  # init stuff here, thx!
end

Instance Method Details

#reloadObject

Called on Ctrl-Z signal This method should be mainly used for “reload” (really!) actions like reloading passenger/spork/bundler/…



36
37
38
# File 'lib/guard/chef.rb', line 36

def reload
  true
end

#run_allObject

Called on Ctrl-/ signal This method should be principally used for long action like running all specs/tests/…



42
43
44
# File 'lib/guard/chef.rb', line 42

def run_all
  true
end

#run_on_changes(paths) ⇒ Object

Called on file modifications and additions



47
48
49
50
51
52
53
54
# File 'lib/guard/chef.rb', line 47

def run_on_changes(paths)
  paths.each do |path|
    unless updated?(path)
      return false
    end
  end
  true
end

#run_on_removals(paths) ⇒ Object

warn a user that we don’t do anything to handle deleted files. does not call super, so guard action isn’t triggered



58
59
60
61
62
# File 'lib/guard/chef.rb', line 58

def run_on_removals(paths)
  paths.each do |path|
    warn "file #{path} removed -- it's up to you to remove it from the server if desired"
  end
end

#startObject

Called once when Guard starts Please override initialize method to init stuff



25
26
27
# File 'lib/guard/chef.rb', line 25

def start
  true
end

#stopObject

Called on Ctrl-C signal (when Guard quits)



30
31
32
# File 'lib/guard/chef.rb', line 30

def stop
  true
end