From ec213b9660ace3b5076e8a6672ff1a7dc55f2621 Mon Sep 17 00:00:00 2001 From: "Katherine G. Pe" Date: Sat, 20 Jun 2015 01:21:11 +0800 Subject: [PATCH] Added Cuba example mroth/phoenix-showdown/issues/#13 --- cuba/benchmarker/.gitignore | 2 ++ cuba/benchmarker/.ruby-version | 1 + cuba/benchmarker/Gemfile | 4 +++ cuba/benchmarker/Gemfile.lock | 15 +++++++++++ cuba/benchmarker/Procfile | 1 + cuba/benchmarker/config.ru | 2 ++ cuba/benchmarker/render.rb | 0 cuba/benchmarker/server.rb | 18 +++++++++++++ cuba/benchmarker/views/_bio.erb | 1 + cuba/benchmarker/views/index.erb | 42 +++++++++++++++++++++++++++++++ cuba/benchmarker/views/layout.erb | 30 ++++++++++++++++++++++ 11 files changed, 116 insertions(+) create mode 100644 cuba/benchmarker/.gitignore create mode 100644 cuba/benchmarker/.ruby-version create mode 100644 cuba/benchmarker/Gemfile create mode 100644 cuba/benchmarker/Gemfile.lock create mode 100644 cuba/benchmarker/Procfile create mode 100644 cuba/benchmarker/config.ru create mode 100644 cuba/benchmarker/render.rb create mode 100644 cuba/benchmarker/server.rb create mode 100644 cuba/benchmarker/views/_bio.erb create mode 100644 cuba/benchmarker/views/index.erb create mode 100644 cuba/benchmarker/views/layout.erb diff --git a/cuba/benchmarker/.gitignore b/cuba/benchmarker/.gitignore new file mode 100644 index 0000000..4d0b534 --- /dev/null +++ b/cuba/benchmarker/.gitignore @@ -0,0 +1,2 @@ +.bundle + diff --git a/cuba/benchmarker/.ruby-version b/cuba/benchmarker/.ruby-version new file mode 100644 index 0000000..ccbccc3 --- /dev/null +++ b/cuba/benchmarker/.ruby-version @@ -0,0 +1 @@ +2.2.0 diff --git a/cuba/benchmarker/Gemfile b/cuba/benchmarker/Gemfile new file mode 100644 index 0000000..757503b --- /dev/null +++ b/cuba/benchmarker/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +gem 'cuba', '~> 3.4.0' +gem 'puma', '~> 2.10.2' diff --git a/cuba/benchmarker/Gemfile.lock b/cuba/benchmarker/Gemfile.lock new file mode 100644 index 0000000..109f4d5 --- /dev/null +++ b/cuba/benchmarker/Gemfile.lock @@ -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) diff --git a/cuba/benchmarker/Procfile b/cuba/benchmarker/Procfile new file mode 100644 index 0000000..a94ef92 --- /dev/null +++ b/cuba/benchmarker/Procfile @@ -0,0 +1 @@ +web: RACK_ENV=production bundle exec puma -t 1:16 -w 4 -p $PORT --preload diff --git a/cuba/benchmarker/config.ru b/cuba/benchmarker/config.ru new file mode 100644 index 0000000..2a6d4f6 --- /dev/null +++ b/cuba/benchmarker/config.ru @@ -0,0 +1,2 @@ +require './server' +run Cuba diff --git a/cuba/benchmarker/render.rb b/cuba/benchmarker/render.rb new file mode 100644 index 0000000..e69de29 diff --git a/cuba/benchmarker/server.rb b/cuba/benchmarker/server.rb new file mode 100644 index 0000000..2a64731 --- /dev/null +++ b/cuba/benchmarker/server.rb @@ -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 diff --git a/cuba/benchmarker/views/_bio.erb b/cuba/benchmarker/views/_bio.erb new file mode 100644 index 0000000..0cb0923 --- /dev/null +++ b/cuba/benchmarker/views/_bio.erb @@ -0,0 +1 @@ +Name: <%= member[:name] %> diff --git a/cuba/benchmarker/views/index.erb b/cuba/benchmarker/views/index.erb new file mode 100644 index 0000000..6f3351a --- /dev/null +++ b/cuba/benchmarker/views/index.erb @@ -0,0 +1,42 @@ +
+

Welcome to Phoenix!

+

Phoenix is an Elixir Web Framework targeting full-featured, fault tolerant applications with realtime functionality.

+
+ +
+
+

Resources: <%= @title %>

+ +
+ +
+

Help

+ + +

Team Members

+
    + <% for member in @members do %> +
  • + <%= partial '_bio', { member: member } %> +
  • + <% end %> +
+
+
diff --git a/cuba/benchmarker/views/layout.erb b/cuba/benchmarker/views/layout.erb new file mode 100644 index 0000000..7e630f1 --- /dev/null +++ b/cuba/benchmarker/views/layout.erb @@ -0,0 +1,30 @@ + + + + + + + + + + Hello Phoenix! + + + +
+
+ + +
+ + <%= content %> + + + +
+ +