Class: Cult::Bundle

Inherits:
Object
  • Object
show all
Defined in:
lib/cult/bundle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(io, &block) ⇒ Bundle

Returns a new instance of Bundle.



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/cult/bundle.rb', line 7

def initialize(io, &block)
  @tar = Gem::Package::TarWriter.new(io)
  if block_given?
    begin
      yield self
    ensure
      @tar.close
      @tar = nil
    end
  end
end

Instance Attribute Details

#tarObject (readonly)

Returns the value of attribute tar.



6
7
8
# File 'lib/cult/bundle.rb', line 6

def tar
  @tar
end

Instance Method Details

#add_file(project, role, node, transferable) ⇒ Object



19
20
21
22
23
24
# File 'lib/cult/bundle.rb', line 19

def add_file(project, role, node, transferable)
  data = transferable.contents(project, role, node, pwd: role.path)
  tar.add_file(transferable.remote_path, transferable.file_mode) do |io|
    io.write(data)
  end
end