Class: PrePackager::Package

Inherits:
Object
  • Object
show all
Includes:
Executor
Defined in:
lib/pre-packager.rb

Defined Under Namespace

Classes: Context

Constant Summary collapse

@@LOGGER =
Logger.new

Instance Method Summary collapse

Methods included from Executor

#execute

Constructor Details

#initialize(path, interpolator = Interpolator.new) ⇒ Package

Returns a new instance of Package.



69
70
71
72
# File 'lib/pre-packager.rb', line 69

def initialize path, interpolator=Interpolator.new
  @interpolator = interpolator
  @file = path
end

Instance Method Details

#extract(target, opts) {|Content.new ctx| ... } ⇒ Object

Yields:



90
91
92
93
94
95
96
97
98
# File 'lib/pre-packager.rb', line 90

def extract target, opts
  ctx = Context.new target, @interpolator, opts

  strip = opts[:strip] || 0
  FileUtils.mkdir_p ctx.local_base
  execute "tar -xf #{@file} -C #{ctx.local_base} --strip #{strip}"

  yield Content.new ctx
end