Ruby installation version 1.8.7 & 1.9.1 on win32 platforms with rubyinstaller

Posted by superuser Fri, 26 Feb 2010 08:41:00 GMT

Luis Lavena and the rubyinstaller group have made 2 very reliable versions of Ruby programming language for Windows platforms.

Unlike the old ruby installer, the 1.8.7 and 1.9.1 versions have been compiled with the MinGW compiler(v. 3.4.5) toolset. Easy installing for Windows is essential for the future of Ruby in the programming jungle, and RubyInstaller works perfectly good.

This article should be intended as a minimal guide to install both Ruby 1.8.7 and Ruby 1.9.1 on win32 platforms.

  • Uninstall any previous installed Ruby version and remove the relative folders (for ex. C:\Ruby and/or C:\Ruby19 )
  • Install Ruby 1.8.7-p249
    • Accept the license (if you agree, of course)
    • Select the destination path of your installation. (i use the default C:\Ruby). Below, in the same window
    • Check the box Ruby executables to your PATH (IMPORTANT!) and “Associate .rb and .rbw files with this Ruby installation”
  • Finish the installation

Ruby 1.8 is succesfully installed!

Now it’s time to install Ruby 1.9 .

  • Install Ruby 1.9.1-p378
    • Accept the license
    • Select the destination path of your installation. (i use the default C:\Ruby19). Below, in the same window
    • DO NOT select anything . Leave both check boxs unchecked.
  • Finish the installation

Ruby 1.9 is succesfully installed!

To run Ruby 1.9 binaries you have to use absolute paths. C:\Ruby19\bin\whatever. That’s not so pretty!
To resolve this, i use an easy and smart method found on some discussions at the rubyinstaller google group.

The idea is to put some .bat (windows) scripts in the bin directory of the Ruby 1.8 installation to call internally the Ruby 1.9 binaries. In this way you do not have to add the Ruby 1.9 directory in your PATH env. variable. For my needs this work perfectly good.

In detail:

  • Download Ruby-Bat.rar . Unrar it. Move the five included .bat files (gem19.bat, irb19.bat, rake19.bat, ri19.bat, ruby19.bat) in your ruby-1.8 (not 1.9) installation directory (in my case this is C:\Ruby\bin).
    That’s all.

Open your command prompt and execute :

C:>irb19 
C:>gem19 install rack
C:>ri19 array
C:>rake19 -h

It works!

If you want to know more, open with your favorite editor for example rake19.bat to see what’s inside:

@echo off 
setlocal 
set PATH=C:\Ruby19\bin;%WINDIR%\system32;%WINDIR% 
ruby.exe -S rake %* 
endlocal 

If you need to make a custom ruby(v-1.9) binary just change the filename, substitute `rake` and save it in your ruby-1.8 (not 1.9) installation directory ( C:\Ruby\bin ). Not a perfect solution, but it just works as it should.

Posted in ,  | Tags , , ,  | no comments

Create your blog with TYPO

Posted by superuser Sun, 29 Jun 2008 10:43:00 GMT

a Ruby On Rails app

In this article you can find how to install & create your blog with Typo (v. 4.1.1) easily in a few steps. The only requirement is that you have already installed on your machine Ruby, Ruby on rails and some required gems by typo (mongrel, mysql, mysql, rcov, rspec, xmpp4r, flexmock, hoe, ruby-debug and ruby-debug-base). My local gem reports the following packages (with version):

*** LOCAL GEMS ***

actionmailer (1.3.6)
actionpack (1.13.6)
actionwebservice (1.2.6)
activerecord (1.15.6)
activeresource (2.1.0)
activesupport (1.4.4)
cgi_multipart_eof_fix (2.5.0)
cmdparse (2.0.2)
columnize (0.1)
daemons (1.0.10)
ezcrypto (0.7)
fastercsv (1.2.3)
fastthread (1.0.1)
flexmock (0.8.2)
gem_plugin (0.2.3)
highline (1.4.0)
hoe (1.5.3)
linecache (0.43)
mime-types (1.15)
mini_magick (1.2.3)
mongrel (1.1.5)
mongrel_cluster (1.0.5)
mysql (2.7)
rails (1.2.6)
rake (0.8.1)
rcov (0.8.1.2.0)
rspec (1.1.4)
ruby-debug (0.10.1)
ruby-debug-base (0.10.1)
rubyforge (1.0.0)
rubygems-update (1.1.1)
sources (0.0.2)
xmpp4r (0.3.2)
As you can see i use rails v. 1.2.6 and this is main reason that i use the 4.1.1 version of Typo (the last Typo version is 5.0.3 and is fully documented on the official site of Typo, but you'll need RoR 2.x version.

Let's start building our Typo-4.1.1 blog:

  • Download typo-4.1.1.tgz (use fetch or wget or via ftp)
    $ fetch http://rubyforge.org/frs/download.php/20466/typo-4.1.1.tgz
  • Extract this in your rails work directory
    $ cd my-rails-work-dir
    $ tar -zxvf 	typo-4.1.1.tgz
  • If now you look in your rails work directory you'll see that typo-4.1.1 rails app directory is created. Before proceeding i suggest you to rename your blog in order to add later more blogs in the same rails work dir.
    $ mv typo-4.1.1 MyWonderfulBlog
    That's it. Now i'm ready to configure in a few step my new blog. All work will be done inside MyWonderfulBlog directory.
  • Go in ~/MyWonderfulBlog/config/ and copy database.yml.example as database.yml
    $  cp database.yml.example database.yml 
    The app is already developed so you can choose to work directly in production environment. Truely, there is no need to select development, but if you do so, there is always an easy way to switch from development in production environment. If you prefer to work in development environment In the following description just replace prod with dev.
  • Let's check database.yml with our favorite editor. In production environment you'll only need to leave the production section. I'll change the database names - i'll use more than one blogs in the same system - so i don't want my databases to have the same name. I'll use a safe mysql username & password as the following:
    production:
      adapter: mysql
      encoding: utf8
      database: wonderfulblog_prod
      username: safesql
      password: mysqlko9
      socket: /tmp/mysql.sock
    Note: I use freebsd (is a unix system) so maybe the socket /tmp/mysql.sock could be different in your case.
  • It's time to create my database
    $ mysqladmin -u root -p create wonderfulblog_prod
    Enter password: [enter your mysql root password here]
    ...and it's done.
  • Grant privileges at the db user: safesql for the production database wonderfulblog_prod
    $ mysql -u root -p
    Enter password:
    
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is xxx
    Server version: 5.0.51a FreeBSD port: mysql-server-5.0.51a
    
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    
    mysql> grant all privileges on wonderfulblog_prod.* to 'safesql'@'localhost' 
    identified by 'mysqlko9';
    Query OK, 0 rows affected (0.09 sec)
    
    mysql> flush privileges;
    Query OK, 0 rows affected (0.05 sec)
    
    mysql> \q
    Bye
  • Populate your database with the typo app data. The right way to act is with the magic "rake db:migrate" command, but with the version 4.1.1 this doesn't work. Use instead:
    $ rake migrate  RAILS_ENV='production'
    (note: in development environment use simply "rake migrate") Rake will extract all necessary items in your database.
  • That's all! Now Typo is ready to run! I use Mongrel to fire up my rails apps, because Mongrel it's easy to setup, run & control. Once Mongrel is set up with a single command i get in production my application (the typo in this case, but similarly works with any app). You have only to select a port (default 3000, i use 8921 in this example), use the flag -d (daemonized - runs in background) and specify the production environment (if you don't use the flag -e, Typo select development environment by default).
    $  mongrel_rails start -d -p 8921  -e production
  • Open your browser and point to http://localhost:8921/admin . It's important to put a username & password in order to safe your blog. After that you can access the administration interface ( http://localhost:8921/admin ), and view the results in http://localhost:8921 .

    In the next article i'll see you how i manage the interface. Until then have a good time!

    Posted in  | Tags , , , , , , , , ,  | 2 comments

  • Εγκατάσταση FreeBSD 6.2 (Πόρτες, προγράμματα)

    Posted by superuser Mon, 09 Apr 2007 12:07:00 GMT

    Μετά την επανακκίνηση κάντε login. Αν ακολουθήσατε κατά γράμμα τις συμβουλές μας τότε ο υπολογιστής σας δεν περιέχει κανένα πρόγραμμα. Για να βλέπετε οποισδήποτε στιγμή ποια προγράμματα είναι εγκατεστημένα δώστε:

    $ pkg_info

    Στην περίπτωση μας εμφανίζεται μόνο το

    linux_base-fc-4_9   Base set of packages ...

    Πρώτη εφαρογή που πρέπει να προσθέσουμε ειναι η συλλογή πορτών. Οι πόρτες στην FreeBSD είναι μια λίστα χιλιάδων εφαρμογών, προγραμμάτων που μας επιτρέπει να τα εγκαταστήσουμε άμεσα στον υπολογιστή μας. Δεν χρειάζεται καμμιά ιδιαίτερη ικανότητα προγραμματισμού για να κάνετε την εγκατάσταση.

    Ας εγκαταστήσουμε την συλλογή πορτών (Collection Ports) από το Sysinstall (απλά και μόνο για να δείτε πως μπορούμε ανά πάσα στιγμή να δουλεύουμε και με αυτό το εργαλείο). Από το shell σαν root δίνω:

    # /usr/sbin/sysinstall
    και μου εμφανίζεται το Sysinstall Main Menu. Για να επιλέξετε να εγκαταστήσετε τις πόρτες επιλέξτε Configure(Do post-install configuration of FreeBSD) και μετά distributions(Install Additional Distribution Sets). Η τελευταία επιλογή είναι ports(The FreeBSD ports Collection). Την επιλέγουμε και εγκαθίσταται αυτόματα. Βγαίνουμε από το Sysinstall. Αυτη τη διαδικασία θα μπορούσαμε να την ακολουθούμε για όλα τα πακέτα προγραμμάτων που θέλουμε να φορτώνουμε. Όμως θα δούμε στη συνέχεια ποσο απλά μπορεί να γίνει κατ'ευθείαν από τις πόρτες.

    Πηγαίνουμε στις πόρτες:

    $ cd /usr/ports
    Εδώ βρίσκονται μια σειρά από κατηγορίες προγραμμάτων. Μπείτε σε μερικές απ'αυτές να πάρετε μια ιδέα ή δείτε εδώ. Για παράδειγμα, ας υποθέσουμε πως θέλουμε να εγκαταστήσουμε το σχεδιαστικό πρόγραμμα gimp. Κατ'αρχήν θέλω να βρω σε ποια πόρτα βρίσκεται με την εντολή whereis:
    # whereis gimp
    και η απάντηση είναι:
    gimp: /usr/ports/graphics/gimp
    . Μεταφέρομαι στην πόρτα
    # cd /usr/ports/graphics/gimp
    . Για να εγκαταστήσω το εκάστοτε πρόγραμμα δίνω το μαγικό
     # make install clean 
    . Αυτό είναι όλο. Ας δούμε όμως λίγο από ποια προγράμματα/libraries εξαρτάται το gimp: aalib-1.4.r5_2, expat-2.0.0_1, fontconfig-2.4.2,1, freetype2-2.2.1_1, gettext-0.16.1_1, gimp-print-4.2.7_2, glib-1.2.10_12, gmake-3.81_1, gtk-1.2.10_17, jpeg-6b_4, libdrm-2.0.2, libiconv-1.9.2_2, libijs-0.35_1, libtool-1.5.22_4, perl-5.8.8, pkg-config-0.21, png-1.2.14, tiff-3.8.2_1, xorg-libraries-6.9.0_1 . Ακολουθώντας την μέθοδο εγκατάστασης μέσω πορτών και μέσω FTP (μια γρήγορη σύνδεση είναι απαραίτητη) δεν χρειάζεται ν'ανησηχούμε για την τυχόν έλλειψη κάποιας βιβλιοθήκης ή σχετικής εφαρμογής, διοτι αν κάτι λείπει, το σύστημα θα φροντίσει να το κατεβάσει μέσω FTP και εγκαταστήσει από μόνο του.

    Επομένως για κάθε εφαρμογή που θέλω να εγκαταστήσω πηγαίνω στην πόρτα της (/usr/ports/...) και εκτελώ make install clean. Η εντολή make στην ουσία εκτελεί το αρχείο Makefile που περιέχεται στην directory της πόρτας. Μεταγλωττίζει (κάνει compile) τον πηγιαίο κώδικα και δημιουργεί το εκτελέσιμο πρόγραμμα. Η εντολή make install εγκαθιστά το πρόγραμμα στους τοπικούς φακέλους μας - συνήθως /usr/local/... - και η εντολή make clean σβήνει τους μεταφρασμένους κώδικες που δεν χρειάζονται πια αφού έχουν εγκατασταθεί το πρόγραμμα. Και όντως μπορείτε να εκτελέσετε μία-μία τις τρεις εντολές. Δείτε τα εγκατεστημένα πακέτα με

    $ pkg_info
    . Καλή εγκατάσταση.


    ____________________________________________________

    Comments Re: Εγκατάσταση FreeBSD 6.2 (Πόρτες, προγράμματα) afou exw egatasthsh to kde pos mporo na kanw to pc na ksekinaei automata se kde perivalon? Καταχωρήθηκε από: tux at January 17,2008 13:37

    Re: Εγκατάσταση FreeBSD 6.2 (Πόρτες, προγράμματα) Πρόσθεσε σε μια νέα γραμμή στο αρχείο /etc/rc.conf :

    kdm_enable="YES"
    Κάνε επανακκίνηση και αν είναι σωστά εγκατεστημένο το KDE - και κυρίως αν το xorg αν είναι σωστά ρυθμισμένο - θα ξεκινήσει αυτόματα. Καταχωρήθηκε από: superuser at January 17,2008 15:00

    Re: Εγκατάσταση FreeBSD 6.2 (Πόρτες, προγράμματα) evala to kdm_enable="YES" sto /etc/rc.conf ekana reboot kai tpt .Otan kano egatastash to gnome kai bazo sto /etc/rc.conf gdm_enable="YES" mpeno amesos se grafiko perivalon gnome xwris na pirakso ka8olou to xorg.conf des to /etc/X11/xorg.conf mou

    Section "ServerLayout"
    Identifier "X.org Configured"
    Screen 0 "Screen0" 0 0
    InputDevice "Mouse0" "CorePointer"
    InputDevice "Keyboard0" "CoreKeyboard"
    EndSection
    
    Section "Files"
    RgbPath "/usr/local/share/X11/rgb"
    ModulePath "/usr/local/lib/xorg/modules"
    FontPath "/usr/local/lib/X11/fonts/misc/"
    FontPath "/usr/local/lib/X11/fonts/TTF/"
    FontPath "/usr/local/lib/X11/fonts/OTF"
    FontPath "/usr/local/lib/X11/fonts/Type1/"
    FontPath "/usr/local/lib/X11/fonts/100dpi/"
    FontPath "/usr/local/lib/X11/fonts/75dpi/"
    EndSection
    
    Section "Module"
    Load "GLcore"
    Load "dbe"
    Load "dri"
    Load "extmod"
    Load "glx"
    Load "record"
    Load "xtrap"
    Load "freetype"
    Load "type1"
    EndSection
    
    Section "InputDevice"
    Identifier "Keyboard0"
    Driver "kbd"
    EndSection
    
    Section "InputDevice"
    Identifier "Mouse0"
    Driver "mouse"
    Option "Protocol" "auto"
    Option "Device" "/dev/sysmouse"
    Option "ZAxisMapping" "4 5 6 7"
    EndSection
    
    Section "Monitor"
    Identifier "Monitor0"
    VendorName "Monitor Vendor"
    ModelName "Monitor Model"
    EndSection
    
    Section "Device"
    ### Available Driver options are:-
    ### Values: : integer, : float, : "True"/"False",
    ### : "String", : " Hz/kHz/MHz"
    ### [arg]: arg optional
    #Option "ShadowFB" # []
    #Option "DefaultRefresh" # []
    #Option "ModeSetClearScreen" # []
    Identifier "Card0"
    Driver "vesa"
    VendorName "ATI Technologies Inc"
    BoardName "Unknown Board"
    BusID "PCI:1:0:0"
    EndSection
    
    Section "Screen"
    Identifier "Screen0"
    Device "Card0"
    Monitor "Monitor0"
    SubSection "Display"
    Viewport 0 0
    Depth 1
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 4
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 8
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 15
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 16
    EndSubSection
    SubSection "Display"
    Viewport 0 0
    Depth 24
    EndSubSection
    EndSection
    Καταχωρήθηκε από: tux at January 18,2008 13:25

    Re: Εγκατάσταση FreeBSD 6.2 (Πόρτες, προγράμματα) Αν ξεκινά κανονικά στο gnome δεν υπάρχει πρόβλημα με το xorg.conf. Προσπάθησε να δώσεις σαν root:

    # echo "exec startkde" > ~/.xinitrc
    
    και δώσε αμέσως μετά (δίχως reboot)
    # startx
    
    Αν ξεκινήσει το KDE τότε πιθανώς να μην ισχύει πια το kdm_enable="YES" που σου είπα προηγούμενα (είδα πως στο handbook πως δεν αναφέρεται πια. Εγώ χρησιμοποιώ gnome). Αν δεν ξεκινήσει, με την διαδικασία αυτή, στείλε το αρχείο αναφοράς του Xorg (/var/log/Xorg.x.log). Τσέκαρε πριν με pkg_info αν όντως το kde είναι εγκατεστημένο. Καταχωρήθηκε από: superuser at January 20,2008 00:13

    Posted in  | Tags , , , , ,  | no comments