Class: Niman::Nimanfile
- Inherits:
-
Object
- Object
- Niman::Nimanfile
- Defined in:
- lib/niman/nimanfile.rb
Instance Attribute Summary collapse
-
#instructions ⇒ Object
readonly
Returns the value of attribute instructions.
Instance Method Summary collapse
- #exec(use_sudo = :no_sudo, command) ⇒ Object
- #file(path) {|f| ... } ⇒ Object
-
#initialize ⇒ Nimanfile
constructor
A new instance of Nimanfile.
- #package(path = nil) {|package| ... } ⇒ Object
Constructor Details
#initialize ⇒ Nimanfile
Returns a new instance of Nimanfile.
8 9 10 |
# File 'lib/niman/nimanfile.rb', line 8 def initialize @instructions = [] end |
Instance Attribute Details
#instructions ⇒ Object (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
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
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 |