volt new overlay
This commit is contained in:
parent
9c7a333127
commit
a0b37977a9
47
.gitignore
vendored
47
.gitignore
vendored
@ -1,42 +1,9 @@
|
||||
# database
|
||||
db
|
||||
|
||||
# rdoc generated
|
||||
rdoc
|
||||
|
||||
# yard generated
|
||||
doc
|
||||
.yardoc
|
||||
|
||||
# bundler
|
||||
.bundle
|
||||
*.gem
|
||||
|
||||
# jeweler generated
|
||||
pkg
|
||||
|
||||
#
|
||||
# Not sure what to needs to be ignored for particular editors/OSes? Here's some ideas to get you started. (Remember, remove the leading # of the line)
|
||||
#
|
||||
# For MacOS:
|
||||
#
|
||||
.config
|
||||
.yardoc
|
||||
tmp
|
||||
.idea
|
||||
.yardoc
|
||||
.sass-cache
|
||||
.DS_Store
|
||||
|
||||
# For TextMate
|
||||
#*.tmproj
|
||||
#tmtags
|
||||
|
||||
# For emacs:
|
||||
#*~
|
||||
#\#*
|
||||
#.\#*
|
||||
|
||||
# For vim:
|
||||
#*.swp
|
||||
|
||||
|
||||
# Object files
|
||||
*.o
|
||||
log
|
||||
|
||||
tmp/
|
||||
compiled
|
26
Gemfile
26
Gemfile
@ -1,6 +1,6 @@
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'volt', :path => "../volt"
|
||||
gem 'volt', '0.9.4'
|
||||
|
||||
# volt uses mongo as the default data store.
|
||||
gem 'volt-mongo', '~> 0.1.0'
|
||||
@ -9,16 +9,28 @@ gem 'volt-mongo', '~> 0.1.0'
|
||||
# Twitter bootstrap
|
||||
gem 'volt-bootstrap', '~> 0.0.10'
|
||||
|
||||
# Simple theme for bootstrap, remove to theme yourself.
|
||||
gem 'volt-bootstrap_jumbotron_theme', '~> 0.1.0'
|
||||
|
||||
# User templates for login, signup, and logout menu.
|
||||
gem 'volt-user_templates', '~> 0.4.0'
|
||||
|
||||
# Add ability to send e-mail from apps.
|
||||
gem 'volt-mailer', '~> 0.1.0'
|
||||
|
||||
# Use rbnacl for message bus encrpytion
|
||||
# (optional, if you don't need encryption, disable in app.rb and remove)
|
||||
#
|
||||
# Message Bus encryption is not supported on Windows at the moment.
|
||||
platform :ruby, :jruby do
|
||||
gem 'rbnacl', require: false
|
||||
gem 'rbnacl-libsodium', require: false
|
||||
end
|
||||
|
||||
# Asset compilation gems, they will be required when needed.
|
||||
gem 'csso-rails', '~> 0.3.4', require: false
|
||||
gem 'uglifier', '>= 2.4.0', require: false
|
||||
|
||||
gem "parslet" , path: "../parslet"
|
||||
#gem "salama" , path: "../salama"
|
||||
gem "salama-reader" , path: "../salama-reader"
|
||||
gem "salama-object-file" , path: "../salama-object-file"
|
||||
|
||||
|
||||
group :test do
|
||||
# Testing dependencies
|
||||
gem 'rspec', '~> 3.2.0'
|
||||
|
78
Gemfile.lock
78
Gemfile.lock
@ -1,36 +1,3 @@
|
||||
PATH
|
||||
remote: ../parslet
|
||||
specs:
|
||||
parslet (1.7.0)
|
||||
|
||||
PATH
|
||||
remote: ../salama-object-file
|
||||
specs:
|
||||
salama-object-file (0.2.0)
|
||||
|
||||
PATH
|
||||
remote: ../salama-reader
|
||||
specs:
|
||||
salama-reader (0.2.0)
|
||||
parslet (~> 1.7.0)
|
||||
|
||||
PATH
|
||||
remote: ../volt
|
||||
specs:
|
||||
volt (0.9.4)
|
||||
bcrypt (~> 3.1.9)
|
||||
bundler (>= 1.5)
|
||||
concurrent-ruby (= 0.8.0)
|
||||
configurations (~> 2.0.0.pre)
|
||||
faye-websocket (~> 0.9.2)
|
||||
listen (~> 3.0.1)
|
||||
opal (~> 0.7.2)
|
||||
pry (~> 0.10.1)
|
||||
rack (~> 1.5.0)
|
||||
sass (~> 3.2.5)
|
||||
sprockets-sass (~> 1.0.0)
|
||||
thor (~> 0.19.0)
|
||||
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
@ -67,9 +34,11 @@ GEM
|
||||
ffi (1.9.10)
|
||||
hike (1.2.3)
|
||||
json (1.8.3)
|
||||
listen (3.0.2)
|
||||
listen (3.0.3)
|
||||
rb-fsevent (>= 0.9.3)
|
||||
rb-inotify (>= 0.9)
|
||||
mail (2.6.3)
|
||||
mime-types (>= 1.16, < 3)
|
||||
method_source (0.8.2)
|
||||
mime-types (2.6.1)
|
||||
mini_portile (0.6.2)
|
||||
@ -90,6 +59,8 @@ GEM
|
||||
cliver (~> 0.3.1)
|
||||
multi_json (~> 1.0)
|
||||
websocket-driver (>= 0.2.0)
|
||||
pony (1.11)
|
||||
mail (>= 2.0)
|
||||
pry (0.10.1)
|
||||
coderay (~> 1.1.0)
|
||||
method_source (~> 0.8.1)
|
||||
@ -100,6 +71,10 @@ GEM
|
||||
rb-fsevent (0.9.5)
|
||||
rb-inotify (0.9.5)
|
||||
ffi (>= 0.5.0)
|
||||
rbnacl (3.2.0)
|
||||
ffi
|
||||
rbnacl-libsodium (1.0.3)
|
||||
rbnacl (~> 3.0, >= 3.0.1)
|
||||
ref (1.0.5)
|
||||
rspec (3.2.0)
|
||||
rspec-core (~> 3.2.0)
|
||||
@ -140,11 +115,31 @@ GEM
|
||||
uglifier (2.7.1)
|
||||
execjs (>= 0.3.0)
|
||||
json (>= 1.8.0)
|
||||
volt (0.9.4)
|
||||
bcrypt (~> 3.1.9)
|
||||
bundler (>= 1.5)
|
||||
concurrent-ruby (= 0.8.0)
|
||||
configurations (~> 2.0.0.pre)
|
||||
faye-websocket (~> 0.9.2)
|
||||
listen (~> 3.0.1)
|
||||
opal (~> 0.7.2)
|
||||
pry (~> 0.10.1)
|
||||
rack (~> 1.5.0)
|
||||
sass (~> 3.2.5)
|
||||
sprockets-sass (~> 1.0.0)
|
||||
thor (~> 0.19.0)
|
||||
volt-bootstrap (0.0.10)
|
||||
volt-bootstrap_jumbotron_theme (0.1.0)
|
||||
volt-fields (0.1.3)
|
||||
volt-mailer (0.1.0)
|
||||
pony (~> 1.11)
|
||||
volt-mongo (0.1.1)
|
||||
mongo (~> 1.9.0)
|
||||
volt-user_templates (0.4.0)
|
||||
volt-fields (~> 0.1.0)
|
||||
volt-mailer (~> 0.1.0)
|
||||
websocket (1.2.2)
|
||||
websocket-driver (0.5.4)
|
||||
websocket-driver (0.6.2)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.2)
|
||||
xpath (2.0.0)
|
||||
@ -160,14 +155,19 @@ DEPENDENCIES
|
||||
concurrent-ruby-ext (~> 0.8.0)
|
||||
csso-rails (~> 0.3.4)
|
||||
opal-rspec (~> 0.4.2)
|
||||
parslet!
|
||||
poltergeist (~> 1.5.0)
|
||||
rbnacl
|
||||
rbnacl-libsodium
|
||||
rspec (~> 3.2.0)
|
||||
salama-object-file!
|
||||
salama-reader!
|
||||
selenium-webdriver (~> 2.43.0)
|
||||
thin (~> 1.6.0)
|
||||
uglifier (>= 2.4.0)
|
||||
volt!
|
||||
volt (= 0.9.4)
|
||||
volt-bootstrap (~> 0.0.10)
|
||||
volt-bootstrap_jumbotron_theme (~> 0.1.0)
|
||||
volt-mailer (~> 0.1.0)
|
||||
volt-mongo (~> 0.1.0)
|
||||
volt-user_templates (~> 0.4.0)
|
||||
|
||||
BUNDLED WITH
|
||||
1.10.5
|
||||
|
1
app/main/assets/css/app.css.scss
Normal file
1
app/main/assets/css/app.css.scss
Normal file
@ -0,0 +1 @@
|
||||
// Place your apps css here
|
11
app/main/config/dependencies.rb
Normal file
11
app/main/config/dependencies.rb
Normal file
@ -0,0 +1,11 @@
|
||||
# Specify which components you wish to include when
|
||||
# the "home" component loads.
|
||||
|
||||
# bootstrap css framework
|
||||
component 'bootstrap'
|
||||
|
||||
# a default theme for the bootstrap framework
|
||||
component 'bootstrap_jumbotron_theme'
|
||||
|
||||
# provides templates for login, signup, and logout
|
||||
component 'user_templates'
|
10
app/main/config/initializers/boot.rb
Normal file
10
app/main/config/initializers/boot.rb
Normal file
@ -0,0 +1,10 @@
|
||||
# Place any code you want to run when the component is included on the client
|
||||
# or server.
|
||||
|
||||
# To include code only on the client use:
|
||||
# if RUBY_PLATFORM == 'opal'
|
||||
#
|
||||
# To include code only on the server, use:
|
||||
# unless RUBY_PLATFORM == 'opal'
|
||||
# ^^ this will not send compile in code in the conditional to the client.
|
||||
# ^^ this include code required in the conditional.
|
14
app/main/config/routes.rb
Normal file
14
app/main/config/routes.rb
Normal file
@ -0,0 +1,14 @@
|
||||
# See https://github.com/voltrb/volt#routes for more info on routes
|
||||
|
||||
client '/about', action: 'about'
|
||||
|
||||
# Routes for login and signup, provided by user_templates component gem
|
||||
client '/signup', component: 'user_templates', controller: 'signup'
|
||||
client '/login', component: 'user_templates', controller: 'login', action: 'index'
|
||||
client '/password_reset', component: 'user_templates', controller: 'password_reset', action: 'index'
|
||||
client '/forgot', component: 'user_templates', controller: 'login', action: 'forgot'
|
||||
client '/account', component: 'user_templates', controller: 'account', action: 'index'
|
||||
|
||||
# The main route, this should be last. It will match any params not
|
||||
# previously matched.
|
||||
client '/', {}
|
27
app/main/controllers/main_controller.rb
Normal file
27
app/main/controllers/main_controller.rb
Normal file
@ -0,0 +1,27 @@
|
||||
# By default Volt generates this controller for your Main component
|
||||
module Main
|
||||
class MainController < Volt::ModelController
|
||||
def index
|
||||
# Add code for when the index view is loaded
|
||||
end
|
||||
|
||||
def about
|
||||
# Add code for when the about view is loaded
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
# The main template contains a #template binding that shows another
|
||||
# template. This is the path to that template. It may change based
|
||||
# on the params._component, params._controller, and params._action values.
|
||||
def main_path
|
||||
"#{params._component || 'main'}/#{params._controller || 'main'}/#{params._action || 'index'}"
|
||||
end
|
||||
|
||||
# Determine if the current nav component is the active one by looking
|
||||
# at the first part of the url against the href attribute.
|
||||
def active_tab?
|
||||
url.path.split('/')[1] == attrs.href.split('/')[1]
|
||||
end
|
||||
end
|
||||
end
|
12
app/main/models/user.rb
Normal file
12
app/main/models/user.rb
Normal file
@ -0,0 +1,12 @@
|
||||
# By default Volt generates this User model which inherits from Volt::User,
|
||||
# you can rename this if you want.
|
||||
class User < Volt::User
|
||||
# login_field is set to :email by default and can be changed to :username
|
||||
# in config/app.rb
|
||||
field login_field
|
||||
field :name
|
||||
|
||||
validate login_field, unique: true, length: 8
|
||||
validate :email, email: true
|
||||
|
||||
end
|
7
app/main/views/main/about.html
Normal file
7
app/main/views/main/about.html
Normal file
@ -0,0 +1,7 @@
|
||||
<:Title>
|
||||
About
|
||||
|
||||
<:Body>
|
||||
<h1>About</h1>
|
||||
|
||||
<p>About page...</p>
|
6
app/main/views/main/index.html
Normal file
6
app/main/views/main/index.html
Normal file
@ -0,0 +1,6 @@
|
||||
<:Title>
|
||||
Home
|
||||
|
||||
<:Body>
|
||||
<h1>Home</h1>
|
||||
|
29
app/main/views/main/main.html
Normal file
29
app/main/views/main/main.html
Normal file
@ -0,0 +1,29 @@
|
||||
<:Title>
|
||||
{{ view main_path, "title", {controller_group: 'main'} }}
|
||||
|
||||
<:Body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<ul class="nav nav-pills pull-right">
|
||||
<:nav href="/">Home</:nav>
|
||||
<:nav href="/about">About</:nav>
|
||||
<:user_templates:menu />
|
||||
</ul>
|
||||
<h3 class="text-muted">salama-debugger</h3>
|
||||
</div>
|
||||
|
||||
<:volt:notices />
|
||||
|
||||
{{ view main_path, 'body', {controller_group: 'main'} }}
|
||||
|
||||
<div class="footer">
|
||||
<p>© Company {{ Time.now.year }}</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<:Nav>
|
||||
<li class="{{ if active_tab? }}active{{ end }}">
|
||||
<a href="{{ attrs.href }}">{{ yield }}</a>
|
||||
</li>
|
||||
|
46
config.ru
46
config.ru
@ -1,42 +1,4 @@
|
||||
# config.ru
|
||||
require 'bundler'
|
||||
Bundler.require
|
||||
|
||||
Opal.use_gem "salama"
|
||||
Opal.use_gem "salama-arm"
|
||||
|
||||
require "tilt/erb"
|
||||
require "susy"
|
||||
require "json"
|
||||
require "react/source"
|
||||
|
||||
class DebugServer < Opal::Server
|
||||
|
||||
def parse(num)
|
||||
string_input = '"Hello again".putstring()'
|
||||
parser = Parser::Salama.new
|
||||
out = parser.parse(string_input)
|
||||
parts = Parser::Transform.new.apply(out)
|
||||
parts.to_basic
|
||||
end
|
||||
|
||||
|
||||
def call(env)
|
||||
if env['PATH_INFO'].include? "/parse.json"
|
||||
parse_out = parse(1).to_s
|
||||
[200, { 'Content-Type' => 'text/json' }, [parse_out]]
|
||||
else
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
run DebugServer.new {|s|
|
||||
s.append_path 'app'
|
||||
s.append_path 'lib'
|
||||
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
|
||||
s.main = 'main'
|
||||
s.debug = false
|
||||
s.source_map = true
|
||||
s.index_path = "index.html.erb"
|
||||
}
|
||||
# Run via rack server
|
||||
require 'bundler/setup'
|
||||
require 'volt/server'
|
||||
run Volt::Server.new.app
|
||||
|
132
config/app.rb
Normal file
132
config/app.rb
Normal file
@ -0,0 +1,132 @@
|
||||
# app.rb is used to configure your app. This code is only run on the server,
|
||||
# then any config options in config.public are passed to the client as well.
|
||||
|
||||
Volt.configure do |config|
|
||||
# Setup your global app config here.
|
||||
|
||||
#######################################
|
||||
# Basic App Info (stuff you should set)
|
||||
#######################################
|
||||
config.domain = 'salama-debugger.com'
|
||||
config.app_name = 'Salama-debugger'
|
||||
config.mailer.from = 'Salama-debugger <no-reply@salama-debugger.com>'
|
||||
|
||||
############
|
||||
# App Secret
|
||||
############
|
||||
# Your app secret is used for signing things like the user cookie so it can't
|
||||
# be tampered with. A random value is generated on new projects that will work
|
||||
# without the need to customize. Make sure this value doesn't leave your server.
|
||||
#
|
||||
# For added security we recommend moving the app secret into an environment. You can
|
||||
# setup that like so:
|
||||
#
|
||||
# config.app_secret = ENV['APP_SECRET']
|
||||
#
|
||||
config.app_secret = 'qwSEmWdixdHgwOgXiLdGJt87b9TxMq009gbJWn0fOTygfIk6fAIlgHO9tAPbA4vaKgY'
|
||||
|
||||
###############
|
||||
# Log Filtering
|
||||
###############
|
||||
# Data updates from the client come in via Tasks. The task dispatcher logs all calls to tasks.
|
||||
# By default hashes in the arguments can be filtered based on keys. So any hash with a key of
|
||||
# password will be filtered. You can add more fields to filter below:
|
||||
config.filter_keys = [:password]
|
||||
|
||||
##########
|
||||
# Database
|
||||
##########
|
||||
# Database config all start with db_ and can be set either in the config
|
||||
# file or with an environment variable (DB_NAME for example).
|
||||
|
||||
# config.db_driver = 'mongo'
|
||||
# config.db_name = (config.app_name + '_' + Volt.env.to_s)
|
||||
# config.db_host = 'localhost'
|
||||
# config.db_port = 27017
|
||||
|
||||
#####################
|
||||
# Compression options
|
||||
#####################
|
||||
# If you are not running behind something like nginx in production, you can
|
||||
# have rack deflate all files.
|
||||
# config.deflate = true
|
||||
|
||||
#######################
|
||||
# Public configurations
|
||||
#######################
|
||||
# Anything under config.public will be sent to the client as well as the server,
|
||||
# so be sure no private data ends up under public
|
||||
|
||||
# Use username instead of email as the login
|
||||
# config.public.auth.use_username = true
|
||||
|
||||
#####################
|
||||
# Compression Options
|
||||
#####################
|
||||
# Disable or enable css/js compression. Default is to only run in production.
|
||||
# if Volt.env.production?
|
||||
# config.compress_javascript = true
|
||||
# config.compress_css = true
|
||||
# end
|
||||
|
||||
################
|
||||
# Mailer options
|
||||
################
|
||||
# The volt-mailer gem uses pony (https://github.com/benprew/pony) to deliver e-mail. Any
|
||||
# options you would pass to pony can be setup below.
|
||||
# NOTE: The from address is setup at the top
|
||||
|
||||
# Normally pony uses /usr/sbin/sendmail if one is installed. You can specify smtp below:
|
||||
# config.mailer.via = :smtp
|
||||
# config.mailer.via_options = {
|
||||
# :address => 'smtp.yourserver.com',
|
||||
# :port => '25',
|
||||
# :user_name => 'user',
|
||||
# :password => 'password',
|
||||
# :authentication => :plain, # :plain, :login, :cram_md5, no auth by default
|
||||
# :domain => "localhost.localdomain" # the HELO domain provided by the client to the server
|
||||
# }
|
||||
|
||||
#############
|
||||
# Message Bus
|
||||
#############
|
||||
# Volt provides a "Message Bus" out of the box. The message bus provides
|
||||
# a pub/sub service between any volt instance (server, client, runner, etc..)
|
||||
# that share the same database. The message bus can be used by app code. It
|
||||
# is also used internally to push data to any listening clients.
|
||||
#
|
||||
# The default message bus (called "peer_to_peer") uses the database to sync
|
||||
# socket ip's/ports.
|
||||
# config.message_bus.bus_name = 'peer_to_peer'
|
||||
#
|
||||
# Encrypt message bus - messages on the message bus are encrypted by default
|
||||
# using rbnacl.
|
||||
# config.message_bus.disable_encryption = true
|
||||
#
|
||||
# ## MessageBus Server -- the message bus binds to a port and ip which the
|
||||
# other volt instances need to be able to connect to. You can customize
|
||||
# the server below:
|
||||
#
|
||||
# Port range - you can specify a range of ports that an instance can bind the
|
||||
# message bus on. You can specify a range, an array of Integers, or an array
|
||||
# of ranges.
|
||||
# config.message_bus.bind_port_ranges = (58000..61000)
|
||||
#
|
||||
# Bind Ip - specifies the ip address the message bus server should bind on.
|
||||
# config.message_bus.bind_ip = '127.0.0.1'
|
||||
|
||||
#############
|
||||
# Concurrency
|
||||
#############
|
||||
# Volt provides a thread worker pool for incoming task requests (and all
|
||||
# database requests, since those use tasks to do their work.) The following
|
||||
# lets you control the size of the worker pool. Threads are only created as
|
||||
# needed, and are removed after a certain amount of inactivity.
|
||||
# config.min_worker_threads = 1
|
||||
# config.max_worker_threads = 10
|
||||
#
|
||||
# You can also specify the amount of time a Task should run for before it
|
||||
# timeout's. Setting this to short can cause unexpected results, currently
|
||||
# we recomend it be at least 10 seconds.
|
||||
# config.worker_timeout = 60
|
||||
end
|
20
config/base/index.html
Normal file
20
config/base/index.html
Normal file
@ -0,0 +1,20 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<%# IMPORTANT: Please read before changing! %>
|
||||
<%# This file is rendered on the server using ERB, so it does NOT use Volt's %>
|
||||
<%# normal template system. You can add to it, but keep in mind the template %>
|
||||
<%# language difference. This file handles auto-loading all JS/Opal and CSS. %>
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<% javascript_files.each do |javascript_file| %>
|
||||
<script src="<%= javascript_file %>"></script>
|
||||
<% end %>
|
||||
|
||||
<% css_files.each do |css_file| %>
|
||||
<link href="<%= css_file %>" media="all" rel="stylesheet" type="text/css" />
|
||||
<% end %>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user