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

#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

#exepathObject

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

#filenameObject



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

def filename = File.basename(path)

#inspectObject



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

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