Class: Analects::RakeTasks
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Analects::RakeTasks
- Defined in:
- lib/analects/rake_tasks.rb
Instance Method Summary collapse
- #data_dir(dir) ⇒ Object
- #define ⇒ Object
-
#initialize(name = :analects, &blk) ⇒ RakeTasks
constructor
A new instance of RakeTasks.
- #library ⇒ Object
- #options ⇒ Object
- #sources ⇒ Object
Constructor Details
#initialize(name = :analects, &blk) ⇒ RakeTasks
Returns a new instance of RakeTasks.
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/analects/rake_tasks.rb', line 5 def initialize(name = :analects, &blk) @name = name if block_given? if blk.arity == 0 self.instance_eval(&blk) else yield self end end define end |
Instance Method Details
#data_dir(dir) ⇒ Object
29 30 31 |
# File 'lib/analects/rake_tasks.rb', line 29 def data_dir(dir) [:data_dir] = dir end |
#define ⇒ Object
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/analects/rake_tasks.rb', line 33 def define namespace @name do namespace :download do sources.each do |source| desc "download #{source.name}" task source.name do source.retrieve! end end desc 'download all sources' task :all => sources.map(&:name) end end end |
#library ⇒ Object
17 18 19 |
# File 'lib/analects/rake_tasks.rb', line 17 def library @library ||= Analects::Library.new() end |
#options ⇒ Object
25 26 27 |
# File 'lib/analects/rake_tasks.rb', line 25 def @options ||= {} end |
#sources ⇒ Object
21 22 23 |
# File 'lib/analects/rake_tasks.rb', line 21 def sources library.sources end |