|Deletions are marked like this.||Additions are marked like this.|
|Line 141:||Line 141:|
|jmax@book ~/projects/MyTrack $ rake db:create|
Important Project Notes
- You will need this to get Ruby under RVM working on Ubuntu.
http://rubysource.com/installing-ruby-with-rvm-on-ubuntu/ (These worked pretty well for me -JLW)
We are current using http://xtremekforever.blogspot.com/2011/05/setup-rails-project-with-postgresql-on.html as our instructions on how to install Postgresql.
Step one is to install Ruby and RubyGems; this is the appropriate incantation for my Linux distribution (Gentoo):
jmax@book ~ $ sudo emerge ruby rubygems ...package manager nattering while it installs ruby and rubygems...
Next, grab a copy of the MyTrack code:
jmax@book ~ $ cd projects/ jmax@book ~/projects $ git clone email@example.com:jmax315/MyTrack.git Cloning into MyTrack... remote: Counting objects: 84, done. remote: Compressing objects: 100% (60/60), done. remote: Total 84 (delta 11), reused 79 (delta 6) Receiving objects: 100% (84/84), 27.40 KiB, done. Resolving deltas: 100% (11/11), done.
Now we install rvm. rvm is a little weird, in that it is for use with Ruby, but is not itself a Ruby program (and hence, it isn't a gem). It's actually a clever shell hack (with both the good and bad implications of that). Anyway, install it like this:
jmax@book ~/projects $ bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) ...rvm nattering while it installs...
Because rvm is a shell hack, we then need to update our current shell's environment (we could also just start a new shell).
jmax@book ~/projects $ source /home/jmax/.rvm/scripts/rvm
Now, whenever we change into the project's root directory, rvm will arrange for us to use the version of Ruby and the various gems specified in the project's .rvmrc file. This first time, it gets a little upset, because we haven't installed the correct version of Ruby or any of the gems:
jmax@book ~/projects $ cd MyTrack/ ============================================================================== = NOTICE = ============================================================================== = RVM has encountered a new or modified .rvmrc file in the current directory = = This is a shell script and therefore may contain any shell commands. = = = = Examine the contents of this file carefully to be sure the contents are = = safe before trusting it! ( Choose v[iew] below to view the contents ) = ============================================================================== Do you wish to trust this .rvmrc file? (/home/jmax/projects/MyTrack/.rvmrc) y[es], n[o], v[iew], c[ancel]> y Gemset 'MyTrack' does not exist, rvm gemset create 'MyTrack' first. Gemset doesn't exist, proceeding with default gemset ruby ruby-1.9.2-p290 is not installed. To install do: 'rvm install ruby-1.9.2-p290'
Following the nice program's suggestions, we create the gemset and install the necessary version of Ruby:
jmax@book ~/projects/MyTrack $ rvm gemset create 'MyTrack' 'MyTrack' gemset created (/home/jmax/.rvm/gems/ruby-1.9.2-p290@MyTrack). jmax@book ~/projects/MyTrack $ rvm install ruby-1.9.2-p290 Fetching yaml-0.1.4.tar.gz to /home/jmax/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 460k 100 460k 0 0 261k 0 0:00:01 0:00:01 --:--:-- 296k Extracting yaml-0.1.4.tar.gz to /home/jmax/.rvm/src Prepare yaml in /home/jmax/.rvm/src/yaml-0.1.4. Configuring yaml in /home/jmax/.rvm/src/yaml-0.1.4. Compiling yaml in /home/jmax/.rvm/src/yaml-0.1.4. Installing yaml to /home/jmax/.rvm/usr Installing Ruby from source to: /home/jmax/.rvm/rubies/ruby-1.9.2-p290, this may take a while depending on your cpu(s)... ruby-1.9.2-p290 - #fetching ruby-1.9.2-p290 - #downloading ruby-1.9.2-p290, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 8604k 100 8604k 0 0 414k 0 0:00:20 0:00:20 --:--:-- 361k ruby-1.9.2-p290 - #extracting ruby-1.9.2-p290 to /home/jmax/.rvm/src/ruby-1.9.2-p290 ruby-1.9.2-p290 - #extracted to /home/jmax/.rvm/src/ruby-1.9.2-p290 ruby-1.9.2-p290 - #configuring ruby-1.9.2-p290 - #compiling ruby-1.9.2-p290 - #installing Retrieving rubygems-1.8.17 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 246k 100 246k 0 0 429k 0 --:--:-- --:--:-- --:--:-- 587k Extracting rubygems-1.8.17 ... Removing old Rubygems files... Installing rubygems-1.8.17 for ruby-1.9.2-p290 ... Installation of rubygems completed successfully. ruby-1.9.2-p290 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.2-p290 - #importing default gemsets (/home/jmax/.rvm/gemsets/) Install of ruby-1.9.2-p290 - #complete
The capybara-webkit gem, which we use for some of our testing, depends on having a QT development environment installed. This may already be present on your system; if not you need to install it. The appropriate incantation for doing this on Ubuntu (and probably other Debian-based distros) is:
apt-get install libqt4-dev
The last package that we will install manually is bundler, which will handle installing everything else for us:
jmax@book ~/projects/MyTrack $ gem install bundler Successfully installed bundler-1.0.22 1 gem installed Installing ri documentation for bundler-1.0.22... Installing RDoc documentation for bundler-1.0.22...
Finally we cd out of the project's root, then back in, so as to update rvm (If you don't, the next step will malfunction).
jmax@book ~/projects/MyTrack $ cd .. jmax@book ~/projects $ cd MyTrack/ Using /home/jmax/.rvm/gems/ruby-1.9.2-p290 with gemset MyTrack
And tell bundler to deal with everything else:
jmax@book ~/projects/MyTrack $ bundle install Fetching source index for https://rubygems.org/ Fetching source index for http://rubygems.org/ Installing rake (0.9.2.2) ...other gems... Installing uglifier (1.2.3) Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
- If 'therubyracer' fails to install try using the edge version of bundler 'gem install bundler --pre'
And we're almost done. The final step is to get our database initialized:
jmax@book ~/projects/MyTrack $ rake db:create jmax@book ~/projects/MyTrack $ rake db:migrate
We now (should) have a working development environment.