If someone is interested, I got Rails 3 working but I had to use
tar2rubyscript together with OCRA:
Preparements (part of the instructions borrowed from
http://www.erikveen.dds.nl/tar2rubyscript/):
- someapp/init.rb:
at_exit do
require "irb"
require "drb/acl"
end
unless defined?(Ocra)
load "script/exe_server.rb"
end
- someapp/script/exe_server.rb (modified based on script/rails):
ENV["RAILS_ENV"] = "production" # I want that the exe runs
automatically in the production mode
APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
# copied from: railties/lib/rails/commands.rb:
require 'rails/commands/server'
Rails::Server.new.tap { |server|
require APP_PATH
Dir.chdir(Rails.application.root)
server.start
}
- someapp/config/database.yml (you could this dynamically as well in
application.rb):
production:
adapter: sqlite3
database: <%= File.expand_path('../production.sqlite3',
ENV["OCRA_EXECUTABLE"]) %>
Building (in the parent folder of someapp):
1. tar2rubyscript someapp (use
https://github.com/ryanbooker/tar2rubyscript,
not gem install tar2rubyscript)
2. ocra someapp.rb --add-all-core --gemfile someapp\Gemfile --dll
sqlite3.dll
This gives me someapp.exe which I'm able to run in a computer without
Ruby. You just need to have production.sqlite3 file in the same folder
with the exe file.
Of course it would be nice to do the same without tar2rubyscript by
just using OCRA but I guess this is fine too.