I forked the geokit gem on github. Now when I add this gem to my Gemfile and then bundle on the server, the gem is downloaded, but without my committed and pushed changes. What am I doing wrong? I'm pretty new to git.
In my Gemfile:
gem 'geokit', :git => 'git://github.com/jan/geokit-gem.git'
And I double-checked, that the changes have been comitted and pushed to github, e.g.:
https://github.com/jan/geokit-gem/blob/master/lib/geokit.rb requires 'geokit/mappable' before 'geokit/geocoders' instead of vice versa.
I go to /usr/local/rvm/gems/ruby-1.9.2-p180/bundler/gems/geokit-gem-e60b6c1f1f29 and do a git pull it actually pulls my changes. So I assume my git has, like, an old version set to be the current version?!
Gemfile.lock contains a revision for gems loaded via git:
GIT
remote: git://github.com/jan/geokit-gem.git
revision: e60b6c1f1f2931209533c78f0a1ecac500302c50
specs:
geokit (1.5.0)
So I had to bundle update geokit. Kind of obvious in retrospect, but I didn't think of it that day. Hope it helps somebody.
Related
Currently, Rails' Github master is on version 6.1.0-alpha. However, this version is not available through Rubygems.
> gem search ^rails$ --pre
*** REMOTE GEMS ***
rails (6.0.3.rc1, 6.0.2.rc2, 6.0.2.rc1, 6.0.1.rc1, 6.0.0.rc2, 6.0.0.rc1, 6.0.0.beta3, .......)
Is there a way to force a gem to be installed with the latest commit through Rubygems.org without using Bundler? Something like Homebrew's devel or the example below would be ideal:
gem install rails --head
When I need to use a head of gem, I just use through Github source like this.
gem 'rails', github: 'rails/rails', branch: 'master'
Since this version is not released on Rubygems yet, I don't know is there a way to use it through RubyGems.
Be aware that installation by Github took long even with fast internet connection.
Is there a way to force a gem to be installed with the latest commit
through Rubygems.org without using Bundler?
The short answer is no, you cannot force-install an unpublished gem through RubyGems.org because RubyGems is a repository for published gems. If the repository owner has pushed a version of the gem to RubyGems you can find and install it. If they haven't, you can't.
If you want to use pre-published code from a repository, use the Bundler method outlined in Semih's answer:
gem 'rails', github: 'rails/rails', branch: 'master'
Per the RubyGems site documentation:
Installing a gem directly from a git repository is a feature of
Bundler, not a feature of RubyGems. Gems installed this way will not
show up when you run gem list.
I'm trying to add a small bug fix to an open source gem. Here's what I've done:
cloned the repository to local
made changes and saved
changed gemfile of rails project to point to local version of gem
> gem 'gem_name', path: "/Users/admin/gem_name"
> bundle install
> bundle update gem_name
> rails s
The gem doesn't reflect any changes I've made (gem isn't updated). I had to change the version.rb file and then run bundle update gem_name to see changes. But to my understanding, this shouldn't be required to see changes?
Why don't you fork the gem in github? fix what you want and then point that for your github link... If you think your fix could be great for another users, why not a pull request? ;)
gem 'gem_name', :git => 'https://github.com/my_user/gem.git'
I have a gem to which I want to make a few edits.
I have opened the gem using
bundle open gem_name
Made the edits and they work fine on development.
What do I need to do in order to make the changes take affect on heroku.
There is nothing to commit locally.
Your local gem is modified, but during deployment the one on github gets installed.
What you could do is to find the gem project on github, and fork it.
Then you can apply all your custom mods and commit into your gem repo.
Once you're done, remember to point to the right repo in your Gemfile:
gem your_gem, , :git => "https://github.com/your_user_name/your_gem.git"
You can vendorize the gem like this:-
gem unpack my_private_gem --target vendor/gems
and then in your Gemfile
gem 'my_private_gem', :path => "vendor/gems/my_private_gem-VERSION"
Initial Problem
I was using yaml_db in a Rails project, but it seems the default branch has some issues with boolean records. Now I know that there's a branch on github that has a fixed version.
I changed my Gemfile so that this branch will be installed instead of the default yaml_db,
gem 'yaml_db', :git => "https://github.com/robsharp/yaml_db.git"
I run bundle install and it shows:
Using yaml_db (0.2.0) from https://github.com/robsharp/yaml_db.git (at master).
Your bundle is complete! It was installed into /Users/user/.rvm/gems/ruby-1.9.2-p0
Fine. Now the fixed file in the Git repository should have this line in lib/serialization_helper.rb:
record[column] = convert_boolean(record[column])
Yet, when I look at my local file, which is .rvm/gems/ruby-1.9.2-p0/bundler/gems/yaml_db-ca178cfb59cf/lib/serialization_helper.rb, it still shows the unpatched old line:
record[column] = (record[column] == 't' or record[column] == '1')
Fine, seems as my local file isn't changed.
Gem not being installed correctly
Running gem list won't show me yaml_db at all. I removed the Gem lockfile and installed the bundle again, still there is no yaml_db in my Gem listing. Running gem install yaml_db of course only installs the broken version.
Manual Install
I now try to manually install from the Git source.
git clone https://github.com/robsharp/yaml_db.git
cd yaml_db
git checkout -b fix_boolean_checks_to_support_oracle
Still, the serialization_helper.rb file is not updated correctly. I just manually changed it and built the Gem. Everything works fine now.
My new question: Why won't it check out the correct file?
If you run gem list yaml_db and see multiple versions in parenthesis, define the version you need in your Gemfile like so
gem 'yaml_db', '~> 0.2.0', :git => "https://github.com/robsharp/yaml_db.git"
I had a similar problem and found out that the Gemfile.lock file stored my old and not–updated version and used that for my project.
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..
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'
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 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