forked from kennethkalmer/ruote-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.ru
68 lines (45 loc) · 965 Bytes
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
require 'pp'
# bundler
require 'rubygems'
require 'bundler/setup'
# json
# make sure you have an entry like:w
#
# gem 'yajl-ruby', :require => 'yajl'
#
# or
# gem 'json', :require => 'yajl'
#
# in your Gemfile
require 'rufus-json/automatic'
# ruote-kit
$:.unshift 'lib'
require 'ruote-kit'
# ruote
require 'ruote/storage/fs_storage'
RuoteKit.engine = Ruote::Engine.new(
Ruote::Worker.new(
Ruote::FsStorage.new(
"ruote_work_#{RuoteKit.env}")))
RuoteKit.engine.register do
catchall
end
# redirecting / to /_ruote (to avoid issue reports from new users)
class ToRuote
def initialize(app)
@app = app
end
def call(env)
if env['PATH_INFO'] == '/'
[ 303, { 'Location' => '/_ruote', 'Content-Type' => 'text/plain' }, [] ]
else
@app.call(env)
end
end
end
# rack middlewares, business as usual...
use ToRuote
use Rack::CommonLogger
use Rack::Lint
use Rack::ShowExceptions
run RuoteKit::Application