Line 1: |
Line 1: |
− | ==Ruby on Rails 1.2 on the SME Server 7== | + | ==Ruby on Rails 2.0 on the SME Server 7== |
| | | |
− | '''Web development that doesn't hurt''' http://rubyonrails.org/ | + | [http://rubyonrails.org/ '''Web development that doesn't hurt'''] |
| | | |
| Ruby on Rails is an open-source web framework that's optimized for programmer happiness and sustainable productivity. It lets you write beautiful code by favouring over configuration. | | Ruby on Rails is an open-source web framework that's optimized for programmer happiness and sustainable productivity. It lets you write beautiful code by favouring over configuration. |
| | | |
− | Here is how to get it up and running on your SME Server. You need to be root (su -) to do the following actions. | + | Here is how to get up and running with [http://rubyonrails.org/ Rails] on your SME Server. |
| + | |
| + | You need to be root (su -) to do the following installation actions. |
| | | |
| ===Add CentOS – testing Repository=== | | ===Add CentOS – testing Repository=== |
| | | |
− | The '''base''' CentOS repositories have an outdated '''ruby''' version, so we need to get it from | + | The '''base''' CentOS repositories have an outdated [http://www.ruby-lang.org/en/ Ruby] version, so we need to get it from the CentOS testing repository. |
− | the CentOS testing repository. Setup the '''centos-testing''' repository as per below: | |
| | | |
− | db yum_repositories set centos-testing repository \
| + | Setup the '''centos-testing''' repository as per below: |
− | BaseURL http://dev.centos.org/centos/4.3/testing/i386/ \
| + | |
− | Name 'CentOS - testing' \
| + | db yum_repositories set centos-testing repository \ |
− | Visible yes \
| + | BaseURL http://dev.centos.org/centos/4/testing/i386/ \ |
− | GPGKey http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing \
| + | Name 'CentOS - testing' \ |
− | GPGCheck yes \
| + | Visible yes \ |
− | status disabled
| + | GPGKey http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing \ |
| + | GPGCheck yes \ |
| + | status disabled |
| | | |
| Regenerate the '''yum.conf''' file: | | Regenerate the '''yum.conf''' file: |
| | | |
− | expand-template /etc/yum.conf
| + | signal-event yum-modify |
| | | |
| ===Install Ruby=== | | ===Install Ruby=== |
Line 38: |
Line 41: |
| ===Install RubyGems=== | | ===Install RubyGems=== |
| | | |
− | RubyGems http://rubygems.org/ is the ruby packaging system. wget the latest version from the RubyForge repository (http://rubyforge.org/frs/?group_id=126). Unpack the tar file and install the package as per below:
| + | [http://rubygems.org/ RubyGems]is the ruby packaging system. wget the latest version from the [http://rubyforge.org/frs/?group_id=126 RubyForge repository]. Unpack the tar file and install the package as per below: |
| | | |
− | wget -c http://rubyforge.org/frs/download.php/17190/rubygems-0.9.2.tgz | + | wget -c http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz |
− | tar xzvf rubygems-0.9.2.tgz | + | tar xzvf rubygems-1.3.5.tgz |
− | cd rubygems-0.9.2 | + | cd rubygems-1.3.5 |
| ruby setup.rb | | ruby setup.rb |
| cd .. | | cd .. |
Line 48: |
Line 51: |
| ===Install Rails=== | | ===Install Rails=== |
| | | |
− | With the gem package manager installed, you are now one step away from installing Rails http://rubyonrails.org/ | + | With the gem package manager installed, you are now one step away from installing [http://rubyonrails.org/ Rails] |
| + | |
| + | gem install rails |
| | | |
− | gem install rails –-include-dependencies
| + | At the moment (Jun 2009) this will install Rails 2.3.2 onto your system, ready for deploying Rails based applications (or creating your own). |
| | | |
| ==Creating a New Rails Application== | | ==Creating a New Rails Application== |
Line 71: |
Line 76: |
| work> cd demo | | work> cd demo |
| demo> ls -p | | demo> ls -p |
− | app/ config/ doc/ log/ Rakefile script/ tmp/ | + | app/ config/ db/ doc/ lib/ log/ public/ |
− | components/ db/ lib/ public/ README test/ vendor/ | + | Rakefile README script/ test/ tmp/ vendor/ |
| | | |
| Start the embedded webserver: | | Start the embedded webserver: |
| | | |
| demo> ruby script/server | | demo> ruby script/server |
− | => Booting Mongrel (use 'script/server webrick' to force WEBrick) | + | => Booting WEBrick |
− | => Rails application starting on http://0.0.0.0:3000 | + | => Rails 2.3.2 application starting on http://0.0.0.0:3000 |
| => Call with -d to detach | | => Call with -d to detach |
| => Ctrl-C to shutdown server | | => Ctrl-C to shutdown server |
− | ** Starting Mongrel listening at 0.0.0.0:3000 | + | [2009-06-30 10:12:48] INFO WEBrick 1.3.1 |
− | ** Starting Rails with development environment...
| + | [2009-06-30 10:12:48] INFO ruby 1.8.5 (2006-08-25) [i386-linux] |
− | ** Rails loaded. | + | [2009-06-30 10:12:48] INFO WEBrick::HTTPServer#start: pid=3424 port=3000 |
− | ** Loading any Rails specific GemPlugins
| |
− | ** Signals ready. TERM => stop. USR2 => restart. INT => stop (no restart).
| |
− | ** Rails signals registered. HUP => reload (without restart). It might not work well. | |
− | ** Mongrel available at 0.0.0.0:3000
| |
− | ** Use CTRL-C to stop.
| |
| | | |
| And open up your browser to http://your_server_url:3000 and admire the welcome page of your new Rails application! | | And open up your browser to http://your_server_url:3000 and admire the welcome page of your new Rails application! |
Line 103: |
Line 103: |
| TextMate http://macromates.com/ (MAC OS X) | | TextMate http://macromates.com/ (MAC OS X) |
| | | |
− | RadRails http://www.radrails.org/ (Eclipse IDE) | + | RadRails http://www.aptana.com/rails/ (Aptana Studio -or- Eclipse IDE) |
| | | |
| ---- | | ---- |
| [[Category:Howto]] | | [[Category:Howto]] |
| + | [[Category:Development Tools]] |