Class: Rake::ChrysalisTask
Instance Method Summary collapse
- #define ⇒ Object
-
#initialize {|_self| ... } ⇒ ChrysalisTask
constructor
A new instance of ChrysalisTask.
Constructor Details
#initialize {|_self| ... } ⇒ ChrysalisTask
Returns a new instance of ChrysalisTask.
10 11 12 13 |
# File 'lib/chrysalis/task.rb', line 10 def initialize() yield self if block_given? define end |
Instance Method Details
#define ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/chrysalis/task.rb', line 15 def define namespace :project do desc "Show project information." task :info do raise "No project has been defined." if Chrysalis::Manifest.instance[:main].nil? puts "" puts "Project information: " main = Chrysalis::Manifest.instance[:main] main.graph.topsort.each do |url| p = Chrysalis::Manifest.instance[url] if p.nil? puts "* #{url} [Not Loaded]" else p.info end end end desc "Display task execution order." task :order do raise "No project has been defined." if Chrysalis::Manifest.instance[:main].nil? order = Chrysalis::Manifest.instance[:main].task_exec_order puts "" puts "Tasks execution order: " order.each { |url| puts "- #{url}" } end desc "Draw dependency graph." task :graph do raise "No project has been defined." if Chrysalis::Manifest.instance[:main].nil? g = Chrysalis::Manifest.instance[:main].graph name = Chrysalis::Manifest.instance[:main].name file = (name ? name.downcase.concat("-graph") : "graph") dot = g.write_to_graphic_file('jpg', file) puts "Dependency graph saved to #{dot}" end end desc "Retrieve dependencies." task :retrieve do raise "No project has been defined." if Chrysalis::Manifest.instance[:main].nil? Chrysalis::Manifest.instance[:main].retrieve end self end |