What to do once you've edited a gemspec file? - ruby-on-rails

I downloaded the latest file from github, edited the .gemspec file to require a gem I need; what do I then do to be able to use the gem? Do I have to bundle it with bundler to be able to use it?
Sorry if dumb question, but so confused right now... can't find much info especially on Rapidfire...

You need to fork the repository.
Clone the forked repository and edit the gemspec: git clone git#github.com:code-mancers/rapidfire.git
Commit your changes: git add .; git commit -m "whatever"
Push your changes: git push origin master
Edit the your project's Gemfile pointing the forked gem: gem 'rapidfire', github: 'your-user/rapidfire', branch: 'master'

You can do:
gem build path-of-the-gemspec-file
Then
gem install path-of-generated-gem-file
For example:
In the root path of your gem, you can do:
gem build my-gem.gempsec
Then:
gem install my-gem-0.1.0.gem
To see if the gem was installed:
gem list | grep my-gem

Related

Can I specify the sub path of a Git repo to require in Gemfile?

I want to use master version of grpc's Ruby gem in my project. But it's located in grpc/src/ruby. So I can't just use it with gem 'grpc', github: 'grpc/grpc'.
Is there a solution to add the gem with something like this gem 'grpc', github: 'grpc/grpc', sub_path: 'src/ruby'?
What about cloning the Gem repo to your local machine or the server and add it through the path option?
Like so:
gem 'grpc', path: 'path/to/your/local_repo'
I see there is an active issue about the same thing you are asking about on the Bundler Github repo[1]
[1] https://github.com/bundler/bundler/issues/396

Bundle install for activeadmin not running

When I try to run bundle install using this in my Gemfile
gem 'activeadmin', github: 'gregbell/active_admin'
I get :
Fetching git://github.com/gregbell/active_admin.git
Retrying source fetch due to error (2/3): You need to install git to be able to
use gems from git repositories. For help installing git, please refer to GitHub'
s tutorial at https://help.github.com/articles/set-up-git
But I already have git installed, and also I can run git commit, git pull and others command.
I'm on windows 8, using RoR 4
There are two ways to access github, over git:// and http:// you can try over http://
I have this line in my Gemfile, you can adapt it to your needs:
gem 'activeadmin-mongoid', :git => 'https://github.com/piousbox/activeadmin-mongoid.git', :branch => 'fix_sidebar_disable'
So for you maybe
gem 'activeadmin', :git => 'https://github.com/gregbell/active_admin.git'
Also, I assume you do have git installed? Because the error says, install git ; )
sudo apt-get install git if you are on ubuntu, or
brew install git if you are on Mac OS X.

Removing system-wide git repos and git checkouts that Bundler may use

In my gem file I have a Git reference:
gem "calendar_date_select", :git => 'git://github.com/paneq/calendar_date_select.git'
I would like to know where bundler paced that Git checkout so I can manually clean it.
Thanks.
this depends on your local setup. let me explain by one of my projects.
it's within an rvm gemset, so my .rvmrc is like this:
rvm use ruby-1.9.3-p125#hamburg_on_ruby --install --create
and i use ActiveAdmin from git in my Gemfile
gem "activeadmin", :git => "https://github.com/gregbell/active_admin.git"
which results in a Gemfile.lock like this
GIT
remote: https://github.com/gregbell/active_admin.git
revision: 82a13de45feeba2510f015aaae9d412878e4c6f5
so the actual cloned repo is in
~/.rvm/gems/ruby-1.9.3-p125#hamburg_on_ruby/bundler/gems/active_admin-82a13de45fee/

not able to install gems

I was trying to install this gem https://github.com/frodefi/rails-messaging into a rails application.
The README gave instructions to put this in my Gemfile
gem 'messaging', git: 'git://github.com/frodefi/rails-messaging.git'
gem 'mailboxer', git: 'git://github.com/dickeytk/mailboxer.git'
However, when I tried to run bundle install, i got this error message
Git error: command `git clone 'git://github.com/dickeytk/mailboxer.git' "/Users/mm/.rvm/gems/ruby-1.9.3-rc1#rails321/cache/bundler/git/mailboxer-d05808c480dfc6c9f04b8334dfdf7879cea63172" --bare --no-hardlinks` in directory /Users/mm/Sites/shawsome has failed.
I googled the error message and saw that some people had gotten this error message when they didn't have git installed. However, I've been using git for a while without problem. Anyone have any suggestions as to what might be the problem.
I also tried changing the syntax to no avail
gem 'messaging', :git => 'git://github.com/frodefi/rails-messaging.git'
I don't see a github account at https://github.com/dickeytk so that's probably why the git command is failing. Consider just using mailboxer from rubygems:
gem 'mailboxer'
or the repo that's linked to as the homepage from rubygems.org for this gem:
gem 'mailboxer', git: 'git://github.com/ging/mailboxer.git'

Bundle forked gem pulls old version

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.

Resources