-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathconfig.ru
More file actions
41 lines (35 loc) · 700 Bytes
/
config.ru
File metadata and controls
41 lines (35 loc) · 700 Bytes
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
require 'rubygems'
require 'json'
class RubyBridge
def call(env)
response = []
data = JSON.dump(env)
IO.popen("./rackup.php", 'r+') do |io|
io.write data
io.close_write
response = io.read
end
JSON.load(response)
end
end
class RubyMiddlewareBridge
def initialize(app)
@app = app
end
def call(env)
env['rack.ruby_bridge_response'] = @app.call(env)
response = []
data = JSON.dump(env)
IO.popen("./rackup.php", 'r+') do |io|
io.write data
io.close_write
response = io.read
end
JSON.load(response)
end
end
use Rack::Reloader
run Rack::Cascade.new([
Rack::File.new('public'),
RubyBridge.new
])