Patches: Browse | Submit New | Admin

[#23196] add support for merb+datamapper

Date:
2008-12-12 07:03
Priority:
3
Submitted By:
Roy Wright (royw)
Assigned To:
Nobody (None)
Category:
None
State:
Open
Summary:
add support for merb+datamapper

Detailed description
Added support for Merb 1.0.4 and DataMapper 0.9.7.

Only generation for Models and Controllers is supported.  The AASM is a rails plugin so did not support AASM graphs.
There is a similar plugin for datamapper (dm-is-state_machine) if anyone wants to tackle it.

One caveat, RailRoad needs to be installed as a system gem, not installed into your application.  If you really must
have railroad installed as an application gem, then you will need to move:

from your_app/gems/gems/railroad-x.x.x/lib/railroad/merb_framework.rb:

    require 'merb-core'
    Merb.start_environment(:testing => true, :adapter => 'runner', :environment => ENV['MERB_ENV'] || 'test')

to your_app/bin/railroad after the require statements and before the gem directory stuff.


Apply patch:

cd /your/system/gems/railroad-0.5.0
patch -p1 /the/path/to/railroad_merb.patch


Example merb rake task:

your_app/lib/tasks/doc.rake:

  namespace :diagram do
    desc 'generate model diagrams'
    task :models do
      sh "railroad -i -l -a -m -M | neato -Tsvg | sed 's/font-size:14.00/font-size:11.00/g' >
doc/models.svg"
    end

    desc 'generate controller diagrams'
    task :controllers do
      sh "railroad -i -l -C | neato -Tsvg | sed 's/font-size:14.00/font-size:11.00/g' >
doc/controllers.svg"
    end
  end

  desc 'generate model and controller diagrams'
  task :diagrams => %w(diagram:models diagram:controllers)

Add A Comment: Notepad

Please login


Followup

Message
Date: 2008-12-21 02:42
Sender: Roy Wright

A gem with this patch is available at github.  To install:

 sudo gem uninstall railroad
 gem sources -a http://gems.github.com
 sudo gem install royw-railroad_xing

I kept the same binary (bin/railroad) so if you have
railroad installed you need to uninstall it first.

Have fun,
Roy
Date: 2008-12-15 01:18
Sender: Roy Wright

notes.  You may need to use the -i option in the patch command:
patch -p1 -i /the/path/to/railroad_merb.patch

Also the merb environment detection assumes that your
application has a merb sub-directory (your_app/merb/).  The
current version of merb-gen does create this sub-directory
but older projects may need to:

cd your_app
touch merb

Attached Files:

Name Description Download
railroad_merb.patch add merb+datamapper support Download

Changes:

Field Old Value Date By
File Added4220: railroad_merb.patch2008-12-12 07:03royw