Two errors when using Railroad for Rails

谁说胖子不能爱 提交于 2019-12-13 18:39:24

问题


I've installed the diaspora rails application https://github.com/diaspora/diaspora on my local machine. Then I installed the Railroads diagram generator http://railroad.rubyforge.org/#download

Following the instructions on the site, I built a rake task to run it, but appear to be getting two separate errors when I run it.

The first error is the absence of the dot command:

sh: dot: command not found

The second error I also get when running without rake:

Seans-MacBook-Pro:diaspora sean$ railroad -o models.dot -M 
/Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-    0.5.0/lib/railroad/app_diagram.rb:54:in `disable_stdout': uninitialized constant     AppDiagram::PLATFORM (NameError)

When I run rake:

Seans-MacBook-Pro:diaspora sean$ rake doc:diagrams
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
railroad -i -l -a -m -M | dot -Tsvg | sed 's/font-size:14.00/font-size:11.00/g' >  doc/models.svg
sh: dot: command not found
/Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-    0.5.0/lib/railroad/app_diagram.rb:54:in `disable_stdout': uninitialized constant    AppDiagram::PLATFORM (NameError)
from /Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-  0.5.0/lib/railroad/app_diagram.rb:72:in `load_environment'
from /Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-0.5.0/lib/railroad/app_diagram.rb:18:in `initialize'
from /Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-0.5.0/lib/railroad/models_diagram.rb:14:in `initialize'
from /Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-0.5.0/bin/railroad:36:in `new'
from /Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-0.5.0/bin/railroad:36:in `<top (required)>'

I also modified railroad/app_diagram.rb as per this link http://rubyforge.org/tracker/index.php?func=detail&aid=26418&group_id=3383&atid=12998

Now I am getting this error:

Seans-MacBook-Pro:diaspora sean$ rake doc:diagrams
WARNING: Nokogiri was built against LibXML version 2.7.3, but has dynamically loaded 2.7.8
railroad -i -l -a -m -M | dot -Tsvg | sed 's/font-size:14.00/font-size:11.00/g' >   doc/models.svg
dyld: Library not loaded: /usr/lib/libltdl.7.dylib
  Referenced from: /usr/local/bin/dot
  Reason: image not found
  Error loading application environment.
 (Are you running railroad on the aplication's root directory?)

/Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-0.5.0/lib/railroad/app_diagram.rb:73:in `require': cannot load such file --    config/environment (LoadError)
from /Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspora/gems/railroad-  0.5.0/lib/railroad/app_diagram.rb:73:in `load_environment'
from /Users/sean/.rvm/gems/ruby-1.9.3-p194@diaspo

I am running from the project root, and the file exists. I also tried adding .rb to the line in the app_diagram.rb file but no change.

Seans-MacBook-Pro:diaspora sean$ pwd
/Users/sean/Dropbox/rails/diaspora

Seans-MacBook-Pro:diaspora sean$ head -73 /Users/sean/.rvm/gems/ruby-1.9.3-    p194@diaspora/gems/railroad-0.5.0/lib/railroad/app_diagram.rb
 | tail -1
      require "config/environment"

Seans-MacBook-Pro:diaspora sean$ ls -l config/environment.rb
-rw-r--r--  1 sean  staff  1481 Jul 19 14:25 config/environment.rb

回答1:


This is the program you need: http://www.graphviz.org/Download_macos.php. Dot is the program which is required to draw the graphs.




回答2:


OK I think I found the answer, under another SO question. RailRoad is not working. Giving me issues ie /railroad-0.5.0/lib/railroad/app_diagram.rb:54:in `disable_stdout': uninitialized constant

It's no longer maintained and has been replaced by https://github.com/preston/railroady#readme



来源:https://stackoverflow.com/questions/13098359/two-errors-when-using-railroad-for-rails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!