aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile2
-rw-r--r--Gemfile.lock8
-rw-r--r--app/views/layouts/application.html.erb24
-rw-r--r--app/views/layouts/application.html.haml16
-rw-r--r--app/views/results/_result.html.erb16
-rw-r--r--app/views/results/_result.html.haml13
-rw-r--r--app/views/snippets/_form.html.erb26
-rw-r--r--app/views/snippets/_form.html.haml15
-rw-r--r--app/views/snippets/new.html.erb1
-rw-r--r--app/views/snippets/new.html.haml1
-rw-r--r--app/views/snippets/show.html.erb6
-rw-r--r--app/views/snippets/show.html.haml4
-rw-r--r--lib/tasks/compiler.rake1
13 files changed, 57 insertions, 76 deletions
diff --git a/Gemfile b/Gemfile
index cd48405..9a787e6 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,6 +5,8 @@ gem "mysql2", ">= 0.3.18", "< 0.5"
gem "sidekiq"
gem "sinatra", require: false
+gem "haml"
+
gem "sprockets"
gem "sass-rails"
gem "uglifier", ">= 1.3.0"
diff --git a/Gemfile.lock b/Gemfile.lock
index 0e0427f..4adfe9c 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -98,6 +98,8 @@ GEM
websocket-driver (>= 0.5.1)
globalid (0.3.6)
activesupport (>= 4.1.0)
+ haml (4.0.7)
+ tilt
hiredis (0.5.2)
hitimes (1.2.3)
i18n (0.7.0)
@@ -159,10 +161,9 @@ GEM
sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0)
tilt (>= 1.1, < 3)
- sidekiq (4.0.1)
+ sidekiq (4.0.2)
concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0)
- json (~> 1.0)
redis (~> 3.2, >= 3.2.1)
sinatra (1.0)
rack (>= 1.0)
@@ -179,7 +180,7 @@ GEM
sprockets (>= 3.0.0)
thor (0.19.1)
thread_safe (0.3.5)
- tilt (2.0.1)
+ tilt (2.0.2)
timers (4.1.1)
hitimes
tzinfo (1.2.2)
@@ -202,6 +203,7 @@ DEPENDENCIES
bootstrap-sass
byebug
codemirror-rails
+ haml
jquery-rails
mysql2 (>= 0.3.18, < 0.5)
plum
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
deleted file mode 100644
index fd1d40c..0000000
--- a/app/views/layouts/application.html.erb
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html lang="ja">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Poe</title>
- <%= csrf_meta_tags %>
- <%= stylesheet_link_tag "application", media: "all" %>
- </head>
-
- <body>
- <nav class="navbar navbar-default navbar-static-top">
- <div class="container-fluid">
- <div class="navbar-header">
- <a class="navbar-brand" href="/"><%= application_name %></a>
- </div>
- </div>
- </nav>
- <div class="container-fluid">
- <%= yield %>
- </div>
- <%= javascript_include_tag "application" %>
- </body>
-</html>
diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml
new file mode 100644
index 0000000..2cbbeb0
--- /dev/null
+++ b/app/views/layouts/application.html.haml
@@ -0,0 +1,16 @@
+!!!
+%html{lang: "ja"}
+ %head
+ %meta{charset: "UTF-8"}/
+ %meta{content: "width=device-width, initial-scale=1", name: "viewport"}/
+ %title poe
+ = csrf_meta_tags
+ = stylesheet_link_tag("application", media: "all")
+ %body
+ %nav.navbar.navbar-default.navbar-static-top
+ .container-fluid
+ .navbar-header
+ %a.navbar-brand{href: "/"}= application_name
+ .container-fluid
+ = yield
+ = javascript_include_tag("application")
diff --git a/app/views/results/_result.html.erb b/app/views/results/_result.html.erb
deleted file mode 100644
index fd59416..0000000
--- a/app/views/results/_result.html.erb
+++ /dev/null
@@ -1,16 +0,0 @@
-<% if result && result.finished? %>
- <div class="result-item panel <%= result.success? ? "panel-success" : "panel-danger" %>" data-id="<%= result.id %>">
- <div class="panel-heading"><%= compiler %></div>
- <div class="panel-body">
- <pre><code><%= result.formatted_output %></code></pre>
- </div>
- </div>
-<% else %>
- <div class="result-item panel panel-default" data-status="<%= result ? "running" : "notran" %>" data-id="<%= result&.id %>" data-compiler-id="<%= compiler.id %>">
- <div class="panel-heading"><%= compiler %></div>
- <div class="panel-body">
- <p>running....</p>
- </div>
- </div>
-<% end %>
-
diff --git a/app/views/results/_result.html.haml b/app/views/results/_result.html.haml
new file mode 100644
index 0000000..0f4c8cd
--- /dev/null
+++ b/app/views/results/_result.html.haml
@@ -0,0 +1,13 @@
+- if result && result.finished?
+ .result-item.panel{class: (result.success? ? "panel-success" : "panel-danger"), "data-id": result.id}
+ .panel-heading= compiler
+ .panel-body
+ %pre
+ %code= result.formatted_output
+ %div
+ Status: #{result.status}
+- else
+ .result-item.panel.panel-default{"data-compiler-id": compiler.id, "data-id": result.id, "data-status": (result ? "running" : "notran")}
+ .panel-heading= compiler
+ .panel-body
+ %p running....
diff --git a/app/views/snippets/_form.html.erb b/app/views/snippets/_form.html.erb
deleted file mode 100644
index 8b21b3d..0000000
--- a/app/views/snippets/_form.html.erb
+++ /dev/null
@@ -1,26 +0,0 @@
-<div class="panel panel-default">
- <div class="panel-body">
- <%= form_for(snippet, url: "/", html: { method: "post" }) do |f| %>
- <% if snippet.errors.any? %>
- <div class="alert alert-danger" role="alert">
- <p><%= pluralize(snippet.errors.count, "error") %> prohibited this snippet from being saved:</p>
-
- <ul>
- <% snippet.errors.full_messages.each do |message| %>
- <li><%= message %></li>
- <% end %>
- </ul>
- </div>
- <% end %>
-
- <div class="form-group">
- <%= f.text_field :title, placeholder: "Untitled", class: "form-control" %>
- </div>
- <div class="form-group" id="code-field">
- <%= f.text_area :code, style: "display: none" %>
- </div>
- <%= f.hidden_field :language, value: "Ruby" %>
- <button type="submit" class="btn btn-default">Run</button>
- <% end %>
- </div>
-</div>
diff --git a/app/views/snippets/_form.html.haml b/app/views/snippets/_form.html.haml
new file mode 100644
index 0000000..d19ec65
--- /dev/null
+++ b/app/views/snippets/_form.html.haml
@@ -0,0 +1,15 @@
+.panel.panel-default
+ .panel-body
+ = form_for(snippet, url: "/", html: { method: "post" }) do |f|
+ - if snippet.errors.any?
+ .alert.alert-danger{:role => "alert"}
+ %p
+ = pluralize(snippet.errors.count, "error")
+ prohibited this snippet from being saved:
+ %ul
+ - snippet.errors.full_messages.each do |message|
+ %li= message
+ #code-field.form-group
+ %textarea{name: "snippet[code]", style: "display: none"}= snippet.code
+ %input{type: "hidden", name: "snippet[language]", value: "Ruby"}
+ %button.btn.btn-default{type: "submit"} Run
diff --git a/app/views/snippets/new.html.erb b/app/views/snippets/new.html.erb
deleted file mode 100644
index 2d2567d..0000000
--- a/app/views/snippets/new.html.erb
+++ /dev/null
@@ -1 +0,0 @@
-<%= render "form", snippet: @snippet %>
diff --git a/app/views/snippets/new.html.haml b/app/views/snippets/new.html.haml
new file mode 100644
index 0000000..fb79a20
--- /dev/null
+++ b/app/views/snippets/new.html.haml
@@ -0,0 +1 @@
+= render "form", snippet: @snippet
diff --git a/app/views/snippets/show.html.erb b/app/views/snippets/show.html.erb
deleted file mode 100644
index e2a1566..0000000
--- a/app/views/snippets/show.html.erb
+++ /dev/null
@@ -1,6 +0,0 @@
-<%= render "form", snippet: @snippet %>
-<span style="display: none" id="snippet-id"><%= @snippet.id %></span>
-
-<% @snippet.results_all.each do |result, compiler| %>
- <%= render partial: "results/result", locals: { result: result, compiler: compiler } %>
-<% end %>
diff --git a/app/views/snippets/show.html.haml b/app/views/snippets/show.html.haml
new file mode 100644
index 0000000..644af96
--- /dev/null
+++ b/app/views/snippets/show.html.haml
@@ -0,0 +1,4 @@
+= render "form", snippet: @snippet
+%span#snippet-id{style: "display: none"}= @snippet.id
+- @snippet.results_all.each do |result, compiler|
+ = render partial: "results/result", locals: { result: result, compiler: compiler }
diff --git a/lib/tasks/compiler.rake b/lib/tasks/compiler.rake
index f337569..f86bd57 100644
--- a/lib/tasks/compiler.rake
+++ b/lib/tasks/compiler.rake
@@ -6,6 +6,7 @@ namespace :compiler do
RUBIES = {
"2.3.0" => "https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.0.tar.gz",
"2.2.4" => "https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.4.tar.gz",
+ "2.1.8" => "https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz",
}
desc "Install a ruby"
task :install, :version