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