gem install with file system as source installs wrong gem - ruby

I have just started working with Ruby. I am trying to install a gem with local file system as source.
$gem source
*** CURRENT SOURCES ***
file:///home/fox/shared/
when i try to install 'bundler' gem it actually installs 'bundler-unload' gem as below.
$gem install bundler --bindir /usr/bin --no-ri --no-rdoc
Successfully installed bundler-unload-1.0.2
1 gem installed
the directory contains both the gems by the way.
bundler-unload-1.0.2.gem
bundler-1.10.6.gem
Is there anything that I am missing here. Why would it install the wrong gem?

I debugged the gem installer code and found the following.
First, the gem installer looks at the current directory to find the gems. It looks for *. It finds two gems (since i was running from the gems source directory) but sorts and reverse orders it and chooses the first one which is not the right gem. It does not do version check also when looking at the local directory. To workaround this i gave 'gem install bundler-1.10.6' which is working. By the way if i run 'gem install' from some other directory it is not able to find any gems from the 'file:' source.

Related

Unable to install atomic v1.1.13 gem via bundler

I have tried to install atomic gem via bundler. I'm getting the below error message:
**Installing atomic 1.1.13 with native extensions The system cannot find the path specified.
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native
extension.
c:/Ruby200/bin/ruby.exe extconf.rb
creating Makefile
Gem files will remain installed in
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.13 for inspection.
Results logged to
c:/Ruby200/lib/ruby/gems/2.0.0/gems/atomic-1.1.13/ext/gem_make.out An
error occurred while installing atomic (1.1.13), and Bundler cannot
continue.**
Could you help me to overcome from this issue. Thanks
To help you here are some steps to follow in order to install your gem lacally.
Download atomic 1.1.13 from RubyGems:
atomic 1.1.13
Place the downloaded gem into a file called gems
Open Ruby cmd consol [clic on start button, select Ruby then select Start command prompt with Ruby]
Cd to the gems file path [lets supose the path of your gems file is C:\Desktop\gems] write the command: cd C:\Desktop\gems then clic enter.
To install the gem run the following comand: gem install --local atomic-1.1.13.gem
I tried it and it worked for me, hopefuly it will work for you.

Build binary Ruby 2 gems

In our production environment, we are forbidden from having compilers installed (don't ask). Back in the Ruby 1.8.7 days, we would use gem-compile to compile binary gems on a dev workstation and put the binary gem out in our repository. Is anybody aware of any similar methods that work with Ruby 2.0? I know RVM is capable of building custom packages of rubies that can be deployed, but I can't find any way to make it work with gems.
I'd like to come up with something a little less brittle than building everything on a dev box and rsync'ing the entire rvm directory over to the server.
Thanks!
check this part of rvm offline installation - http://rvm.io/rvm/offline#installing-gems :
Online
Create a (fake) project directory: mkdir gems; cd gems
Install bundler: gem install bundler
Create Gemfile: bundle init
Add rails to it: echo "gem 'rails'" >> Gemfile
Install all gems: bundle install
Get gem files: bundle package
Package project: tar czf gems.tgz .
Download bundler from https://rubygems.org/gems/bundler the Download link
Offline
Create a (fake) project directory: mkdir gems; cd gems
Unpack gems: tar xzf gems.tgz
Install bundler: gem install bundler-1.2.1.gem
Install gems: bundle install --local
Nevermind, I found the answer. There is a newer gem called gem-compiler from https://github.com/luislavena/gem-compiler that works with Ruby 2. I didn't think it was working because I inadvertently still had an old copy of gem-compile installed and that was getting executed when I ran 'gem compile'. Anyways, this generates platform specific gems for me that I can install in our production environment.
Cheers and Thanks,
Jason

Bundler::GemfileNotFound Error (Mac OSX)

MacBook-Air:~ bdeely$ gem install bundler
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5...
MacBook-Air:~ bdeely$ rbenv rehash
MacBook-Air:~ bdeely$ bundle install
Bundler::GemfileNotFound
I keep getting this error "Bundler::GemfileNotFound" even after I have successfully installed bundler.
Does anyone have any idea what might be going on?
For reference, I am following the directions here:
http://octopress.org/docs/setup/
Create Gemfile in your directory.
Bundler is a gem manager. You should point somewhere which gems you need. The place is Gemfile.
Article
The instructions that come with Octopress aren't clear, but the part where you bundle install has to be performed from within the Octopress directory.
You can't skip the first 3 step of cloning octopress:
git clone git://github.com/imathis/octopress.git octopress
cd octopress # If you use RVM, You'll be asked if you trust the .rvmrc file (say yes).
ruby --version # Should report Ruby 1.9.3
After that, your should in octopress folder and there is a Gemfile in it, now you can move on with bundle install

Installing new gems

Hi I am looking to install the win32-service gem in Ruby for Windows, I have tried using the "gem install" command but it doesn't seem to know where to find my gem ;(
I downloaded the gem itself which came with a load of folders but no install instructions.
Is there anyway I can manually install the gem or point IRB in the right direction?
run this command to install gem file manually.
gem install [your gem file]

How to force gem install to download the docs file as well?

I've setup the following in my ~/.gemrc file
gem: --no-ri --no-rdoc
so that when I do gem install some_gem, the rdocs won't get installed to not pile up my disk.
But for some gem, I'ld like to install the rdocs as well. So i tried,
gem install some_gem --rdoc --ri
the docs doesn't get downloaded. How can I force the gem install to download rdocs as well for some gem if I wnat to??
You can create a second config file called ~/.gemrc_withdoc or something similar and include the commands to install with documentation then try the following comand
gem install some_gem --config-file=~/.gemrc_withdoc
You may even be able to get away with not creating a confile file at all and running
gem install some_gem --config-file=/dev/null
This should work as expected because gem will only use one config-file, either the one specified on the command line or ~/.gemrc. It will never use both
--rdoc and --ri are indeed the correct options, according to gem help install. If it doesn't work as expected, I assume that you have to edit your ~/.gemrc every time you want to install rdocs and ri.

Resources