Specify a plugin as gem from github in Gemfile
Asked Answered
F

3

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..

Fingerling answered 11/11, 2010 at 15:4 Comment(0)
C
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.

Confiscate answered 11/11, 2010 at 15:7 Comment(2)
oh ok, got it. Does the repository need to have a .gem file, so that it becomes a rubygem?Fingerling
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.Confiscate
A
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'
Attenuant answered 20/9, 2013 at 8:38 Comment(1)
...and don't forget restart server.Anhanhalt
C
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.

Confiscate answered 11/11, 2010 at 15:7 Comment(2)
oh ok, got it. Does the repository need to have a .gem file, so that it becomes a rubygem?Fingerling
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.Confiscate
T
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
Triecious answered 11/11, 2010 at 16:23 Comment(1)
yeah bundle gem plugin_name helped in creating .gemspec .. thanks, i wan't aware of that...Fingerling

© 2022 - 2024 — McMap. All rights reserved.