Showing posts with label Redmine. Show all posts
Showing posts with label Redmine. Show all posts

2011-10-20

Using SyntaxHighlighter in Redmine

Redmine provides built-in syntax highlighting based on CodeRay (for this, refer here). But it is not so much powerful as leading libraries such as SyntaxHighlighter.

You can use SyntaxHighlighter with Redmine by simply modifying one template file in the Redmine. The file to modify, base.rhtml is a template file specifying the layout of most pages and located at the following position.



The default contents of base.rhtml is like followings.


You can add a few header elements for styles and scripts to install SyntaxHighlighter like the following.

If your Redmine is located at a restricted network and so can reach 'http://alexgorbatchev.com/'. You should download SyntaxHighlighter and deploy it under the public directory of your Redmine installation.

When SyntaxHighlighter is deployed at ${redmine.home}/htdocs/pulbic/vendor/syntaxhighlighter_3.0.83 directory, the custom header elements would be like the following.



You should restart Redmine to apply the change of template. When loading Redmine using Apache HTTP server, just restart Apache HTTP server.

For more about SyntaxHighlighter refer its homepage at http://alexgorbatchev.com/SyntaxHighlighter/

2010-02-25

Tips on Redmine

The number in the parenthesis means the version of Redmine.

Features and Shortness

Features
  • The pages are based on 'XHTML 1.0 Transitional' (0.9.2)
Shortness
  • List syntax in wiki, especially with ordered list and nested list, can't provide to use blank lines between list items. (0.9.2)
    For example, the following is not to be made simply with Wiki
    1. Spring Framework
      - Dependency injection.
      - Application module or component model.
    
    2. iBATIS
      - Data assess.
      - Separation of source and SQL statement.
      - Effective and easy syntax for dynamic query.
      - No resource leakage due to unclosed ResultSet or Statement object.
    
    
  • Each project can't define its own set of issue status. All the project in the Redmine have to share the same set of issue status. (0.8.4)
  • Writing directly HTML tags in Wiki or Forum is not allowed. (0.9.2)
  • Tracker and name of the issue can't be changed. Why? (0.9.2)
    I was wrong. Changing tracker and name of an issue has been possible since 0.9.x
  • An issue can't be assigned to more than two members. (0.9.2)

Notable Redmine Plugins

2010-02-12

Installing Redmine on Windows

Installation Procedure

Redmine, which is one of the most promising collaboration software including wiki, issue tracking, forum and etc., is based on Ruby. When you install it, you need some packages for ruby and use commands in ruby's world. So, for those who have no experience on Ruby, the installation guide at Redmine's homepage is not enough.

To install Redmine on windows, you should work the following steps. I intalled Redmine 0.9.2 with them. Redmine, as of 0.9.2, supports MySQL 4.1+, PostgreSQL 8 and SQLite 3. MySQL is supposed in the followings. You can easily apply the steps for database for PostgreSQL and SQLite.

  1. Install Ruby using Ruby installer.
  2. Adjust RubyGems.
  3. Install Rake.
  4. Install Rails.
  5. Install internationalization package.
  6. Install MySQL API module for Ruby.
  7. Download and extract Redmine binaries.
  8. Create user and database for Redmine in MySQL.
  9. Setup database configuration of Redmine.
  10. Generate a session store secret.
  11. Update PATH variable of Windows.
  12. Build database schema.
  13. Build default configuration data into the database.
  14. Test the installation.
Install Ruby using Ruby installer.

You can find Ruby Installer for Windows in the following location. : http://rubyinstaller.org/
Ruby Installer is .exe file which make it easy to installing Ruby on windows. It includes RubyGems which is packaging tool for Ruby based applications.
From 0.8.x to 1.1.x of Redmine, Ruby 1.8.6 or 1.8.7 is necessary and 1.9.x is not supported.
After you install Ruby using Ruby Installer, you can find ruby.exe and gem.bat in the bin directory under the Ruby's home.
Ruby Installer will add the bin directory (eg. c:\ruby\bin) to PATH variable of your windows.

You need to install several packages before installing redmine. Those includes rake, rails, and rack. According to the version of the Redmine for you to install, each package has limitation for its version. For this, refer to the official installation guide of Redmine.

During installation, you can identify the packages installed in your machine using the following command.


c:\ruby\bin>gem list -l

It seems to be no problem to install different versions of the same package at the same machine. Applications or packages of ruby seem to be able to find proper version among more than one versions of the necessary package in the machine.

Adjust RubyGems.

You should use RubyGems 1.4.2 or less to install Redmine 1.1.2 correctly. Using RubyGems 1.5.2 with Redmine 1.1.2 would fail when building database schema.

The RubyGems would be installed with Ruby. The version of RubyGems can be identified like this.

c:\ruby\bin>gem -v

If the installed version of the RubyGems is higher than the one required by Redmine, you can downgrade the RubyGems using commands like following.

c:\ruby\bin>gem -v
1.5.2
c:\ruby\bin>gem install rubygems-update -r -v=1.4.2
...
c:\ruby\bin>update_rubygems
...
c:\ruby\bin>gem -v
1.4.2
Install Rake.

Rake is build tool for Ruby. It's like make for Unix or Ant for Java.
You can install Rake using RubyGems's remote installation without manually downloading binaries to your local computer.

c:\ruby\bin>gem install rake -r

Actually, you can run gem.bat in any directory, 'cause Ruby Installer will add the bin directory to the PATH variable.
In the above sample command, -r option means remote installation where the RubyGems would download the wanted packages from the remote site.

Install Rails.

Rails is that famous application framework for Ruby. It is also called Ruby on Rails or RoR.

Redmine 1.1.x requires Rails 2.3.5, so, you have to specify the version of the Rails to install with -v option.

c:\ruby\bin>gem install rails -r -v=2.3.5

Note that the RubyGems also install Rack 1.0.1 during installing Rails 2.3.5. Rack is a web server interface of the ruby for ruby frameworks.

Install internationalization package.

Redmine 1.1.2 with MySQL 5.0 needs 0.4.2 not higher version of i18n package.


c:\ruby\bin>gem install i18n -r -v=0.4.2
Install MySQL API module for Ruby.

First make query for available mysql package. The following command will show the latest version of mysql.

c:\ruby\bin>gem list mysql -r

There may be different mysql packages not only by version but also by platform. If so, you should specify the platform using --platform option.

c:\ruby\bin>gem install mysql -r -v 2.8.1 --platform x86-mswin32
Download and extract Redmine binaries.

You can get Redmine in zip format from here.
You can just extract it any directory you like such as c:\appls\redmine.

Create user and database for Redmine in MySQL.

If you don't have MySQL already, install and setup MySQL 5.0.
You should create a database for Redmine, create a user and then grant proper privilege to the user. You can use the following SQL statements after logging-in as an administrator

create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'passwordforredmine';
grant all privileges on redmine.* to 'redmine'@'localhost';
Setup database configuration of Redmine.

For this, refer official installation guide of Redmine

Generate a session store secret.

If you don't have session_store.rb in config\initializers\ directory under Redmine home directory (eg. c:\appls\redmine\), you should generate it first.
You should run Rake at Redmine home directory.

c:\appls\redmine>rake generate_session_store

And now, you can generate secret.

C:\appls\redmine>rake config/initializers/session_store.rb RAILS_ENV=production
Update PATH variable of Windows.

Ruby's mysql pacakge needs libmysql.dll at runtime. Previously the dll was included in Ruby installer but at some time, it became excluded.
Originally, libmysql.dll is located in the bin directory of MySQL installation.
So, you need to update PATH variable of your Windows to include MySQL's bin directory.

Build database schema.

You should run your MySQL first. And then, use the following Rake command at Redmine home directory.

C:\appls\redmine>rake db:migrate RAILS_ENV=production
Build default configuration data into the database.

While still your MySQL is running,

C:\appls\redmine>rake redmine:load_default_data RAILS_ENV=production
Test the installation.

While still MySQL is running, start your Redmine.

C:\appls\redmine>ruby script/server webrick -e production

Access the login page : http://localhost:3000/login
Try to login built-in default account : admin:admin

References