Assignment 0: System Setup

September 4th, 2009 Leave a comment Go to comments

In this assignment, you will set up your computer with Ruby, RubyGems, Ruby on Rails, Sqlite, and Git.

First read; then see at the very end a checklist of what you need to submit.

You must have the following versions:

Installation Tips

System setup is actually much improved compared to years past. For guidance regarding Windows, Mac OS/X, and Linux setups, see the screencasts pages. One gap is for OS/X Tiger: I’m hoping that all Mac users are now on Leopard.

Your Submission

Download the assn0-1.0.0.zip from the downloads page.

In that download, you’ll find the file versions.rb

This will report the versions of the required software. We also collect a wee bit of personal information — your time zone and a geo-location of your IP address (because of this, you should be on the Internet when you run this). Once you’re satisfied with the result, run it again, and redirect the output to a file whose name is “versions.txt” — for example:

ruby versions.rb >versions.txt

You will also need to submit a second file. For this one, change your directory into demo/ in the the download, and . . .

ruby demo.rb

This is a little game that uses the “curses” support in Ruby. You should see a star moving in a box. Press the forward slash key (/) to “reflect” the star to a new direction. Press q to quit. John will demo this in the video for the first lecture. NOTE: We want to hear about it if this program doesn’t work, because Assignment 2 will have very similar code. Linux users in particular: See my notes regarding the setup of curses for Ruby 1.9.1.

Then take a look at the log file (called info.log). You should be able to find a line in there with a secret word. Create a second file with the name secret_word.txt. Edit the file, and put the name of the secret word in there.

Zip up the entire project, and make sure that the file name has your name in it. If you use the command “rake package” from the root directory, this will be done for you. As a note to the wise: Open your own ZIP and double-check that everything is there (especially versions.txt and secret_word.txt, with your info).

Then submit both files via iSites.

  1. Ron Newman
    September 10th, 2009 at 14:45 | #1

    @Priyanka is referring to the list you posted here

    http://e168f09.plugh.org/2009/09/04/for-assignment-0-rails-2-3-3-only/

    which (I think) wasn't actually intended to be a list of gems we needed to have.

  2. halip
    September 10th, 2009 at 14:50 | #2

    A question on ri:

    I'm on Windows XP, see installation and versions info below.
    If I try ri String, I got

    ------------------------------------------------- Class: String < Object
    Enhance the String class with a XML escaped character version of
    to_s.

    User defined methods to be added to String.

    ------------------------------------------------------------------------

    Instance methods:
    -----------------

    ext, pathmap, pathmap_explode, pathmap_partial, pathmap_replace,
    to_blob
    (END)

    So if I try ri String#split, I will have "Nothing known about String#split"

    My installation:

    ----- Software version check at 2009-09-08 12:32:18 -0500

    Time Zone: Eastern Daylight Time
    Location: Country: UNITED STATES (US); City: (Unknown city)
    Working dir: /cygdrive/c/E168
    Ruby Platform: i386-mingw32
    Ruby Engine: ruby
    Ruby Version: 1.9.1
    Ruby Patchlevel: 243
    RubyGems: 1.3.5
    Rails: 2.3.3
    sqlite3-ruby: 1.2.5
    Sqlite: 3.6.17
    Sqlite via Ruby: 3.6.17
    zip -r: OK
    ssh: OpenSSH_5.1p1, OpenSSL 0.9.8k 25 Mar 2009
    git: git version 1.6.1.2

    Gems:

    actionmailer (2.3.3)
    actionpack (2.3.3)
    activerecord (2.3.3)
    activeresource (2.3.3)
    activesupport (2.3.3)
    rack (1.0.0)
    rails (2.3.3)
    rake (0.8.7)
    sqlite3-ruby (1.2.5)

    Any idea? Thanks.

  3. September 10th, 2009 at 14:50 | #3

    @Ron Newman

    Oh, right -- No, your gem list doesn't have to be like the one quoted. You simply need to satisfy the sentence that says "You must have the following versions."

    Let me know if there was some stray sentence that suggested that any displayed gem list was required.

    Here's a little guide on the usage of words like "must" and "should" :-)

    http://www.ietf.org/rfc/rfc2119.txt

  4. September 10th, 2009 at 14:55 | #4

    @halip

    Let's see the result of these commands (from the DOS prompt C:\>) -- (don't worry if some fail):

    echo %PATH%
    which ri
    whereis ri
    which ruby
    whereis ruby

    Are you remote or in Boston? If you're on a laptop and we can't figure it out from here, it might be worth bringing the machine in.

  5. halip
    September 10th, 2009 at 15:00 | #5

    C:\>echo %PATH%
    C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\Downloaded Program Files;C:\IBMTOOLS\Python22;C:\Program Files\PC-Doctor for Windows\services;C:\MSSQL7\BINN;C:\Program Files\QuickTime\QTSystem\;C:\Ruby19\bin;C:\sqlite-3_6_17;C:\cygwin\bin

    C:\>which ri
    /cygdrive/c/Ruby19/bin/ri

    C:\>whereis ri
    ri:

    C:\>which ruby
    /cygdrive/c/Ruby19/bin/ruby

    C:\>whereis ruby
    ruby:

    It's my desktop

  6. September 10th, 2009 at 15:13 | #6

    @halip

    Hmm.

    Try:

    rdoc --all --ri-system
    (note that all and ri-system are each prefixed by two dashes.)

    Then try ri String again.

  7. halip
    September 10th, 2009 at 15:22 | #7

    I got following error, and no change on ri String:

    C:\>rdoc --all --ri-system
    C:/Ruby19/lib/ruby/1.9.1/optparse.rb:1262: warning: regexp match /.../n against
    to IBM437 string
    C:/Ruby19/lib/ruby/1.9.1/optparse.rb:1278: warning: regexp match /.../n against
    to IBM437 string
    C:/Ruby19/lib/ruby/1.9.1/optparse.rb:1262: warning: regexp match /.../n against
    to IBM437 string
    C:/Ruby19/lib/ruby/1.9.1/optparse.rb:1278: warning: regexp match /.../n against
    to IBM437 string
    C:/Ruby19/lib/ruby/1.9.1/rdoc/options.rb:632:in `stat': No such file or director
    y - รป-all (Errno::ENOENT)
    from C:/Ruby19/lib/ruby/1.9.1/rdoc/options.rb:632:in `block in check_fil
    es'
    from C:/Ruby19/lib/ruby/1.9.1/rdoc/options.rb:631:in `each'
    from C:/Ruby19/lib/ruby/1.9.1/rdoc/options.rb:631:in `check_files'
    from C:/Ruby19/lib/ruby/1.9.1/rdoc/options.rb:539:in `parse'
    from C:/Ruby19/lib/ruby/1.9.1/rdoc/rdoc.rb:247:in `document'
    from C:/Ruby19/bin/rdoc:15:in `'

  8. September 10th, 2009 at 15:34 | #8

    @halip

    Strange.

    IBM437 is a character set.

    Is there anything unusual about your system? Unusual language bindings?

    Let me check a few other things.

    Other students: Do NOT try rdoc --all --ri-system, etc.

  9. September 10th, 2009 at 15:44 | #9

    @halip

    I will have to double-check my Windows system at home. It may be that ri doesn't get installed properly with the new 1.9.1 one-click installer.

    Can anyone verify that ri works for sure on Windows? You would want to do . . .

    ri String

    and then see output something like this:

    ------------------------------------------------- Class: String < Object
    A +String+ object holds and manipulates an arbitrary sequence of
    bytes, typically representing characters. String objects may be
    created using +String::new+ or as literals.

  10. Priyanka
    September 10th, 2009 at 18:44 | #10

    @ Ron thanks.
    I hope the list of gems work for the entire semester..:)

  11. DDay
    September 11th, 2009 at 18:50 | #11

    Hi y'all - I've got this mostly set up. I am running Ubuntu 8.10 (Intrepid Ibex) and have managed to install most of what's necessary. In order to get the correct version of Ruby I installed form source without a hitch. I did need to chown the ~/.ri directory to me (build left it as root:root). Now ri works fine.

    Here's the output of versions.rb. I do not understand the meaning of the error I get from Sqlite via Ruby:. How do I interpret it?

    Also, do I need to install the additional gems?

    Thanks,

    David

    dday@dday-laptop:~/CSCI_E-168/e168-assignment0-jgn-1.0.000$ ruby versions.rb

    ----- Software version check at 2009-09-11 18:44:47 -0400

    Time Zone: EDT
    Location: Country: UNITED STATES (US); City: Newton, MA
    Working dir: /home/dday/CSCI_E-168/e168-assignment0-jgn-1.0.000
    Ruby Platform: i686-linux
    Ruby Engine: ruby
    Ruby Version: 1.9.1
    Ruby Patchlevel: 243
    RubyGems: 1.3.5
    Rails: 2.3.3
    sqlite3-ruby: 1.2.5
    Sqlite: 3.5.9
    Sqlite via Ruby: Exception: uninitialized constant SQLite3::Driver::Native::Driver::API
    zip -r: OK
    ssh: OpenSSH_5.1p1 Debian-3ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
    git: git version 1.5.6.3

    Gems:

    actionmailer (2.3.3)
    actionpack (2.3.3)
    activerecord (2.3.3)
    activeresource (2.3.3)
    activesupport (2.3.3)
    rack (1.0.0)
    rails (2.3.3)
    rake (0.8.7)
    dday@dday-laptop:~/CSCI_E-168/e168-assignment0-jgn-1.0.000$

  12. DDay
    September 11th, 2009 at 19:00 | #12

    Oh yeah, when I try to run demo.rb I get this message. I know that according to gem I have activesupport (2.3.3) installed. How do I proceed from here?

    Thanks,

    David

    --==--==--== --==--==--== --==--==--== --==--==--== --==--==--==

    dday@dday-laptop:~/CSCI_E-168/e168-assignment0-jgn-1.0.000/demo$ ruby demo.rb
    /home/dday/CSCI_E-168/e168-assignment0-jgn-1.0.000/demo/lib/game.rb:1:in `require': no such file to load -- active_support (LoadError)
    from /home/dday/CSCI_E-168/e168-assignment0-jgn-1.0.000/demo/lib/game.rb:1:in `'
    from demo.rb:7:in `require'
    from demo.rb:7:in `'
    dday@dday-laptop:~/CSCI_E-168/e168-assignment0-jgn-1.0.000/demo$

    --==--==--== --==--==--== --==--==--== --==--==--== --==--==--==

    dday@dday-laptop:~/CSCI_E-168/e168-assignment0-jgn-1.0.000/demo$ gem list

    *** LOCAL GEMS ***

    actionmailer (2.3.3)
    actionpack (2.3.3)
    activerecord (2.3.3)
    activeresource (2.3.3)
    activesupport (2.3.3)
    rack (1.0.0)
    rails (2.3.3)
    rake (0.8.7)
    dday@dday-laptop:~/CSCI_E-168/e168-assignment0-jgn-1.0.000/demo$

  13. September 11th, 2009 at 19:14 | #13

    The "Sqlite via Ruby" issue means that you have not installed the sqlite3-ruby gem. See this page (near the bottom): http://e168f09.plugh.org/screencasts/screencast-setting-up-on-linux/

  14. September 11th, 2009 at 19:18 | #14

    This means that a path is set incorrectly and/or stuff is wrong in your .gem directory, or files in there don't have their permissions set correctly.

    In your earlier e-mail, you say that you had to chown the .ri directory -- this suggests that you conducted part of the installation as root.

    If you follow the directions I gave you (using the ruby_switcher.sh script), you shouldn't need to be root.

    I would strongly advise reviewing your login directly, and see what else might be owned by root. Then I would remove ALL of the Ruby-related files and directories, and do a fresh re-install using ruby_switcher.sh

    If you really want to install Ruby 1.9.1 as your system Ruby, you can do that -- let me know, 'cos I will have some things to say about how to get that accomplished.

  15. September 11th, 2009 at 19:20 | #15

    @halip

    Halip,

    I reviewed my Windows system, and the new Windows installer does NOT install ri correctly. I will log a bug with the developer.

    What this means is that for routine "ri"-style docs, you should look here:

    http://www.ruby-doc.org/core-1.9/index.html

  16. DDay
    September 13th, 2009 at 00:12 | #16

    John,

    Thanks for the help. I now have Ruby installed locally and am using ruby_switcher's definitions. I will not be installing it for the whole machine (at least not until I understand better the implications of doing that).

    The installed programs and the list of gems match your list. Also, the demo game now works fine on this machine (Ubuntu 8.10. Intrepid Ibex).

    David

  17. Rita
    September 13th, 2009 at 02:38 | #17

    I have problem launching irb after installing "gem install rails sqlite3-ruby". The following is what I got when I try to launch irb. What do I need to do to launch irb again?

    C:\Documents and Settings\Rita Lam>irb
    c:/Ruby19/lib/ruby/site_ruby/1.9.1/rbreadline.rb:4336:in ``': No such file or di
    rectory - chcp (Errno::ENOENT)
    from c:/Ruby19/lib/ruby/site_ruby/1.9.1/rbreadline.rb:4336:in `'
    from c:/Ruby19/lib/ruby/site_ruby/1.9.1/rbreadline.rb:13:in `'
    from c:/Ruby19/lib/ruby/site_ruby/1.9.1/readline.rb:8:in `require'
    from c:/Ruby19/lib/ruby/site_ruby/1.9.1/readline.rb:8:in `'
    from c:/Ruby19/lib/ruby/site_ruby/1.9.1/readline.rb:6:in `'
    from c:/Ruby19/lib/ruby/1.9.1/irb/input-method.rb:98:in `require'
    from c:/Ruby19/lib/ruby/1.9.1/irb/input-method.rb:98:in `'
    from c:/Ruby19/lib/ruby/1.9.1/irb/input-method.rb:14:in `'
    from c:/Ruby19/lib/ruby/1.9.1/irb.rb:19:in `require'
    from c:/Ruby19/lib/ruby/1.9.1/irb.rb:19:in `'
    from c:/Ruby19/bin/irb:9:in `require'
    from c:/Ruby19/bin/irb:9:in `'

    C:\Documents and Settings\Rita Lam>

  18. September 13th, 2009 at 08:22 | #18

    @Rita

    Rita - could you run the versions.rb command, and paste in what you get?

  19. September 13th, 2009 at 10:11 | #19

    @Rita

    Rita -- By the way, I notice that you typed

    gem install rails sqlite3-ruby

    Do not do this. Notice that on the Windows install page (http://e168f09.plugh.org/screencasts/screencast-setting-up-under-windows/) I remind you that we want Rails 2.3.3. So do

    gem uninstall rails
    (all versions)

    then:

    gem install rails -v 2.3.3

  20. Priyanka
    September 13th, 2009 at 10:56 | #20

    Hi,
    I am getting this error when i try to run the second command :
    ruby demo.rb

    C:\Users\Pankhudi\Acads_PR\Current_Semester _Fall_2009\Ruby\e168-assignment0-jgn-1.0.000\e168-assignment0-jgn
    1.0.000\demo>ruby demo.rb
    LINES value must be >= 2 and <= 62: got 63
    initscr(): Unable to create SP

    and when I check my log file I already have a secret word in it.

  21. September 13th, 2009 at 12:01 | #21

    @Priyanka

    Did it happen immediately, or after a key press? If after a key press, what did you you press? The only allowed characters are / and q

    As I explained in an earlier comment, the earliest version of the download included the secret word file. (Oops.)

    Also, Priyanka, re-run your versions.rb and paste in the newest results.

    One last thing:

    Is your DOS window especially big, or scaled in a strange way? Is there a scroll bar?

    Is there anything else about your computer's setup that might make it unusual? For instance, running Windows in a virtual machine, etc.?

  22. Priyanka
    September 13th, 2009 at 15:07 | #22

    Hi John,
    thanks for the reply ..it worked well when I reszied the command window...

  23. Rita
    September 13th, 2009 at 20:53 | #23

    Hi John,

    Thanks for responding to my posting.

    I know that I have installed Rails 2.3.4. I uninstalled all the wrong Rails versions and installed the correct versions 2.3.3. Here was what i got when ran the versions.rb commmand.

    C:\Documents and Settings\Rita Lam\Desktop\e168-assignment0>ruby versions.rb

    ----- Software version check at 2009-09-13 20:45:10 -0500

    Time Zone: Eastern Daylight Time
    Location: Country: UNITED STATES (US); City: (Unknown city)
    Working dir: /cygdrive/c/Documents and Settings/Rita Lam/Desktop/e168-a
    ssignment0
    Ruby Platform: i386-mingw32
    Ruby Engine: ruby
    Ruby Version: 1.9.1
    Ruby Patchlevel: 243
    RubyGems: 1.3.5
    Rails: 2.3.3
    sqlite3-ruby: 1.2.5
    Sqlite: 3.6.17
    Sqlite via Ruby: 3.6.17
    zip -r: OK
    ssh: OpenSSH_5.1p1, OpenSSL 0.9.8k 25 Mar 2009
    git: git version 1.6.1.2

    Gems:

    actionmailer (2.3.3)
    actionpack (2.3.3)
    activerecord (2.3.3)
    activeresource (2.3.3)
    activesupport (2.3.3)
    rack (1.0.0)
    rails (2.3.3)
    rake (0.8.7)
    sqlite3-ruby (1.2.5)

    C:\Documents and Settings\Rita Lam\Desktop\e168-assignment0>

  24. Luis
    September 14th, 2009 at 03:07 | #24

    I have been struggling with this for a few days now and still can not figure it out...I'm pretty sure everything is installed correctly on my system, here is my versions.txt:

    Time Zone: EDT
    Location: Country: UNITED STATES (US); City: Seattle, WA
    Working dir: /home/luis/Desktop/CSCIE-168/Assignments/0
    Ruby Platform: i686-linux
    Ruby Engine: ruby
    Ruby Version: 1.9.1
    Ruby Patchlevel: 243
    RubyGems: 1.3.5
    Rails: 2.3.3
    sqlite3-ruby: 1.2.5
    Sqlite: 3.6.10
    Sqlite via Ruby: 3.6.10
    zip -r: OK
    ssh: OpenSSH_5.1p1 Debian-5ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
    git: git version 1.6.0.4

    Gems:

    actionmailer (2.3.3)
    actionpack (2.3.3)
    activerecord (2.3.3)
    activeresource (2.3.3)
    activesupport (2.3.3)
    cgi_multipart_eof_fix (2.5.0)
    daemons (1.0.10)
    eventmachine (0.12.8)
    fastthread (1.0.7)
    gem_plugin (0.2.3)
    rack (1.0.0)
    rails (2.3.3)
    rake (0.8.7)
    sqlite3-ruby (1.2.5)
    thin (1.2.4)

    But whenever I run the demo, I always get this error message:

    /home/luis/Desktop/CSCIE-168/Assignments/0/demo/lib/game.rb:1:in `require': no such file to load -- active_support (LoadError)
    from /home/luis/Desktop/CSCIE-168/Assignments/0/demo/lib/game.rb:1:in `'
    from demo.rb:7:in `require'
    from demo.rb:7:in `'

    Any idea what is causing it?

  25. September 14th, 2009 at 07:40 | #25

    @Luis

    Luis: Did you install the code with ruby_switcher.sh as we suggested?

    Do you "source" ruby_switcher.sh and then "use_ruby_191" from your .bash_profile or other initialization script?

  26. Scott Aldort
    September 24th, 2009 at 17:04 | #26

    @john
    I just noticed that when I go to this URL, the list of classes is *much* shorter than at http://ruby-doc.org/core/. For example, Array is missing! Can we trust that /core/ is up to date?

  27. September 24th, 2009 at 17:16 | #27

    @Scott Aldort

    Which URL?

  28. Scott Aldort
    September 24th, 2009 at 17:41 | #28

    @john
    Sorry...the one you posted as an alternative to the ri docs for Windows:

    http://www.ruby-doc.org/core-1.9/index.html

  29. Scott Aldort
    September 24th, 2009 at 18:11 | #29

    @Scott Aldort
    May have just answered my own question, see http://ruby-doc.org/ruby-1.9/index.html

  30. September 24th, 2009 at 18:11 | #30

    @Scott Aldort

    Thanks.

    I don't know what they're doing with their site at ruby-doc.org, but use this:

    http://ruby-doc.org/ruby-1.9/index.html

  31. Gabriel
    September 27th, 2009 at 06:40 | #31

    This goes for all those who installed from source on a (debian) linux (not using the switcher from John):
    When firing up my webbrick server, I got the strange error message that openssl couldn't be found. Easy fix, I thought:
    > sudo apt-get install libopenssl-ruby libopenssl1.9-ruby

    Noop... no change.
    So here was the problem. When installing openssl (through apt-get or by source build) it is put into /usr/local/ssl and ruby will never find it. So here is what I did:
    0) first make sure your system is clear of openssl:
    > sudo apt-get remove openssl libopenssl-ruby etc.
    1) go to http://www.openssl.org/source/ and download the current openssl
    2) go to your downloaded source (e.g. /usr/local/src/openssl) and do:
    > ./config --prefix=/usr/local --openssldir=/usr/local/openssl
    > make && make test && sudo make install

    3) go back to your ruby sources (e.g. /usr/local/src/ruby) and change to the directory /ext/openssl then do:
    > ruby extconf.rb
    > make && sudo make install

    And it's done :)

Comment pages
1 2 100
  1. No trackbacks yet.