Skip to content

Commit

Permalink
Added Cuba example
Browse files Browse the repository at this point in the history
mroth/phoenix-showdown/issues/mroth#13
  • Loading branch information
kathgironpe authored and yamadapc committed Jun 5, 2016
1 parent 044d364 commit ec213b9
Show file tree
Hide file tree
Showing 11 changed files with 116 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cuba/benchmarker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.bundle

1 change: 1 addition & 0 deletions cuba/benchmarker/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.2.0
4 changes: 4 additions & 0 deletions cuba/benchmarker/Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'cuba', '~> 3.4.0'
gem 'puma', '~> 2.10.2'
15 changes: 15 additions & 0 deletions cuba/benchmarker/Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
cuba (3.4.0)
rack
puma (2.10.2)
rack (>= 1.1, < 2.0)
rack (1.6.0)

PLATFORMS
ruby

DEPENDENCIES
cuba (~> 3.4.0)
puma (~> 2.10.2)
1 change: 1 addition & 0 deletions cuba/benchmarker/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: RACK_ENV=production bundle exec puma -t 1:16 -w 4 -p $PORT --preload
2 changes: 2 additions & 0 deletions cuba/benchmarker/config.ru
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require './server'
run Cuba
Empty file added cuba/benchmarker/render.rb
Empty file.
18 changes: 18 additions & 0 deletions cuba/benchmarker/server.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
require 'cuba'
require 'cuba/render'
require 'erb'

Cuba.plugin Cuba::Render

Cuba.define do
on ':title' do |title|
@title = title
@members = [
{ name: "Chris McCord" },
{ name: "Matt Sears" },
{ name: "David Stump" },
{ name: "Ricardo Thompson" }
]
res.write view('index')
end
end
1 change: 1 addition & 0 deletions cuba/benchmarker/views/_bio.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<b>Name:</b> <%= member[:name] %>
42 changes: 42 additions & 0 deletions cuba/benchmarker/views/index.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<div class="jumbotron">
<h2>Welcome to Phoenix!</h2>
<p class="lead">Phoenix is an Elixir Web Framework targeting full-featured, fault tolerant applications with realtime functionality.</p>
</div>

<div class="row marketing">
<div class="col-lg-6">
<h4>Resources: <%= @title %></h4>
<ul>
<li>
<a href="http://api.phoenixframework.org/">Docs</a>
</li>
<li>
<a href="https://github.com/phoenixframework/phoenix">Source</a>
</li>
</ul>
</div>

<div class="col-lg-6">
<h4>Help</h4>
<ul>
<li>
<a href="https://github.com/phoenixframework/phoenix/issues?state=open">Issues</a>
</li>
<li>
<a href="irc://irc.freenode.net/elixir-lang">#elixir-lang on freenode IRC</a>
</li>
<li>
<a href="https://twitter.com/chris_mccord">@chris_mccord</a>
</li>
</ul>

<h4>Team Members</h4>
<ul>
<% for member in @members do %>
<li>
<%= partial '_bio', { member: member } %>
</li>
<% end %>
</ul>
</div>
</div>
30 changes: 30 additions & 0 deletions cuba/benchmarker/views/layout.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">

<title>Hello Phoenix!</title>
</head>

<body>
<div class="container">
<div class="header">
<ul class="nav nav-pills pull-right">
<li><a href="https://github.com/phoenixframework/phoenix">Get Started</a></li>
</ul>
<span class="logo"></span>
</div>

<%= content %>

<div class="footer">
<p><a href="http://phoenixframework.org">phoenixframework.org</a></p>
</div>

</div> <!-- /container -->
</body>
</html>

0 comments on commit ec213b9

Please sign in to comment.