Class: Chef::Provider::Bincache

Inherits:
Chef::Provider show all
Defined in:
lib/bincache/provider/bincache.rb

Instance Method Summary collapse

Instance Method Details

#action_runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bincache/provider/bincache.rb', line 9

def action_run
  scripts = []

  ## find all of the bincache resources that are running and collect the ones that are operating with the same directory
  bincache_resources = self.run_context.resource_collection.all_resources.select { |r|
    r.class.inspect == self.class.to_s.gsub(/Provider/,'Resource') &&
    r.directory == @new_resource.directory }

  ## add the scripts from each resource to our script list. Stop after we add our own script
  bincache_resources.each do |r|
    scripts << r.script
    break if r.name == @new_resource.name
  end

  ## run bincache
  require 'bincache'
  bincache = BinCache.new
  bincache.run_series_once(@new_resource.directory,scripts,@new_resource.cwd,@new_resource.script_hash)
end

#load_current_resourceObject



30
31
32
# File 'lib/bincache/provider/bincache.rb', line 30

def load_current_resource
  Chef::Resource::File.new(@new_resource.name)
end