Class: Redcar::Project::OpenCommand
Overview
FIXME: XXX: The rest of this file is outright ugly. The Redcar.platform ultimately needs to return a platform object which we can dispatch to for commandlines, configuration, escaping and all that.
Direct Known Subclasses
OpenDirectoryInCommandLineCommand, OpenDirectoryInExplorerCommand
Constant Summary
Constants included from Observable
Instance Attribute Summary (collapse)
-
- (Object) path
readonly
Returns the value of attribute path.
Attributes inherited from Command
Instance Method Summary (collapse)
- - (Object) find(executable)
-
- (OpenCommand) initialize(path)
constructor
A new instance of OpenCommand.
- - (Object) run_application(app, *options)
Methods inherited from Command
active_changed, #environment, inherited, #inspect, norecord, record?, #run
Methods included from Sensitive
#active?, #sensitivities, #sensitivity_names, #sensitize
Methods included from Observable
#add_listener, #notify_listeners, #remove_listener
Constructor Details
- (OpenCommand) initialize(path)
A new instance of OpenCommand
250 251 252 |
# File 'plugins/project/lib/project/commands.rb', line 250 def initialize(path) @path = path end |
Instance Attribute Details
- (Object) path (readonly)
Returns the value of attribute path
248 249 250 |
# File 'plugins/project/lib/project/commands.rb', line 248 def path @path end |
Instance Method Details
- (Object) find(executable)
254 255 256 257 258 259 260 261 262 263 264 265 266 |
# File 'plugins/project/lib/project/commands.rb', line 254 def find(executable) path = if Redcar.platform == :windows ENV['PATH'].split(';') else ENV['PATH'].split(':') end.find {|d| File.exist?(File.join(d, executable))} if path File.join(path, executable) else nil end end |
- (Object) run_application(app, *options)
268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'plugins/project/lib/project/commands.rb', line 268 def run_application(app, *) # TODO: Investigate why Spoon doesn't seem to work on osx if SPOON_AVAILABLE and Redcar.platform != :osx ::Spoon.spawn(app, *) else # TODO: This really needs proper escaping. = .map {|o| %{ "#{o}" } }.join(' ') Thread.new do system("#{app} #{}") puts " Finished: #{app} #{}" end end end |