Class: Nand::Launcher::ExecutableFileLauncher
- Inherits:
-
ShellLauncher
- Object
- Base
- ShellLauncher
- Nand::Launcher::ExecutableFileLauncher
- Defined in:
- lib/nand/launcher/executable_file_launcher.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes inherited from Base
Class Method Summary collapse
- .exec_file(target) ⇒ Object
- .launchable?(target, io, opts) ⇒ Boolean
- .load(target, opts = {}, *argv) ⇒ Object
Instance Method Summary collapse
- #cmd ⇒ Object
-
#initialize(target, opts, *argv) ⇒ ExecutableFileLauncher
constructor
A new instance of ExecutableFileLauncher.
Methods inherited from ShellLauncher
Methods inherited from Base
Constructor Details
#initialize(target, opts, *argv) ⇒ ExecutableFileLauncher
Returns a new instance of ExecutableFileLauncher.
25 26 27 28 29 |
# File 'lib/nand/launcher/executable_file_launcher.rb', line 25 def initialize(target, opts, *argv) super(target, opts, *argv) @file = self.class.exec_file(target) @name = opts[:name] || @file.basename.to_s end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/nand/launcher/executable_file_launcher.rb', line 24 def name @name end |
Class Method Details
.exec_file(target) ⇒ Object
21 22 23 |
# File 'lib/nand/launcher/executable_file_launcher.rb', line 21 def self.exec_file(target) Pathname.new(target). end |
.launchable?(target, io, opts) ⇒ Boolean
8 9 10 11 12 13 14 15 16 |
# File 'lib/nand/launcher/executable_file_launcher.rb', line 8 def self.launchable?(target, io, opts) file = exec_file(target) raise "Not Found #{file.to_s}" unless file.exist? raise "Not Executable #{file.to_s}" unless file.executable? true rescue => e io.puts "\t- " + e. false end |
.load(target, opts = {}, *argv) ⇒ Object
17 18 19 20 |
# File 'lib/nand/launcher/executable_file_launcher.rb', line 17 def self.load(target, opts = {}, *argv) file = exec_file(target) new(target, opts, *argv) end |
Instance Method Details
#cmd ⇒ Object
30 |
# File 'lib/nand/launcher/executable_file_launcher.rb', line 30 def cmd; "#{@file} #{@argv.join(" ")}" end |