Guide to Installing Hieraki2

Posted by Juice10 Fri, 22 Sep 2006 06:57:00 GMT

Yesterday I tried installing Hieraki2 but because of the lack of documentation if found myself bumping into bugs and unforseen issues. So now for everyone wanting to install Hieraki2 here is what you have to do:

What do I need?

  • Mysql 4.1 or higher
  • Ruby 1.8.2 or higher
  • Rails 1.0 or higher
  • Rubygems 0.8.11 or higher
  • Gem packages: syntax, redcloth

Step one, getting the goods.

First thing you need to do is download and uncompress Hieraki 2.0.1

wget http://rubyforge.org/frs/download.php/7920/hieraki-2.0.1.tgz
tar -zxvf hieraki-2.0.1.tgz

Then cd into the hieraki directory

cd hieraki-2.0.1/

Database

If you want to run hieraki you need a MySQL 4.1 database or higher. Go ahead and create one:

mysqladmin -u root create hieraki2

Now we need to get the tables and data into the database.

mysql -u root hieraki2 < db/schema.mysql.sql

Edit config/database.yml to set the Mysql user account information. Rename config/mail.yml.example to config/mail.yml and check the settings.

Gems and plugins

If you haven’t allread installed syntax & redcloth install them.

sudo gem install syntax redcloth

You will also need the upload_progress plugin to get it working.

script/plugin install upload_progress

Editing the code

Unfortunatly we need to edit some files. Firstup is models/wiki/page.rb

Around lines 65-86 comment out

find_by_sql(["SELECT * 
              FROM pages
              WHERE MATCH (keywords) AGAINST (?)", tokens.join(' ')])

And add:

find(:all, :conditions => [(["(LOWER(keywords) LIKE ?)"] * 
        tokens.size).join(" AND "), *tokens.collect { |token| [token] * 1
        }.flatten],
        :order => 'updated_at DESC')

Your code should look a bit like this:

  def self.search(query, options = {})
    configuration = { :only_published => false }
    configuration.update(options) if options.is_a?(Hash)
    if !query.to_s.strip.empty?
      published = 'AND published != 0' if configuration[:only_published]
      tokens = query.split
#      if configuration[:only_published]

#      else
#        find_by_sql(["SELECT * 
#                      FROM pages
#                      WHERE MATCH (keywords) AGAINST (?)", tokens.join(' ')])
#      end
      find(:all, :conditions => [(["(LOWER(keywords) LIKE ?)"] * 
        tokens.size).join(" AND "), *tokens.collect { |token| [token] * 1
        }.flatten],
        :order => 'updated_at DESC')
    else
      []
    end
  end

(Thanks to Ed Gard)

Second up is config/environment.rb

Comment out line 86:

# ActionController::Base.enable_upload_progress

Nearly there

Before you fire up your server we need to add something to the database. This isn’t needed to use Hieraki but it enables the first user to edit the homepage.

INSERT INTO acl VALUES (1,1,1,1,1,1,1)

Fire up your engines!

Now its time for you to startup your mongrels or your webricks. But before you get nice little error messages you need to start them up in production mode.

Mongrel:
mongrel_rails start -e production

Webrick:
scripts/server -e production

Now you can go ahead and signup to create a new user.

Have fun!

Comments

(leave url/email »)