Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

annotate command not working, added it to my gemfile

My gem file looks like:

 group :development, :test do
    gem 'rspec-rails'
    gem 'annotate-models', '1.0.4'
 end

I ran 'bundle install' and it installed the annotate-models bundle.

If I type: annotate I get a command not found error.

If I type: bundle show annotate I get a 'could not find gem annotate in the current bundle.

If I type bundle show annotate-models it says it installed in:

/Library/Ruby/Gems/1.8/gems/annotate-models-1.0.4

typing:

annotate-models

doesn't work either.

I'm following along in railstutorial.org and got stuck at this point.

like image 457
Blankman Avatar asked Sep 19 '10 16:09

Blankman


2 Answers

Edit: Better version (using Bundler to install it only for the current project)

  1. Add gem 'annotate' to Gemfile
  2. Run $ bundle install
  3. Run $ bundle exec annotate

Edit2: Seems you have to explicitly specify annotate version for now, so in Gemfile put gem 'annotate', '2.4.1.beta1' (which is a prereleased beta gem that works with the latest version of activerecord as opposed to specifying the github repo directly)

Edit3: 2.5.0 final is out now, so hopefully no need to force a beta version any more, just getting the latest should work!

Old version (with installing the gem on a system level too):

If running Rails 3 the drill is:

  1. Run $ sudo gem install annotate
  2. Add gem 'annotate' to Gemfile
  3. Run $ bundle install
  4. Run $ annotate
  5. Be happy :)
like image 182
dain Avatar answered Oct 09 '22 14:10

dain


You should run the command inside your bundled environment with:

$ bundle exec annotate

Check out the man page for more details.

like image 39
eric Avatar answered Oct 09 '22 15:10

eric