Class: XPCOMCore::Tasks::ApplicationTask

Inherits:
Object
  • Object
show all
Defined in:
lib/xpcomcore-rubygem/tasks/application_task.rb

Constant Summary collapse

AppLocation =
"xpcomcore/app"
IniLocation =
"#{AppLocation}/application.ini"

Instance Method Summary collapse

Constructor Details

#initialize(task_name = "xpcomcore:update_app") ⇒ ApplicationTask

Returns a new instance of ApplicationTask.



13
14
15
16
17
18
# File 'lib/xpcomcore-rubygem/tasks/application_task.rb', line 13

def initialize(task_name = "xpcomcore:update_app")
  desc("Updates the embedded XUL application's application.ini file for release and generates any stub apps necessary.")
  task(task_name) { self.invoke }
  # Adds this as a dependency to gemspec so it updates along with it.
  task(:gemspec => task_name)
end

Instance Method Details

#invokeObject



20
21
22
23
24
25
26
27
28
# File 'lib/xpcomcore-rubygem/tasks/application_task.rb', line 20

def invoke
  @ini_file = Pathname(IniLocation)
  raise("The ini file at '#{ini_file}' doesn't exist or is not writable.") unless @ini_file.exist? && @ini_file.writable?
  @ini_file.open('r+') do |f|
    write_build_id(f)
    write_version(f)
  end
  update_stub_app
end