move to opal from sinatra

also external index
This commit is contained in:
Torsten Ruger 2015-07-22 17:10:50 +03:00
parent d021816726
commit a0721a0cde
5 changed files with 15 additions and 49 deletions

View File

@ -1,8 +1,6 @@
source 'https://rubygems.org'
gem 'opal-react', :path => '../react.rb'
gem 'opal-browser'
gem 'sinatra'
gem 'opal-jquery'
gem 'react-source'

View File

@ -44,20 +44,10 @@ GEM
tilt (>= 1.4)
opal-activesupport (0.1.0)
opal (>= 0.5.0, < 1.0.0)
opal-browser (0.1.0.beta1)
opal (>= 0.5.5)
paggio
opal-jquery (0.4.0)
opal (>= 0.7.0, < 0.9.0)
paggio (0.2.4)
rack (1.6.4)
rack-protection (1.5.3)
rack
react-source (0.13.3)
sinatra (1.4.6)
rack (~> 1.4)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
sourcemap (0.1.1)
sprockets (3.2.0)
rack (~> 1.0)
@ -67,7 +57,6 @@ PLATFORMS
ruby
DEPENDENCIES
opal-browser
opal-jquery
opal-react!
parslet!
@ -76,7 +65,6 @@ DEPENDENCIES
salama-arm!
salama-object-file!
salama-reader!
sinatra
BUNDLED WITH
1.10.5

View File

@ -1,5 +1,4 @@
require 'opal'
require 'browser'
require 'opal-jquery'
require "json"
require 'opal-react'

View File

@ -5,42 +5,11 @@ Bundler.require
require "react/source"
opal = Opal::Server.new {|s|
run Opal::Server.new {|s|
s.append_path 'app'
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
s.main = 'debuger'
s.main = 'debugger'
s.debug = true
s.source_map = true
s.index_path = "index.html.erb"
}
map '/assets' do
run opal.sprockets
end
post "/parse.json" do
# File.write('./parse.json', JSON.pretty_generate(comments, :indent => ' '))
# JSON.generate(comments)
end
get '/' do
<<-HTML
<!doctype html>
<html>
<head>
<title>Salama Debugger</title>
<link rel="stylesheet" href="base.css" />
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="/assets/react-with-addons.js"></script>
<script src="/assets/debugger.js"></script>
<script>#{Opal::Processor.load_asset_code(opal.sprockets, "debugger.js")}</script>
</head>
<body>
<div id="content"></div>
</body>
</html>
HTML
end
run Sinatra::Application

12
index.html.erb Normal file
View File

@ -0,0 +1,12 @@
<html>
<head>
<title>Salama Debugger</title>
<link rel="stylesheet" href="base.css" />
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<script src="/assets/react-with-addons.js"></script>
<%= javascript_include_tag 'debugger' %>
</head>
<body>
<div id="content"></div>
</body>
</html>