<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>juretta.com (Rails)</title>
    <link>http://www.juretta.com</link>
    <language>en</language>
    <webMaster>Stefan Saasen</webMaster>
    <pubDate>2010-01-13T23:33:16+13:00</pubDate>
    <copyright>Copyright 2007-2009</copyright>
    <ttl>60</ttl>
    <description></description>
    
    
    
    
    <item>
      <title>Goodby Rails, kind of...</title>
      <link>http://www.juretta.com/log/2009/05/29/goodbye-rails</link>
      <pubDate>Fri May 29 00:00:00 +1200 2009</pubDate>
      <guid>http://www.juretta.com/log//log/2009/05/29/goodbye-rails/</guid>
      <description>&lt;p&gt;I started this blog about 4 years ago using a custom built Rails blog engine using Rails 0.8.
A Rails based blog engine wasn't around at that time and I wanted to build something using Rails anyway.&lt;/p&gt;

&lt;p&gt;Having a custom built blog engine has its benefits and drawbacks. The rather basic administration interface
was a pain to use and running two Mongrel instances for a nearly static website seemed to be a
misallocation of ressources anyway.&lt;/p&gt;

&lt;p&gt;So instead of switching to another full-fledged blog engine I switched to using &lt;a href=&quot;http://github.com/mojombo/jekyll/tree/master&quot; title=&quot;Jekyll&quot;&gt;Jekyll&lt;/a&gt; to generate a static version of the blog.&lt;/p&gt;

&lt;p&gt;Tom Preston-Werner (the author of Jekyll) writes about his reasons for creating Jekkyl in
&lt;a href=&quot;http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html&quot;&gt;Blogging Like a Hacker&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote cite=&quot;http://tom.preston-werner.com/2008/11/17/blogging-like-a-hacker.html&quot;&gt;
I was tired of complicated blogging engines like WordPress and Mephisto. I wanted to write great posts, not style a zillion template pages, moderate comments all day long, and constantly lag behind the latest software release.
&lt;/blockquote&gt;


&lt;p&gt;Jekyll is the complete opposite, it is a:&lt;/p&gt;

&lt;blockquote&gt;
    [...] simple, blog aware, static site generator. It takes a template directory (representing the raw form of a website), runs it through Textile and Liquid converters, and spits out a complete, static website suitable for serving with Apache or your favorite web server.
&lt;/blockquote&gt;


&lt;p&gt;With a basic directory layout and a simple configuration file creating a static copy of your blog is merely running
the &lt;code&gt;jekyll&lt;/code&gt; command in your blog directory.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;stefan@macbook-pro:~/webs/juretta.com/www &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;tree -L 3
.
|-- Rakefile
|-- _config.yml
|-- site
|   |-- 404.html
|   |-- _includes
|   |   &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;-- entry-preview.html
|   |-- _layouts
|   |   |-- default.html
|   |   &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;-- post.html
|   |-- _posts
|   |   |-- 2008-11-11-hudson_test_drive_part_1_rails.html
|   |   |-- 2008-12-11-hudson_at_wellrailed.html
|   |   |-- 2009-05-24-activemq-jms-stomp.markdown
|   |   &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;-- 2009-05-29-goodbye-rails.markdown
|   |-- about
|   |   &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;-- index.html
|   |-- atom.xml
|   |-- favicon.ico
|   |-- images
|   |-- index.html
|   |-- javascripts
|   |-- rss.xml
|   |-- sitemap.xml
|   &lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;-- stylesheets
&lt;span class=&quot;sb&quot;&gt;`&lt;/span&gt;-- web
&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Running &lt;code&gt;jekyll&lt;/code&gt; in this directory will copy all the static files in &lt;code&gt;site&lt;/code&gt; into &lt;code&gt;web&lt;/code&gt; and will transform your
content files (HTML, Markdown, Textile based) applying a series of layout files (Read more on the Jekyll Wiki pages: &lt;a href=&quot;http://wiki.github.com/mojombo/jekyll/usage&quot;&gt;Usage&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;Running &lt;code&gt;jekyll --server&lt;/code&gt; will transform the files and fires up a local WEBrick server running on &lt;code&gt;http://localhost:4000&lt;/code&gt;.&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;stefan@macbook-pro:~/webs/juretta.com/www &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;master&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;0&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake server
&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;in /Users/stefan/webs/juretta.com/www&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
juicer merge --force --document-root ./site ./site/stylesheets/base.css
Produced site/stylesheets/base.min.css from
  site/stylesheets/undohtml.css
  site/stylesheets/screen.css
  site/stylesheets/form.css
  site/stylesheets/syntax.css
  site/stylesheets/base.css
jekyll --server
Configuration from ./_config.yml
Building site: site -&amp;gt; web
Successfully generated site: site -&amp;gt; web
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2009-05-29 17:49:10&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; INFO  WEBrick 1.3.1
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2009-05-29 17:49:10&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; INFO  ruby 1.8.6 &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;2007-09-24&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;i686-darwin9.2.0&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;2009-05-29 17:49:10&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; INFO  WEBrick::HTTPServer#start: &lt;span class=&quot;nv&quot;&gt;pid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;7634 &lt;span class=&quot;nv&quot;&gt;port&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;4000
&lt;/pre&gt;
&lt;/div&gt;


&lt;p&gt;Throw in some &lt;a href=&quot;http://www.cjohansen.no/en/ruby/juicer_a_css_and_javascript_packaging_tool&quot;&gt;juicer&lt;/a&gt; goodness and a nice git post-receive hook and your new post is only a single &lt;code&gt;git push&lt;/code&gt; away.&lt;/p&gt;
</description>
      
    </item>
    
    
    
    
    
    <item>
      <title>Hudson at WellRailed</title>
      <link>http://www.juretta.com/log/2008/12/11/hudson_at_wellrailed</link>
      <pubDate>Thu Dec 11 00:00:00 +1300 2008</pubDate>
      <guid>http://www.juretta.com/log//log/2008/12/11/hudson_at_wellrailed/</guid>
      <description>

&lt;p&gt;
I had the pleasure to give a short talk about Rails and Hudson at the Wellington Rails user group (WellRailed) meeting in November.
&lt;/p&gt;

&lt;p&gt;
I talked about using the &lt;a href=&quot;https://hudson.dev.java.net/&quot;&gt;Hudson extensible continuous integration engine&lt;/a&gt; to run Rails tests and using git as the SCM.
&lt;/p&gt;

&lt;p&gt;
The slides are availble here: &lt;a href=&quot;http://static.coravy.com/talks/WellRailed-Hudson-Rails-git.pdf&quot;&gt;static.coravy.com/talks/WellRailed-Hudson-Rails-git.pdf&lt;/a&gt;
&lt;/p&gt;

</description>
      
    </item>
    
    
    
    <item>
      <title>Hudson test drive (Part 1: Rails)</title>
      <link>http://www.juretta.com/log/2008/11/11/hudson_test_drive_part_1_rails</link>
      <pubDate>Tue Nov 11 00:00:00 +1300 2008</pubDate>
      <guid>http://www.juretta.com/log//log/2008/11/11/hudson_test_drive_part_1_rails/</guid>
      <description>

&lt;p&gt;
I've been using &lt;a href=&quot;https://hudson.dev.java.net/&quot;&gt;Hudson&lt;/a&gt; for quite a while now and it just rocks. Gone are my CruiseControl (for Java) and CruiseControl.rb (for Ruby/Rails) installations. I even ditched most of my crontab entries and have Hudson manage the repeated tasks for me.
&lt;/p&gt;

&lt;blockquote cite=&quot;http://hudson.gotdns.com/wiki/display/HUDSON/Meet+Hudson&quot;&gt;
Hudson monitors executions of repeated jobs, such as building a software project or jobs run by cron. Among those things, current Hudson focuses on the following two jobs:
1. Building/testing software projects continuously just like CruiseControl or DamageControl. [...]
2. Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs, even those that are run on a remote machine. [...]
&lt;/blockquote&gt;

&lt;p&gt;
Compared to CruiseControl configuring jobs in Hudson is really easy and straightforward. You can easily give it a test ride without even installing Hudson in your servlet container. Let's give it a try.
&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;stefan@macbook-pro:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;curl -OL http://hudson.gotdns.com/latest/hudson.war
  % Total    % Received % Xferd  
                                 
100 19.6M  100 19.6M    0     0  
stefan@macbook-pro:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;java -jar hudson.war 
&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;Winstone 2008/10/24 12:33:11&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; - Beginning extraction from war file
hudson home directory: /Users/stefan/.hudson
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
This will start an instance of hudson which can be accessed at &lt;a href=&quot;http://localhost:8080/&quot;&gt;http://localhost:8080/&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
Hudson will create a &lt;code&gt;.hudson&lt;/code&gt; directory to store files and plugins. You can set the &lt;code&gt;HUDSON_HOME&lt;/code&gt; environment variable to use a different directory.
&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;stefan@macbook-pro:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;export &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;HUDSON_HOME&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;/opt/local/hudson
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
Due to its multi purpose nature it's easy to build different kinds of software projects. If you can build your projetc using a command line script you might be able to build it using Hudson.
&lt;/p&gt;

&lt;h3&gt;Hudson and Rails&lt;/h3&gt;

&lt;p&gt;
Part one covers building &lt;a href=&quot;http://www.rubyonrails.org/&quot;&gt;Rails&lt;/a&gt; projects with Hudson. I'm going to cover building Java and Flex projects in future posts.
&lt;/p&gt;

&lt;p&gt;
In order to build a Rails project as soon as a commit is made, we need a couple of plugins. I'm going to use the &lt;a href=&quot;http://git.or.cz/&quot;&gt;git&lt;/a&gt; scm for this example. The default Hudson installation supports SVN out of the box but with the &lt;a href=&quot;http://hudson.gotdns.com/wiki/display/HUDSON/Git+Plugin&quot;&gt;Hudson git plugin&lt;/a&gt; using git as your scm is a piece of cake.
&lt;/p&gt;

&lt;p&gt;
Go to &lt;strong&gt;Manage hudson&lt;/strong&gt; (http://localhost:8080/manage) &amp;gt; &lt;strong&gt;Manage plugins&lt;/strong&gt; (http://localhost:8080/pluginManager/) and click on the &lt;em&gt;Available&lt;/em&gt; tab. Choose the following plugins:
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Git Plugin&lt;/li&gt;
  &lt;li&gt;Rake plugin&lt;/li&gt;
  &lt;li&gt;Ruby Plugin&lt;/li&gt;
&lt;!--  &lt;li&gt;Ruby metrics plugin&lt;/li&gt;--&gt;
&lt;/ul&gt;

&lt;p&gt;
and click on the &lt;strong&gt;Install&lt;/strong&gt; Button (bottom right).
&lt;/p&gt;

&lt;p&gt;
Hudson needs to be restarted in order to activate the plugins. Stop the currently running proceess (&lt;code&gt;CTRL+C&lt;/code&gt;) and start Hudson again (&lt;code&gt;java -jar hudson.war&lt;/code&gt;).
&lt;/p&gt;

&lt;h3&gt;Configure your Rails project&lt;/h3&gt;

&lt;p&gt;
Hudson can run your Rake test task without further modification. But it would be really nice if the test output could be aggregated in Hudson.
&lt;/p&gt;

&lt;p&gt;
We are going to install the ci_reporter gem (http://caldersphere.rubyforge.org/ci_reporter/) for this purpose.
&lt;/p&gt;

&lt;blockquote cite=&quot;http://caldersphere.rubyforge.org/ci_reporter/&quot;&gt;
CI::Reporter is an add-on to Test::Unit and RSpec that allows you to generate XML reports of your test and/or spec runs. The resulting files can be read by a continuous integration system that understands Ant‘s JUnit report XML format, thus allowing your CI system to track test/spec successes and failures. 
&lt;/blockquote&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;stefan@macbook-pro:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;sudo gem install ci_reporter
Successfully installed ci_reporter-1.5.1
1 gem installed
Installing ri documentation &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;ci_reporter-1.5.1...
Installing RDoc documentation &lt;span class=&quot;k&quot;&gt;for &lt;/span&gt;ci_reporter-1.5.1...
&lt;/pre&gt;
&lt;/div&gt;

Add the following lines to your Rakefile (or clone the git repository with the Rails example project: &lt;br /&gt;&lt;code&gt;git clone http://github.com/juretta/hudson-example-project-rails/tree/master&lt;/code&gt;).

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;rubygems&amp;#39;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# Install:&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#  sudo gem install ci_reporter&lt;/span&gt;
&lt;span class=&quot;n&quot;&gt;gem&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;ci_reporter&amp;#39;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;ci/reporter/rake/test_unit&amp;#39;&lt;/span&gt; &lt;span class=&quot;c1&quot;&gt;# use this if you&amp;#39;re using Test::Unit&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
Run the following rake task and the ci_reporter gem should create xml files in the &lt;code&gt;results&lt;/code&gt; directory of your project.
&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;stefan@macbook-pro:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;rake ci:setup:testunit &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:units &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt;:functionals &lt;span class=&quot;nv&quot;&gt;CI_REPORTS&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;results
&lt;/pre&gt;
&lt;/div&gt;


&lt;h3&gt;Add a new job&lt;/h3&gt;

&lt;p&gt;
Go to the Hudson homepage and click on &lt;strong&gt;New Job&lt;/strong&gt; (http://localhost:8080/newJob). Choose a Job name, select &lt;strong&gt;Build a free-style software project&lt;/strong&gt; and click &lt;em&gt;Ok&lt;/em&gt;.
&lt;/p&gt;

&lt;p&gt;
You should now be on the project configuration page (http://localhost:8080/job/YOUR-PROJECT-NAME/configure). 
&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;In the &lt;em&gt;Source Code Management&lt;/em&gt; section choose &lt;strong&gt;git&lt;/strong&gt;. Enter your git repository URL (The Rails project used in this example is hosted on github: git://github.com/juretta/hudson-example-project-rails.git).
&lt;/li&gt;
&lt;!--
&lt;li&gt;Ignore &lt;em&gt;Build Triggers&lt;/em&gt; for now - we will come to that one later.&lt;/li&gt;
--&gt;
&lt;li&gt;Click on &lt;em&gt;Add build step&lt;/em&gt; and choose &lt;em&gt;Invoke Rake&lt;/em&gt;. Enter &lt;em&gt;db:migrate ci:setup:testunit test:units test:functionals CI_REPORTS=results RAILS_ENV=test&lt;/em&gt; into the &lt;strong&gt;Task&lt;/strong&gt; field.&lt;/li&gt;
&lt;li&gt;In the &lt;em&gt;Post-build Actions&lt;/em&gt; section check &lt;em&gt;Publish JUnit test result report&lt;/em&gt; and enter &lt;code&gt;results/*.xml&lt;/code&gt; into the &lt;strong&gt;Test report XMLs&lt;/strong&gt; field.&lt;/li&gt;
&lt;!--
&lt;li&gt;Resist the temptation to check &lt;em&gt;Publish Rcov report&lt;/em&gt; - we will come to that later.&lt;/li&gt;
&lt;li&gt;Check &lt;em&gt;Publish Rails stats report&lt;/em&gt; instead and click &lt;strong&gt;Save&lt;/strong&gt;&lt;/li&gt;
--&gt;
&lt;li&gt;Click &lt;strong&gt;Save&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;


&lt;p&gt;
You can click &lt;strong&gt;Build now&lt;/strong&gt; to trigger the first build of your Rails project. 
&lt;/p&gt;

&lt;p&gt;
We now want to trigger the build automatically as soon as we do a git commit.
Edit the &lt;code&gt;post-receive&lt;/code&gt; file in the &lt;code&gt;hooks&lt;/code&gt; directory of your git repository (.git/hooks/post-receive).
&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;nv&quot;&gt;URL&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;http://localhost:8080/job/YOUR-PROJECT-NAME/build&amp;#39;&lt;/span&gt;

&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Run Hudson build&amp;quot;&lt;/span&gt;
wget &lt;span class=&quot;nv&quot;&gt;$URL&lt;/span&gt; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
Make the file executable.
&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;stefan@macbook-pro:~&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;chmod u+x .git/hooks/post-receive
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
The hook script now triggers a build after each commit.
&lt;/p&gt;


&lt;h3&gt;The Ruby metrics plugin&lt;/h3&gt;

&lt;p&gt;
The Ruby metrics plugin shows Rails stats (LOC) and rcov reports. 
Unfortunately with the latest version of Hudson the Ruby metrics Plugin does not seem to work. 
&lt;br /&gt;
You should definitely give it a try. If you get an HTTP 500 Status code with a &lt;code&gt;org.apache.commons.jelly.JellyTagException&lt;/code&gt;
&lt;br /&gt;
remove (or disable) the following line:
&lt;br /&gt;
&lt;code&gt;&amp;lt;st:include it=&quot;${it.owner}&quot; page=&quot;sidepanel.jelly&quot; /&amp;gt;&lt;/code&gt; in
&lt;br /&gt; 
&lt;code&gt;$HUDSON_HOME/plugins/rubyMetrics/WEB-INF/classes/hudson/plugins/rubyMetrics/railsStats/RailsStatsBuildAction/index.jelly&lt;/code&gt;
&lt;/p&gt;


&lt;p&gt;
Have fun with Hudson!
&lt;/p&gt;


</description>
      
    </item>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <item>
      <title>Rails WDDX request</title>
      <link>http://www.juretta.com/log/2007/01/31/rails_wddx_request</link>
      <pubDate>Wed Jan 31 00:00:00 +1300 2007</pubDate>
      <guid>http://www.juretta.com/log//log/2007/01/31/rails_wddx_request/</guid>
      <description>

&lt;!--
http://attachr.com/6887
http://attachr.com/6888
--&gt;
&lt;p&gt;
I was asked how to get the body of an HTTP post request in a Rails controller. And with the most things in Rails it's very easy.
&lt;/p&gt;

&lt;p&gt;
In Java you can get a ServletInputStream from the request object, in PHP there is  $_SERVER['RAW_POST_DATA']. Pretty much like in the java version you can just ask the request object for &lt;code&gt;raw_post&lt;/code&gt; in Rails.
&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c1&quot;&gt;# Simple RPC-Controller in Rails&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# request.raw_post contains the raw post data, that is&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# the data that is submitted in the http request body.&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# The example uses the wddx gem to return a simple WDDX response message&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# To us WDDX install the wddx gem ([sudo] gem install wddx)&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# and a require &amp;quot;wddx&amp;quot; statement&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# to config/environment.rb&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# app/controllers/rpc_controller.rb&lt;/span&gt;

&lt;span class=&quot;c1&quot;&gt;# This controller has a simple method &amp;quot;endpoint&amp;quot;&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# The body of the post request is written to the &lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# log/#{environment}.log file.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# The controller returns a WDDX XML message.&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;RpcController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ApplicationController&lt;/span&gt;             
  &lt;span class=&quot;c1&quot;&gt;# simple endpoint&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;endpoint&lt;/span&gt;
     &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post?&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;logger&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;debug&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;request&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;raw_post&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Ok&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_wddx&lt;/span&gt;
     &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
       &lt;span class=&quot;n&quot;&gt;render&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:xml&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;Failure&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_wddx&lt;/span&gt;
     &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;
To test this controller you can use the following code to issue a post request.
&lt;/p&gt;

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;c1&quot;&gt;#!/usr/bin/env ruby&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#  Created by Stefan Saasen on 2007-01-31.&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;#  Copyright (c) 2007. All rights reserved.&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;rubygems&amp;#39;&lt;/span&gt;  
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;net/http&amp;#39;&lt;/span&gt;
&lt;span class=&quot;nb&quot;&gt;require&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;wddx&amp;#39;&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;begin&lt;/span&gt;      
  &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Net&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;HTTP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;new&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;localhost&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3000&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
  &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;http&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;post&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&amp;#39;/Rpc/endpoint&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;key&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; 
      &lt;span class=&quot;s2&quot;&gt;&amp;quot;another&amp;quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;value&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;to_wddx&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; 
  &lt;span class=&quot;nb&quot;&gt;puts&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;body&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;rescue&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;SocketError&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;e&lt;/span&gt;
  &lt;span class=&quot;c1&quot;&gt;# error handling&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;

</description>
      
    </item>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <item>
      <title>Rspec Rails plugin</title>
      <link>http://www.juretta.com/log/2006/12/07/rspec_rails_plugin</link>
      <pubDate>Thu Dec 07 00:00:00 +1300 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/12/07/rspec_rails_plugin/</guid>
      <description>
I'm using the very convenient RSpec Rails plugin. 
From the Rspec website:
&lt;blockquote cite=&quot;http://rspec.rubyforge.org/&quot;&gt;
RSpec is a framework for practicing Behaviour Driven Development (BDD) in Ruby.
&lt;/blockquote&gt;

&lt;p&gt;
You can find more information on Rspec and the rails plugin on &lt;a href=&quot;http://rspec.rubyforge.org/&quot;&gt;http://rspec.rubyforge.org/&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
After using rspec for a little while the following error suddenly occured:
&lt;/p&gt;
&lt;pre class=&quot;shell&quot;&gt;
vendor/plugins/rspec/lib/spec/rails/version.rb:14: (RuntimeError) 
############################################################################
Your RSpec on Rails plugin is incompatible with your installed RSpec.

RSpec          : 0.7.4 (r1201)
RSpec on Rails : r35

Make sure your RSpec on Rails plugin is compatible with your RSpec gem.
See http://rspec.rubyforge.org/documentation/rails/install.html for details.
############################################################################
&lt;/pre&gt;
&lt;p&gt;
The RSpec plugin uses the Subversion Revision information to determine the current version number. If you are using Subversion to manage your rails project this error will occur if you have svn:keywords enabled and svn:keywords contains &quot;Revision&quot;. The version information then reflects the revision of your repository.
&lt;/p&gt;
&lt;p&gt;
You either have to disable svn:keywords for vendor/plugins/rspec/lib/spec/rails/version.rb or change the REV constant in version.rb to the current Rspec plugins Revision (1201 for the RSpec on Rails 0.7.4 plugin):
&lt;/p&gt;
&lt;pre class=&quot;shell&quot;&gt;
macbook-sts: $ cd vendor/plugins/rspec/lib/spec/rails
macbook-sts: $ svn pe svn:keywords version.rb
&quot;Id Author Revision&quot; -&gt; &quot;Id Author&quot; (for example)
&lt;/pre&gt;

&lt;pre class=&quot;shell&quot;&gt;
macbook-sts: $ svn diff -r44:45
Index: version.rb
===================================================================
--- version.rb  (revision 44)
+++ version.rb  (revision 45)
@@ -3,7 +3,7 @@
     module VERSION
       unless defined?(REV)
         # RANDOM_TOKEN: 0.644898830762263
-        REV = &quot;$LastChangedRevision: 1201 $&quot;.match(/LastChangedRevision: (\d+)/)[1]
+        REV = &quot;1201&quot;
       end
     end
   end
&lt;/pre&gt;
</description>
      
    </item>
    
    
    
    
    
    <item>
      <title>Using Spamassassin with Rails ActionMailer</title>
      <link>http://www.juretta.com/log/2006/11/25/using_spamassassin_with_rails_actionmailer</link>
      <pubDate>Sat Nov 25 00:00:00 +1300 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/11/25/using_spamassassin_with_rails_actionmailer/</guid>
      <description>
&lt;p&gt;
Running &lt;a href=&quot;http://attachr.com/&quot;&gt;attachr.com&lt;/a&gt; for quite a while i noticed that the email service (you can send an email to save@attachr.com to save a code snippet) became target for spam mails.
&lt;br /&gt;
I decided to install spamassassin to mark incoming emails for the ActionMailer service that inserts email entries into the attachr.com database.
&lt;/p&gt;

&lt;p&gt;
Running a decent Debian webserver the whole task took only about 10 minutes.
&lt;/p&gt;

&lt;strong&gt;First, install spamassassin&lt;/strong&gt;
&lt;br /&gt;
&lt;pre class=&quot;shell&quot;&gt;
attachr:~# apt-get install spamassassin
&lt;/pre&gt;

&lt;p&gt;
You need to enable spamassassing in /etc/default/spamassassin.
&lt;/p&gt;

&lt;pre class=&quot;shell&quot;&gt;
attachr:~# vim /etc/default/spamassassin
# /etc/default/spamassassin
# Duncan Findlay

# WARNING: please read README.spamd before using.
# There may be security risks.

# Change to one to enable spamd
ENABLED=1
# ^^^^^set ENABLED to 1
&lt;/pre&gt;
&lt;p&gt;
Start the Spamassassin Daemon:
&lt;/p&gt;

&lt;pre class=&quot;shell&quot;&gt;
attachr:~# /etc/init.d/spamassassin start
&lt;/pre&gt;

&lt;p&gt;
To filter every incoming email with spammassasin the alias file (&lt;code&gt;/etc/postfix/attachr&lt;/code&gt; looks like this:
&lt;/p&gt;
&lt;pre class=&quot;shell&quot;&gt;
cat /etc/postfix/attachr
save: &quot;|/usr/bin/spamc|/path/to/app/script/runner 'EntryMailer.receive(STDIN.read)'&quot; 
&lt;/pre&gt;

&lt;p&gt;
Spamassassin marks every email with additional mail header fields (X-Spam-...).
Email marked as Spam has a X-Spam-Status header field like this:
&lt;/p&gt;

&lt;pre&gt;
X-Spam-Status: Yes, score=7.0 required=5.0 tests=FORGED_MUA_OUTLOOK,
&lt;/pre&gt;

The Ruby code handling inbound mails has an &quot;email&quot; object containing the incoming email. The &quot;x-spam-status&quot; field contains the header value. Just match a /^Yes/ to flag the incoming mail as spam (attachr.com just ignores entries flagged as spam).
&lt;br /&gt;
&lt;code&gt;spam = true if email[&quot;x-spam-status&quot;].to_s =~ /^Yes/ &lt;/code&gt;

</description>
      
    </item>
    
    
    
    <item>
      <title>Add generated Rails files to SVN</title>
      <link>http://www.juretta.com/log/2006/11/21/add_generated_rails_files_to_svn</link>
      <pubDate>Tue Nov 21 00:00:00 +1300 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/11/21/add_generated_rails_files_to_svn/</guid>
      <description>
&lt;code&gt;./script/generate model MediaFile --svn&lt;/code&gt;

creates your model and test files. The generated files are automatically added to your Subversion repository (after commit).

&lt;pre class=&quot;shell&quot;&gt;
      exists  app/models/
      exists  test/unit/
      exists  test/fixtures/
      create  app/models/media_file.rb
A         app/models/media_file.rb
      create  test/unit/media_file_test.rb
A         test/unit/media_file_test.rb
      create  test/fixtures/media_files.yml
A         test/fixtures/media_files.yml
      exists  db/migrate
      create  db/migrate/002_create_media_files.rb
A         db/migrate/002_create_media_files.rb
&lt;/pre&gt;
</description>
      
    </item>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <item>
      <title>Rails: Reload models in script/console</title>
      <link>http://www.juretta.com/log/2006/08/11/rails_reload_models_in_script_console</link>
      <pubDate>Fri Aug 11 00:00:00 +1200 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/08/11/rails_reload_models_in_script_console/</guid>
      <description>
&lt;code&gt;Dispatcher.reset_application!&lt;/code&gt; reloads your model while running &lt;code&gt;script/console&lt;/code&gt;.

&lt;pre class=&quot;shell&quot;&gt;
stefan@www:~$ ./script/console
Loading development environment.
&gt;&gt; ...
[...]
&gt;&gt; Dispatcher.reset_application!
&lt;/pre&gt;
</description>
      
    </item>
    
    
    
    <item>
      <title>Rails 1.1.5: Mandatory security patch - UDPATE</title>
      <link>http://www.juretta.com/log/2006/08/10/rails_1_1_5_mandatory_security_patch</link>
      <pubDate>Thu Aug 10 00:00:00 +1200 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/08/10/rails_1_1_5_mandatory_security_patch/</guid>
      <description>
&lt;p&gt;
This is a MANDATORY upgrade for anyone not running on a very recent edge (which isn't affected by this). If you have a public Rails site, you MUST upgrade to Rails 1.1.5. The security issue is severe and you do not want to be caught unpatched. &lt;a href=&quot;http://weblog.rubyonrails.org/2006/8/9/rails-1-1-5-mandatory-security-patch-and-other-tidbits&quot;&gt;read more&lt;/a&gt;
&lt;/p&gt;

&lt;strong&gt;Update&lt;/strong&gt;
&lt;p&gt;
Rails 1.0 and prior is not affected by the latest security breach. Neither is Rails 1.1.3. &lt;a href=&quot;http://weblog.rubyonrails.org/2006/8/10/security-update-rails-1-0-not-affected&quot;&gt;read more&lt;/a&gt;
&lt;/p&gt;


&lt;strong&gt;Update&lt;/strong&gt;
&lt;p&gt;
Unfortunately another upgrade (1.1.6) is required! Do it now:
&lt;/p&gt;
&lt;pre class=&quot;shell&quot;&gt;
stefans@powermac:~$sudo gem install rails --source http://gems.rubyonrails.org --include-dependencies
&lt;/pre&gt;
&lt;p&gt;
&lt;a href=&quot;http://weblog.rubyonrails.org/2006/8/10/rails-1-1-6-backports-and-full-disclosure&quot;&gt;read more&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
You might want to use this &lt;a href=&quot;http://pastie.caboo.se/7993&quot;&gt;vulnerability tester&lt;/a&gt; to test your application. Read the code carfully and try to understand what it does before you use it to test your rails application.
&lt;/p&gt;
&lt;blockquote ecite=&quot;http://blog.evanweaver.com/articles/2006/08/10/explanation-of-the-rails-security-vulnerability-in-1-1-4-others&quot;&gt;
Be very careful to check that it wonâ€™t accidentally do something dangerous to your app.
&lt;/blockquote&gt;

&lt;p&gt;
You can find more info about this security hole &lt;a href=&quot;http://blog.evanweaver.com/articles/2006/08/10/explanation-of-the-rails-security-vulnerability-in-1-1-4-others&quot;&gt;here&lt;/a&gt; or &lt;a href=&quot;http://www.tuxedo-es.org/blog/2006/08/10/light-over-ruby-on-rails-critical-security-upgrade-115/&quot;&gt;here&lt;/a&gt;.
&lt;/p&gt;





</description>
      
    </item>
    
    
    
    
    
    <item>
      <title>Rails-Rdoc task fails on Windows</title>
      <link>http://www.juretta.com/log/2006/08/07/rails-rdoc_task_fails_on_windows</link>
      <pubDate>Mon Aug 07 00:00:00 +1200 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/08/07/rails-rdoc_task_fails_on_windows/</guid>
      <description>
&lt;p&gt;
Using the most recent version of Rails the rdoc rake task fails on my windows test box.
&lt;/p&gt;
&lt;p&gt;
A quick and simple hack enables the rdoc task.
&lt;/p&gt;
Replace:
&lt;pre class=&quot;ruby&quot;&gt;
Rake::RDocTask.new(&quot;appdoc&quot;) { |rdoc|
  rdoc.rdoc_dir = 'doc/app'
  rdoc.title    = &quot;Rails Application Documentation&quot;
  rdoc.options &lt;&lt; '--line-numbers --inline-source'
  rdoc.rdoc_files.include('doc/README_FOR_APP')
  rdoc.rdoc_files.include('app/**/*.rb')
}
&lt;/pre&gt;
&lt;p&gt;
with:
&lt;/p&gt;
&lt;pre class=&quot;ruby&quot;&gt;
task &quot;appdoc&quot; do
   require 'rdoc/rdoc'
   rdoc = RDoc::RDoc.new
   options = Array.new
   #options &lt;&lt; '-a'   # parses all methods (include protected, private)
   #options &lt;&lt; '-cUTF-8' # you may want to set the charset
   options &lt;&lt; '-odoc/app'
   options &lt;&lt; '--line-numbers'
   options &lt;&lt; '--inline-source'
   options &lt;&lt; '-Thtml'
   options &lt;&lt; 'doc/README_FOR_APP'
   Dir.glob('app/**/*.rb').each do |file|
    options &lt;&lt; file
   end
   rdoc.document(options)    
end
&lt;/pre&gt;


&lt;strong&gt;Update: &lt;/strong&gt; see &lt;a href=&quot;http://dev.rubyonrails.org/ticket/2018&quot;&gt;http://dev.rubyonrails.org/ticket/2018&lt;/a&gt; for further information.
</description>
      
    </item>
    
    
    
    
    
    <item>
      <title>Capistrano: Hide SVN Files</title>
      <link>http://www.juretta.com/log/2006/07/07/capistrano_hide_svn_files</link>
      <pubDate>Fri Jul 07 00:00:00 +1200 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/07/07/capistrano_hide_svn_files/</guid>
      <description>
Do you use Capistrano to deploy your Rails app?

&lt;p&gt;
Capistrano uses subversion to deploy rails applications. Unfortunately this means that the hidden subversion directories (usually .svn) are accessible via HTTP.
To prevent the exposure of .svn files or directories you are strongly encouraged to add the following lines to your server configuration:
&lt;/p&gt;

&lt;strong&gt;Apache&lt;/strong&gt;:
&lt;pre&gt;
# Don't expose .svn files/directories    
&amp;lt;DirectoryMatch &quot;^/.*/\.svn/&quot;&amp;gt;
    Order deny,allow
    Deny from all
&amp;lt;/DirectoryMatch&amp;gt;
&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;strong&gt;Using a (mod_rewrite) rewrite rule:&lt;/strong&gt;
&lt;pre&gt;
RewriteRule \.svn/.*   -   [F]   
&lt;/pre&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;strong&gt;Lighttpd&lt;/strong&gt;:
&lt;pre&gt;
$HTTP[&quot;url&quot;] =~ &quot;/\.svn/&quot; {
    url.access-deny = ( &quot;&quot; )
}
&lt;/pre&gt;
</description>
      
    </item>
    
    
    
    <item>
      <title>Restart lighttpd and Rails</title>
      <link>http://www.juretta.com/log/2006/05/16/restart_lighttpd_and_rails</link>
      <pubDate>Tue May 16 00:00:00 +1200 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/05/16/restart_lighttpd_and_rails/</guid>
      <description>
Small shell script to restart lighttpd. The script kills all dispatch.fcgi processes and restarts the webserver.

&lt;pre class=&quot;shell&quot;&gt;
#!/bin/bash
# Autor: Stefan Saasen &lt;s@juretta.com&gt;

# lighttpd stop
#kill -KILL $(ps -ax | grep &quot;lighttpd.conf&quot; | \
                             grep -v &quot;grep&quot; | awk '{print $1}')
echo &quot;Stopping lighttpd...&quot;
sudo /etc/init.d/lighttpd stop

# Ruby stop
echo &quot;kill dispatch.fcgi processes...&quot;
for i in $(ps aux | egrep &quot;^www-data(.*)dispatch.fcgi&quot; | \
             grep -v &quot;grep&quot; | awk '{print $2}'); do kill -KILL $i; done

# lighttpd start
echo &quot;start lighttpd&quot;
sudo /etc/init.d/lighttpd start
&lt;/pre&gt;
</description>
      
    </item>
    
    
    
    <item>
      <title>Daedalus considered 'verboten'</title>
      <link>http://www.juretta.com/log/2006/04/25/daedalus_considered_verboten</link>
      <pubDate>Tue Apr 25 00:00:00 +1200 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/04/25/daedalus_considered_verboten/</guid>
      <description>
See: &lt;a href=&quot;http://weblog.textdrive.com/article/185/happy-thanksgiving-daedalus-is-for-dinner&quot;&gt;http://weblog.textdrive.com/article/185/happy-thanksgiving-daedalus-is-for-dinner&lt;/a&gt; , &lt;a href=&quot;http://weblog.textdrive.com/article/178/fun&quot;&gt;http://weblog.textdrive.com/article/178/fun&lt;/a&gt; and &lt;a href=&quot;http://forum.textdrive.com/viewtopic.php?id=7081&quot;&gt;http://forum.textdrive.com/viewtopic.php?id=7081&lt;/a&gt; for further information.


</description>
      
    </item>
    
    
    
    <item>
      <title>Freeze Rails</title>
      <link>http://www.juretta.com/log/2006/04/01/freeze_rails</link>
      <pubDate>Sat Apr 01 00:00:00 +1200 2006</pubDate>
      <guid>http://www.juretta.com/log//log/2006/04/01/freeze_rails/</guid>
      <description>
&lt;p&gt;
As soon as you deploy a rails app on the production server you should consider to &quot;freeze&quot; your Rails. That means to put the Rails framework in a subdirectory (&lt;code&gt;vendor/rails&lt;/code&gt;) of your application.
&lt;/p&gt;

&lt;p&gt;
As of Rails version 0.14.x you just need to run &lt;code&gt;rake freeze_gems&lt;/code&gt; inside your app directory to unpack the current gems into vendor/rails.
&lt;/p&gt;

&lt;p&gt;
Another way to achieve this is to check out the desired version into vendor/rails using svn.
&lt;/p&gt;

&lt;p&gt;
Browse &lt;a href=&quot;http://dev.rubyonrails.org/svn/rails/tags/&quot;&gt;http://dev.rubyonrails.org/svn/rails/tags/&lt;/a&gt; and check out the desired version using
&lt;/p&gt;
&lt;pre class=&quot;shell&quot;&gt;
stefan@www:~$ cd /path/to/your/app/vendor
stefan@www:~$ svn co http://dev.rubyonrails.org/svn/rails/tags/rel_1-0-0/ \
rails
&lt;/pre&gt;

&lt;p&gt;
In case your application already is under version control using subversion (as i hope it is) you can set svn:external to fetch the framework into vendor/rails.
&lt;/p&gt;

&lt;pre class=&quot;shell&quot;&gt;
stefan@www:~$ cd /path/to/your/app/vendor
stefan@www:~$ svn ps svn:externals \
&quot;rails http://dev.rubyonrails.org/svn/rails/tags/rel_1-0-0/&quot; &lt;strong&gt;.&lt;/strong&gt;
&lt;/pre&gt;
</description>
      
    </item>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <item>
      <title>Ruby Mysql on Mac OS X (Panther)</title>
      <link>http://www.juretta.com/log/2005/12/11/ruby_mysql_on_mac_os_x_panther</link>
      <pubDate>Sun Dec 11 00:00:00 +1300 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/12/11/ruby_mysql_on_mac_os_x_panther/</guid>
      <description>

&lt;h3&gt;Any problems installing the Ruby mysql gem?&lt;/h3&gt;

&lt;div class=&quot;shell&quot;&gt;[sts@powerbook mysql-2.7]$ sudo gem install mysql
[...]
    ERROR: Failed to build gem native extension.
&lt;/div&gt;

&lt;div class=&quot;shell&quot;&gt;[sts@powerbook mysql-2.7]$ cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7
[sts@powerbook mysql-2.7]$ sudo ruby extconf.rb --with-mysql-lib=/usr/local/mysql/lib 
&lt;br /&gt;--with-mysql-include=/usr/local/mysql/include
[sts@powerbook mysql-2.7]$ sudo make
[sts@powerbook mysql-2.7]$ sudo make install
&lt;/div&gt;
</description>
      
    </item>
    
    
    
    <item>
      <title>How to change the asset path in RubyOnRails</title>
      <link>http://www.juretta.com/log/2005/12/10/how_to_change_the_asset_path_in_rubyonrails</link>
      <pubDate>Sat Dec 10 00:00:00 +1300 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/12/10/how_to_change_the_asset_path_in_rubyonrails/</guid>
      <description>

If you don't want to name your asset directories for javascript files and stylesheets &quot;javascripts&quot; and &quot;stylesheets&quot; here is how you can change the default path settings.

Add the following snippet to your app/controllers/application.rb:
&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;ActionView&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Helpers&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;AssetTagHelper&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Returns path to a javascript asset. Example:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;#   javascript_path &amp;quot;xmlhr&amp;quot; # =&amp;gt; /javascripts/xmlhr.js      &lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;javascript_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;compute_public_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;js&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;js&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;        
      &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# Returns path to a stylesheet asset. Example:&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;#&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;#   stylesheet_path &amp;quot;style&amp;quot; # =&amp;gt; /stylesheets/style.css&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;stylesheet_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;compute_public_path&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;source&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;css&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;s1&quot;&gt;&amp;#39;css&amp;#39;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
      &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;      
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
</description>
      
    </item>
    
    
    
    
    
    
    
    
    
    
    
    <item>
      <title>Logrotate auf FreeBSD: newsyslog</title>
      <link>http://www.juretta.com/log/2005/10/19/logrotate_auf_freebsd_newsyslog</link>
      <pubDate>Wed Oct 19 00:00:00 +1300 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/10/19/logrotate_auf_freebsd_newsyslog/</guid>
      <description>
&lt;blockquote&gt;
newsyslog is a highly configurable program for managing and archiving log files. 
&lt;/blockquote&gt;


&lt;div class=&quot;shell&quot;&gt;/usr/sbin/newsyslog -r -f /home/sts/etc/newsyslog.conf
&lt;/div&gt;
&lt;p&gt;
Ausgabe des Outputs ohne die Logfiles zu bearbeiten:
&lt;/p&gt;
&lt;div class=&quot;shell&quot;&gt;/usr/sbin/newsyslog -r &lt;strong&gt;-n&lt;/strong&gt; -f /home/sts/etc/newsyslog.conf
&lt;/div&gt;



&lt;p&gt;
[1] Link: &lt;a href=&quot;http://www.weird.com/~woods/projects/newsyslog.html&quot;&gt;http://www.weird.com/~woods/projects/newsyslog.html&lt;/a&gt;
&lt;br /&gt;
[2] Manpage newsyslog &lt;a href=&quot;http://www.weird.com/~woods/projects/newsyslog.8.html&quot;&gt;newsyslog&lt;/a&gt;
&lt;br /&gt;
[3] Manpage newsyslog.conf &lt;a href=&quot;http://www.weird.com/~woods/projects/newsyslog.conf.5.html&quot;&gt;newsyslog.conf&lt;/a&gt;
&lt;/p&gt;

</description>
      
    </item>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    <item>
      <title>Rails: Setting Content Type</title>
      <link>http://www.juretta.com/log/2005/06/07/rails_setting_content_type</link>
      <pubDate>Tue Jun 07 00:00:00 +1200 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/06/07/rails_setting_content_type/</guid>
      <description>

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;ApplicationController&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;lt&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;ActionController&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Base&lt;/span&gt;

  &lt;span class=&quot;n&quot;&gt;before_filter&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:set_default_content_type&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set_content_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;content_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@response&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;content_type&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set_default_content_type&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;set_content_type&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;text/html; charset=utf-8&amp;quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
</description>
      
    </item>
    
    
    
    
    
    
    
    <item>
      <title>Setting the charset in a Rails App</title>
      <link>http://www.juretta.com/log/2005/05/26/setting_the_charset_in_a_rails_app</link>
      <pubDate>Thu May 26 00:00:00 +1200 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/05/26/setting_the_charset_in_a_rails_app/</guid>
      <description>
before-filter in application.rb:

&lt;div class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;span class=&quot;n&quot;&gt;before_filter&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;:set_charset&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;set_charset&lt;/span&gt;
    &lt;span class=&quot;vi&quot;&gt;@headers&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&amp;quot;Content-Type&amp;quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&amp;quot;text/html; charset=ISO-8859-15&amp;quot;&lt;/span&gt; 
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
</description>
      
    </item>
    
    
    
    
    
    
    
    
    
    
    
    <item>
      <title> Howto Install Complete Ruby On Debian</title>
      <link>http://www.juretta.com/log/2005/05/18/_howto_install_complete_ruby_on_debian</link>
      <pubDate>Wed May 18 00:00:00 +1200 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/05/18/_howto_install_complete_ruby_on_debian/</guid>
      <description>
&lt;blockquote cite=&quot;http://wiki.rubyonrails.com/rails/show/HowtoInstallCompleteRubyOnDebian&quot;&gt;
&lt;p&gt;
The following command will install all packages and libraries with &quot;ruby1.8&quot; in the package name, which should lead to a more or less complete installation of ruby on your machine:
&lt;/p&gt;

&lt;code&gt;
apt-get install `apt-cache search -n ruby1.8 | cut -d ' ' -f 1` irb1.8 rdoc1.8 ri1.8
&lt;/code&gt;
&lt;/blockquote&gt;

&lt;p&gt;
A few additional packages will be listed as &quot;recommended&quot; or &quot;suggested&quot; before the download/installation starts. You can cut/paste these names into the above command line; some of these packages won't be available however, so you will have to reedit the resulting command line until it is accepted by apt-get.
&lt;/p&gt;

</description>
      
    </item>
    
    
    
    <item>
      <title>Ruby and Rails on Mac OS X Tiger</title>
      <link>http://www.juretta.com/log/2005/04/24/ruby_and_rails_on_mac_os_x_tiger</link>
      <pubDate>Sun Apr 24 00:00:00 +1200 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/04/24/ruby_and_rails_on_mac_os_x_tiger/</guid>
      <description>
&lt;strong&gt;ruby -v&lt;/strong&gt;

&lt;div class=&quot;shell&quot;&gt;[powermac:~] sts% ruby -v
ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]
&lt;/div&gt;

&lt;div class=&quot;shell&quot;&gt;
Readline installieren
curl ftp://ftp.gnu.org/gnu/readline/readline-5.0.tar.gz | tar xfz 
cd readline-5.0
./configure
cd ./shlib; sed -e 's/-dynamic/-dynamiclib/' Makefile &gt; Makefile_; mv Makefile_ Makefile; cd ..
make
sudo make install
sudo rm /usr/lib/libreadline*
sudo ln -s /usr/local/lib/libreadline* /usr/lib/
&lt;/div&gt;
</description>
      
    </item>
    
    
    
    <item>
      <title>lighthttp Apache and RubyOnRails</title>
      <link>http://www.juretta.com/log/2005/03/22/so_gehts</link>
      <pubDate>Tue Mar 22 00:00:00 +1200 2005</pubDate>
      <guid>http://www.juretta.com/log//log/2005/03/22/so_gehts/</guid>
      <description>
&lt;p&gt;
Using Apache as a proxy to serve a Rails on lighttpd application
&lt;/p&gt;


&lt;pre class=&quot;shell&quot;&gt;
&amp;lt;Virtualhost xxx.xxx.xxx.xxx&amp;gt;
        ServerAdmin s@example.com
        ServerName rails.juretta.net
        ServerAlias www.rails.juretta.net

        ProxyPass / http://localhost:81/
        ProxyPassReverse / http://localhost:81
        # disable public proxy usage
        &amp;lt;LocationMatch &quot;^[^/]&quot;&amp;gt;
                Deny from all
        &amp;lt;/LocationMatch&amp;gt;
        ProxyRequests Off
&amp;lt;/Virtualhost&amp;gt;
&lt;/pre&gt;
</description>
      
    </item>
    
    
    
    
  </channel>
</rss>
