Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't know how to build task 'erd' #16

Closed
sps196 opened this issue Jun 29, 2011 · 6 comments
Closed

Don't know how to build task 'erd' #16

sps196 opened this issue Jun 29, 2011 · 6 comments

Comments

@sps196
Copy link

sps196 commented Jun 29, 2011

Hi,

rake doesn't seem to know about the erd task:

$ rake erd
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'erd'

(See full trace by running task with --trace)

I've also tried this with rake 0.8.7, and aside from the deprecation warning disappearing nothing changed.

This is my Gemfile:

$ cat Gemfile

source :rubygems

group :development do
gem "rails-erd"
end

And bundle claims it's all installed correctly:

$ bundle install
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using arel (2.0.10)
Using tzinfo (0.3.29)
Using activerecord (3.0.9)
Using ruby-graphviz (0.9.21)
Using rails-erd (0.4.5)
Using bundler (1.0.15)
Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed.

$ bundle show rails-erd
/usr/lib/ruby/gems/1.8/gems/rails-erd-0.4.5

I'm pretty stumped. Here's a full rake trace:

$ rake erd --trace
rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
Don't know how to build task 'erd'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/task_manager.rb:49:in []' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:111:ininvoke_task'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:ineach'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:90:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:instandard_exception_handling'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:84:in top_level' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:62:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:129:in standard_exception_handling' /usr/lib/ruby/gems/1.8/gems/rake-0.9.2/lib/rake/application.rb:59:inrun'
/usr/lib/ruby/gems/1.8/gems/rake-0.9.2/bin/rake:32
/usr/bin/rake:19:in `load'
/usr/bin/rake:19

Sam

@kaleemullah
Copy link

same issue

@dwwoelfel
Copy link

I solved this by adding the following line to my Rakefile:

require '/usr/lib/ruby/gems/1.8/gems/rails-erd-0.4.5/lib/rails_erd/tasks.rake'

I'm sure there's a better way, but this works.

@nicolasgarnil
Copy link

I'm having the same problem.

@rolftimmermans
Copy link
Member

The rake task is automatically registered in Rails projects. If you don't use Rails directly, you can use Rails ERD by calling the API. Here's an example:

require "rails_erd/diagram/graphviz"
# Load your models here.
RailsERD::Diagram::Graphviz.create

A future version may supply an executable file so you no longer need Rake and/or Rails.

@Adithya-copart
Copy link

For others who encounter the NoMethodError: undefined method `application' for Rails:Module,
I was able to monkey-patch the name method in domain class to return nil and got around this.

Used outside Rails with ActiveRecord 5.1.1

 RailsERD::Diagram::Graphviz.create
NoMethodError: undefined method `application' for Rails:Module
	from /Users/adpentela/.rvm/gems/ruby-2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/domain.rb:52:in `name'
	from /Users/adpentela/.rvm/gems/ruby-2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram/graphviz.rb:179:in `block in <class:Graphviz>'
	from /Users/adpentela/.rvm/gems/ruby-2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:126:in `instance_eval'
	from /Users/adpentela/.rvm/gems/ruby-2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:126:in `generate'
	from /Users/adpentela/.rvm/gems/ruby-2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:119:in `create'
	from /Users/adpentela/.rvm/gems/ruby-2.4.0/gems/rails-erd-1.5.2/lib/rails_erd/diagram.rb:74:in `create'
	from (irb):11
	from /Users/adpentela/.rvm/rubies/ruby-2.4.0/bin/irb:11:in `<main>'

@ADTC
Copy link

ADTC commented Jun 10, 2021

Try bundle exec erd as this will directly execute it instead of running it as a Rails Task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants