Module: AndFeathers

Defined in:
lib/and_feathers.rb,
lib/and_feathers/tarball.rb,
lib/and_feathers/version.rb,
lib/and_feathers/tarball/file.rb,
lib/and_feathers/tarball/directory.rb,
lib/and_feathers/tarball/contains_files.rb,
lib/and_feathers/tarball/contains_directories.rb

Overview

The entry-point to the builder DSL

Defined Under Namespace

Classes: Tarball

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.build(base = nil, base_mode = 16877) {|tarball| ... } ⇒ Object

Builds a new Tarball. If base is not given, the tarball’s contents would be extracted to intermingle with whichever directory contains the tarball. If base is given, the tarball’s contents will live inside a directory with that name. This is just a convenient way to have a dir call wrap the tarball’s contents

Parameters:

  • base (String) (defaults to: nil)

    name of the base directory containing the tarball’s contents

  • base_mode (Fixnum) (defaults to: 16877)

    the mode of the base directory

Yield Parameters:



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/and_feathers.rb', line 23

def self.build(base = nil, base_mode = 16877, &block)
  if base && base_mode
    Tarball.new.tap do |tarball|
      tarball.dir(base, base_mode) do |dir|
        block.call(dir)
      end
    end
  else
    Tarball.new.tap do |tarball|
      block.call(tarball)
    end
  end
end