Module: PKGUtil

Defined in:
lib/iesd/utility/pkgutil.rb,
lib/iesd/utility/pkgutil.rb

Overview

:nodoc:

Defined Under Namespace

Classes: PKG

Class Method Summary collapse

Class Method Details

.read(input) ⇒ Object

Perform read-only actions on the input package.

If a block is given the block will be yielded with the path of the package expanded directory, otherwise a shell will be open.

input - The String path to the input package.



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/iesd/utility/pkgutil.rb', line 14

def self.read input
  Dir.mktmpdir { |tmp|
    tmp = File.join tmp, File.basename(input)
    expand input, tmp
    if block_given?
      yield tmp
    else
      shell tmp
    end
  }
end

.write(input, output = input) ⇒ Object

Perform read-write actions on the input package and export as the output package.

If a block is given the block will be yielded with the path of the package expanded directory, otherwise a shell will be open.

input - The String path to the input package. output - The String path to the output package.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/iesd/utility/pkgutil.rb', line 32

def self.write input, output = input
  Dir.mktmpdir { |tmp|
    tmp = File.join tmp, File.basename(input)
    expand input, tmp
    if block_given?
      yield tmp
    else
      shell tmp
    end
    flatten tmp, output
  }
end