class FPM::Fry::Source::Patched

Attributes

inner[RW]

Public Class Methods

decorate(options) { |options| ... } click to toggle source
# File lib/fpm/fry/source/patched.rb, line 137
def self.decorate(options)
  if options.key?(:patches) && Array(options[:patches]).size > 0
    p = options.delete(:patches)
    return new( yield(options), patches: p )
  else
    return yield options
  end
end
new( inner , options = {}) click to toggle source
# File lib/fpm/fry/source/patched.rb, line 110
def initialize( inner , options = {})
  @inner = inner
  @patches = Array(options[:patches]).map do |file|
    if file.kind_of? String
      options = {file: file}
    elsif file.kind_of? Hash
      options = file.dup
    else
      raise ArgumentError, "Expected a Hash or a String, got #{file.inspect}"
    end
    options[:file] = File.expand_path(options[:file])
    if !File.exist?(options[:file])
      raise ArgumentError, "File doesn't exist: #{options[:file]}"
    end
    options
  end
  if @inner.respond_to? :logger
    @logger = @inner.logger
  else
    @logger = Cabin::Channel.get
  end
end

Public Instance Methods

build_cache(tmpdir) click to toggle source
# File lib/fpm/fry/source/patched.rb, line 133
def build_cache(tmpdir)
  Cache.new(self,tmpdir)
end