Installing new gems - ruby

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]

Related

gem install with file system as source installs wrong gem

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.

Ruby install gem offline in Windows

I need to install some Ruby gems in Windows in the offline-mode (without internet). I have gem files downloaded from the other PC.
As long as the gem does not require specific options (with --), I just execute gem install somegem --local and everything is fine.
But if the gem does require those options, there is a trouble. For example, I want to install sqlite3-1.3.10.gem:
gem install sqlite3 --local -- --with-sqlite3-dir="c:\programs\sqlite"
This returns me an error:
ERROR: While executing gem ... (OptionParser::InvalidOption)
invalid option: --with-sqlite3-dir=c:\programs\sqlite
What is wrong?
ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]
Rails 4.2.2
Got the reason. I ran all commands in Windows PowerShell.
Now I tried to do it in usual cmd.exe - and it just worked.
Just for a case here is how I installed sqlite3.gem: followed instructions from https://stackoverflow.com/a/16023062 and executed command:
gem install sqlite3-1.3.10.gem --local --platform=ruby -- '--with-sqlite3-dir="c:/programs/sqlite" --with-sqlite3-lib="c:/programs/sqlite/.libs" --with-sqlite3-include="c:/programs/sqlite"'
Thank you for comments, they helped to correct the command.

Cannot install Ruby Gems in Windows 7

I have successfully installed Ruby Gems on my Mac many times. I need to configure a Windows 7 Enterprise virtual machine with Compass, Sass and Suzy.
I downloaded an installed Ruby on the Windows machine with the installer, 1.9.3. I ran gem update --system which updated Rubygems to 1.8.4.
I was able to install Sass 3.2 by running gem install sass
However, if I run gem install compass or gem install susy I get an error:
Error while excecuting gem .. (ArgumentError) marshall data too short
Any ideas? At this point, I can't install those gems.
The alternative solution..: Download gem compass from here to your ruby root folder. Then try again
gem install compass
It should install this time..Good luck
Had same issue, updating rubygems system solved it. Just use the following command
gem update --system
For those finding this question, many great tips here. Using them, I found this solution to work:
At the N: prompt in "start command line with ruby environment", I used the command rmdir /S .gem which deleted all gems. I then installed them again with gem install as directed on their respective host web pages. Hope this helps someone.

How would I install this locally? Will gem install work?

https://github.com/Shopify/shopify_api
I've never manually installed something like this before, I have only used gem install xxxx in the past.
I am using RVM.
Update
OK, gem install does work, but how would I install it manually?
It's a gem so you could download it and decompress it, cd into its directory, then run rake. But why? gem install will be less work and will do as well.
gem install path/to/gem/file.gem
It's a gem, it's available from Rubygems, so
gem install shopify_api
See https://rubygems.org/gems/shopify_api

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