Class: Prick::Build::ExecutableNode
- Defined in:
- lib/prick/builder/node.rb
Overview
Virtual base class for executable nodes
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Node
#args, #kind, #parent, #path, #phase
Instance Method Summary collapse
-
#exepath ⇒ Object
Path to executable.
- #filename ⇒ Object
-
#initialize(parent, phase, path, args = nil) ⇒ ExecutableNode
constructor
A new instance of ExecutableNode.
- #inspect ⇒ Object
Methods inherited from Node
#dump, #lines, #name, #prefix_lines, #relpath, #schema, #schema=, #source, #source_lines, #to_s
Constructor Details
#initialize(parent, phase, path, args = nil) ⇒ ExecutableNode
Returns a new instance of ExecutableNode.
144 145 146 147 148 |
# File 'lib/prick/builder/node.rb', line 144 def initialize(parent, phase, path, args = nil) constrain args, [String] super(parent, phase, :exe, path, args) check_path end |
Instance Method Details
#exepath ⇒ Object
Path to executable
135 136 137 138 139 140 |
# File 'lib/prick/builder/node.rb', line 135 def exepath() @exepath ||= begin v = `which #{path} 2>/dev/null`.chomp v == "" ? nil : v end end |
#filename ⇒ Object
142 |
# File 'lib/prick/builder/node.rb', line 142 def filename = File.basename(path) |
#inspect ⇒ Object
150 |
# File 'lib/prick/builder/node.rb', line 150 def inspect() "#{path} #{(args || []).join(" ")}" end |