Parent

Included Modules

Warbler::Application

Extension of Rake::Application that allows the warble command to report its name properly and inject its own tasks without a Rakefile.

Public Class Methods

new() click to toggle source
# File lib/warbler/application.rb, line 16
def initialize
  super
  Warbler.application = self
  @project_loaded = false
end

Public Instance Methods

load_project_rakefile() click to toggle source

Loads the project Rakefile in a separate application

# File lib/warbler/application.rb, line 51
def load_project_rakefile
  return if @project_loaded
  # Load any application rakefiles to aid in autodetecting applications
  app = Warbler.project_application = Rake::Application.new
  Rake.application = app
  Rake::Application::DEFAULT_RAKEFILES.each do |rf|
    if File.exist?(rf)
      load rf
      break
    end
  end
  Rake.application = self
  @project_loaded = true
end
load_rakefile() click to toggle source

Sets the application name and loads Warbler’s own tasks

# File lib/warbler/application.rb, line 23
def load_rakefile
  @name = 'warble'

  # Load the main warbler tasks
  wt = Warbler::Task.new

  task :default => wt.name

  desc "Generate a configuration file to customize your archive"
  task :config => "#{wt.name}:config"

  desc "Install Warbler tasks in your Rails application"
  task :pluginize => "#{wt.name}:pluginize"

  desc "Feature: package gem repository inside a jar"
  task :gemjar => "#{wt.name}:gemjar"

  desc "Feature: make an executable archive"
  task :executable => "#{wt.name}:executable"

  desc "Feature: precompile all Ruby files"
  task :compiled => "#{wt.name}:compiled"

  desc "Display version of Warbler"
  task :version => "#{wt.name}:version"
end
run() click to toggle source

Run the application: The equivalent code for the warble command is simply Warbler::Application.new.run.

# File lib/warbler/application.rb, line 68
def run
  Rake.application = self
  super
end
standard_rake_options() click to toggle source

Remap the version option to display Warbler version.

# File lib/warbler/application.rb, line 74
def standard_rake_options
  super.map do |opt|
    if opt.first == '--version'
      ['--version', '-V', "Display the program version.",
       lambda { |value|
         puts "Warbler version #{Warbler::VERSION}"
         exit
       }
      ]
    else
      opt
    end
  end
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.