rubyx-debugger/config.ru

43 lines
859 B
Plaintext
Raw Normal View History

2015-07-22 15:17:25 +02:00
# config.ru
require 'bundler'
Bundler.require
2015-07-22 22:08:36 +02:00
Opal.use_gem "salama"
Opal.use_gem "salama-arm"
2015-07-22 15:17:25 +02:00
require "tilt/erb"
require "susy"
require "json"
2015-07-22 15:17:25 +02:00
require "react/source"
class DebugServer < Opal::Server
def parse(num)
string_input = '"Hello again".putstring()'
parser = Parser::Salama.new
out = parser.parse(string_input)
parts = Parser::Transform.new.apply(out)
parts.to_basic
end
def call(env)
if env['PATH_INFO'].include? "/parse.json"
parse_out = parse(1).to_s
[200, { 'Content-Type' => 'text/json' }, [parse_out]]
else
super
end
end
2015-07-22 15:17:25 +02:00
end
run DebugServer.new {|s|
2015-07-22 15:26:46 +02:00
s.append_path 'app'
2015-07-23 12:15:44 +02:00
s.append_path 'lib'
2015-07-22 15:17:25 +02:00
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
s.main = 'main'
2015-07-24 09:15:27 +02:00
s.debug = false
2015-07-22 15:17:25 +02:00
s.source_map = true
s.index_path = "index.html.erb"
2015-07-22 15:17:25 +02:00
}