Class: Warbler::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Warbler::Task
- Defined in:
- lib/warbler/task.rb
Overview
Warbler Rake task. Allows defining multiple configurations inside the same Rakefile by using different task names.
To define multiple Warbler configurations in a single project, use code like the following in a Rakefile:
Warbler::Task.new("war1", Warbler::Config.new do |config|
config.war_name = "war1"
# ...
end
Warbler::Task.new("war2", Warbler::Config.new do |config|
config.war_name = "war2"
# ...
end
With this setup, you can create two separate war files two different configurations by running rake war1 war2
.
Instance Attribute Summary collapse
-
#config ⇒ Object
Warbler::Config.
-
#name ⇒ Object
Task name.
-
#war ⇒ Object
Warbler::War.
Instance Method Summary collapse
-
#initialize(name = :war, config = nil) {|_self| ... } ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(name = :war, config = nil) {|_self| ... } ⇒ Task
Returns a new instance of Task.
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/warbler/task.rb', line 41 def initialize(name = :war, config = nil) @name = name @config = config if @config.nil? && File.exists?(Config::FILE) @config = eval(File.open(Config::FILE) {|f| f.read}) end @config ||= Config.new unless @config.kind_of? Config warn "Warbler::Config not provided by override in initializer or #{Config::FILE}; using defaults" @config = Config.new end @war = Warbler::War.new yield self if block_given? define_tasks end |
Instance Attribute Details
#config ⇒ Object
Warbler::Config
36 37 38 |
# File 'lib/warbler/task.rb', line 36 def config @config end |
#name ⇒ Object
Task name
33 34 35 |
# File 'lib/warbler/task.rb', line 33 def name @name end |
#war ⇒ Object
Warbler::War
39 40 41 |
# File 'lib/warbler/task.rb', line 39 def war @war end |