I would like to install gem from the latest GitHub source.
How do I do this?
That depends on the project in question. Some projects have a *.gemspec file in their root directory. In that case, it would be:
gem build GEMNAME.gemspec
gem install gemname-version.gem
Other projects have a rake task, called gem or build or something like that. In that case you have to invoke rake <taskname>, but that depends on the project.
In both cases you have to download the source.
gemname-version.gem file is created when invoking gem buildgem install gemname-version.gem command installs the git gem locally? I cannot find anywhere in my local machine an engine gem installed this way. Where does bundler hides it?gem install gemname-version.gem line should be gem install --local gemname-version.gemgem which gemname should tell you where a specific gem is, does that not work for you?In case you are using bundler, you need to add something like this to your Gemfile:
gem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git'
And in case there is .gemspec file, it should be able to fetch and install the gem when running bundle install.
UPD. As indicated in comments, for Bundler to function properly you also need to add the following to config.ru:
require "bundler"
Bundler.setup(:default)
require "bundler" Bundler.setup(:default) See bundler docs for more detailsgem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git', :branch => 'yourbranch'gem 'redcarpet', github: 'tanoku/redcarpet'. akash.im/2012/06/05/bundler-new-github-option.htmlgem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git', :tag => 'v2.3.5' <- the :tag => '' partgit:// with https:// solved it: The git source git://... uses the git protocol, which transmits data without encryption. Disable this warning with bundle config set --local git.allow_insecure true, or switch to the https protocol to keep your data secure.Try the specific_install gem it allows you you to install a gem from its github repository (like 'edge'), or from an arbitrary URL. Very usefull for forking gems and hacking on them on multiple machines and such.
gem install specific_install
gem specific_install -l <url to a github gem>
e.g.
gem specific_install https://github.com/githubsvnclone/rdoc.git
specific_install gem?ERROR: While executing gem ... (NoMethodError) undefined method 'build' for Gem::Package:Module Sounds very cool but I won't be looking into it further. Just wanted to post that it didn't work for me in case someone else is about to give it a whirl based on SO recommendation.Bundler allows you to use gems directly from git repositories. In your Gemfile:
# Use the http(s), ssh, or git protocol
gem 'foo', git: 'https://github.com/dideler/foo.git'
gem 'foo', git: '[email protected]:dideler/foo.git'
gem 'foo', git: 'git://github.com/dideler/foo.git'
# Specify a tag, ref, or branch to use
gem 'foo', git: '[email protected]:dideler/foo.git', tag: 'v2.1.0'
gem 'foo', git: '[email protected]:dideler/foo.git', ref: '4aded'
gem 'foo', git: '[email protected]:dideler/foo.git', branch: 'development'
# Shorthand for public repos on GitHub (supports all the :git options)
gem 'foo', github: 'dideler/foo'
For more info, see https://bundler.io/v2.0/guides/git.html
bundle, such git-gem- dependencies will not be installed globally but in the current user's home directory instead. Passenger will run ruby as your web-server's user (e.g. www-data) which has no access to this directory and therefore this "git-gem" won't be loaded. You will get an error ... is not yet checked out. Run bundle install first.OBSOLETE (see comments)
If the project is from github, and contained in the list on http://gems.github.com/list.html, then you can just add the github repo to the gems sources to install it :
$ gem sources -a http://gems.github.com
$ sudo gem install username-projectname
Also you can do gem install username-projectname -s http://gems.github.com
In your Gemfile, add the following:
gem 'example', :git => 'git://github.com/example.git'
You can also add ref, branch and tag options,
For example if you want to download from a particular branch:
gem 'example', :git => "git://github.com/example.git", :branch => "my-branch"
Then run:
bundle install