forked from pact-foundation/pact_broker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.rb
67 lines (54 loc) · 1.46 KB
/
app.rb
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 'pact_broker/ui/controllers/index'
require 'pact_broker/ui/controllers/groups'
require 'pact_broker/ui/controllers/matrix'
require 'pact_broker/ui/controllers/can_i_deploy'
require 'pact_broker/ui/controllers/error_test'
require 'pact_broker/doc/controllers/app'
module PactBroker
module UI
class PathInfoFixer
PATH_INFO = 'PATH_INFO'.freeze
def initialize app
@app = app
end
def call env
env[PATH_INFO] = '/' if env[PATH_INFO] == ''
@app.call(env)
end
end
class App
def initialize
@app = ::Rack::Builder.new {
map "/ui/relationships" do
run PactBroker::UI::Controllers::Index
end
map "/groups" do
run PactBroker::UI::Controllers::Groups
end
map "/doc" do
run PactBroker::Doc::Controllers::App
end
map "/matrix" do
use PathInfoFixer
run PactBroker::UI::Controllers::Matrix
end
map "/pacticipants/" do
use PathInfoFixer
run PactBroker::UI::Controllers::CanIDeploy
end
map "/test/error" do
use PathInfoFixer
run PactBroker::UI::Controllers::ErrorTest
end
map "/" do
use PathInfoFixer
run PactBroker::UI::Controllers::Index
end
}
end
def call env
@app.call(env)
end
end
end
end