Skip to content

Commit

Permalink
Add sinatra example app
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Jan 7, 2014
1 parent 875ceb9 commit 545667c
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 3 deletions.
3 changes: 0 additions & 3 deletions example/Gemfile

This file was deleted.

3 changes: 3 additions & 0 deletions examples/rack/Gemfile
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'opal', :path => '../../../'
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions examples/sinatra/Gemfile
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'opal', :path => '../../../opal'
gem 'sinatra'
7 changes: 7 additions & 0 deletions examples/sinatra/app/application.rb
@@ -0,0 +1,7 @@
require 'opal'

def alert(msg)
`alert(msg)`
end

alert "Hi there!"
21 changes: 21 additions & 0 deletions examples/sinatra/config.ru
@@ -0,0 +1,21 @@
require 'opal'
require 'sinatra'

get '/' do
<<-EOS
<!doctype html>
<html>
<head>
<script src="/assets/application.js"></script>
</head>
</html>
EOS
end

map '/assets' do
env = Opal::Environment.new
env.append_path 'app'
run env
end

run Sinatra::Application

0 comments on commit 545667c

Please sign in to comment.