Can I download all of rubygems.org? - ruby

I have an air gapped network that I use for development. Is there any way that I can easily download a snapshot of rubygems.org to import to the gem server running on said network?
I saw the help article on the rubygems site about how to get specific gems with no network:
$ gem install rails -i repo --no-rdoc --no-ri
I want to try to get everything at once. Any idea how big this would be even without the rdoc and ri?

I have not ever used it, but googling, this tool claims to be able to do that:
https://github.com/rubygems/rubygems-mirror

you can build a gem server at your server.
I think this article can help you.
http://guides.rubygems.org/run-your-own-gem-server/

Related

Ruby: CLI script failing when requiring gems installed through git

I am patching a script, and want to run code from a repo I manage that has patches.
The gem in question is not installed through a published gem but through a github link
When requiring any gem that is normally installed. The script works. But requiring any gem that is installed through a github link fails. Any suggestions?
If I understand the problem correctly, there are a few solutions:
Clone the gem that's only available via the github link, build the gem locally, install it. You should be able to require it
You might be able to manage the project with bundler and a Gemfile. Instructions here for the syntax. Bundler basically does what I suggested above, for you. I don't think gem can install a gem from a remote natively?
Would love to see some more clarification, and if you're using a Gemfile the relevant snippets
So the issue was I was running the script in question using ./bin/path/script
This will not work if the script includes github referenced gems, you need to prefix this with bundle exec which is not immediately obvious, given that when you use non-github referenced gems, it works fine without it.
Now running bundle exec ./bin/path/script will work for both, it's probably just better using that wherever possible.

How to release large Ruby Gem?

I´m finishing a Ruby Gem that depends on Chromium (jxBrowser). Chromium is quite large and has versions for linux, mac and windows. Releasing this gem to RubyGem is not possible, as the gem size is larger than supported by RubyGem. So, are there any recommendations on where/how to release this? I´d love to keep it in RubyGem as my other gens were released there. Should I release an installer in RubyGem and put the files in GitHub? What´s the best way?
Thanks for any hints and suggestions....
You can ask your users to install the gem from git (bundler: http://bundler.io/git.html, Install Gem from Github Branch?).
This will result in a line like
gem 'hard_drive_expander', github: 'rodrigo/hard_drive_expander'
in a Gemfile (or a bit a lengthier process for gem install - do you intend 'library' kind of usage or standalone installations). Note that depending on your scenario you could have an installer gem that depends on the "github-hosted" gem, or downloads and builds/installs it (both seem like dirty solutions to me though, its not what I expect or commonly see).
Although github does place quotas on your repositories, you will probably not hit them (https://help.github.com/articles/what-is-my-disk-quota/).
Another option is to host it yourself (http://guides.rubygems.org/run-your-own-gem-server/).
Sorry for the "linky" answer.
However, #icguida and #engineersmnky s comments to your question are very worth considering: Do you really need to include chromium?
Update
There is a gem that will hook into gem to allow for usage like this: gem specific_install https://github.com/githubsvnclone/rdoc.git. The gem is called specific_install: https://github.com/rdp/specific_install .

Where can I install gems from when rubygems.org is down?

Currently Rubygems.org is down - the website reports an error, and a few gem install tasks are returning 500 errors.
Is there a mirror / backup source of gem files, or is rubygems.org essentially a single point of failure within the ruby gem installation process ?
As per several folks on Twitter, add this to your Gemfile:
source 'https://production.cf.rubygems.org'
Also, if you're not using Bundler you can just run:
$ gem source -a 'https://production.cf.rubygems.org'
For the record, the folks on Twitter include:
laizer, iltempo, and jimneath. Major thanks to them for saving my morning :)
same issue affecting all git push to Heroku
solved the same was by changing the source on GemFile to the http://production.cf.rubygems.org
Mirror for Asia/Pacific Region: https://ruby.taobao.org/ (recommended, high availability, syncing every 15 min)
Other mirrors:
https://gems.cloudafrica.net/
https://tokyo-m.rubygems.org/
Having experienced my share of flaky network connections I find I've most often got the .gem files I need on my system, it's just a matter of finding them and installing them locally.
Use the find command to find local .gem files and install them directly with gem install [file].
find ~/.rbenv/versions -type f -name 'minitest*.gem'
That works for individual gems but if you need to install dependencies, etc. it can be a pain.
If you've got the gem on some other computer, or on other rubies on the same
computer, use
gem server
to create your own gem server.
Otherwise, download the source code for the gem in question from github, and do
the rake task to build the gem.

how to build a transparent private gem source server

My connection to default gem source server http://rubygems.org/ is slow. So I am looking for a method to build a private gem server on a machine which I have fast connection to. I have some questions after reading gems doc:
If I have multiple gem sources , what is the order which source is used when running gem install xxx?
Will any method documented in http://docs.rubygems.org/read/chapter/18 help build a transparent gem server? "Transparent" means I need this only one gem server in my gem sources, and when I request a gem from this server, it will first serve the gem from cache. If the gem is not in cache yet, the server will try to download it from http://rubygems.org/, serve and cache it.
If the answer for question 2 is "No", how can I build a transparent gem source server?
I'd suggest just installing the pre-release bundler, which is several orders of magnitude faster due to major architectural changes. It's not just your connection to rubygems that is slow; it's that painful for all of us ;) gem install bundler --pre will give you a much faster bundler.
That said, if you really want a loca gem server, try Gem in a box:
https://github.com/cwninja/geminabox
Here are a few projects that are specifically made to run a RubyGems.org mirror:
https://github.com/YorickPeterse/gem-mirror
https://github.com/rubygems/rubygems-mirror

Is it possible to download a Ruby gem without installing it automatically?

When I download something using gem I'd like to be able to just download the gem, and then choose whether or not I want to install it. I'm asking this because I'd like to install a particular gem on more than one computers ( without installing from the internet on each one ).
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.
Most of the gems are hosted on github.com right now, you just have to clone the repo.
Yes it is. Browse to the package's page on RubyGems.org and follow the download link.
Eg. from https://rubygems.org/gems/pony to https://rubygems.org/downloads/pony-1.4.gem

Resources