arnklint Challenges, overcomings, thoughts and inspiration.

Distribute your Rails App with a One Click .exe

Ever wondered how to distribute you rails application to a window instance. This is how:

Distribute your Rails app with a one click .exe

There is a great tool for making a ruby application run smoothly on Microsoft platforms. It’s called RubyScript2Exe and Tar2RubyScript. The author of both of these has made a great job explaining how to distribute a Rails app as a one click .exe with the above tools. However, the example is about three years old by now, so a small update is posted here.

The part I have changed since Erik posted the tutorial (which is using Ruby on Rails version 0.14.3) is the following. Instead of:

module Rails
  class Configuration
    def database_configuration
      conf = YAML::load(ERB.new(IO.read(database_configuration_file)).result)
      if defined?(TAR2RUBYSCRIPT)
        conf.each do |k, v|
          if v["adapter"] =~ /^sqlite/
            v["database"] = oldlocation(v["database"]) if v.include?("database")
            v["dbfile"]   = oldlocation(v["dbfile"]) if v.include?("dbfile")
          end
        end
      end
      conf
    end
  end
end