Examples of long AND WELL-WRITTEN Ruby scripts

I’m looking for examples of Ruby scripts that are long AND well-written.

I have a Ruby script for scraping information on stock ETFs and mutual funds and storing the data in a Postgres database at https://github.com/jhsu802701/bsf-scrape/blob/master/scrape.rb . While I need to make some minor changes to it (like providing external options to choose between the long and short version, as the “Enter blahblahblah within 20 seconds” approach doesn’t work in a cron job), I know I need to make one major change: making the script better-written.

Substantial parts of my script are cobbled together from examples of code for performing various tasks. (I’m quite new to Ruby.) I know that my script is far from optimal. What long Ruby scripts are considered to be the gold standards in Ruby style and techniques?

I'm looking for examples of Ruby scripts that are long AND well-written.

I have a Ruby script for scraping information on stock ETFs and mutual funds and storing the data in a Postgres database at https://github.com/jhsu802701/bsf-scrape/blob/master/scrape.rb . While I need to make some minor changes to it (like providing external options to choose between the long and short version, as the "Enter blahblahblah within 20 seconds" approach doesn't work in a cron job), I know I need to make one major change: making the script better-written.

Substantial parts of my script are cobbled together from examples of code for performing various tasks. (I'm quite new to Ruby.) I know that my script is far from optimal. What long Ruby scripts are considered to be the gold standards in Ruby style and techniques?

Long scripts may be the entire problem right there. A lot of the "masterful" Ruby I have seen is really brief, not long at all. If a method takes more than a handful of lines, it gets refactored into two or more shorter methods, these get organized into sensibly-designed classes, and no single script gets responsibility for more than one thing. I am in no way qualified to write like this, but I have seen it enough times to know that it's what I should be reaching for in my own work. Open up @tenderlove's CSSPool project, which parses CSS into Ruby objects. It's pretty hard to find a method more than 4 lines long anywhere within it.

Walter

Walter, I’ve looked at the Ruby source code of a few games, and I’m starting to see what you’re talking about. I see that more experienced Ruby developers don’t cram everything into one file like I did. I see that I should be giving each class its own file, and I should be using Modules. I see that there are Ruby scripts that use a Gemfile but not Rails. (Is there a “ruby generate” or “ruby new” command analogous to “rails generate” and “rails new”?)

What do you think of Conway’s Game of Life at https://github.com/spaghetticode/game-of-life-ruby ? I’ve tried it out, so I know it works. Does the source code set an example of coding practices to emulate?

As far as generators go, there actually are a few. The ones I'm most
familiar with generate directory and file structure, and have some
opinions about where best to place things. These are a few I use:

- bundler gem gemname
- methadone [options] cliappname
- GLI [options] clisappsuitename

The thor gem talks about it's use as a generator tool as well.