Code it and they will run
Posted August 22nd, 2007 at 6:05 pm EDT by S. Brent Faulkner — View Comments
My apologies to W. P. Kinsella (if indeed he is responsible for the original phrase)...
Well, I was digging around through the SimpleLog forums and stumbled upon a promising post entitled SimpleHighlight - Syntax highlighting for SimpleLog. Given that I expect to be featuring code on here now and then, I thought this would be kind of nice.
Oh, the joys of a shared hosting environment!
The following block should be nicely syntax coloured...
class Post has_many :comments end
My intention here is documenting the mess involved in getting SimpleHighlight installed on HostMonster... and to give another hint (that I didn't find documented anywhere) for how to actually enable the highlighting...
First, we need to be able to install our own gems on HostMonster. The HostMonster Helpdesk is actually very helpful.
1. Add the following to your .bashrc file:
export PATH="$PATH:$HOME/packages/bin:$HOME/.gems/bin" export GEM_HOME="$HOME/.gems" export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8" export GEM_CACHE="$GEM_HOME/cache"
2. Make a copy of the sources gem, install it and update all gems (including rails):
cp /usr/lib/ruby/gems/1.8/cache/sources-0.0.1.gem ~ gem install ~/sources-0.0.1.gem gem update -y
3. Modify config/environment.rb to use the local gems:
ENV['GEM_PATH'] = '/path/to/your/home/.gems:/usr/lib/ruby/gems/1.8'
Install Required Library
4. Download, compile and install the Oniguruma regular expression library:
cd ~/src curl -O http://www.geocities.jp/kosako3/oniguruma/archive/onig-5.9.1.tar.gz tar zxvf onig-5.9.1.tar.gz cd onig-5.9.1 ./configure --prefix=/path/to/your/home make make install
Install Prerequisite Gems
NOTE: Most of the required gems were not found by gem install, so downloading them and installing them directly seemed the only option.
5. Install the Oniguruma ruby bindings:
cd ~/src curl -O http://files.rubyforge.vm.bytemark.co.uk/oniguruma/oniguruma-1.1.0.gem gem install oniguruma-1.1.0.gem -- --with-opt-dir=/path/to/your/home
6. Install the plist property list management library:
gem install plist
7. Install the Textpow TextMate Bundle Parsing library:
cd ~/src curl -O http://rubyforge.iasi.roedu.net/files/textpow/textpow-0.10.0.gem gem install textpow-0.10.0.gem
8. Install the Ultraviolet Syntax Highlighting Engine:
cd ~/src curl -O http://files.rubyforge.mmmultiworks.com/ultraviolet/ultraviolet-0.10.1.gem gem install ultraviolet-0.10.1.gem
UPDATE: replace 5...8 with gem install ultraviolet -- --with-opt-dir=/path/to/your/home
9. Install SimpleHighlight from the SVN repository:
./script/plugin install svn://svn.roundhaus.com/daikini/plugins/simple_highlight
NOTE: I didn't actually install from SVN, as it kept timing out. I may figure this out at a later date, but for now I simply installed it on my own working copy of SimpleLog and then used scp -r to copy the vendor/plugins/simple_highlight folder to the appropriate location on the shared host.
IMPORTANT: This is all fine and dandy, but will not do much of anything if you don't actually copy the appropriate CSS into the right spot.
1. Copy the all_hallows_eve.css to your simplelog theme:
cd ~/.gems/gems/ultraviolet-0.10.1/render/xhtml/files/css cp all_hallows_eve.css ~/rails/simplelog_2.0.2/themes/yourtheme/stylesheets
2. Import the css file into your main css file by inserting the following line:
It should now be working... you may have to restart your server or fastcgi processes... or possibly clear your theme cache to get it going...
--Brentblog comments powered by Disqus