https://wiki.archlinux.org/api.php?action=feedcontributions&user=Exis10z&feedformat=atomArchWiki - User contributions [en]2024-03-29T00:26:23ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Ruby&diff=105151Ruby2010-05-01T18:34:38Z<p>Exis10z: /* RubyGems */</p>
<hr />
<div>[[Category:Development (English)]]<br />
Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or are not working on any legacy systems.<br />
<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=30221], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8<br />
<br />
RubyGems must be installed seperately from another package[http://aur.archlinux.org/packages.php?ID=30224]:<br />
# yaourt -S rubygems1.8<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=36898], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8.6-legacy<br />
<br />
RubyGems must be installed seperately using the standard rubygems package[http://aur.archlinux.org/packages.php?ID=33312]:<br />
# yaourt -S rubygems<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}<br />
<br />
== RubyGems ==<br />
''gem'' is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. The ''gem'' command will be installed if you followed the installation instructions above.<br />
<br />
=== Running as root ===<br />
When running gem as root, gems will be installed for everyone on the machine. This has the advantage of simplicity and is the most reliable method, but updating or installing gems without everyone's knowledge (like on a shared server) might cause Ruby applications to break.<br />
<br />
When not running gem as root, the gems will be installed into ~/.gem and not affect anyone else, although it might be worth noting that not all gems are happy to be installed in this way and might insist on being installed by root (especially if they have native extensions).<br />
<br />
Bundler[http://github.com/carlhuda/bundler] solves these problems to some extent by packaging gems into your application. See the section below on using bundler.<br />
<br />
=== Updating RubyGems ===<br />
# [sudo] gem update --system<br />
<br />
=== Installing a gem ===<br />
This example installs the MySQL ruby gem:<br />
# [sudo] gem install mysql<br />
<br />
The process can be speeded up somewhat if you don't need local documentation:<br />
# [sudo] gem install mysql --no-rdoc --no-ri<br />
<br />
The gem will now be downloaded, compiled if necessary, and installed.<br />
<br />
=== Bundler ===<br />
Bundler[http://github.com/carlhuda/bundler] installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of [[Ruby On Rails]] applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier.<br />
<br />
It might be a good idea to install bundler as a system-wide gem so everyone can use it:<br />
# [sudo] gem install bundler<br />
<br />
To start a new bundle:<br />
# bundle init<br />
<br />
Then add your required gems into "Gemfile" in the current directory (created by bundle init):<br />
gem "rails", "2.3.4"<br />
gem "mysql"<br />
<br />
Finally, run the following to install your gems. They will all be installed locally into ~/.bundle, eliminating the need for root access:<br />
# bundle install<br />
<br />
== See also ==<br />
* [[Ruby On Rails]]<br />
<br />
== References ==<br />
* Ruby - ruby-lang.org/<br />
* Rubyforge - http://rubyforge.org<br />
* Bundler - http://github.com/carlhuda/bundler</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby&diff=105150Ruby2010-05-01T18:33:53Z<p>Exis10z: /* Bundler */</p>
<hr />
<div>[[Category:Development (English)]]<br />
Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or are not working on any legacy systems.<br />
<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=30221], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8<br />
<br />
RubyGems must be installed seperately from another package[http://aur.archlinux.org/packages.php?ID=30224]:<br />
# yaourt -S rubygems1.8<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=36898], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8.6-legacy<br />
<br />
RubyGems must be installed seperately using the standard rubygems package[http://aur.archlinux.org/packages.php?ID=33312]:<br />
# yaourt -S rubygems<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}<br />
<br />
== RubyGems ==<br />
gem is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. RubyGems will be installed if you followed the installation instructions above.<br />
<br />
=== Running as root ===<br />
When running gem as root, gems will be installed for everyone on the machine. This has the advantage of simplicity and is the most reliable method, but updating or installing gems without everyone's knowledge (like on a shared server) might cause Ruby applications to break.<br />
<br />
When not running gem as root, the gems will be installed into ~/.gem and not affect anyone else, although it might be worth noting that not all gems are happy to be installed in this way and might insist on being installed by root (especially if they have native extensions).<br />
<br />
Bundler[http://github.com/carlhuda/bundler] solves these problems to some extent by packaging gems into your application. See the section below on using bundler.<br />
<br />
=== Updating RubyGems ===<br />
# [sudo] gem update --system<br />
<br />
=== Installing a gem ===<br />
This example installs the MySQL ruby gem:<br />
# [sudo] gem install mysql<br />
<br />
The process can be speeded up somewhat if you don't need local documentation:<br />
# [sudo] gem install mysql --no-rdoc --no-ri<br />
<br />
The gem will now be downloaded, compiled if necessary, and installed.<br />
<br />
=== Bundler ===<br />
Bundler[http://github.com/carlhuda/bundler] installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of [[Ruby On Rails]] applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier.<br />
<br />
It might be a good idea to install bundler as a system-wide gem so everyone can use it:<br />
# [sudo] gem install bundler<br />
<br />
To start a new bundle:<br />
# bundle init<br />
<br />
Then add your required gems into "Gemfile" in the current directory (created by bundle init):<br />
gem "rails", "2.3.4"<br />
gem "mysql"<br />
<br />
Finally, run the following to install your gems. They will all be installed locally into ~/.bundle, eliminating the need for root access:<br />
# bundle install<br />
<br />
== See also ==<br />
* [[Ruby On Rails]]<br />
<br />
== References ==<br />
* Ruby - ruby-lang.org/<br />
* Rubyforge - http://rubyforge.org<br />
* Bundler - http://github.com/carlhuda/bundler</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby&diff=105149Ruby2010-05-01T18:32:14Z<p>Exis10z: Add category</p>
<hr />
<div>[[Category:Development (English)]]<br />
Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or are not working on any legacy systems.<br />
<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=30221], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8<br />
<br />
RubyGems must be installed seperately from another package[http://aur.archlinux.org/packages.php?ID=30224]:<br />
# yaourt -S rubygems1.8<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=36898], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8.6-legacy<br />
<br />
RubyGems must be installed seperately using the standard rubygems package[http://aur.archlinux.org/packages.php?ID=33312]:<br />
# yaourt -S rubygems<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}<br />
<br />
== RubyGems ==<br />
gem is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. RubyGems will be installed if you followed the installation instructions above.<br />
<br />
=== Running as root ===<br />
When running gem as root, gems will be installed for everyone on the machine. This has the advantage of simplicity and is the most reliable method, but updating or installing gems without everyone's knowledge (like on a shared server) might cause Ruby applications to break.<br />
<br />
When not running gem as root, the gems will be installed into ~/.gem and not affect anyone else, although it might be worth noting that not all gems are happy to be installed in this way and might insist on being installed by root (especially if they have native extensions).<br />
<br />
Bundler[http://github.com/carlhuda/bundler] solves these problems to some extent by packaging gems into your application. See the section below on using bundler.<br />
<br />
=== Updating RubyGems ===<br />
# [sudo] gem update --system<br />
<br />
=== Installing a gem ===<br />
This example installs the MySQL ruby gem:<br />
# [sudo] gem install mysql<br />
<br />
The process can be speeded up somewhat if you don't need local documentation:<br />
# [sudo] gem install mysql --no-rdoc --no-ri<br />
<br />
The gem will now be downloaded, compiled if necessary, and installed.<br />
<br />
=== Bundler ===<br />
Bundler[http://github.com/carlhuda/bundler] installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of [[Ruby On Rails]] applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier.<br />
<br />
It might be a good idea to install bundler as a system-wide gem so everyone can use it:<br />
# [sudo] gem install bundler<br />
<br />
To start a new bundle:<br />
# bundle init<br />
<br />
Then add your required gems into the "Gemfile" file created by the above command:<br />
gem "rails", "2.3.4"<br />
gem "mysql"<br />
<br />
Finally, run the following to install your gems. They will all be installed locally into ~/.bundle, eliminating the need for root access:<br />
# bundle install<br />
<br />
== See also ==<br />
* [[Ruby On Rails]]<br />
<br />
== References ==<br />
* Ruby - ruby-lang.org/<br />
* Rubyforge - http://rubyforge.org<br />
* Bundler - http://github.com/carlhuda/bundler</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby&diff=105148Ruby2010-05-01T18:30:32Z<p>Exis10z: </p>
<hr />
<div>Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or are not working on any legacy systems.<br />
<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=30221], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8<br />
<br />
RubyGems must be installed seperately from another package[http://aur.archlinux.org/packages.php?ID=30224]:<br />
# yaourt -S rubygems1.8<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=36898], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8.6-legacy<br />
<br />
RubyGems must be installed seperately using the standard rubygems package[http://aur.archlinux.org/packages.php?ID=33312]:<br />
# yaourt -S rubygems<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}<br />
<br />
== RubyGems ==<br />
gem is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. RubyGems will be installed if you followed the installation instructions above.<br />
<br />
=== Running as root ===<br />
When running gem as root, gems will be installed for everyone on the machine. This has the advantage of simplicity and is the most reliable method, but updating or installing gems without everyone's knowledge (like on a shared server) might cause Ruby applications to break.<br />
<br />
When not running gem as root, the gems will be installed into ~/.gem and not affect anyone else, although it might be worth noting that not all gems are happy to be installed in this way and might insist on being installed by root (especially if they have native extensions).<br />
<br />
Bundler[http://github.com/carlhuda/bundler] solves these problems to some extent by packaging gems into your application. See the section below on using bundler.<br />
<br />
=== Updating RubyGems ===<br />
# [sudo] gem update --system<br />
<br />
=== Installing a gem ===<br />
This example installs the MySQL ruby gem:<br />
# [sudo] gem install mysql<br />
<br />
The process can be speeded up somewhat if you don't need local documentation:<br />
# [sudo] gem install mysql --no-rdoc --no-ri<br />
<br />
The gem will now be downloaded, compiled if necessary, and installed.<br />
<br />
=== Bundler ===<br />
Bundler[http://github.com/carlhuda/bundler] installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of [[Ruby On Rails]] applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier.<br />
<br />
It might be a good idea to install bundler as a system-wide gem so everyone can use it:<br />
# [sudo] gem install bundler<br />
<br />
To start a new bundle:<br />
# bundle init<br />
<br />
Then add your required gems into the "Gemfile" file created by the above command:<br />
gem "rails", "2.3.4"<br />
gem "mysql"<br />
<br />
Finally, run the following to install your gems. They will all be installed locally into ~/.bundle, eliminating the need for root access:<br />
# bundle install<br />
<br />
== See also ==<br />
* [[Ruby On Rails]]<br />
<br />
== References ==<br />
* Ruby - ruby-lang.org/<br />
* Rubyforge - http://rubyforge.org<br />
* Bundler - http://github.com/carlhuda/bundler</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby&diff=105147Ruby2010-05-01T18:29:16Z<p>Exis10z: </p>
<hr />
<div>Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or simply want the assurance that most tools and gems will work without hassle.<br />
<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=30221], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8<br />
<br />
RubyGems must be installed seperately from another package[http://aur.archlinux.org/packages.php?ID=30224]:<br />
# yaourt -S rubygems1.8<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=36898], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8.6-legacy<br />
<br />
RubyGems must be installed seperately using the standard rubygems package[http://aur.archlinux.org/packages.php?ID=33312]:<br />
# yaourt -S rubygems<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}<br />
<br />
== RubyGems ==<br />
gem is the package manager of sorts for Ruby modules (called Gems), somewhat comparable to what pacman is to Arch Linux. RubyGems will be installed if you followed the installation instructions above.<br />
<br />
=== Running as root ===<br />
When running gem as root, gems will be installed for everyone on the machine. This has the advantage of simplicity and is the most reliable method, but updating or installing gems without everyone's knowledge (like on a shared server) might cause Ruby applications to break.<br />
<br />
When not running gem as root, the gems will be installed into ~/.gem and not affect anyone else, although it might be worth noting that not all gems are happy to be installed in this way and might insist on being installed by root (especially if they have native extensions).<br />
<br />
Bundler[http://github.com/carlhuda/bundler] solves these problems to some extent by packaging gems into your application. See the section below on using bundler.<br />
<br />
=== Updating RubyGems ===<br />
# [sudo] gem update --system<br />
<br />
=== Installing a gem ===<br />
This example installs the MySQL ruby gem:<br />
# [sudo] gem install mysql<br />
<br />
The process can be speeded up somewhat if you don't need local documentation:<br />
# [sudo] gem install mysql --no-rdoc --no-ri<br />
<br />
The gem will now be downloaded, compiled if necessary, and installed.<br />
<br />
=== Bundler ===<br />
Bundler[http://github.com/carlhuda/bundler] installs gems (including those with native extensions) directly into your application, which works very well for shared hosting and easy deployment of [[Ruby On Rails]] applications for example. Bundler also resolves dependencies as a whole, rather than individually like RubyGems, making things a lot easier.<br />
<br />
It might be a good idea to install bundler as a system-wide gem so everyone can use it:<br />
# [sudo] gem install bundler<br />
<br />
To start a new bundle:<br />
# bundle init<br />
<br />
Then add your required gems into the "Gemfile" file created by the above command:<br />
gem "rails", "2.3.4"<br />
gem "mysql"<br />
<br />
Finally, run the following to install your gems. They will all be installed locally into ~/.bundle, eliminating the need for root access:<br />
# bundle install<br />
<br />
== See also ==<br />
* [[Ruby On Rails]]<br />
<br />
== References ==<br />
* Ruby - ruby-lang.org/<br />
* Rubyforge - http://rubyforge.org<br />
* Bundler - http://github.com/carlhuda/bundler</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby&diff=105146Ruby2010-05-01T18:11:35Z<p>Exis10z: Created page with 'Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity. == Installing Ruby == The version of Ruby you need to install depen…'</p>
<hr />
<div>Ruby is a dynamic, interpreted, open source programming language with a focus on simplicity and productivity.<br />
<br />
== Installing Ruby ==<br />
The version of Ruby you need to install depends on your requirements, as not all 3rd party code is compatible with all versions. Here's a summary of the versions below and how to get them:<br />
<br />
=== Ruby 1.9 (Development) ===<br />
<br />
Pros:<br />
* Vastly improved performance over 1.8<br />
* New features for concurrency such as fibers.<br />
* Various other language improvements, such as an improved CSV parser.<br />
<br />
Cons:<br />
* Not compatible with many older gems (and Ruby On Rails versions prior to 2.3)<br />
* Changes in the language might cause older Ruby code not to run, or exhibit unexpected bugs.<br />
<br />
'''Summary:''' Use Ruby 1.9 for a new new Rails project, or when you're sure all your required gems are supported by Ruby 1.9<br />
<br />
{{Box Note | Visit http://isitruby19.com/ to determine if the gems/modules you require are compatible with Ruby 1.9 }}<br />
<br />
To install Ruby 1.9, simply run:<br />
# pacman -S ruby<br />
<br />
Ruby 1.9 also includes RubyGems (detailed below), so you can easily update to the latest RubyGems using:<br />
# gem update --system<br />
<br />
=== Ruby 1.8.7 (Stable) ===<br />
Pros:<br />
* Latest version of the 1.8 branch, capable of running most if not all recently updated gems and Ruby On Rails<br />
<br />
Cons:<br />
* Introduces certain breaking changes from 1.8.6, which causes older lesser-maintained gems and Rails prior to 2.0 not to work without "monkey patching".<br />
<br />
'''Summary:''' Use Ruby 1.8.7 if you're unsure, or simply want the assurance that most tools and gems will work without hassle.<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=30221], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8<br />
<br />
RubyGems must be installed seperately from another package[http://aur.archlinux.org/packages.php?ID=30224]:<br />
# yaourt -S rubygems1.8<br />
<br />
=== Ruby 1.8.6 (Legacy) ===<br />
Pros:<br />
* Compatible with just about anything <br />
<br />
Cons:<br />
* Missing some performance and language enhancements from 1.8.7<br />
* Support might be dropped with Rails 3.0 (in Beta at the time of writing)<br />
<br />
'''Summary:''' Use Ruby 1.8.6 if you are working on old project, older version of Rails (especially < 2.0), or simply want the least possible issues.<br />
<br />
There is an [[AUR]] build available[http://aur.archlinux.org/packages.php?ID=36898], that can be installed manually or with [[yaourt]]:<br />
# yaourt -S ruby1.8.6-legacy<br />
<br />
RubyGems must be installed seperately using the standard rubygems package[http://aur.archlinux.org/packages.php?ID=33312]:<br />
# yaourt -S rubygems<br />
<br />
{{Box Note | This package will replace the official "ruby" package, as installing both Ruby 1.8 and 1.9 while possible, can cause erratic behaviour of some 3rd party code }}</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby_on_Rails&diff=105144Ruby on Rails2010-05-01T17:50:22Z<p>Exis10z: Backlinks</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|RubyOnRails|Ruby On Rails}}<br />
<br />
== Introduction ==<br />
This document describes how to set up the Ruby on Rails Framework on an Arch Linux system.<br />
<br />
Ruby on Rails requires [[Ruby]] to be installed, so read that article first for installation instructions.<br />
<br />
== Installation via RubyGems (Recommended) ==<br />
{{Box Note | If this command is run without being root (using sudo or otherwise), the gem will be installed into the home directory of the user.}}<br />
<br />
# gem install rails<br />
<br />
Building the documentation takes a while. If you want to skip it, append the parameters --no-ri --no-rdoc to the install command.<br />
# gem install rails --no-ri --no-rdoc<br />
<br />
===Updating gems===<br />
gem is a package manager for Ruby modules, somewhat like pacman is to Arch Linux. To update your gems, simply run:<br />
# gem update<br />
<br />
== Installing via the AUR ==<br />
{{Warning | This is not recommended, as this might not include the latest Rails version, and additional dependencies may be introduced that may require you to run "gem install" anyway. }}<br />
There is a Rails package[http://aur.archlinux.org/packages.php?ID=14624] available in the [[AUR]]. Note that this is not in an official repository, so you'll need to build it manually with makepkg or using a helper tool such as [[yaourt]]. <br />
<br />
== Configuration ==<br />
Rails is bundled with a basic HTTP server called WeBrick. You can create a test application to test it. First, create an application with the rails command :<br />
<br />
# rails testapp_name<br />
<br />
Next start the web server. It listens on port 3000 by default :<br />
<br />
# cd testapp_name<br />
# ruby script/server <br />
<br />
Finally open your server address on port 3000 in your web browser. For example, if you're working on your local machine, visit http://localhost:3000/<br />
<br />
You should see a test page titled "Welcome aboard".<br />
<br />
== Web servers ==<br />
While the default Ruby On Rails HTTP server (WeBrick) is convenient for basic development it is not recommended for production use. Here are some suitable alternatives:<br />
<br />
=== Mongrel ===<br />
Mongrel is a drop-in replacement for WeBrick, that can be run in precisely the same way, but offers better performance.<br />
<br />
First install the Mongrel gem:<br />
# gem install mongrel<br />
<br />
Then start it using:<br />
# mongrel_rails start<br />
<br />
Alternatively, you can just run "ruby script/server" again, as it replaces WeBrick by default.<br />
<br />
Generally, Mongrel is used in a production environment by running multiple instances of mongrel_rails, which are load-balanced behind an [[nginx]] or [[Apache]] reverse proxy. However, you might find Phusion Passenger (see below) a much simpler solution for running a production environment.<br />
<br />
=== Phusion Passenger (Recommended for production) ===<br />
Passenger or mod_rails[http://www.modrails.com/] is module available for [[nginx]] and [[Apache]] that greatly simplifies setting up a Rails server environment, especially for those who are familiar with mod_php5 or mod_perl.<br />
<br />
First install the passenger gem:<br />
# gem install passenger<br />
<br />
Then, if you're hoping to run the Apache HTTP Server:<br />
# passenger-install-apache2-module<br />
<br />
Or, for nginx:<br />
# passenger-install-nginx-module<br />
<br />
The installer will provide inform you of any other steps (such as installing additional libraries) that are required.<br />
<br />
See also: [[nginx]] for more information on configuring a Rails / Passenger/ nginX web stack.<br />
<br />
== Databases ==<br />
Most web applications will need to interact with some sort of database. ActiveRecord (the ORM used by Rails to provide database abstraction) supports several database vendors, the most popular of which are MySQL, SQLite, and PostgreSQL.<br />
<br />
=== SQLite ===<br />
SQLite is the default lightweight database for Ruby on Rails. To enable SQLite, simply install ruby-sqlite3<br />
# pacman -S ruby-sqlite3<br />
<br />
=== MySQL 5+ ===<br />
{{Box Note | You must first install MySQL with the appropriate headers in /usr/include (just pacman -S mysql is fine) before attempting to install the Ruby MySQL extensions }}<br />
<br />
Please refer to [[MySQL]] on how to install MySQL Server.<br />
<br />
A gem with some native extensions is required, probably best installed as root:<br />
# sudo gem install mysql<br />
<br />
You can generate a rails application configured for MySQL by using the -d parameter :<br />
# rails -d mysql testapp_name<br />
<br />
You then need to edit config/database.yml. Rails uses different databases for development, testing, production and other environments. Here's an example development configuration for MySQL running on localhost:<br />
<br />
development:<br />
adapter: mysql<br />
database: my_application_database<br />
username: development<br />
password: my_secret_password<br />
<br />
Note that you don't have to actually create the database using a MySQL, as this can be done via Rails with :<br />
# rake db:create<br />
<br />
If no errors are shown, then your database has been created and Rails can talk to your MySQL database.<br />
<br />
== See also ==<br />
* [[Ruby]]<br />
* [[nginx]]<br />
* [[LAMP]]<br />
* [[MySQL]]<br />
<br />
== References ==<br />
* Ruby on Rails http://rubyonrails.org/download<br />
* Mongrel http://mongrel.rubyforge.org/</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby_on_Rails&diff=105143Ruby on Rails2010-05-01T17:49:45Z<p>Exis10z: Move ruby information to another article</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|RubyOnRails|Ruby On Rails}}<br />
<br />
== Introduction ==<br />
This document describes how to set up the Ruby on Rails Framework on an Arch Linux system.<br />
<br />
Ruby on Rails requires [[Ruby]] to be installed, so read that article first for installation instructions.<br />
<br />
== Installation via RubyGems (Recommended) ==<br />
{{Box Note | If this command is run without being root (using sudo or otherwise), the gem will be installed into the home directory of the user.}}<br />
<br />
# gem install rails<br />
<br />
Building the documentation takes a while. If you want to skip it, append the parameters --no-ri --no-rdoc to the install command.<br />
# gem install rails --no-ri --no-rdoc<br />
<br />
===Updating gems===<br />
gem is a package manager for Ruby modules, somewhat like pacman is to Arch Linux. To update your gems, simply run:<br />
# gem update<br />
<br />
== Installing via the AUR ==<br />
{{Warning | This is not recommended, as this might not include the latest Rails version, and additional dependencies may be introduced that may require you to run "gem install" anyway. }}<br />
There is a Rails package[http://aur.archlinux.org/packages.php?ID=14624] available in the [[AUR]]. Note that this is not in an official repository, so you'll need to build it manually with makepkg or using a helper tool such as [[yaourt]]. <br />
<br />
== Configuration ==<br />
Rails is bundled with a basic HTTP server called WeBrick. You can create a test application to test it. First, create an application with the rails command :<br />
<br />
# rails testapp_name<br />
<br />
Next start the web server. It listens on port 3000 by default :<br />
<br />
# cd testapp_name<br />
# ruby script/server <br />
<br />
Finally open your server address on port 3000 in your web browser. For example, if you're working on your local machine, visit http://localhost:3000/<br />
<br />
You should see a test page titled "Welcome aboard".<br />
<br />
== Web servers ==<br />
While the default Ruby On Rails HTTP server (WeBrick) is convenient for basic development it is not recommended for production use. Here are some suitable alternatives:<br />
<br />
=== Mongrel ===<br />
Mongrel is a drop-in replacement for WeBrick, that can be run in precisely the same way, but offers better performance.<br />
<br />
First install the Mongrel gem:<br />
# gem install mongrel<br />
<br />
Then start it using:<br />
# mongrel_rails start<br />
<br />
Alternatively, you can just run "ruby script/server" again, as it replaces WeBrick by default.<br />
<br />
Generally, Mongrel is used in a production environment by running multiple instances of mongrel_rails, which are load-balanced behind an [[nginx]] or [[Apache]] reverse proxy. However, you might find Phusion Passenger (see below) a much simpler solution for running a production environment.<br />
<br />
=== Phusion Passenger (Recommended for production) ===<br />
Passenger or mod_rails[http://www.modrails.com/] is module available for [[nginx]] and [[Apache]] that greatly simplifies setting up a Rails server environment, especially for those who are familiar with mod_php5 or mod_perl.<br />
<br />
First install the passenger gem:<br />
# gem install passenger<br />
<br />
Then, if you're hoping to run the Apache HTTP Server:<br />
# passenger-install-apache2-module<br />
<br />
Or, for nginx:<br />
# passenger-install-nginx-module<br />
<br />
The installer will provide inform you of any other steps (such as installing additional libraries) that are required.<br />
<br />
See also: [[nginx]] for more information on configuring a Rails / Passenger/ nginX web stack.<br />
<br />
== Databases ==<br />
Most web applications will need to interact with some sort of database. ActiveRecord (the ORM used by Rails to provide database abstraction) supports several database vendors, the most popular of which are MySQL, SQLite, and PostgreSQL.<br />
<br />
=== SQLite ===<br />
SQLite is the default lightweight database for Ruby on Rails. To enable SQLite, simply install ruby-sqlite3<br />
# pacman -S ruby-sqlite3<br />
<br />
=== MySQL 5+ ===<br />
{{Box Note | You must first install MySQL with the appropriate headers in /usr/include (just pacman -S mysql is fine) before attempting to install the Ruby MySQL extensions }}<br />
<br />
Please refer to [[MySQL]] on how to install MySQL Server.<br />
<br />
A gem with some native extensions is required, probably best installed as root:<br />
# sudo gem install mysql<br />
<br />
You can generate a rails application configured for MySQL by using the -d parameter :<br />
# rails -d mysql testapp_name<br />
<br />
You then need to edit config/database.yml. Rails uses different databases for development, testing, production and other environments. Here's an example development configuration for MySQL running on localhost:<br />
<br />
development:<br />
adapter: mysql<br />
database: my_application_database<br />
username: development<br />
password: my_secret_password<br />
<br />
Note that you don't have to actually create the database using a MySQL, as this can be done via Rails with :<br />
# rake db:create<br />
<br />
If no errors are shown, then your database has been created and Rails can talk to your MySQL database.<br />
<br />
== More Resources ==<br />
* Ruby on Rails http://rubyonrails.org/download<br />
* Mongrel http://mongrel.rubyforge.org/<br />
* [[MySQL]]<br />
* [[LAMP]]</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby_on_Rails&diff=105142Ruby on Rails2010-05-01T17:47:01Z<p>Exis10z: /* Phusion Passenger (Recommended for production) */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|RubyOnRails|Ruby On Rails}}<br />
<br />
== Introduction ==<br />
This document describes how to set up the Ruby on Rails Framework on an Arch Linux system.<br />
<br />
== Installation via RubyGems (Recommended) ==<br />
<br />
Since Rails is not currently in the repositories, using RubyGems is the easiest method to install Ruby on Rails. As of ruby-1.9 rubygems is part of ruby so you only have to install the ruby package to get RubyGems as well:<br />
<br />
# pacman -S ruby<br />
<br />
Next install Rails using RubyGems. All the dependencies for Ruby on Rails will be downloaded and installed.<br />
<br />
{{Box Note | If this command is run without being root (using sudo or otherwise), the gem will install it in the home directory of the user.}}<br />
<br />
# gem install rails<br />
<br />
Building the documentation takes a while. If you want to skip it, append the parameters --no-ri --no-rdoc to the install command.<br />
# gem install rails --no-ri --no-rdoc<br />
<br />
===Updating gems===<br />
gem is a package manager for Ruby modules, somewhat like pacman is to Arch Linux. To update your gems, simply run:<br />
# gem update<br />
<br />
== Installing via the AUR ==<br />
{{Warning | This is not recommended, as this might not include the latest Rails version, and additional dependencies may be introduced that may require you to run "gem install" anyway. }}<br />
There is a Rails package[http://aur.archlinux.org/packages.php?ID=14624] available in the [[AUR]]. Note that this is not in an official repository, so you'll need to build it manually with makepkg or using a helper tool such as [[yaourt]]. <br />
<br />
== Configuration ==<br />
Rails is bundled with a basic HTTP server called WeBrick. You can create a test application to test it. First, create an application with the rails command :<br />
<br />
# rails testapp_name<br />
<br />
Next start the web server. It listens on port 3000 by default :<br />
<br />
# cd testapp_name<br />
# ruby script/server <br />
<br />
Finally open your server address on port 3000 in your web browser. For example, if you're working on your local machine, visit http://localhost:3000/<br />
<br />
You should see a test page titled "Welcome aboard".<br />
<br />
== Web servers ==<br />
While the default Ruby On Rails HTTP server (WeBrick) is convenient for basic development it is not recommended for production use. Here are some suitable alternatives:<br />
<br />
=== Mongrel ===<br />
Mongrel is a drop-in replacement for WeBrick, that can be run in precisely the same way, but offers better performance.<br />
<br />
First install the Mongrel gem:<br />
# gem install mongrel<br />
<br />
Then start it using:<br />
# mongrel_rails start<br />
<br />
Alternatively, you can just run "ruby script/server" again, as it replaces WeBrick by default.<br />
<br />
Generally, Mongrel is used in a production environment by running multiple instances of mongrel_rails, which are load-balanced behind an [[nginx]] or [[Apache]] reverse proxy. However, you might find Phusion Passenger (see below) a much simpler solution for running a production environment.<br />
<br />
=== Phusion Passenger (Recommended for production) ===<br />
Passenger or mod_rails[http://www.modrails.com/] is module available for [[nginx]] and [[Apache]] that greatly simplifies setting up a Rails server environment, especially for those who are familiar with mod_php5 or mod_perl.<br />
<br />
First install the passenger gem:<br />
# gem install passenger<br />
<br />
Then, if you're hoping to run the Apache HTTP Server:<br />
# passenger-install-apache2-module<br />
<br />
Or, for nginx:<br />
# passenger-install-nginx-module<br />
<br />
The installer will provide inform you of any other steps (such as installing additional libraries) that are required.<br />
<br />
See also: [[nginx]] for more information on configuring a Rails / Passenger/ nginX web stack.<br />
<br />
== Databases ==<br />
Most web applications will need to interact with some sort of database. ActiveRecord (the ORM used by Rails to provide database abstraction) supports several database vendors, the most popular of which are MySQL, SQLite, and PostgreSQL.<br />
<br />
=== SQLite ===<br />
SQLite is the default lightweight database for Ruby on Rails. To enable SQLite, simply install ruby-sqlite3<br />
# pacman -S ruby-sqlite3<br />
<br />
=== MySQL 5+ ===<br />
{{Box Note | You must first install MySQL with the appropriate headers in /usr/include (just pacman -S mysql is fine) before attempting to install the Ruby MySQL extensions }}<br />
<br />
Please refer to [[MySQL]] on how to install MySQL Server.<br />
<br />
A gem with some native extensions is required, probably best installed as root:<br />
# sudo gem install mysql<br />
<br />
You can generate a rails application configured for MySQL by using the -d parameter :<br />
# rails -d mysql testapp_name<br />
<br />
You then need to edit config/database.yml. Rails uses different databases for development, testing, production and other environments. Here's an example development configuration for MySQL running on localhost:<br />
<br />
development:<br />
adapter: mysql<br />
database: my_application_database<br />
username: development<br />
password: my_secret_password<br />
<br />
Note that you don't have to actually create the database using a MySQL, as this can be done via Rails with :<br />
# rake db:create<br />
<br />
If no errors are shown, then your database has been created and Rails can talk to your MySQL database.<br />
<br />
== More Resources ==<br />
* Ruby on Rails http://rubyonrails.org/download<br />
* Mongrel http://mongrel.rubyforge.org/<br />
* [[MySQL]]<br />
* [[LAMP]]</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby_on_Rails&diff=105141Ruby on Rails2010-05-01T17:46:33Z<p>Exis10z: /* Phusion Passenger (Recommended for production) */</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|RubyOnRails|Ruby On Rails}}<br />
<br />
== Introduction ==<br />
This document describes how to set up the Ruby on Rails Framework on an Arch Linux system.<br />
<br />
== Installation via RubyGems (Recommended) ==<br />
<br />
Since Rails is not currently in the repositories, using RubyGems is the easiest method to install Ruby on Rails. As of ruby-1.9 rubygems is part of ruby so you only have to install the ruby package to get RubyGems as well:<br />
<br />
# pacman -S ruby<br />
<br />
Next install Rails using RubyGems. All the dependencies for Ruby on Rails will be downloaded and installed.<br />
<br />
{{Box Note | If this command is run without being root (using sudo or otherwise), the gem will install it in the home directory of the user.}}<br />
<br />
# gem install rails<br />
<br />
Building the documentation takes a while. If you want to skip it, append the parameters --no-ri --no-rdoc to the install command.<br />
# gem install rails --no-ri --no-rdoc<br />
<br />
===Updating gems===<br />
gem is a package manager for Ruby modules, somewhat like pacman is to Arch Linux. To update your gems, simply run:<br />
# gem update<br />
<br />
== Installing via the AUR ==<br />
{{Warning | This is not recommended, as this might not include the latest Rails version, and additional dependencies may be introduced that may require you to run "gem install" anyway. }}<br />
There is a Rails package[http://aur.archlinux.org/packages.php?ID=14624] available in the [[AUR]]. Note that this is not in an official repository, so you'll need to build it manually with makepkg or using a helper tool such as [[yaourt]]. <br />
<br />
== Configuration ==<br />
Rails is bundled with a basic HTTP server called WeBrick. You can create a test application to test it. First, create an application with the rails command :<br />
<br />
# rails testapp_name<br />
<br />
Next start the web server. It listens on port 3000 by default :<br />
<br />
# cd testapp_name<br />
# ruby script/server <br />
<br />
Finally open your server address on port 3000 in your web browser. For example, if you're working on your local machine, visit http://localhost:3000/<br />
<br />
You should see a test page titled "Welcome aboard".<br />
<br />
== Web servers ==<br />
While the default Ruby On Rails HTTP server (WeBrick) is convenient for basic development it is not recommended for production use. Here are some suitable alternatives:<br />
<br />
=== Mongrel ===<br />
Mongrel is a drop-in replacement for WeBrick, that can be run in precisely the same way, but offers better performance.<br />
<br />
First install the Mongrel gem:<br />
# gem install mongrel<br />
<br />
Then start it using:<br />
# mongrel_rails start<br />
<br />
Alternatively, you can just run "ruby script/server" again, as it replaces WeBrick by default.<br />
<br />
Generally, Mongrel is used in a production environment by running multiple instances of mongrel_rails, which are load-balanced behind an [[nginx]] or [[Apache]] reverse proxy. However, you might find Phusion Passenger (see below) a much simpler solution for running a production environment.<br />
<br />
=== Phusion Passenger (Recommended for production) ===<br />
Passenger or mod_rails[http://www.modrails.com/] is module available for [[nginx]] and [[Apache]] that greatly simplifies setting up a Rails server environment, especially for those who are familiar with mod_php5 or mod_perl.<br />
<br />
First install the passenger gem:<br />
# gem install passenger<br />
<br />
Then, if you're hoping to run the Apache HTTP Server:<br />
# passenger-install-apache2-module<br />
<br />
Or, for nginx:<br />
# passenger-install-nginx-module<br />
<br />
The installer will provide inform you of any other steps (such as installing additional libraries) that are required.<br />
<br />
See also: [[nginx]] for more information on configuring a Rails / nginx web stack.<br />
<br />
== Databases ==<br />
Most web applications will need to interact with some sort of database. ActiveRecord (the ORM used by Rails to provide database abstraction) supports several database vendors, the most popular of which are MySQL, SQLite, and PostgreSQL.<br />
<br />
=== SQLite ===<br />
SQLite is the default lightweight database for Ruby on Rails. To enable SQLite, simply install ruby-sqlite3<br />
# pacman -S ruby-sqlite3<br />
<br />
=== MySQL 5+ ===<br />
{{Box Note | You must first install MySQL with the appropriate headers in /usr/include (just pacman -S mysql is fine) before attempting to install the Ruby MySQL extensions }}<br />
<br />
Please refer to [[MySQL]] on how to install MySQL Server.<br />
<br />
A gem with some native extensions is required, probably best installed as root:<br />
# sudo gem install mysql<br />
<br />
You can generate a rails application configured for MySQL by using the -d parameter :<br />
# rails -d mysql testapp_name<br />
<br />
You then need to edit config/database.yml. Rails uses different databases for development, testing, production and other environments. Here's an example development configuration for MySQL running on localhost:<br />
<br />
development:<br />
adapter: mysql<br />
database: my_application_database<br />
username: development<br />
password: my_secret_password<br />
<br />
Note that you don't have to actually create the database using a MySQL, as this can be done via Rails with :<br />
# rake db:create<br />
<br />
If no errors are shown, then your database has been created and Rails can talk to your MySQL database.<br />
<br />
== More Resources ==<br />
* Ruby on Rails http://rubyonrails.org/download<br />
* Mongrel http://mongrel.rubyforge.org/<br />
* [[MySQL]]<br />
* [[LAMP]]</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Nginx&diff=105140Nginx2010-05-01T17:45:09Z<p>Exis10z: Actually, gonna link the other article to this one instead.</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|NginX}}<br />
{{i18n_entry|简体中文|Archlinux NginX配置指南(简体中文)}}<br />
{{i18n_links_end}}<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.7.62:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
check that /etc/rc.d/nginx has this line correct.<br />
PID="/var/run/nginx.pid"<br />
<br />
Run<br />
# /etc/rc.d/nginx start<br />
The nginx server should now be running. <br />
The default main page is /srv/http/nginx/index.html(the nginx package does not install a default index.html, you must create this now). <br />
After creating a /srv/http/nginx/index.html webpage, you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx/conf. (/etc/nginx/conf/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method does not require any third party tools.<br />
<br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br />
<br />
For example:<br />
$ sudo pacman -S php php-cgi<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
<br />
This command sets up the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Since nginx 0.7.62, the default internal $document_root is /etc/nginx/html which is moved outside the default nginx directory and symlinked to /srv/http/nginx in the arch package. For php to work with nginx 0.7.62 the open_basedir in /etc/php/php.ini has to contain the directory /etc/nginx/html. IE. open_basedir = /etc/nginx/html/:/srv/http/:/home/:/tmp/:/usr/share/pear/<br />
<br />
Below is a daemon script to be used in rc.conf on boot to start php-cgi. save it as /etc/rc.d/fastcgi and add "fastcgi" to your DAEMONS array in /etc/rc.conf<br />
#!/bin/bash<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
case "$1" in<br />
start)<br />
stat_busy 'Starting Fastcgi Server'<br />
if /usr/bin/php-cgi -b 127.0.0.1:9000 &<br />
then<br />
add_daemon fastcgi<br />
stat_done<br />
else<br />
stat_fail fi<br />
fi<br />
;;<br />
stop)<br />
stat_busy 'Stopping Fastcgi Server'<br />
[ -e /var/run/daemons/fastcgi ] && kill $(pidof php-cgi) &> /dev/null;<br />
if [ $? -gt 0 ]; then <br />
stat_fail<br />
else<br />
rm_daemon fastcgi<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "Usage: $0 {start|stop|restart}"<br />
esac<br />
<br />
2) Running PHP inside some third-party wrapper - this can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommended.)<br />
<br />
For example:<br />
<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php-cgi<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php-cgi<br />
<br />
# php --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Un-comment these lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php; <br />
fastcgi_param SCRIPT_FILENAME /srv/http/nginx/$fastcgi_script_name;<br />
include fastcgi_params<br />
}<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/http/nginx/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Configuring for Ruby (on Rails)===<br />
The [http://wiki.rubyonrails.org/ Ruby on Rails wiki] has tutorials on configuring Ruby for [http://nginx.org/ Nginx]. It is not recommended to use [http://www.fastcgi.com/drupal/ FastCGI] for Ruby anymore.<br />
[http://nginx.org/ Nginx] and [http://modrails.com/ Passenger] are recommended, and this setup is extremely easy to achieve on Arch Linux.<br />
<br />
====Installation====<br />
Install the [http://aur.archlinux.org/packages.php?ID=28185 Nginx Passenger] package from AUR, and you are basically read to go.<br />
<br />
I encourage you to read through the Nginx part of [http://wiki.rubyonrails.org/deployment/vps-setup-nginx-passenger this tutorial] for configuring Nginx for Ruby on Rails.<br />
<br />
Note that with Passenger you are also able to run other Ruby web frameworks, e.g. [http://www.sinatrarb.com/ Sinatra] or anything [http://rack.rubyforge.org/ Rack]-based.<br />
<br />
====Troubleshooting====<br />
<br />
=====403 errors=====<br />
This is most likely a permission error. Are you sure whatever user configured in the Nginx configuration is able to read the correct files?<br />
<br />
If the files are located within a home directory, (e.g. '''/home/arch/public/webap'''p) and you are sure the user running Nginx has the right permissions (you can temporarily chmod all the files to 777 in order to determent this), '''/home/arch''' might be '''chmod 750''', simply '''chmod''' it to '''751''', and it should work.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
Most Likely you don't have the SCRIPT_FILENAME containing the full path to you scripts.<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in nginx.conf, make sure the "root" points to the same directory as it in "location /" in the same server. Or you may just set root as global, don't define it in any location section.<br />
<br />
Also keep in mind that your php script path was defined as /srv/www/nginx/html by default using the variable "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.nginx.org/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Nginx&diff=105139Nginx2010-05-01T17:44:02Z<p>Exis10z: add link to ruby on rails article</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
[[Category:Web Server (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|NginX}}<br />
{{i18n_entry|简体中文|Archlinux NginX配置指南(简体中文)}}<br />
{{i18n_links_end}}<br />
<br />
==Summary==<br />
Nginx (pronounced "engine X") written by Igor Sysoev (Russia) in 2005, is a free, open-source, high-performance HTTP server and reverse proxy, as well as an IMAP/POP3 proxy server. According to the ''[http://news.netcraft.com/archives/2009/06/17/june_2009_web_server_survey.html June 2009 Web Server Survey from Netcraft]'', nginx now hosts nearly 3.37% of all domains worldwide, while lighttpd hosts about 1.8%. Nginx is now well known for its stability, rich feature set, simple configuration, and low resource consumption.<br />
<br />
==Installation ==<br />
The nginx package is now in the [community] repository, the latest stable version is nginx-0.7.62:<br />
# pacman -S nginx<br />
or you can compile and install the latest development version with ABS.<br />
<br />
==Starting service ==<br />
check that /etc/rc.d/nginx has this line correct.<br />
PID="/var/run/nginx.pid"<br />
<br />
Run<br />
# /etc/rc.d/nginx start<br />
The nginx server should now be running. <br />
The default main page is /srv/http/nginx/index.html(the nginx package does not install a default index.html, you must create this now). <br />
After creating a /srv/http/nginx/index.html webpage, you can use this URL: <nowiki>http://127.0.0.1</nowiki> to test if nginx is working.<br />
<br />
To enable service by default at startup just add "nginx" to the DAEMONS in the /etc/rc.conf.<br />
<br />
==Configuring ==<br />
You can modify the configurations by editing the files in /etc/nginx/conf. (/etc/nginx/conf/nginx.conf being the main config file) . <br />
<br />
More details can be referred from [http://wiki.codemongers.com/NginxConfiguration Nginx Configuration Examples].<br />
<br />
===Use PHP/Python with nginx ===<br />
FastCGI technology is introduced into nginx to work with many external tools and servers, ie: PHP and Python. So, you cannot use PHP or Python service unless FastCGI server has been started. <br />
<br />
PHP and Python can be run as FastCGI application and can process FastCGI requests from nginx.<br />
<br />
'''Step 1: Start the FastCGI server'''<br><br />
There are two different ways to run FastCGI server: <br />
<br />
1) Directly running PHP’s built-in FastCGI server - this method does not require any third party tools.<br />
<br />
Archlinux's '''''php''''' package in the [extra] repository has already enabled FastCGI support.<br />
<br />
For example:<br />
$ sudo pacman -S php php-cgi<br />
$ php-cgi -b 127.0.0.1:9000 &<br />
<br />
This command sets up the local machine as a FastCGI server using port 9000.<br />
<br />
'''Note:''' Since nginx 0.7.62, the default internal $document_root is /etc/nginx/html which is moved outside the default nginx directory and symlinked to /srv/http/nginx in the arch package. For php to work with nginx 0.7.62 the open_basedir in /etc/php/php.ini has to contain the directory /etc/nginx/html. IE. open_basedir = /etc/nginx/html/:/srv/http/:/home/:/tmp/:/usr/share/pear/<br />
<br />
Below is a daemon script to be used in rc.conf on boot to start php-cgi. save it as /etc/rc.d/fastcgi and add "fastcgi" to your DAEMONS array in /etc/rc.conf<br />
#!/bin/bash<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
case "$1" in<br />
start)<br />
stat_busy 'Starting Fastcgi Server'<br />
if /usr/bin/php-cgi -b 127.0.0.1:9000 &<br />
then<br />
add_daemon fastcgi<br />
stat_done<br />
else<br />
stat_fail fi<br />
fi<br />
;;<br />
stop)<br />
stat_busy 'Stopping Fastcgi Server'<br />
[ -e /var/run/daemons/fastcgi ] && kill $(pidof php-cgi) &> /dev/null;<br />
if [ $? -gt 0 ]; then <br />
stat_fail<br />
else<br />
rm_daemon fastcgi<br />
stat_done<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
$0 start<br />
;;<br />
*)<br />
echo "Usage: $0 {start|stop|restart}"<br />
esac<br />
<br />
2) Running PHP inside some third-party wrapper - this can be more comfortable than first method because of more flexibility. You can install ''fcgi''(which includes ''cgi-fcgi''), ''lighttpd'' (which includes ''spawn-fcgi''), and '''''PHP-FPM ''''' (PHP FastCGI Process Manager, which is now in the AUR. Recommended.)<br />
<br />
For example:<br />
<br />
# cgi-fcgi -start -connect localhost:9000 /usr/bin/php-cgi<br />
<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -C 9 -f /usr/bin/php-cgi<br />
<br />
# php --fpm -b 127.0.0.1:9000<br />
<br />
'''Note:''' You may need to edit /etc/php-fpm.conf at first. More details about php-fpm can be referred from '''[http://php-fpm.anight.org/ php-fpm website]'''<br />
<br />
'''Note:''' Sometimes, you may encounter some permission issue when running some third party software to start PHP as FastCGI-server. See '''[[Nginx#Tips|Tips]]'''.<br />
<br />
<br />
'''Step 2: Edit /etc/nginx/conf/nginx.conf'''<br><br />
Un-comment these lines and edit in the file to be as follows:<br />
location ~ \.php$ {<br />
root html;<br />
fastcgi_pass 127.0.0.1:9000;<br />
fastcgi_index index.php; <br />
fastcgi_param SCRIPT_FILENAME /srv/http/nginx/$fastcgi_script_name;<br />
include fastcgi_params<br />
}<br />
<br />
'''Step 3: Restart nginx'''<br><br />
If nginx has been working, run<br />
# /etc/rc.d/nginx restart<br />
<br />
Edit /srv/http/nginx/index.php,<br />
<?php<br />
phpinfo();<br />
?> <br />
view the URL: <nowiki>http://localhost/index.php</nowiki> with your browser, and you'll find PHP has worked well with nginx.<br />
<br />
===Configuring for Ruby (on Rails)===<br />
The [http://wiki.rubyonrails.org/ Ruby on Rails wiki] has tutorials on configuring Ruby for [http://nginx.org/ Nginx]. It is not recommended to use [http://www.fastcgi.com/drupal/ FastCGI] for Ruby anymore.<br />
[http://nginx.org/ Nginx] and [http://modrails.com/ Passenger] are recommended, and this setup is extremely easy to achieve on Arch Linux.<br />
<br />
See also: [[Ruby On Rails]]<br />
<br />
====Installation====<br />
Install the [http://aur.archlinux.org/packages.php?ID=28185 Nginx Passenger] package from AUR, and you are basically read to go.<br />
<br />
I encourage you to read through the Nginx part of [http://wiki.rubyonrails.org/deployment/vps-setup-nginx-passenger this tutorial] for configuring Nginx for Ruby on Rails.<br />
<br />
Note that with Passenger you are also able to run other Ruby web frameworks, e.g. [http://www.sinatrarb.com/ Sinatra] or anything [http://rack.rubyforge.org/ Rack]-based.<br />
<br />
====Troubleshooting====<br />
<br />
=====403 errors=====<br />
This is most likely a permission error. Are you sure whatever user configured in the Nginx configuration is able to read the correct files?<br />
<br />
If the files are located within a home directory, (e.g. '''/home/arch/public/webap'''p) and you are sure the user running Nginx has the right permissions (you can temporarily chmod all the files to 777 in order to determent this), '''/home/arch''' might be '''chmod 750''', simply '''chmod''' it to '''751''', and it should work.<br />
<br />
===Security ===<br />
* allow/deny based on IP <br />
[http://wiki.codemongers.com/NginxHttpAccessModule ngx_http_access_module]<br />
* HTTP authentication<br />
[http://wiki.codemongers.com/NginxHttpAuthBasicModule ngx_http_auth_basic_module]<br />
* HTTPS support<br />
[http://wiki.codemongers.com/NginxHttpSslModule ngx_http_ssl_module]<br />
<br />
==Tips==<br />
* Tuning the kernel for better speed<br />
Add the followings to /etc/sysctl.conf<br />
net.ipv4.tcp_fin_timeout = 30<br />
net.ipv4.tcp_keepalive_time = 300<br />
net.ipv4.tcp_syncookies = 1<br />
net.ipv4.tcp_tw_reuse = 1<br />
net.ipv4.tcp_tw_recycle = 1<br />
net.ipv4.ip_local_port_range = 5000 65000 <br />
and make it active:<br />
# /sbin/sysctl -p<br />
<br />
* The browser results in: '''the page you are looking for is temporarily unavailable. Please try again later. '''<br />
This is because the FastCGI server has not been started. <br />
<br />
* The browser results in: '''no input file specified'''<br />
Most Likely you don't have the SCRIPT_FILENAME containing the full path to you scripts.<br />
If the configuration of nginx (fastcgi_param SCRIPT_FILENAME) is all right, this kind of error means php fail to load the requestd script. Usually it's simply an permission issue, you can just run php-cgi as root<br />
# spawn-fcgi -a 127.0.0.1 -p 9000 -f /usr/bin/php-cgi<br />
or you should create some group and user to start the php-cgi. For instance :<br />
$ sudo groupadd www<br />
$ sudo useradd -g www www<br />
$ sudo chmod +w /srv/www/nginx/html<br />
$ sudo chown -R www:www /srv/www/nginx/html<br />
$ sudo spawn-fcgi -a 127.0.0.1 -p 9000 -u www -g www -f /usr/bin/php-cgi<br />
<br />
Another occasion is that, wrong "root" argument in the "location ~ \.php$" section in nginx.conf, make sure the "root" points to the same directory as it in "location /" in the same server. Or you may just set root as global, don't define it in any location section.<br />
<br />
Also keep in mind that your php script path was defined as /srv/www/nginx/html by default using the variable "open_basedir" in /etc/php/php.ini, you can change them if you need.<br />
<br />
==References ==<br />
*[http://nginx.net/ Nginx Official site]<br />
*[http://wiki.nginx.org/Main Nginx Wiki]<br />
*[http://calomel.org/nginx.html Nginx Howto]</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby_on_Rails&diff=105138Ruby on Rails2010-05-01T17:38:33Z<p>Exis10z: General grammar improvements, more concise information regarding database, and expanded section about web servers</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|RubyOnRails|Ruby On Rails}}<br />
<br />
== Introduction ==<br />
This document describes how to set up the Ruby on Rails Framework on an Arch Linux system.<br />
<br />
== Installation via RubyGems (Recommended) ==<br />
<br />
Since Rails is not currently in the repositories, using RubyGems is the easiest method to install Ruby on Rails. As of ruby-1.9 rubygems is part of ruby so you only have to install the ruby package to get RubyGems as well:<br />
<br />
# pacman -S ruby<br />
<br />
Next install Rails using RubyGems. All the dependencies for Ruby on Rails will be downloaded and installed.<br />
<br />
{{Box Note | If this command is run without being root (using sudo or otherwise), the gem will install it in the home directory of the user.}}<br />
<br />
# gem install rails<br />
<br />
Building the documentation takes a while. If you want to skip it, append the parameters --no-ri --no-rdoc to the install command.<br />
# gem install rails --no-ri --no-rdoc<br />
<br />
===Updating gems===<br />
gem is a package manager for Ruby modules, somewhat like pacman is to Arch Linux. To update your gems, simply run:<br />
# gem update<br />
<br />
== Installing via the AUR ==<br />
{{Warning | This is not recommended, as this might not include the latest Rails version, and additional dependencies may be introduced that may require you to run "gem install" anyway. }}<br />
There is a Rails package[http://aur.archlinux.org/packages.php?ID=14624] available in the [[AUR]]. Note that this is not in an official repository, so you'll need to build it manually with makepkg or using a helper tool such as [[yaourt]]. <br />
<br />
== Configuration ==<br />
Rails is bundled with a basic HTTP server called WeBrick. You can create a test application to test it. First, create an application with the rails command :<br />
<br />
# rails testapp_name<br />
<br />
Next start the web server. It listens on port 3000 by default :<br />
<br />
# cd testapp_name<br />
# ruby script/server <br />
<br />
Finally open your server address on port 3000 in your web browser. For example, if you're working on your local machine, visit http://localhost:3000/<br />
<br />
You should see a test page titled "Welcome aboard".<br />
<br />
== Web servers ==<br />
While the default Ruby On Rails HTTP server (WeBrick) is convenient for basic development it is not recommended for production use. Here are some suitable alternatives:<br />
<br />
=== Mongrel ===<br />
Mongrel is a drop-in replacement for WeBrick, that can be run in precisely the same way, but offers better performance.<br />
<br />
First install the Mongrel gem:<br />
# gem install mongrel<br />
<br />
Then start it using:<br />
# mongrel_rails start<br />
<br />
Alternatively, you can just run "ruby script/server" again, as it replaces WeBrick by default.<br />
<br />
Generally, Mongrel is used in a production environment by running multiple instances of mongrel_rails, which are load-balanced behind an [[nginx]] or [[Apache]] reverse proxy. However, you might find Phusion Passenger (see below) a much simpler solution for running a production environment.<br />
<br />
=== Phusion Passenger (Recommended for production) ===<br />
Passenger or mod_rails[http://www.modrails.com/] is module available for [[nginx]] and [[Apache]] that greatly simplifies setting up a Rails server environment, especially for those who are familiar with mod_php5 or mod_perl.<br />
<br />
First install the passenger gem:<br />
# gem install passenger<br />
<br />
Then, if you're hoping to run the Apache HTTP Server:<br />
# passenger-install-apache2-module<br />
<br />
Or, for nginx:<br />
# passenger-install-nginx-module<br />
<br />
The installer will provide inform you of any other steps (such as installing additional libraries) that are required.<br />
<br />
== Databases ==<br />
Most web applications will need to interact with some sort of database. ActiveRecord (the ORM used by Rails to provide database abstraction) supports several database vendors, the most popular of which are MySQL, SQLite, and PostgreSQL.<br />
<br />
=== SQLite ===<br />
SQLite is the default lightweight database for Ruby on Rails. To enable SQLite, simply install ruby-sqlite3<br />
# pacman -S ruby-sqlite3<br />
<br />
=== MySQL 5+ ===<br />
{{Box Note | You must first install MySQL with the appropriate headers in /usr/include (just pacman -S mysql is fine) before attempting to install the Ruby MySQL extensions }}<br />
<br />
Please refer to [[MySQL]] on how to install MySQL Server.<br />
<br />
A gem with some native extensions is required, probably best installed as root:<br />
# sudo gem install mysql<br />
<br />
You can generate a rails application configured for MySQL by using the -d parameter :<br />
# rails -d mysql testapp_name<br />
<br />
You then need to edit config/database.yml. Rails uses different databases for development, testing, production and other environments. Here's an example development configuration for MySQL running on localhost:<br />
<br />
development:<br />
adapter: mysql<br />
database: my_application_database<br />
username: development<br />
password: my_secret_password<br />
<br />
Note that you don't have to actually create the database using a MySQL, as this can be done via Rails with :<br />
# rake db:create<br />
<br />
If no errors are shown, then your database has been created and Rails can talk to your MySQL database.<br />
<br />
== More Resources ==<br />
* Ruby on Rails http://rubyonrails.org/download<br />
* Mongrel http://mongrel.rubyforge.org/<br />
* [[MySQL]]<br />
* [[LAMP]]</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby_On_Rails&diff=105119Ruby On Rails2010-05-01T13:36:20Z<p>Exis10z: Redirect when searching multiple words to the right article</p>
<hr />
<div>#REDIRECT [[RubyOnRails]]</div>Exis10zhttps://wiki.archlinux.org/index.php?title=Ruby_on_Rails&diff=105118Ruby on Rails2010-05-01T13:32:41Z<p>Exis10z: Redirect ruby on rails as well (only found the mandarin article by searching!)</p>
<hr />
<div>[[Category:Networking (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n|RubyOnRails|Ruby On Rails}}<br />
<br />
== Introduction ==<br />
This document describes how to set up the Ruby on Rails Framework on an Arch Linux system.<br />
<br />
== Installation via rubygems ==<br />
<br />
Since rails is not currently in the repositories, using rubygems is the easiest method to install Ruby on Rails. As of ruby-1.9 rubygems is part of ruby so you only have to install the ruby package to get rubygems as well:<br />
<br />
# pacman -S ruby<br />
<br />
Next install rails via gem . All the dependencies for Ruby on Rails will be downloaded. <br />
<br />
{{Box Note | If this command is typed without being root, gem will install it in the home directory of the user.}}<br />
<br />
# gem install rails<br />
<br />
Building the ri documentation takes a little while. If you want to skip it, append the --no-ri parameter to the install command.<br />
# gem install rails --no-ri<br />
<br />
===updating gems===<br />
gem is a package manager for ruby modules, similar in concept to pacman. To update your modules, simply ask gem:<br />
# gem update<br />
<br />
== Installation via AUR ==<br />
There is also a ''rails'' package in AUR. Since it isn't at the moment in the community repository, you will need to build it by yourself, either by using makepkg or by using an helper tool like ''yaourt''.<br />
<br />
If installing rails via AUR allows you to manage it via pacman, keep in mind that not all ruby modules (gems) are packaged and you might need to install some modules via gems anyways.<br />
<br />
== Configuration ==<br />
Rails is bundled with a basic HTTP server called WeBrick. You can create a test application to test it. First, create an application with the rails command :<br />
<br />
# rails testapp_name<br />
<br />
Next start the web server. It listens on port 3000 by default :<br />
<br />
# cd testapp_name<br />
# ruby script/server <br />
<br />
Finally open your server address on port 3000 in your web browser. For example, if the server is on the local host :<br />
open http://127.0.0.1:3000/ in web browser<br />
<br />
You should see a test page titled "Welcome aboard".<br />
<br />
==Mongrel==<br />
The default Ruby On Rails HTTP server (WeBrick) while being convenient for tests is not recommend for production use. A better alternative is Mongrel. <br />
<br />
Install mongrel via gem:<br />
# gem install mongrel<br />
<br />
Next start mongrel:<br />
# mongrel_rails start<br />
<br />
That's it!<br />
<br />
==Using databases==<br />
Most web applications need some sort of database to stock the data. Ruby on Rails is very versatile because it supports a lot of databases.<br />
<br />
===sqlite===<br />
sqlite is the default database for Ruby on Rails. To enable sqlite, install ruby-sqlite3<br />
# pacman -S ruby-sqlite3<br />
<br />
===mysql===<br />
mysql needs to be configured prior to using it with rails. To know how, refer to the [[MySQL]] and [[LAMP]] pages on this wiki.<br />
<br />
First install the gem module for mysql:<br />
# gem install mysql<br />
<br />
You can generate a rails application configured for mysql by using the -d parameter :<br />
# rails -d mysql testapp_name<br />
<br />
You then need to edit config/database.yml. Rails uses 3 databases for production/tests/development. For testing purposes, only the development database is needed. Fill out the database, username & password fields.<br />
<br />
To test the database, issue the following command :<br />
# rake db:migrate<br />
<br />
If no error are shown, then your setup is correct. To be sure, you can take a peak at the mysql database. For example :<br />
# mysql -u root -p testapp_development<br />
mysql> show tables;<br />
+-------------------+<br />
| Tables_in_testapp |<br />
+-------------------+<br />
| schema_migrations |<br />
+-------------------+<br />
1 row in set (0.00 sec)<br />
<br />
== More Resources ==<br />
* Ruby on Rails http://rubyonrails.org/download<br />
* Mongrel http://mongrel.rubyforge.org/<br />
* [[MySQL]]<br />
* [[LAMP]]</div>Exis10z