Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 344
- Log:
Massive changeset which brings the old, ROOL customised Instiki
version up to date, but without any ROOL customisations in this
latest checked-in version (which is 0.19.1). This is deliberate,
so that it's easy to see the changes made for the ROOL version
in a subsequent changeset. The 'app/views/shared' directory is not
part of Instiki but is kept to maintain the change history with
updated ROOL customisations, some of which involve the same files
in that same directory.
- Author:
- rool
- Date:
- Sat Mar 19 19:52:13 +0000 2011
- Size:
- 3508 Bytes
- Properties:
- Property svn:executable is set
1 | #!/usr/bin/env ruby |
2 | require File.join(File.dirname(__FILE__), '..', 'config', 'boot') |
3 | # Don't do this. Instead, put it here, where we can customize it. |
4 | #require 'commands/server' |
5 | |
6 | require 'active_support' |
7 | require 'action_controller' |
8 | |
9 | require 'fileutils' |
10 | require 'optparse' |
11 | |
12 | # TODO: Push Thin adapter upstream so we don't need worry about requiring it |
13 | begin |
14 | require_library_or_gem 'thin' |
15 | rescue Exception |
16 | # Thin not available |
17 | end |
18 | |
19 | options = { |
20 | :Port => 2500, |
21 | :Host => "0.0.0.0", |
22 | :environment => (ENV['RAILS_ENV'] || "production").dup, |
23 | :config => Rails.root.join('config.ru'), |
24 | :detach => false, |
25 | :debugger => false |
26 | } |
27 | |
28 | ARGV.clone.options do |opts| |
29 | opts.on("-p", "--port=port", Integer, |
30 | "Runs Instiki on the specified port.", "Default: 2500") { |v| options[:Port] = v } |
31 | opts.on("-b", "--binding=ip", String, |
32 | "Binds Instiki to the specified ip.", "Default: 0.0.0.0") { |v| options[:Host] = v } |
33 | opts.on("-c", "--config=file", String, |
34 | "Use custom rackup configuration file") { |v| options[:config] = v } |
35 | opts.on("-d", "--daemon", "Make server run as a Daemon.") { options[:detach] = true } |
36 | opts.on("-u", "--debugger", "Enable ruby-debugging for the server.") { options[:debugger] = true } |
37 | opts.on("-e", "--environment=name", String, |
38 | "Specifies the environment to run this server under (test/development/production).", |
39 | "Default: production") { |v| options[:environment] = v } |
40 | opts.on("-P", "--path=/path", String, "Runs Instiki mounted at a specific path.", "Default: /") { |v| options[:path] = v } |
41 | |
42 | opts.separator "" |
43 | |
44 | opts.on("-h", "--help", "Show this help message.") { puts opts; exit } |
45 | |
46 | opts.parse! |
47 | end |
48 | |
49 | server = Rack::Handler.get(ARGV.first) rescue nil |
50 | unless server |
51 | begin |
52 | server = Rack::Handler::Mongrel |
53 | rescue LoadError => e |
54 | server = Rack::Handler::WEBrick |
55 | end |
56 | end |
57 | |
58 | puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}" |
59 | puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}#{options[:path]}" |
60 | |
61 | %w(cache pids sessions sockets).each do |dir_to_make| |
62 | FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make)) |
63 | end |
64 | |
65 | if options[:detach] |
66 | Process.daemon |
67 | pid = Rails.root.join('tmp', 'pids', 'server.pid') |
68 | File.open(pid, 'w'){ |f| f.write(Process.pid) } |
69 | at_exit { File.delete(pid) if File.exist?(pid) } |
70 | end |
71 | |
72 | ENV["RAILS_ENV"] = options[:environment] |
73 | RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV) |
74 | |
75 | if File.exist?(options[:config]) |
76 | config = options[:config] |
77 | if config =~ /\.ru$/ |
78 | cfgfile = File.read(config) |
79 | if cfgfile[/^#\\(.*)/] |
80 | opts.parse!($1.split(/\s+/)) |
81 | end |
82 | inner_app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config) |
83 | else |
84 | require config |
85 | inner_app = Object.const_get(File.basename(config, '.rb').capitalize) |
86 | end |
87 | else |
88 | require Rails.root.join('config', 'environment') |
89 | inner_app = ActionController::Dispatcher.new |
90 | end |
91 | |
92 | if options[:path].nil? |
93 | map_path = "/" |
94 | else |
95 | ActionController::Base.relative_url_root = options[:path] |
96 | map_path = options[:path] |
97 | end |
98 | |
99 | app = Rack::Builder.new { |
100 | use Rails::Rack::LogTailer unless options[:detach] |
101 | use Rails::Rack::Debugger if options[:debugger] |
102 | map map_path do |
103 | use Rails::Rack::Static |
104 | run inner_app |
105 | end |
106 | }.to_app |
107 | |
108 | puts "=> Call with -d to detach" |
109 | |
110 | trap(:INT) { exit } |
111 | |
112 | puts "=> Ctrl-C to shutdown server" |
113 | |
114 | begin |
115 | server.run(app, options.merge(:AccessLog => [])) |
116 | ensure |
117 | puts 'Exiting' |
118 | end |