From: Robert Klemme Date: 2011-07-05T18:55:06+09:00 Subject: Re: downloading all of gem to my hd? On Sun, Jul 3, 2011 at 10:24 PM, Josh Cheek wrote: > On Sun, Jul 3, 2011 at 9:57 AM, Y. NOBUOKA wrote: > >> Hi, >> >> I found "gem mirror" command in a old version of gem, but >> a current version of gem doesn't have such a command. >> >> Now, I think that the one way to download all gem files is to do >> following steps: >> >> 1. obtain all gem names with "gem search" command >> $ gem search --remote >> 2. download all gem files with "gem fetch" command >> $ gem fetch [gemname] [gemname] [gemname] ... >> ([gemname] is one of the gem names obtained in step 1) >> >> Although this way is troublesome if you do by your hand, >> you can write a simple script which do these steps automatically. >> >> > > This worked for me: > > $ cd some/dir/to/store/gems/in > $ gem update --system && gem search --no-installed --no-details > --no-versions --remote | awk 'NR<10' | xargs gem fetch --bulk-threshold 2 > Latest version currently installed. Aborting. > Fetching: 10io-jekyll-0.10.0.gem (100%) > Downloaded 10io-jekyll-0.10.0 > Fetching: 1234567890_-1.0.gem (100%) > Downloaded 1234567890_-1.0 > Fetching: 12_hour_time-0.0.3.gem (100%) > Downloaded 12_hour_time-0.0.3 > Fetching: 24games-0.2.1.gem (100%) > Downloaded 24games-0.2.1 > Fetching: 2Performant-0.0.8.gem (100%) > Downloaded 2Performant-0.0.8 > Fetching: 360_services-1.1.3.gem (100%) > Downloaded 360_services-1.1.3 > Fetching: 3d-ribbon-0.1.1.gem (100%) > Downloaded 3d-ribbon-0.1.1 > Fetching: 3scale_client-2.2.7.gem (100%) > Downloaded 3scale_client-2.2.7 > > > If you want all of them, just don't pipe it through awk. I think Jan is on > the right path with fetching the gems (as opposed to installing them, which > could have security consequences, and probably lead to hard to track bugs > from some gem authors not understanding the conventions). Then, when you > want one of the gems, you can cd into that dir and `$ gem install > gemname-version.gem` > > Of course, this doesn't fetch every version of every gem, just the most > recent. What about $ gem19 help mirror ? Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/