require 'rake' require 'rake/tasklib' require 'chrysalis/manifest' module Rake class ChrysalisTask < TaskLib def initialize() yield self if block_given? define end 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 end end Chrysalis.boot