diff options
Diffstat (limited to 'guides/source/development_dependencies_install.md')
-rw-r--r-- | guides/source/development_dependencies_install.md | 112 |
1 files changed, 77 insertions, 35 deletions
diff --git a/guides/source/development_dependencies_install.md b/guides/source/development_dependencies_install.md index ec25e09222..3d9ec578ae 100644 --- a/guides/source/development_dependencies_install.md +++ b/guides/source/development_dependencies_install.md @@ -45,75 +45,89 @@ $ cd rails The test suite must pass with any submitted code. No matter whether you are writing a new patch, or evaluating someone else's, you need to be able to run the tests. -Install first libxml2 and libxslt together with their development files for Nokogiri. In Ubuntu that's +Install first SQLite3 and its development files for the `sqlite3` gem. Mac OS X +users are done with: ```bash -$ sudo apt-get install libxml2 libxml2-dev libxslt1-dev +$ brew install sqlite3 ``` -If you are on Fedora or CentOS, you can run +In Ubuntu you're done with just: ```bash -$ sudo yum install libxml2 libxml2-devel libxslt libxslt-devel +$ sudo apt-get install sqlite3 libsqlite3-dev ``` -If you are running Arch Linux, you're done with: +And if you are on Fedora or CentOS, you're done with ```bash -$ sudo pacman -S libxml2 libxslt +$ sudo yum install sqlite3 sqlite3-devel ``` -On FreeBSD, you just have to run: +If you are on Arch Linux, you will need to run: ```bash -# pkg_add -r libxml2 libxslt +$ sudo pacman -S sqlite ``` -Alternatively, you can install the `textproc/libxml2` and `textproc/libxslt` -ports. +For FreeBSD users, you're done with: + +```bash +# pkg install sqlite3 +``` -If you have any problems with these libraries, you can install them manually by compiling the source code. Just follow the instructions at the [Red Hat/CentOS section of the Nokogiri tutorials](http://nokogiri.org/tutorials/installing_nokogiri.html#red_hat__centos) . +Or compile the `databases/sqlite3` port. -Also, SQLite3 and its development files for the `sqlite3` gem — in Ubuntu you're done with just +Get a recent version of [Bundler](http://bundler.io/) ```bash -$ sudo apt-get install sqlite3 libsqlite3-dev +$ gem install bundler +$ gem update bundler ``` -And if you are on Fedora or CentOS, you're done with +and run: ```bash -$ sudo yum install sqlite3 sqlite3-devel +$ bundle install --without db ``` -If you are on Arch Linux, you will need to run: +This command will install all dependencies except the MySQL and PostgreSQL Ruby drivers. We will come back to these soon. + +NOTE: If you would like to run the tests that use memcached, you need to ensure that you have it installed and running. + +You can use [Homebrew](http://brew.sh/) to install memcached on OS X: ```bash -$ sudo pacman -S sqlite +$ brew install memcached ``` -For FreeBSD users, you're done with: +On Ubuntu you can install it with apt-get: ```bash -# pkg_add -r sqlite3 +$ sudo apt-get install memcached ``` -Or compile the `databases/sqlite3` port. +Or use yum on Fedora or CentOS: + +```bash +$ sudo yum install memcached +``` -Get a recent version of [Bundler](http://gembundler.com/) +If you are running on Arch Linux: ```bash -$ gem install bundler -$ gem update bundler +$ sudo pacman -S memcached ``` -and run: +For FreeBSD users, you're done with: ```bash -$ bundle install --without db +# pkg install memcached ``` -This command will install all dependencies except the MySQL and PostgreSQL Ruby drivers. We will come back to these soon. With dependencies installed, you can run the test suite with: +Alternatively, you can compile the `databases/memcached` port. + +With the dependencies now installed, you can run the test suite with: ```bash $ bundle exec rake test @@ -133,13 +147,20 @@ $ cd railties $ TEST_DIR=generators bundle exec rake test ``` -You can run any single test separately too: +You can run the tests for a particular file by using: ```bash $ cd actionpack $ bundle exec ruby -Itest test/template/form_helper_test.rb ``` +Or, you can run a single test in a particular file: + +```bash +$ cd actionpack +$ bundle exec ruby -Itest path/to/test.rb -n test_name +``` + ### Active Record Setup The test suite of Active Record attempts to run four times: once for SQLite3, once for each of the two MySQL gems (`mysql` and `mysql2`), and once for PostgreSQL. We are going to see now how to set up the environment for them. @@ -152,7 +173,19 @@ The Active Record test suite requires a custom config file: `activerecord/test/c #### MySQL and PostgreSQL -To be able to run the suite for MySQL and PostgreSQL we need their gems. Install first the servers, their client libraries, and their development files. In Ubuntu just run +To be able to run the suite for MySQL and PostgreSQL we need their gems. Install +first the servers, their client libraries, and their development files. + +On OS X, you can run: + +```bash +$ brew install mysql +$ brew install postgresql +``` + +Follow the instructions given by Homebrew to start these. + +In Ubuntu just run: ```bash $ sudo apt-get install mysql-server libmysqlclient15-dev @@ -177,8 +210,8 @@ $ sudo pacman -S postgresql postgresql-libs FreeBSD users will have to run the following: ```bash -# pkg_add -r mysql56-client mysql56-server -# pkg_add -r postgresql92-client postgresql92-server +# pkg install mysql56-client mysql56-server +# pkg install postgresql93-client postgresql93-server ``` Or install them through ports (they are located under the `databases` folder). @@ -204,26 +237,35 @@ mysql> GRANT ALL PRIVILEGES ON activerecord_unittest.* to 'rails'@'localhost'; mysql> GRANT ALL PRIVILEGES ON activerecord_unittest2.* to 'rails'@'localhost'; +mysql> GRANT ALL PRIVILEGES ON inexistent_activerecord_unittest.* + to 'rails'@'localhost'; ``` and create the test databases: ```bash $ cd activerecord -$ bundle exec rake mysql:build_databases +$ bundle exec rake db:mysql:build ``` -PostgreSQL's authentication works differently. A simple way to set up the development environment for example is to run with your development account +PostgreSQL's authentication works differently. To setup the development environment +with your development account, on Linux or BSD, you just have to run: ```bash $ sudo -u postgres createuser --superuser $USER ``` -and then create the test databases with +and for OS X: + +```bash +$ createuser --superuser $USER +``` + +Then you need to create the test databases with ```bash $ cd activerecord -$ bundle exec rake postgresql:build_databases +$ bundle exec rake db:postgresql:build ``` It is possible to build databases for both PostgreSQL and MySQL with @@ -244,4 +286,4 @@ NOTE: Using the rake task to create the test databases ensures they have the cor NOTE: You'll see the following warning (or localized warning) during activating HStore extension in PostgreSQL 9.1.x or earlier: "WARNING: => is deprecated as an operator". -If you’re using another database, check the file `activerecord/test/config.yml` or `activerecord/test/config.example.yml` for default connection information. You can edit `activerecord/test/config.yml` to provide different credentials on your machine if you must, but obviously you should not push any such changes back to Rails. +If you're using another database, check the file `activerecord/test/config.yml` or `activerecord/test/config.example.yml` for default connection information. You can edit `activerecord/test/config.yml` to provide different credentials on your machine if you must, but obviously you should not push any such changes back to Rails. |