Class: XPCOMCore::CommandParser::LaunchCommand

Inherits:
CmdParse::Command
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializeLaunchCommand

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.options = 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_xulrunnerObject

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_typeObject



151
152
153
# File 'lib/xpcomcore-rubygem/commands/launch.rb', line 151

def runner_type
  use_xulrunner? ? :xulrunner : :firefox
end

#use_xulrunner?Boolean

Returns:

  • (Boolean)


147
148
149
# File 'lib/xpcomcore-rubygem/commands/launch.rb', line 147

def use_xulrunner?
  !!use_xulrunner
end