Class: Prick::Build::ExecutableNode

Inherits:
Node
  • Object
show all
Defined in:
lib/prick/builder/node.rb

Overview

Virtual base class for executable nodes

Direct Known Subclasses

ScriptNode, SystemCommandNode

Instance Attribute Summary

Attributes inherited from Node

#args, #kind, #parent, #path, #phase

Instance Method Summary collapse

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

#exepathObject

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

#filenameObject



155
# File 'lib/prick/builder/node.rb', line 155

def filename = File.basename(path)

#inspectObject



163
# File 'lib/prick/builder/node.rb', line 163

def inspect() "#{path} #{(args || []).join(" ")}" end