Install or upgrade Ruby, RubyGems, Mongrel, Ruby on Rails, and MySQL with the required versions:
(Subject to revision up to the first lecture!)
- Ruby 1.8.6 [1.8.5 is ok]
- RubyGems 0.9.2 or later [0.9.0, 0.9.1 ok for Linux]
- Ruby on Rails 1.2.3
- Mongrel 1.0.1
- MySQL 5.0.x
- mysql gem 2.7.3 [2.7.x ok for Linux]
You may use any of the convenience installers you like (Windows One-Click Ruby Install, Instant Rails, Locomotive, etc.) as long as you end up with the correct versions and can execute the key programs (ruby, mysql, rails, irb, etc.). My personal preference is to install the “real” versions (rather than use, say, Instant Rails).
For links to the various installers, go to http://www.rubyonrails.com/down
On Windows, I think the easiest method is the Windows One-Click Ruby Install; since this comes with RubyGems, you can immediately install Ruby on Rails and Mongrel with gem. I’ve created a screencast of a full Windows install.
On Linux you use a combination of your system installer (aptitude, rpm, yast, etc.) and gem. There’s a screencast for Linux as well.
Then e-mail your section leader the following:
Subject line: Must include e168
Somewhere in the body of the e-mail: submission:assignment1
(1) the result of the following commands (case-sensitive):
ruby -v gem -v mongrel_rails --version rails -v irb -v mysql -V gem list mysql
Example output:
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
0.9.2
Mongrel Web Server 1.0.1
Rails 1.2.3
irb 0.9.5(05/04/13)
mysql Ver 14.12 Distrib 5.0.41, for Win32 (ia32)
*** LOCAL GEMS ***
mysql (2.7.3)
A win32-native build of the MySQL API module for Ruby.
(2) A screenshot showing that Rails is working.
To do this, get a command prompt, and create a rails application named “assignment1″ with
rails assignment1 cd assignment1
Now type:
ruby script/server [Wait - server is loading . . . When you see "** Use CTRL-C to stop" . . .]
That starts the Mongrel server listening on Port 3000.
Now start your browser and browse to http://localhost:3000
When you see the “Welcome aboard” page, click on the link for “About your application’s environment”: The result should look like this (click for larger version):
Once you have the screenshot, you can interrupt the Mongrel server by pressing control-C. Then you can remove the directory created by “rails assignment1″.
(3) Fun bonus (no extra points . . .):
What is the result of . . .
[NOTE: 26-Sep-2007: small change in quotation marks to support Bash 3. See comment below.]
ruby -e 'p "Uryyb, jbeyq!".tr("A-Za-z", "N-ZA-Mn-za-m")'
To sum up: A submission consists of three things: (1) a transcript or screenshot showing the versions of the installed software; (2) A screenshot of your browser showing the “Welcome aboard” page, along with the results of clicking “About your application’s environment”; (3) [optional] the answer to the fun bonus.
The e-mail subject line must include “E168″ and the body must have somewhere: submission:assignment1
September 26th, 2007 at 9:01 am
If I have version 1.8.5 which I know is ok to have for the assignment, but want to update to 1.8.6, is there a command I can us to do so from the command line or do I have to download the Windows One-Click installer?
In either case, will doing so erase anything in my Ruby directory including GEMS?
September 26th, 2007 at 10:05 am
If you don’t have many gems, I would get rid of your Ruby, use the Windows one-click installer, and then get the rest with gems.
The reason is this: The Windows one-click installer puts a lot of other useful stuff on your system, including stuff that is hard to install (fxruby, rxri, a few others).
September 26th, 2007 at 1:19 pm
Folks,
Joseph Eattimoottil brought to our attention that the original version of the ruby -e ‘p “Uryyb, jbeyq!”.tr(”A-Za-z”, “N-ZA-Mn-za-m”)’ command would fail on some versions of Linux.
Max Newell traced it to bash 3, and proposed the new version above, which works on bash 2 and 3, as well as at (at least on my computer) the DOS prompt.
Thanks Joseph and Max!
September 26th, 2007 at 9:20 pm
I am on a Mac and I am still having problems getting mysql gems to work. Everything else works and I do have XCode installed.
Here is what I get:
===================
peglets$ sudo gem install mysql — –with-mysql-dir=/usr/local/mysql
Need to update 49 gems from http://gems.rubyforge.org
………………………………………….
complete
Select which gem to install for your platform (universal-darwin8.0)
1. mysql 2.7.3 (mswin32)
2. mysql 2.7.1 (mswin32)
3. mysql 2.7 (ruby)
4. mysql 2.6 (ruby)
5. Skip this gem
6. Cancel installation
> 3
Building native extensions. This could take a while…
ERROR: While executing gem … (Gem::Installer::ExtensionBuildError)
ERROR: Failed to build gem native extension.
ruby extconf.rb install mysql — –with-mysql-dir=/usr/local/mysql
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lm… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lz… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lsocket… no
checking for mysql_query() in -lmysqlclient… no
checking for main() in -lnsl… no
checking for mysql_query() in -lmysqlclient… no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/usr/local/bin/ruby
–with-mysql-config
–without-mysql-config
–with-mysql-dir
–with-mysql-include
–without-mysql-include=${mysql-dir}/include
–with-mysql-lib
–without-mysql-lib=${mysql-dir}/lib
–with-mysqlclientlib
–without-mysqlclientlib
–with-mlib
–without-mlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-zlib
–without-zlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-socketlib
–without-socketlib
–with-mysqlclientlib
–without-mysqlclientlib
–with-nsllib
–without-nsllib
–with-mysqlclientlib
–without-mysqlclientlib
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/gem_make.out
============
I am about ready to give up on this.
Short of reinstalling my operating system, does anyone have an suggestions?
Thanks, peggy
September 27th, 2007 at 9:26 am
Hi Peggy
Note sure this will help. But a take a look at this site. There are other people with similar problems
http://wiki.rubyonrails.com/rails/pages/HowtoInstallOnOSXTiger
some suggestions.
sudo gem install mysql — –with-mysql-include=/usr/local/mysql/include/ –with-mysql-lib=/usr/local/mysql/lib/ –with-mysql-config=/usr/local/mysql/bin/mysql_config
Or this.
sudo gcc_select 3.3
sudo gem install mysql — –with-mysql-dir=/usr/local/mysql –with-mysql-include=/usr/local/mysql/include/ –with-mysql-lib=/usr/local/mysql/lib/ –with-mysql-config=/usr/local/mysql/bin/mysql_config
Joseph
September 27th, 2007 at 2:36 pm
Joseph, thanks for the tips. Still some glitches, but different glitches, so maybe I can figure it out from there.
Thanks,
Peggy
September 28th, 2007 at 10:13 am
Does anyone know about a good battery of unit tests which I can run against my deployment?
I was able to complete the assignment with all the correct version numbers. But I would like to gain some confidence in my deployment, since I had to compile source myself, and I’ve never done that before.
Running some tests would also tell me if my system performance is going to be tolerable. It is Xubuntu (dapper) on a Celeron 433MHz CPU, with only 256MB RAM. But it has a huge swap partition on a dedicated disk. For the assignment1 rails app, it did fine.
September 28th, 2007 at 12:26 pm
One thing you could do is open the archive I posted of the linkwizz project (the one with the screencast), create the tables, and run the app (from the top-level directory, ruby script/server then browse to http://localhost:3000).
The code is here: http://e168f07.7fff.com/private/code/
Unless you start running Rails projects that create lots and lots of objects, or do very compute-intensive things, this would be a good sanity check.
If you don’t run X-Windows, you can get a lot done on Linux with a CPU like that and a 256MB memory footprint.
October 2nd, 2007 at 12:34 pm
Is it me or can one not cut and paste in Windows “Command Prompt?” Are there better apps out there that anyone could recommend?
October 2nd, 2007 at 12:57 pm
i believe the standard solution to the windows command prompt inadequacy, barring an OS defection, is cygwin. But I am sure John knows more than I do about that. I defected way back in ought-three.
Max says, however, to proceed with caution where cygwin is concerned; there are some quirks.
October 2nd, 2007 at 1:14 pm
In Windows, if you click on the icon at the upper-left-hand-corner of the DOS window, you will see an Edit menu. On the Edit menu are Mark, Cut, and Paste.
October 2nd, 2007 at 1:21 pm
oh, well, provide a simple solution, why don’t you?
October 2nd, 2007 at 1:43 pm
The hard way to is get a secure shell into your Windows system. To do that, install Cygwin (http://www.cygwin.com), and then figure out how to get the Cygwin sshd server to work (http://pigtail.net/LRP/printsrv/cygwin-sshd.html). Then use Putty (free client), which provides awesome cut-and-paste.
October 2nd, 2007 at 1:54 pm
You can also right click on the blue bar at the top of the window, choose Properties, and then click on the Options tab. Under Edit Options, check the Quick Edit Mode. Then save it to apply to any window, not just the current one. You can then click inside your window and drag to select. Right-clicking in the highlighted area copies it to the clipboard. There’s probably a short cut for pasting, but I usually use the Paste command from the menu if I need to do that.
October 2nd, 2007 at 2:05 pm
Thank you one and all, It made me realize just how long it’s been, running Linux for years before converting to Mac (but not at work… yet!).
October 2nd, 2007 at 2:12 pm
Erik,
I remember John showed a tool called “FXri” or something like that. That tool (through what I’ve seen) provides a gui front to the ri command as well as a terminal for irb. I’m not sure if that terminal would be riding upon the Windows terminal or not. If it is not, then probably it will have some type of cut and paste (if it is, then you end up with the same problem).
Also, search for FXIrb.
October 27th, 2007 at 1:04 pm
Here’s a starter pager on Leopard and Rails:
http://weblog.rubyonrails.org/2007/10/26/today-is-leopard-day
I haven’t tried it yet (as I yet to have Leopard yet) but if you’re upgrading and wonder if it’s compatible with the class requirements this would be the place to start - http://weblog.rubyonrails.org/2007/10/26/today-is-leopard-day