Class: PodBuilder::Actions::Item
- Inherits:
-
Object
- Object
- PodBuilder::Actions::Item
- Defined in:
- lib/pod_builder/actions.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#quiet ⇒ Object
readonly
Returns the value of attribute quiet.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(name, step, hash) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(name, step, hash) ⇒ Item
Returns a new instance of Item.
26 27 28 29 30 31 32 33 |
# File 'lib/pod_builder/actions.rb', line 26 def initialize(name, step, hash) @name = name @step = step @path = hash.fetch("path", "") @quiet = hash.fetch("quiet", false) raise "\n\nEmpty or missing #{step} #{name} action path\n".red if @path.empty?() end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/pod_builder/actions.rb', line 24 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
22 23 24 |
# File 'lib/pod_builder/actions.rb', line 22 def path @path end |
#quiet ⇒ Object (readonly)
Returns the value of attribute quiet.
23 24 25 |
# File 'lib/pod_builder/actions.rb', line 23 def quiet @quiet end |
Instance Method Details
#execute ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/pod_builder/actions.rb', line 35 def execute() cmd = PodBuilder::basepath(path) unless File.exist?(cmd) raise "\n\n#{@step.capitalize} #{@name} action path '#{cmd}' does not exists!\n".red end if @quiet cmd += " > /dev/null 2>&1" end puts "Executing #{@step} #{@name} action".yellow `#{cmd}` end |