Class: Rum::Application

Inherits:
Rake::Application
  • Object
show all
Defined in:
lib/rumrunner/application.rb

Overview

Rum main application object. When invoking rum from the command line, a Rum::Application object is created and run.

Constant Summary collapse

DEFAULT_RAKEFILES =

Default names for Rum Runner manifests.

[
  "rumfile",
  "Rumfile",
  "rumfile.rb",
  "Rumfile.rb",
]

Instance Method Summary collapse

Constructor Details

#initializeApplication

Initialize a Rumfile::Application object.



22
23
24
25
26
# File 'lib/rumrunner/application.rb', line 22

def initialize
  super
  @name = "rum"
  @rakefiles = DEFAULT_RAKEFILES.dup
end

Instance Method Details

#init(app_name = "rum", argv = ARGV) ⇒ Object

Initialize the command line parameters and app name.



30
31
32
# File 'lib/rumrunner/application.rb', line 30

def init(app_name="rum", argv = ARGV)
  super "rum", argv
end

#rumfile?Boolean

Return true if any of the default Rumfiles exist

Returns:

  • (Boolean)


36
37
38
# File 'lib/rumrunner/application.rb', line 36

def rumfile?
  DEFAULT_RAKEFILES.map{|x| File.size? x }.any?
end

#run(argv = ARGV) ⇒ Object

Run application



42
43
44
45
46
47
48
49
50
# File 'lib/rumrunner/application.rb', line 42

def run(argv = ARGV)
  if argv.first == "init" && !rumfile?
    Rum.init
  elsif ["-V", "--version"].include? argv.first
    puts "rum, version #{Rum::VERSION}"
  else
    super
  end
end