Is it possible to download a Ruby gem without installing it automatically?
gem fetch
So, something like $ gem fetch gosu
... this will leave gosu-0.7.14.gem
in the current directory.
This will work even if you have already installed it.
Is it possible to download a platfrom specific Ruby gem without installing it?
$ gem fetch --help
Usage: gem fetch GEMNAME [GEMNAME ...] [options]
Options:
-v, --version VERSION Specify version of gem to fetch
--platform PLATFORM Specify the platform of gem to fetch
Local/Remote Options:
-B, --bulk-threshold COUNT Threshold for switching to bulk
synchronization (default 1000)
-p, --[no-]http-proxy [URL] Use HTTP proxy for remote operations
--source URL Use URL as the remote source for gems
Common Options:
-h, --help Get help on this command
-V, --[no-]verbose Set the verbose level of output
-q, --quiet Silence commands
--config-file FILE Use this config file instead of default
--backtrace Show stack backtrace on errors
--debug Turn on Ruby debugging
Arguments:
GEMNAME name of gem to download
Summary:
Download a gem and place it in the current directory
Defaults:
--version '>= 0'
You should be able to do
$ gem fetch gosu --platform x86-mswin32
Or simply go to the download page.
How to automatically download .gem files, including dependencies, and save .gem's to one folder?
Bundler has a great way to do this: bundle package
.
http://bundler.io/v1.2/bundle_package.html
The package command will put all your gems in the bundle into ./vendor/cache. You can then do whatever you want with that directory, such as copying it to another machine, or checking it into version control, or torrenting it. etc.
Download all gems dependencies
Thats exactly the problem I had.
After searching around a while I found a Solution who works using Bundler https://bundler.io/
Getting Gem with Dependencies:
- Create a new Folder with a File named Gemfile in it.
- Write a Source and the Gem you want to have the dependencys for into the File
- Example:
source "http://rubygems.org"
gem 'rails', '3.2.1' - Open a Commandline at this Folder an Execute: bundle install
- This should download and install all Dependencys
- Execute the Command bundle list if you wanna see it
- Execute the Command bundle package
- This should create the Directory Structure vendor/cache
- Inside the cache Directory are now all the Dependencys you need for your gem
Install Gem on Machine without internet connection:
- Copy the cache Folder to the Machine
- Open a Commandline inside the Cache Folder and execute gem install --local Gemname.gem
- Example:
gem install --local rails-3.2.1.gem
Is there a way to update RubyGems offline?
When you do gem install it will search the current directory before looking to the remote source. You must specify the version if you are installing a local gem (see rubygems manual).
gem install copland-0.2.0.gem
I'm sorry, I don't know a way to update the gem system offline without doing a manual upgrade
What is gem install bundler?
I dont have much knowledge of nodejs or java but can give you some idea.
Is it like npm for NodeJs and Maven for Java/J2EE
Yes, It is somewhat like that npm
.Bundler
helps to manage application dependency like xyz
app requires foo
bar
gem. gem
is like of libraries
which extend the app functionality. This gems are primary located in rubygems.org
server.
The first command i executed is gem install bundler. What is gem here and What is bundler, can some one enlighten me in terms of NodeJs or Maven.
when you do gem install <gem_name>
, it creates a request to rubygems.org and download the repo
(gem) and put it in the configured location. The location can be found in gem env
command. To get the details of gem, you have to use gem install <gem_name> -d
. So, when you are doing gem install bundler
, you are installing bundler
gem. This gem
will help you to resolve/manage/install application dependencies. This is like npm install bundler
with npm
.
Where these getting installed?. I don't specify -g like i do in NodeJs for globally.
No, there is no need to write -g
option here. My default, we install gems in one location which is not inside apps. personally i think transferring all those gems from one computer to another is slightly cumbersome, rather i prefer to run a command which automatically install all dependency. This is where bundler
shines. Let say you have an app which requires foo
, bar
dependency since it uses its functionality. Without bundler, you have install this gems
by running gem install foo
, gem install bar
. But with bundler, you will just do bundle install
and you are done.
That's all. This will give you good start.
Why do I need to bundle install after every reboot in rails 3.2.1 with rvm?
If you're using Rails 3.2.1 with RVM, you usually do not need to run 'gem install' manually.
My guess is, you've installed ruby interpreter via RVM (or possibly, you haven't installed ruby in RVM), or you haven't configured RVM to select the default ruby interpreter.
You can configure default ruby by (if you're using 1.9.3-p0):
rvm 1.9.3-p0 --default
Then, the 1.9.3-p0 ruby will in effect after logging in to the shell. You can check which ruby interpreter is in use, by:
which ruby
If you correctly configured, it should be print like:
{your-home-path}/.rvm/rubies/ruby-1.9.3-p0/bin/ruby
In the post bundler-age rails app, you just need to run bundler to install required gems (onto the current gemset in RVM). If you don't create gemset, global gemset will be used. Run:
bundle
will install all gems you need.
Now, since RVM automatically select 1.9.3-p0 with gemset named 'global', you don't need to re-install after boot (as I do).
You can optionally create gemset for the rails app and configure per-directory basis. To configure default gemset/ruby interpreter per application, check the RVM site.
Related Topics
Argument Out of Range Rails 4 and Bootstrap3-Datetimepicker-Rails
Accessing Headers from Sinatra
What's the Easiest Way to Send a Message Through Outlook with Ruby
Why Does Psych Yaml Interpreter Add Line Breaks Around 80 Characters
What Ide/Editor Do You Use for Ruby on Linux
Undefined Method When Accessing Hash Element
Can Multiple Sidekiq Instances Process The Same Queue
Cancan Load_And_Authorize_Resource Triggers Forbidden Attributes
Ruby/Rails - How to Create a Class and Access It from the Controller
Ruby Metaprogramming, How Does Rspec's 'Should' Work
How to Create a Jwt for Use with Apple Music
Turn a Ruby Hash into HTML List
Should Rbenv Be Installed System-Wide, or at a User Level
Error Nomethoderror: Undefined Method 'Debug_Rjs=' for Actionview::Base:Class