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.
Constant Summary collapse
- COPY_PROC =
proc {|t| cp t.prerequisites.last, t.name }
Instance Attribute Summary collapse
-
#config ⇒ Object
Warbler::Config.
-
#name ⇒ Object
Task name.
-
#verbose ⇒ Object
Whether to print a line when a file or directory task is declared; helps to see what is getting included.
Instance Method Summary collapse
-
#initialize(name = :war, config = nil, tasks = :define_tasks) {|_self| ... } ⇒ Task
constructor
A new instance of Task.
Constructor Details
#initialize(name = :war, config = nil, tasks = :define_tasks) {|_self| ... } ⇒ Task
Returns a new instance of Task.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/warbler/task.rb', line 36 def initialize(name = :war, config = nil, tasks = :define_tasks) @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 "War::Config not provided by override in initializer or #{Config::FILE}; using defaults" @config = Config.new end yield self if block_given? send tasks end |
Instance Attribute Details
#config ⇒ Object
Warbler::Config
30 31 32 |
# File 'lib/warbler/task.rb', line 30 def config @config end |
#name ⇒ Object
Task name
27 28 29 |
# File 'lib/warbler/task.rb', line 27 def name @name end |
#verbose ⇒ Object
Whether to print a line when a file or directory task is declared; helps to see what is getting included
34 35 36 |
# File 'lib/warbler/task.rb', line 34 def verbose @verbose end |