Offering Help

I’m new to Ruby and I am willing to learn. Anyone need help on a
project for the next 3 days? All my friends are on vacation and I have
nothing better to do. I do have programming experience in Java and C.

On Fri, Jul 1, 2011 at 11:43 AM, Joe P. [email protected] wrote:

I’m new to Ruby and I am willing to learn. Anyone need help on a
project for the next 3 days? All my friends are on vacation and I have
nothing better to do. I do have programming experience in Java and C.

Have you done the Ruby Koans?

http://rubykoans.com/

Never heard of it, but I’ll get right on it. Thanks.

On Sat, Jul 2, 2011 at 1:39 PM, Joe P. [email protected] wrote:

Just finished this. I had to find some more info on exceptions to get
past that part, and it took me a while to figure out that
“method_missing” is automagically called on a class if it doesn’t have
the method being called. Redifining that made the proxy koan much
easier to solve.

I still need some brushing up on regex and file IO stuff.

Thanks again for pointing me in the right direction.

No problem!

Two other sites come to mind:

Just finished this. I had to find some more info on exceptions to get
past that part, and it took me a while to figure out that
“method_missing” is automagically called on a class if it doesn’t have
the method being called. Redifining that made the proxy koan much
easier to solve.

I still need some brushing up on regex and file IO stuff.

Thanks again for pointing me in the right direction.

Hi.
Im programming for the fun of it. I lose my internet connection
in a month, for a looong time.

So I thought if I switch to perl I can download the cpan and
have 22000 modules on my hd. So I did.
But I really,really,really prefer Ruby.
So I thought maybe I can download all of gem?
So I can stick with ruby?

/Mix

On Sun, Jul 3, 2011 at 9:51 AM, m b [email protected] wrote:

/Mix

There’s no free WiFi anywhere near you so you can get a few gems now and
then?

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.

There might be a better way than this way, but I don’t know.

Regards,

A tutorial site here.
http://www.tutorialspoint.com/ruby/index.htm

2011/7/3 Jeremy H. [email protected]

Hi *,

On 07/03/2011 04:57 PM Y. NOBUOKA wrote:

  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.

using bash this might look like this:

=========================================================================
$ for GEM in $(gem search -qr | awk ‘NR>2 { print $1 }’); do gem fetch
${GEM}; done;

All available remote gems ([email protected]) will be fetched to the
current
working directory. However, this also includes all sort of garbage
modules
created for testing or those no longer under active development.

Hope this helps …

So long …
Jan

On Sun, Jul 3, 2011 at 9:57 AM, Y. NOBUOKA [email protected]
wrote:

  1. 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.

$ gem search --remote
$ for GEM in $(gem search -qr | awk ‘NR>2 { print $1 }’); do gem fetch
${GEM}; done;
=========================================================================

All available remote gems ([email protected]) will be fetched to the current
working directory. However, this also includes all sort of garbage modules
created for testing or those no longer under active development.

Hope this helps …

thanx ill try this… im sure cpan holds some garbage modules too…
this means i can stick with ruby… :slight_smile:

On Mon, Jul 04, 2011 at 03:35:02AM +0900, Jan wrote:

using bash this might look like this:

=========================================================================
$ for GEM in $(gem search -qr | awk ‘NR>2 { print $1 }’); do gem fetch
${GEM}; done;

This is actually sh syntax. It just also happens to work in bash.

On Mon, Jul 4, 2011 at 12:37 AM, Chad P. [email protected] wrote:

On Mon, Jul 04, 2011 at 03:35:02AM +0900, Jan wrote:

using bash this might look like this:

=========================================================================
$ for GEM in $(gem search -qr | awk ‘NR>2 { print $1 }’); do gem fetch
${GEM}; done;

This is actually sh syntax. It just also happens to work in bash.

Expect the next version of bash to fix this bug. :stuck_out_tongue:


Phillip G.

twitter.com/phgaw
phgaw.posterous.com

A method of solution is perfect if we can forsee from the start,
and even prove, that following that method we shall attain our aim.
– Leibniz

On 02.07.2011 19:46, Jeremy H. wrote:

Two other sites come to mind:
[…]

Jeremy, thanks for that hint, I instantly fell in love with this site.
Unfortunately I was never great at math but I love to tinker with such
problems. Cool :slight_smile:

  • Markus

On Sun, Jul 3, 2011 at 10:24 PM, Josh C. [email protected]
wrote:

  1. obtain all gem names with “gem search” command
    This worked for me:
    Downloaded 12_hour_time-0.0.3

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

On Tue, Jul 5, 2011 at 4:55 AM, Robert K.
[email protected]wrote:

I don’t have it:

$ gem -v
1.8.5

$ gem help mirror
WARNING: Unknown command mirror. Try gem help commands

$ gem help commands
GEM commands are:

build             Build a gem from a gemspec
cert              Manage RubyGems certificates and signing settings
check             Check installed gems
cleanup           Clean up old versions of installed gems in the 

local
repository
contents Display the contents of the installed gems
dependency Show the dependencies of an installed gem
environment Display information about the RubyGems environment
fetch Download a gem and place it in the current
directory
generate_index Generates the index files for a gem server
directory
help Provide help on the ‘gem’ command
install Install a gem into the local repository
list Display gems whose name starts with STRING
lock Generate a lockdown list of gems
outdated Display all gems that need updates
owner Manage gem owners on RubyGems.org.
pristine Restores installed gems to pristine condition from
files
located in the gem cache
push Push a gem up to RubyGems.org
query Query gem information in local or remote
repositories
rdoc Generates RDoc for pre-installed gems
search Display all gems whose name contains STRING
server Documentation and gem repository HTTP server
sources Manage the sources and cache file RubyGems uses to
search
for gems
specification Display gem specification (in yaml)
stale List gems along with access times
uninstall Uninstall gems from the local repository
unpack Unpack an installed gem to the current directory
update Update the named gems (or all installed gems) in
the
local
repository
which Find the location of a library file you can
require

For help on a particular command, use ‘gem help COMMAND’.

Commands may be abbreviated, so long as they are unambiguous.
e.g. ‘gem i rake’ is short for ‘gem install rake’.

On Jul 5, 2011, at 04:36 , Josh C. wrote:

$ gem -v
1.8.5

$ gem help mirror
WARNING: Unknown command mirror. Try gem help commands

https://github.com/rubygems/rubygems-mirror

looks like it hasn’t been released as a gem yet… I haven’t seen much
movement on it lately so I don’t know the status of it.

That said… gem mirror will download ALL the gems, not just the
latest. It’s a bit heavy handed if you’re looking to do something more
casual.