Sha256: 21b16f8396cf5218075951633bfbef17cda903fc20d6e994a49c6872b4cd5a0e

Contents?: true

Size: 629 Bytes

Versions: 8

Compression:

Stored size: 629 Bytes

Contents

namespace :db do
  namespace :diagrams do

    desc "Generate DB diagrams and convert to PDF with Graphviz and Ghostview"
    task :pdf => 'db:diagrams:ps' do
      ModalDiagrams.parameters.output_tools.each do |cmd|
        in_dir = Rails.root.join("db/diagrams/#{cmd}_ps")
        out_dir = Rails.root.join("db/diagrams/#{cmd}_pdf")
        mkdir_p out_dir
        Dir[in_dir.join('*.ps')].each do |fn|
          fn = Pathname(fn)
          out_fn = out_dir.join(fn.basename.sub_ext('.pdf'))
          `ps2pdf '#{fn}' '#{out_fn}'`
        end
        puts "Output has been generated in #{out_dir}"
      end
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
modaldiagrams-1.1.6 lib/tasks/diagrams_pdf.rake
modaldiagrams-1.1.5 lib/tasks/diagrams_pdf.rake
modaldiagrams-1.1.4 lib/tasks/diagrams_pdf.rake
modaldiagrams-1.1.3 lib/tasks/diagrams_pdf.rake
modaldiagrams-1.1.2 lib/tasks/diagrams_pdf.rake
modaldiagrams-1.1.1 lib/tasks/diagrams_pdf.rake
modaldiagrams-1.1.0 lib/tasks/diagrams_pdf.rake
modaldiagrams-1.0.1 lib/tasks/diagrams_pdf.rake