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

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

Related

Bundle install fails, Gem install succeeds

When trying to bundle install on a Gemfile that contained only the GitHub Pages gem and nothing else, on Ubuntu 18.04, I got error messages telling me to try installing eventmachine using gem install. That always succeeds, but bundle install still fails. How can I get bundler to see that the gem is installed?
I fixed this after many hours of struggle, by noticing that on the GitHub Pages repo there's a note that says
Important: Make sure you have Bundler > v1.14 by running gem update bundler in your terminal before following the next steps.
I have no idea why this mattered but I removed my ruby packages from Ubuntu and reinstalled them, then installed bundler with rubygems, which gave me a newer version:
sudo apt-get remove ruby
sudo apt-get install ruby ruby-dev
sudo gem install bundler
bundler --version
If anyone knows why I needed that version of bundler, or how I should have diagnosed this faster, I'd be interested to hear it. I'm not new to programming but I'm new to Ruby.
From my understanding it might be the gem you are trying to install requires a specific feature provided by bundler. If you check the change log of bundler there is some changes related to install github based gems on how to correctly read the user git settings. So I think that might be where the problem is from.

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.

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]

Can't install JSON gem

I need to install json because I get this error:
Could not find json-1.4.6 in any of the sources
I ran gem install json and bundle install but I was only able to install json-1.5.1 when I need json-1.4.6
I have gem 'json', '1.4.6' in my gemfile, so I'm not sure what's going on...
UPDATE
I get this error:
Installing json (1.4.6) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb:1216:in `chmod': Operation not permitted - /Library/Ruby/Gems/1.8/gems/json-1.4.6/CHANGES (Errno::EPERM)
After checking logs by running $ heroku logs
I found "An error occurred while installing json (1.4.6), and Bundler cannot continue.
Make sure that gem install json -v '1.4.6' succeeds before bundling."
I then removed 2 json entries from the Gemfile.lock and had no further issues.
Why did you run gem install json at all? Bundler takes care of that for you and will ensure that the correct version of each gem is installed (since sometimes dependencies require an older version). Run
gem uninstall json
bundle install
Also ensure you have source 'https://rubygems.org' at the top of your Gemfile.
As for the permissions info, you may have to run gem and bundle commands with sudo.
By the way, I highly recommend taking a look at and using RVM, particularly the gemsets feature. It will make your life infinitely better when developing Ruby apps. If you decide to do so, I'd also suggest trashing all the gems you've install using the system Ruby by running sudo rm -rf /Library/Ruby/Gems/1.8/. It's also important that when using RVM you don't have to use sudo when running gem (or bundle), which is not only safer but less typing too.
Please update your rubygems by executing the following command..
gem update --system
may be it will solve the problem. After updating your gem. Then run the following command to install json
gem install json
Now you can get json gem installed in your system.
Try:
$ sudo apt-get install ruby1.8-dev
If you're using rbenv, try rbenv rehash
I had this problem when trying to build a website with Jekyll.
Turned out I hadn't followed all the instructions at https://jekyllrb.com/docs/installation/ubuntu/
I don't know if it was the missing packages or commands into ~/.bashrc but it fixed the problem in two instances of Ubuntu in WSL
Remove the json entries from the Gemfile.lock file and try to re run bundle install..

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