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.
150 151 152 153 154 |
# File 'lib/prick/builder/node.rb', line 150 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
141 142 143 144 145 146 |
# File 'lib/prick/builder/node.rb', line 141 def exepath() @exepath ||= begin v = `which #{path} 2>/dev/null`.chomp v == "" ? nil : v end end |
#filename ⇒ Object
148 |
# File 'lib/prick/builder/node.rb', line 148 def filename = File.basename(path) |
#inspect ⇒ Object
156 |
# File 'lib/prick/builder/node.rb', line 156 def inspect() "#{path} #{(args || []).join(" ")}" end |