EPF Wiki Development Guide
Welcome to the EPF Wiki Development Guide. This guide covers the steps necessary to begin development on EPF Wiki using Aptana Studio, CVS, and Bugzilla.
Development Environment Setup
- Ruby 1.8.4 but 1.8.6 is recommended
- Ruby Gems 0.9.4 or higher
- Rails 2.0.2
- MySQL 5.0.15 or higher
- Windows UnxUtils (for Windows)
- TinyMCE 2.1.3 stable (currently the only supported editor)
You can use another database, in fact you can use any of supported databases by Rails migrations. UnxUtils is included with the requirements because the current documentation of EPF Wiki assumes the development environment will run on Windows (XP) and the production environment on Linux.
Ruby is shipped with SCIntilla based Text Editor so this minimum setup is already very complete. But for more serious development work the following extra components come highly recommended.
- Aptana Studio
XAMPP includes MySQL so this replaces the MySQL database listed with the minimum requirements. On top of that XAMPP includes many other useful components for development.
This step is documented in the Installation Guide, see http://wiki.eclipse.org/EPF_Wiki_Installation_Guide#UnxUtils
Install HTML Tidy
HTML Tidy can be downloaded from tidy.sf.net. The easiest way to install this is to save the executable tidy.exe in the location C:\WINDOWS\system32. Alternatively you can of course put in another location and add that location to your PATH system variable.
Install Ruby and Ruby Gems
The following gems need te be installed
These can be installed with the following commands:
gem install tidy gem install mysql gem install rails -v=2.0.2 gem install xhtmldiff
Ruby Gems can be installed using command gem install or can be installed manually by downloading the gems from gems.rubyforge.org. Your proxy server can be specified using p switch, for more information type gem help install
- Download Aptana Studio
- Add RadRails to Aptana Studio by following the Start Page instructions (Help > Aptana Studio Start Page...).
See the screencast for more information.
Checkout project from CVS
Start Aptana Studio and switch to the CVS repository perspective. Add a repository location with the following properties
Connection type: extssh Host: dev.eclipse.org Repository path: /cvsroot/technology
See also CVS Repository Setup in the EPF Composer Development Guide.
From the menu bar select File > New > Project > CVS > Project from CVS.
In the wizard check Use and existing repository location and select the newly created repository. Select Use an existing module and then browse to and select the module name org.eclipse.epf/epfwiki/source
CVS does not version folders so after the previous step we need to run rails -s source to create the folders that are missing. Of course none of the files that we checked out need to be overwritten. The -s option skips over all of these files.
This commercial editor can be integrated with EPF Wiki.
- Download TinyMCE 2.1.3 stable from tinymce.moxiecode.com
The most recent version of TinyMCE is not supported yet.
Create a Development Database
Assuming you have created a MySQL user with enough privileges to create and drop databases you can create a development database with some test accounts, a test Wiki and a Templates Wiki by executing a few simple commands from the EPF Wiki application root folder:
set RAILS_ENV=development rake db:create db:migrate db:fixtures:load ruby script/runner 'create_templates' ruby script/runner 'create_oup_wiki'
If you want to recreate the database you can do so by adding a drop command to the second command displayed above:
rake db:drop db:create db:migrate db:fixtures:load
This steps above are explained in more detail in the remainder of this section. Edit the database configuration file config/database.yml file, specify the information for your databases or accept the defaults. It is recommended to specify a MySQL user with enough privileges to create and drop databases. With such a setup you can (re)create the database, create some test accounts with a single command executed from the application root:
rake db:drop db:create db:migrate db:fixtures:load
Of course you can split up this command and do it step by step.
- Drop the database: rake db:drop
- Create the database: rake db:create
- Create the database schema: rake db:migrate
The default environment this works on is the development environment, see #How to specify, use the Rails environments if you want to use this for other environments.
Load some test data (optional)
Navigate to the application root and specify to environment
Create some users
This command creates the following users:
- Administrator email@example.com with password Andy Kaufman.
- User firstname.lastname@example.org with password Cash Oshman
- Central administrator email@example.com with password George Shapiro
Create a Wiki using OpenUP
ruby script/runnner -e development 'create_oup_wiki'
Create the Templates Wiki
ruby script/runner -e development 'create_templates'
Run Unit, Functional, Integration Tests
gem install feedvalidator
To genereate a test coverage report, you can use rcov. This can be installed with:
gem install rcov
You can generate a HTML report with the following commands:
rcov --rails --aggregate rcoverage.data --text-summary --no-html test/unit/*_test.rb rcov --rails --aggregate rcoverage.data --text-summary --no-html test/functional/*_test.rb rcov --rails --aggregate rcoverage.data --text-summary --html test/integration/*_test.rb
This will create a directory coverage that contains a HTML report with the test coverage results.
How to specify, use the Rails environments
undefined method `require_gem'
After upgrade of Ruby Gems things are not working as expected. For instance when you run a rake tasks you get a message similar to
c:/ruby/bin/rake.bat:24: undefined method `require_gem' for main:Object (NoMethodError)
You fix this by reinstalling gems. You can find out what to reinstall by doing a search for require_gem in c:\ruby\bin. You can also replace manually all instance of of require_gem with gem.