Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Getting Set Up For Development

vincent-gros edited this page Apr 12, 2012 · 4 revisions

We are currently using a few ruby libraries to aid in the development work flow. These are all listed in the project's Gemfile. In order to contribute to the project you may need to set up these libraries. Here is a rundown on how to do it:

##1. Install a Ruby interpreter:

###On Windows:

Download an installer for a recent version of ruby (>= 1.9.2) from this site and run it.

###On Mac / Linux:

It is best to use RVM or rbenv to manage your ruby environments on nix' systems. To set up RVM follow these step:

  1. Open a terminal
  2. Enter this command to install RVM: $ curl -L get.rvm.io | bash -s stable
  3. Reload your shell environment: $ source ~/.bash_profile
  4. Install any requirements you are missing (follow the instructions): $ rvm requirements
  5. Right now we recommend using ruby 1.9.2, install it: $ rvm install 1.9.2
  6. Go and grab a coffee, it will take a few minutes to compile
  7. Tell your system to use the ruby interpreter you just installed by default: $ rvm use 1.9.2 --default
  8. Create a gemset for the readium project: $ rvm gemset create readium
  9. cd (out of and then back) into the root directory of the Readium project and trust the .rvmrc when prompted

Install Bundler

simply type this command: $ gem install bundler

Install the project dependencies

###On Windows:

To set up the project dependencies, follow these steps:

  1. Download the Development Kit from this site, double-click, choose an installation directory ;
  2. In a terminal navigate, enter these commands:
  • $ cd <DEVKIT_DIR> (from step 1 above),
  • $ ruby dk.rb init
  • $ ruby dk.rb install
  1. Unfortunately, eventmachine (0.12.10) is not compatible with Windows7 and Ruby >= 1.9.2. You need a pre-release version: $ gem install eventmachine --pre (eventmachine 1.0.0.beta.4.1)
  2. In the project directory, remove Gemfile.lock and edite Gemfile:
  • # for running the server
  • gem "eventmachine", "1.0.0.beta.4.1"
  • gem 'thin'
  • ...
  1. Now, to the project root, type: $ bundle install
  2. WARNING : because you have modified it, don't forget to reload Gemfile and Gemfile.lock with git like:
  • $ git fetch upstream
  • $ git merge upstream/master

###On Mac / Linux:

thanks to Bundler you can do this in one shot. In a terminal navigate to the project root and type:

$ bundle install

Using the libraries

Running unit tests

We use the Jasmine Ruby Gem to run our unit tests in the browser. To start the tests use the command $ rake jasmine to start up a web server running on port 8888 then open a browser and navigate to http://localhost:8888/ to run the tests.

Working with CSS

We are using SASS and Bourbon to take a bit of the pain out of writing CSS. you you should never edit .css files directly, instead modify the .scss files Use the command $ rake styles to start up a process that will watch the project's .scss files for changes and automagically regenerate the css files.

Running the dev server

We are working on a configuration of Readium runs as a webpage and fetches EPUBs over the network. To start a simple server on localhost:3000 serving the readium source, use the command $ rake server. In chrome you should be able to load up the library view by visiting http://localhost:3000/views/library.html