Class: XPCOMCore::CommandParser::LaunchCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- XPCOMCore::CommandParser::LaunchCommand
- Defined in:
- lib/xpcomcore-rubygem/commands/launch.rb
Defined Under Namespace
Classes: ApplicationNotFoundError, BaseLauncher, DarwinLauncher, LinuxLauncher
Constant Summary collapse
- GemAppRelativePath =
LinuxLauncher
"xpcomcore/app/application.ini"
- CurrentPlatform =
Sys::Uname.sysname.downcase.to_sym
Instance Attribute Summary collapse
-
#use_xulrunner ⇒ Object
Returns the value of attribute use_xulrunner.
Instance Method Summary collapse
- #execute(args) ⇒ Object
-
#initialize ⇒ LaunchCommand
constructor
A new instance of LaunchCommand.
- #runner_type ⇒ Object
- #use_xulrunner? ⇒ Boolean
Constructor Details
#initialize ⇒ LaunchCommand
Returns a new instance of LaunchCommand.
129 130 131 132 133 134 135 136 |
# File 'lib/xpcomcore-rubygem/commands/launch.rb', line 129 def initialize super('launch', false, # Doesn't take subcommands true) # Uses partial command matching self.short_desc = "Launches an XPCOMCore based XUL application either from RubyGems or a given path" self. = CmdParse::OptionParserWrapper.new do |opt| opt.on('-x', '--use-xulrunner', 'Tries to use XULRunner to launch the given application rather than the default of Firefox', method(:use_xulrunner=)) end end |
Instance Attribute Details
#use_xulrunner ⇒ Object
Returns the value of attribute use_xulrunner.
11 12 13 |
# File 'lib/xpcomcore-rubygem/commands/launch.rb', line 11 def use_xulrunner @use_xulrunner end |
Instance Method Details
#execute(args) ⇒ Object
138 139 140 141 142 143 144 145 |
# File 'lib/xpcomcore-rubygem/commands/launch.rb', line 138 def execute(args) app_name_or_path = args.shift || '.' application = find_app(app_name_or_path) unless application raise(ApplicationNotFoundError, "The application '#{app_name_or_path}' could not be found in the given path or in your RubyGems install") end launch_app(application, args) end |
#runner_type ⇒ Object
151 152 153 |
# File 'lib/xpcomcore-rubygem/commands/launch.rb', line 151 def runner_type use_xulrunner? ? :xulrunner : :firefox end |
#use_xulrunner? ⇒ Boolean
147 148 149 |
# File 'lib/xpcomcore-rubygem/commands/launch.rb', line 147 def use_xulrunner? !!use_xulrunner end |