Class: Warbler::Task
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Warbler::Task
- Includes:
- RakeHelper
- 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.jar_name = "war1"
# ...
end
Warbler::Task.new("war2", Warbler::Config.new do |config|
config.jar_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.
-
#jar ⇒ Object
(also: #war)
Warbler::Jar.
-
#name ⇒ Object
Task name.
Instance Method Summary collapse
-
#initialize(name = nil, config = nil) {|_self| ... } ⇒ Task
constructor
A new instance of Task.
Methods included from RakeHelper
Constructor Details
#initialize(name = nil, config = nil) {|_self| ... } ⇒ Task
Returns a new instance of Task.
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/warbler/task.rb', line 43 def initialize(name = nil, config = nil) @config = config if @config.nil? && File.exists?(Config::FILE) @config = eval(File.read(Config::FILE), binding, Config::FILE, 0) end @config ||= Config.new unless @config.kind_of? Config $stderr.puts "Warbler::Config not provided by override in initializer or #{Config::FILE}; using defaults" @config = Config.new end @name = name || @config.jar_extension @jar = Warbler::Jar.new yield self if block_given? define_tasks end |
Instance Attribute Details
#config ⇒ Object
Warbler::Config
38 39 40 |
# File 'lib/warbler/task.rb', line 38 def config @config end |
#jar ⇒ Object Also known as: war
Warbler::Jar
41 42 43 |
# File 'lib/warbler/task.rb', line 41 def jar @jar end |
#name ⇒ Object
Task name
35 36 37 |
# File 'lib/warbler/task.rb', line 35 def name @name end |