lib/rails_erd/tasks.rake in rails-erd-1.6.1 vs lib/rails_erd/tasks.rake in rails-erd-1.7.0

- old
+ new

@@ -1,9 +1,11 @@ require 'graphviz/utils' -def say(message) - puts message unless Rake.application.options.silent +module ErdRakeHelper + def say(message) + puts message unless Rake.application.options.silent + end end namespace :erd do task :check_dependencies do include GraphViz::Utils @@ -29,10 +31,12 @@ end end end task :load_models do + include ErdRakeHelper + say "Loading application environment..." Rake::Task[:environment].invoke say "Loading code in search of Active Record models..." begin @@ -53,15 +57,17 @@ raise "Active Record was not loaded." unless defined? ActiveRecord end task :generate => [:check_dependencies, :options, :load_models] do + include ErdRakeHelper + say "Generating Entity-Relationship Diagram for #{ActiveRecord::Base.descendants.length} models..." require "rails_erd/diagram/graphviz" file = RailsERD::Diagram::Graphviz.create - say "Done! Saved diagram to #{file}." + say "Done! Saved diagram to ./#{file}" end end desc "Generate an Entity-Relationship Diagram based on your models" task :erd => "erd:generate"