Skip to content

Commit 545667c

Browse files
committed
Add sinatra example app
1 parent 875ceb9 commit 545667c

File tree

9 files changed

+35
-3
lines changed

9 files changed

+35
-3
lines changed

example/Gemfile

-3
This file was deleted.

examples/rack/Gemfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'opal', :path => '../../../'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/sinatra/Gemfile

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
source 'https://rubygems.org'
2+
3+
gem 'opal', :path => '../../../opal'
4+
gem 'sinatra'

examples/sinatra/app/application.rb

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
require 'opal'
2+
3+
def alert(msg)
4+
`alert(msg)`
5+
end
6+
7+
alert "Hi there!"

examples/sinatra/config.ru

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
require 'opal'
2+
require 'sinatra'
3+
4+
get '/' do
5+
<<-EOS
6+
<!doctype html>
7+
<html>
8+
<head>
9+
<script src="/assets/application.js"></script>
10+
</head>
11+
</html>
12+
EOS
13+
end
14+
15+
map '/assets' do
16+
env = Opal::Environment.new
17+
env.append_path 'app'
18+
run env
19+
end
20+
21+
run Sinatra::Application

0 commit comments

Comments
 (0)