THANKS TO:-
http://raflabs.com/blogs/silence-is-foo/2010/07/19/installing-a-gem-fork-from-github-source/
Usually, installing a gem is as easy as issuing:
but, what if you want to install a fork of a gem?
As you may know Github no longer hosts gems, so doing the following won't work:
$ sudo gem install technoweenie-grit --source http://gems.github.com
NOTE: Actually it'd work if the gem you're trying to install is in this list: http://gems.github.com/list.html
Main repo => http://github.com/mojombo/grit
Techno Weenie's fork => http://github.com/technoweenie/grit
Github has a "Download Source" button, if you click it you'll be presented with two big images (say buttons): "ZIP" and "TAR", clicking these buttons will start downloading the code of the master branch in the selected format; below those buttons you'll find the list of tags of the repository, you'll be able to click one of the tags and again you'll be presented with "ZIP" and "TAR" to download the source of such tag.
http://github.com/USER/REPOSITORY/FORMAT/BRANCH_OR_TAG
"ZIP" => http://github.com/technoweenie/grit/zipball/master
"TAR" => http://github.com/technoweenie/grit/tarball/master
said this:
Issuing this command will generate a gem_name-version.gem file which is the gem itself, let's install it:
Some projects doesn't have a .gemspec file but rake tasks, in that case you just need to do:
If any of these methods work, you'd have to look at the Rakefile for tasks to generate the .gemspec file.
...and we're done!
NOTE: 'gem build' will not take in consideration special and external dependencies the gem might require, so you must take care of the dependencies manually. Check in the code all the 'require' lines to see dependencies.
Hope it helps.
http://raflabs.com/blogs/silence-is-foo/2010/07/19/installing-a-gem-fork-from-github-source/
Usually, installing a gem is as easy as issuing:
1.
gem
install
gem_name
As you may know Github no longer hosts gems, so doing the following won't work:
$ sudo gem install technoweenie-grit --source http://gems.github.com
NOTE: Actually it'd work if the gem you're trying to install is in this list: http://gems.github.com/list.html
Disecting the "Download Source" button
Let's suppose we want to install the Techno Weenie's fork of Grit from Github:Main repo => http://github.com/mojombo/grit
Techno Weenie's fork => http://github.com/technoweenie/grit
Github has a "Download Source" button, if you click it you'll be presented with two big images (say buttons): "ZIP" and "TAR", clicking these buttons will start downloading the code of the master branch in the selected format; below those buttons you'll find the list of tags of the repository, you'll be able to click one of the tags and again you'll be presented with "ZIP" and "TAR" to download the source of such tag.
How does this works?
This is how the URL is built:http://github.com/USER/REPOSITORY/FORMAT/BRANCH_OR_TAG
"ZIP" => http://github.com/technoweenie/grit/zipball/master
"TAR" => http://github.com/technoweenie/grit/tarball/master
said this:
1.
$ wget http://github.com/technoweenie/grit/zipball/master
2.
3.
$ unzip technoweenie-grit-v2.0.0-12-g0bd0c5f.zip
4.
5.
$
cd
technoweenie-grit-0bd0c5f
Installing the gem
Gems source code has a special file called gem_name.gemspec, this is like the DNA of the gem and it's used to build it:1.
$ gem build grit.gemspec
1.
$
sudo
gem
install
grit-2.0.0.gem
1.
$ rake build
2.
$ rake
install
...and we're done!
NOTE: 'gem build' will not take in consideration special and external dependencies the gem might require, so you must take care of the dependencies manually. Check in the code all the 'require' lines to see dependencies.
Hope it helps.
No comments:
Post a Comment