17

I am including 'acts_as_rateable' gem in my Gemfile like this

gem 'acts_as_rateable', :git => 'git://github.com/azabaj/acts_as_rateable.git'

and then when I do bundle install it gives me this error message!

Could not find gem 'acts_as_rateable (>= 0, runtime)' in git://github.com/azabaj/acts_as_rateable.git (at master). Source does not contain any versions of 'acts_as_rateable (>= 0, runtime)'

I am developing a plugin of my own, when I include that, even that gives the same error like this..

I assume this has something to do with the gemspec?

Please help

Rails version : 3.0.1 Rubygems version : 1.3.7 Bundler version : 1.0.3

let me know if you need any other details..

Madhusudhan
  • 8,374
  • 12
  • 47
  • 68

3 Answers3

19

If you want to pull a gem directly from GitHub, you can put this into your GemFile:

gem 'twitter', github: 'sferik/twitter'

Which will use the default branch. To specify the branch to use:

gem 'twitter', github: 'sferik/twitter', branch: 'branch_name'
Community
  • 1
  • 1
Richard Peck
  • 76,116
  • 9
  • 93
  • 147
4

The problem is that the repository you link to is not a RubyGem. You can get with

$ rails plugin install git://github.com/azabaj/acts_as_rateable.git 

Edit: This answer was accurate on the date it was published. Rails 4 doesn't support plugins anymore, so you will have to make this into a local gem yourself. Bundler has some commands that will help you with it, or alternatively you can use a different library, e.g. https://github.com/anton-zaytsev/acts_as_rateable.

Jakub Hampl
  • 39,863
  • 10
  • 77
  • 106
  • oh ok, got it. Does the repository need to have a .gem file, so that it becomes a rubygem? – Madhusudhan Nov 11 '10 at 15:41
  • Well at least that. But more so it should be published to RubyGems to be sure that it's stable as a gem. Github used to publish gems (but doesn't anymore) so some old gems are still there. – Jakub Hampl Nov 11 '10 at 15:46
2

Jakub Hampl is right, but it seems strange to depend on git repos like that. I guess you're you making it yourself? If so, make it a real gem. It should have a acts_as_rateable.gemspec and you'll be able to depend on it like you wrote. Bundler makes your life easy, create the gemspec with

$ bundle gem acts_as_rateable
oma
  • 38,642
  • 11
  • 71
  • 99