<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>JuiceBlog! comments on Guide to Installing Hieraki2</title>
    <link>http://juice10.com/blog/</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>JuiceBlog! comments</description>
    <item>
      <title>"Guide to Installing Hieraki2" by justinhalsall</title>
      <description>&lt;p&gt;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:&lt;/p&gt;


	&lt;h2&gt;What do I need?&lt;/h2&gt;


	&lt;ul&gt;
	&lt;li&gt;Mysql 4.1 or higher&lt;/li&gt;
		&lt;li&gt;Ruby 1.8.2 or higher&lt;/li&gt;
		&lt;li&gt;Rails 1.0 or higher&lt;/li&gt;
		&lt;li&gt;Rubygems 0.8.11 or higher&lt;/li&gt;
		&lt;li&gt;Gem packages: syntax, redcloth&lt;/li&gt;
	&lt;/ul&gt;

&lt;h2&gt;Step one, getting the goods.&lt;/h2&gt;


	&lt;p&gt;First thing you need to do is download and uncompress &lt;a href="http://rubyforge.org/frs/?group_id=581&amp;#38;release_id=3926"&gt;Hieraki 2.0.1&lt;/a&gt;&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;wget http://rubyforge.org/frs/download.php/7920/hieraki-2.0.1.tgz
tar -zxvf hieraki-2.0.1.tgz&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Then &lt;code&gt;cd&lt;/code&gt; into the hieraki directory&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;cd hieraki-2.0.1/&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Database&lt;/h2&gt;


	&lt;p&gt;If you want to run hieraki you need a MySQL 4.1 database or higher.
Go ahead and create one:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;mysqladmin -u root create hieraki2&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Now we need to get the tables and data into the database.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;mysql -u root hieraki2 &amp;lt; db/schema.mysql.sql&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Edit config/database.yml to set the Mysql user account information. Rename config/mail.yml.example to config/mail.yml and check the settings.&lt;/p&gt;


	&lt;h2&gt;Gems and plugins&lt;/h2&gt;


	&lt;p&gt;If you haven&amp;#8217;t allread installed syntax &amp;#38; redcloth install them.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;sudo gem install syntax redcloth&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;You will also need the upload_progress plugin to get it working.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;script/plugin install upload_progress&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Editing the code&lt;/h2&gt;


	&lt;p&gt;Unfortunatly we need to edit some files. Firstup is &lt;code&gt;models/wiki/page.rb&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;Around lines 65-86 comment out&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;find_by_sql(["SELECT * 
              FROM pages
              WHERE MATCH (keywords) AGAINST (?)", tokens.join(' ')])&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;And add:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;find(:all, :conditions =&amp;gt; [(["(LOWER(keywords) LIKE ?)"] * 
        tokens.size).join(" AND "), *tokens.collect { |token| [token] * 1
        }.flatten],
        :order =&amp;gt; 'updated_at DESC')&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;Your code should look a bit like this:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;  def self.search(query, options = {})
    configuration = { :only_published =&amp;gt; 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 =&amp;gt; [(["(LOWER(keywords) LIKE ?)"] * 
        tokens.size).join(" AND "), *tokens.collect { |token| [token] * 1
        }.flatten],
        :order =&amp;gt; 'updated_at DESC')
    else
      []
    end
  end&lt;/code&gt;&lt;/pre&gt;

	&lt;p&gt;(Thanks to &lt;a href="http://www.freeonrails.com/node/3216#comment-9608"&gt;Ed Gard&lt;/a&gt;)&lt;/p&gt;


	&lt;p&gt;Second up is &lt;code&gt;config/environment.rb&lt;/code&gt;&lt;/p&gt;


	&lt;p&gt;Comment out line 86:&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;# ActionController::Base.enable_upload_progress&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Nearly there&lt;/h2&gt;


	&lt;p&gt;Before you fire up your server we need to add something to the database. This isn&amp;#8217;t needed to use Hieraki but it enables the first user to edit the homepage.&lt;/p&gt;


&lt;pre&gt;&lt;code&gt;INSERT INTO acl VALUES (1,1,1,1,1,1,1)&lt;/code&gt;&lt;/pre&gt;

	&lt;h2&gt;Fire up your engines!&lt;/h2&gt;


	&lt;p&gt;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.&lt;/p&gt;


&lt;p&gt;Mongrel:&lt;br /&gt;
&lt;code&gt;mongrel_rails start -e production&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Webrick:&lt;br /&gt;
&lt;code&gt;scripts/server -e production&lt;/code&gt;&lt;/p&gt;

	&lt;p&gt;Now you can go ahead and signup to create a new user.&lt;/p&gt;


	&lt;p&gt;&lt;em&gt;Have fun!&lt;/em&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 21 Sep 2006 23:57:00 PDT</pubDate>
      <guid>&lt;a href="/blog/articles/2006/09/21/guide-to-installing-hieraki2"&gt;Guide to Installing Hieraki2&lt;/a&gt;</guid>
      <link>&lt;a href="/blog/articles/2006/09/21/guide-to-installing-hieraki2"&gt;Guide to Installing Hieraki2&lt;/a&gt;</link>
    </item>
  </channel>
</rss>
