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
#dir, #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.
157 158 159 160 161 |
# File 'lib/prick/builder/node.rb', line 157 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
148 149 150 151 152 153 |
# File 'lib/prick/builder/node.rb', line 148 def exepath() @exepath ||= begin v = `which #{path} 2>/dev/null`.chomp v == "" ? nil : v end end |
#filename ⇒ Object
155 |
# File 'lib/prick/builder/node.rb', line 155 def filename = File.basename(path) |
#inspect ⇒ Object
163 |
# File 'lib/prick/builder/node.rb', line 163 def inspect() "#{path} #{(args || []).join(" ")}" end |