Class: Niman::Nimanfile

Inherits:
Object
  • Object
show all
Defined in:
lib/niman/nimanfile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNimanfile

Returns a new instance of Nimanfile.



8
9
10
# File 'lib/niman/nimanfile.rb', line 8

def initialize
  @instructions = []
end

Instance Attribute Details

#instructionsObject (readonly)

Returns the value of attribute instructions.



6
7
8
# File 'lib/niman/nimanfile.rb', line 6

def instructions
  @instructions
end

Instance Method Details

#exec(use_sudo = :no_sudo, command) ⇒ Object



25
26
27
# File 'lib/niman/nimanfile.rb', line 25

def exec(use_sudo = :no_sudo, command)
  @instructions.push(Niman::Library::Command.new(command: command, use_sudo: use_sudo))
end

#file(path) {|f| ... } ⇒ Object

Yields:

  • (f)


12
13
14
15
16
# File 'lib/niman/nimanfile.rb', line 12

def file(path)
  f = Niman::Library::File.new(path: path)
  yield(f)
  @instructions.push(f)
end

#package(path = nil) {|package| ... } ⇒ Object

Yields:



18
19
20
21
22
23
# File 'lib/niman/nimanfile.rb', line 18

def package(path = nil)
  package = Niman::Library::Package.new
  package.path = path unless path.nil?
  yield(package) if block_given?
  @instructions.push(package)
end