class Chef::Provider::Archive

Public Class Methods

new(new_resource, run_context) click to toggle source
Calls superclass method
# File lib/garcon/chef/provider/archive.rb, line 97
def initialize(new_resource, run_context)
  super
  __zip__ unless defined?(Zip)
end

Public Instance Methods

action_extract() click to toggle source
# File lib/garcon/chef/provider/archive.rb, line 125
def action_extract
  converge_by "Extracting #{r.source} to #{r.path}" do
    extract
    do_acl_changes
    ::File.unlink(cached_file) if r.remove_after
  end
  r.updated_by_last_action(true)
end
action_zip() click to toggle source
# File lib/garcon/chef/provider/archive.rb, line 134
def action_zip
  if ::File.exists?(r.path) && !r.overwrite
    Chef::Log.info "#{r.path} already exists - nothing to do"
  else
    ::File.unlink(r.path) if ::File.exists?(r.path)
    if ::File.directory?(r.source)
      converge_by "Zip #{r.source}" do
        z = Zip::File.new(r.path, true)
        Find.find(r.source) do |f|
          next if f == r.source
          zip_fname = f.sub(r.source, '')
          z.add(zip_fname, f)
        end
        z.close
        do_acl_changes
        r.updated_by_last_action(true)
      end
    else
      Chef::Log.warn 'A valid directory must be specified for ziping.'
    end
  end
end
load_current_resource() click to toggle source

Load and return the current resource.

@return [Chef::Provider]

@api private

# File lib/garcon/chef/provider/archive.rb, line 120
def load_current_resource
  @current_resource ||= Chef::Resource::Archive.new(r.name)
  @current_resource
end
whyrun_supported?() click to toggle source

Boolean indicating if WhyRun is supported by this provider.

@return [TrueClass, FalseClass]

@api private

# File lib/garcon/chef/provider/archive.rb, line 111
def whyrun_supported?
  true
end