Thursday, May 14, 2009

Ruby on Rails, a pain in windows for a beginner…

My Installation Notes… Incase I forget, so that I don't waste time later on…

Download and Install:
MYSQL:
http://dev.mysql.com/downloads/mysql/5.0.html#win32
CYGWIN:http://www.cygwin.com/setup.exe
            Save and run setup.exe in c:\cygwin\pkg\
            Select Site
http://mirrors.dotsrc.org/
            Do Default Install
CONSOLE:
http://sourceforge.net/projects/console
            Install / Copy to Path
            Note to self: Always run as Admin
e-TextEditor or jEdit

Cygwin Additional Packages Install:
All->Admin->Cron
All->Archive->All
All->Devel->Ruby (Required for RoR)
All->Web->Curl
(Required for Download additional packages)
All->Web->Wget
(Required for Download additional packages)
All->Devel->subversion-ruby
(Subversion System Option 1)
All->Devel->GCC (Required for MySql in RoR)
All->Devel->git (Subversion System Option 2)
All->Devel->git-completion (Subversion System Option 2)
All->Devel->make (Required for MySql in RoR)
All->Net->netcat
All->Net->ncftp
All->Net->ping
All->Net->whois
All->Shells->All
All->Web->httPing
All->Devel->autoconf
All->Devel->automake
All->Devel->bison
All->Devel->boost
All->Devel->ctags
All->Devel->cmake
All->Devel->cogito (Subversion System Option 2)
All->Devel->doxygen
All->Devel->gcc4
All->Devel->makedepend
All->Devel->pkg-config
All->Devel->robodoc
All->Devel->swig
All->Graphics->ImageMagick
(Required for RMagick)
All->Libs->libbz2-devel (Required for RMagick)
All->Libs->libmagick-devel (Required for RMagick)
NA->NA->XFree86-lib-compat (Not Available Now)
NA->NA->xorg-x11-devel
(Not Available Now)
All->Devel->openssl-devel (Not sure if MySql requires this)
All->Editors->joe
All->Editors->nano
All->Editors->mc
All->Editors->vim
All->Database->sqlite3 (Not sure if required)
All->Libs->libreadline5
(with source – Not required)
All->Libs->libreadline6 (with source – Only RTM required)
All->Web->fcgi
All->Utils->file
All->Utils->time

Start C:\Cygwin\Cygwin.bat
Technorati Tags: ,,

Exit

In home directory:
wget
http://rubyforge.org/frs/download.php/56227/rubygems-1.3.3.tgz
tar xvfz rubygems-1.3.3.tgz
cd rubygems-1.3.3
unset RUBYOPT
ruby setup.rb
gem update --system OR 
gem install rails
gem install actionwebservice
gem install capistrano mongrel railsmachine
gem install gem_plugin daemons rspec
gem install ZenTest
gem install rmagick

cd /etc/
echo [client]$'\n'host=127.0.0.1$'\n'[mysqld]$'\n'host=127.0.0.1$'\n' > my.cnf

cd /cygwindrive/c/
mkdir mysql-src
cd mysql-src

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.34.tar.gz/from/http://mysql.mirrors.pair.com/

tar xvfz mysql-5.1.34.tar.gz
cd mysql-5.1.34

./configure --prefix=/cygwindrive/c/mysql-src/mysql-5.1.34 --exec-prefix=/cygwindrive/c/mysql-src/mysql-5.1.34 --without-server --without-docs --without-man --with-mysql=/cygwindrive/c/mysql-src/mysql-5.1.34/mysql_config

cd include
make
make install
cd ..
cd libmysql
make
make install
cd ..
cd ..
wget
http://dev.mysql.com/get/Downloads/Connector-C/mysql-connector-c-6.0.1.tar.gz/from/http://mysql.mirrors.pair.com/
tar xvfz mysql-connector-c-6.0.1.tar.gz
cd mysql-connector-c-6.0.1
cd include
cp *.* /usr/local/include/mysql/*.*
cd mysys
cp *.* /usr/local/include/mysql/*.*
cd ..
cd atomic
cp *.* /usr/local/include/mysql/*.*
cd ~
gem install mysql
Customize CYGWIN:
Edit C:\cygwin\home\{USERNAME}\.bashrc
Add the following:

            Inside # Aliases
                        # #######
# Shorten commonly used commands
alias srv='script/server'
alias mig='rake db:migrate'
alias log='tail -f log/development.log'
alias installrspec=’install svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec’
alias installrspeconrails=’install svn://rubyforge.org/var/svn/rspec/tags/CURRENT/rspec_on_rails’

# If using e-Texteditor uncomment below line
# alias e='cygstart e'
# Now you can use “e .” inside your /rails/app directory to open

# If using jEdit uncomment below line
# alias j='cygstart jedit'
# now you can use "j ." inside your /rails/app directory to open

            Inside # Shell Options
                        # #############
# Mount custom directory to your cygwin environment
# You can then access these directories using cd /rails
mount -f -u -b "E:\MyRailsProjects" "/rails"
# For autochange directory uncomment below line
# cd /rails

Customize Console2:
Settings->Tabs->Add->
            Shell = c:\cygwin\bin\bash --login -i
            Background = R0, G47, B94
            Cursor Color = White

For Rail Apps:
Go to Rails Directory:
            cd /rails
Create App:
            rails app
Go to App Directory:
            cd app
Create Databases:
            mysqladmin -uroot create app_development
            mysqladmin -uroot create app_test
Install the RSpec:
             ruby script/plugin installrspec
Install the Spec:Rails Plugins:
            ruby script/plugin installrspeconrails
Generate RSpec:
            ruby script/generate rspec
For Model:
            ruby script/generate rspec_model post
For Controller:
            ruby script/generate rspec_controller blog

No comments:

Post a Comment