What is the difference between local and remote gems? - ruby-on-rails

When I tried to install the mysql2 gem (using "sudo gem install mysql2"), I was surprised not to find the gem listed in my "gem list".
After some googling I found out that the mysql2 gem was installed in my remote gems (look them up using "gem query --remote" or with "gem search mysql2 -r") and than I installed them from remote to local using "gem install --remote mysql2".
Now the mysql2 is listed in my gem list.
I am glad I found the solution, however, I don't really understand why the gem installed in remote gems in the first place or what the difference is. Googling did not return a good explanation.
Can someone please explain the difference to me?

Remote gems are really just those on the RubyForge or Github servers. Why it wouldn't install is beyond me, but know that there is no such thing as a remote gem, just gems installed on your machine and gems that you can download from a remote server.

Related

Linux Rails Gem Install Error

Does anyone know what's happening here?
root#ip-172-31-5-114:/home/bitnami/htdocs/kicksharer/kickscraper# gem install rails
Successfully installed rails-5.0.0.1
Parsing documentation for rails-5.0.0.1
Done installing documentation for rails after 0 seconds
1 gem installed
root#ip-172-31-5-114:/home/bitnami/htdocs/kicksharer/kickscraper# bundle show rails-5.0.0.1
Could not find gem 'rails-5.0.0.1'.
Any suggestions for troubleshooting would be really appreciated.
When you gem install rails it installs it on your system. You need to make sure rails is specified in your gem file and then bundle install in order to install those gems in the bundle. (It should use the already installed gems on your system)

Ruby on Rails error during installation

I'm trying to install Ruby, I followed the installation guide well, but when I tried to run the server by the command:
ruby bin/rails setup
after I created the controller called blog as described in the instructions, it gave me an error in red and a text in yellow:
Error:
Could not find gem uglifier <>= 1.3.0 in the gems available on the machine.
Yes! I know that this is a Googleable question but all I can get are solutions for people with internet access on their PC.
But unfortunately, my computer doesn't have a working Internet connection. I'm posting this question from my phone. So I'm unable to install uglifier(if that's the required thing to do) through the command prompt. Many thanks.
Please could you check if your Gemfile has the following gem
gem 'uglifier'
If the Gem is not present add it to your Gemfile, if you already have it in your Gemfile please run:
bundle install
After that you should check if the bundler is installing the uglifier gem.
Hope that helps,

Could not find a valid gem 'mysql2-0.3.18.gem'

i am new to Ruby on rails and i have facing this problem during Rails installation. I have searched a lot and tried many solution which were available on stackoverflow but nothing work for me. Please help how can i get out of this problem..
I have had this problem before, and the reason you are getting this method, is because you are trying to download from an https website.
My guess is you are trying to install all the gems in your gemfile and bundle install didn't work. It would give you a message like
bundler cannot continue. Please make sure gem install samplegem succeeds
Change the following line in your gemfile
source 'https://rubygems.org'
to
source 'http://rubygems.org'
and run bundle
alternatively, you could do the following
gem install mysql2 -s http://rubygems.org
Either way, you should be able to install the gem.
Had you already installed mysql in your machine? The same experiencing happened with me. I was using a virtual environment and trying to install gem mysql2 but I forget that I haven't mysql in my "main" environment.
I ran the following and mysql2 installed successfully.
gem install mysql2 -s http://rubygems.org
But the problem remaied the same when re ran the "bundle install"

Rails: purpose of downloading gems locally

Generally, if I need a gem, I put it in the Gemfile and bundle install. However, I don't understand if there is a benefit to downloading the gems locally first with gem install _____. Is there any benefit to this? Does bundle install no longer have to connect to the net in that situation?
Bundler installs the gems located in your Gemfile locally the same as if you ran gem install for each of those gems.
Gem install needed for gems that can be used outside of bundler applications. For example request-log-analyzer need to be installed outside of any apps for be available in command line.
I myself use gem install _______ then i use bundle install --local which doesn't require internet connection if the gem is found locally but will return an error if the gem was not found locally...
I find this method faster in downloading and installing gems, plus if the gems are found locally then i have also the benefit of altering the gemfile and install the gems without having internet connection.

Is ruby-debug-ide available to be installed on windows with ruby1.9.3?

I was trying to install ruby-debug-ide on my windows ruby environment. A lot of errors show up. My environment are Ruby1.9.3, Windows 7 and DevKit. So is there any guide to install ruby-debug-ide which can be used on the Aptana Studio.
I had lots of problems with this too, which I was able to solve after a lot of Googling.
Install rubyinstaller-1.9.3-p327.exe
Extract DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe to somewhere
cd to where it is (where you find dk.rb)
run: ruby dk.rb init
ruby dk.rb install
Go to http://rubyforge.org/frs/?group_id=8883 to download the gems below
cd to where the *.gem files are
gem uninstall ruby-debug-ide ruby-debug-base linecache
gem install linecache19-0.5.13.gem
gem install ruby-debug-base19-0.11.26.gem -- --with-ruby-include=C:\Ruby193\include\ruby-1.9.1\ruby-1.9.3-p327
gem install ruby-debug-ide19-0.4.12.gem
After all this you might still face the problem with is_binary_data? which was resolved in another thread. Thanks to all the great help. I'm not sure why all this are not packed in rubyinstaller itself though. After all, debugging should be a minimum.
The problem is that the version of ruby-debug19 gem available at rubygems.org is not up-to-date.
Instead, for some strange reason, gem author only pushed the gems to RubyForge:
http://rubyforge.org/projects/ruby-debug19
See the announcement here:
http://rubyforge.org/forum/forum.php?forum_id=39580
I've tried poking the gem author without success.
Hope that helps.

Resources