only slightly trimmed volt new output

This commit is contained in:
Torsten Ruger 2015-07-06 14:20:21 +03:00
commit d4803fe919
21 changed files with 552 additions and 0 deletions

43
.gitignore vendored Normal file
View File

@ -0,0 +1,43 @@
# rcov generated
coverage
coverage.data
# 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:
#
.DS_Store
# For TextMate
#*.tmproj
#tmtags
# For emacs:
#*~
#\#*
#.\#*
# For vim:
#*.swp
# Object files
*.o
log
tmp/

46
Gemfile Normal file
View File

@ -0,0 +1,46 @@
source 'https://rubygems.org'
gem 'volt', '0.9.4'
# volt uses mongo as the default data store.
gem 'volt-mongo', '~> 0.1.0'
# The following gem's are optional for themeing
# Twitter bootstrap
gem 'volt-bootstrap', '~> 0.0.10'
# Simple theme for bootstrap, remove to theme yourself.
gem 'volt-bootstrap_jumbotron_theme', '~> 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
group :test do
# Testing dependencies
gem 'rspec', '~> 3.2.0'
gem 'opal-rspec', '~> 0.4.2'
gem 'capybara', '~> 2.4.2'
gem 'selenium-webdriver', '~> 2.43.0'
gem 'chromedriver2-helper', '~> 0.0.8'
gem 'poltergeist', '~> 1.5.0'
end
# Server for MRI
platform :mri, :mingw do
# The implementation of ReadWriteLock in Volt uses concurrent ruby and ext helps performance.
gem 'concurrent-ruby-ext', '~> 0.8.0'
# Thin is the default volt server, Puma is also supported
gem 'thin', '~> 1.6.0'
gem 'bson_ext', '~> 1.9.0'
end

158
Gemfile.lock Normal file
View File

@ -0,0 +1,158 @@
GEM
remote: https://rubygems.org/
specs:
bcrypt (3.1.10)
bson (1.9.2)
bson_ext (1.9.2)
bson (~> 1.9.2)
capybara (2.4.4)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
childprocess (0.5.6)
ffi (~> 1.0, >= 1.0.11)
chromedriver2-helper (0.0.8)
nokogiri
cliver (0.3.2)
coderay (1.1.0)
concurrent-ruby (0.8.0)
ref (~> 1.0, >= 1.0.5)
concurrent-ruby-ext (0.8.0)
concurrent-ruby (~> 0.8.0)
configurations (2.0.0)
csso-rails (0.3.4)
execjs (>= 1)
daemons (1.2.3)
diff-lcs (1.2.5)
eventmachine (1.0.7)
execjs (2.5.2)
faye-websocket (0.9.2)
eventmachine (>= 0.12.0)
websocket-driver (>= 0.5.1)
ffi (1.9.10)
hike (1.2.3)
json (1.8.3)
listen (3.0.1)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
method_source (0.8.2)
mime-types (2.6.1)
mini_portile (0.6.2)
mongo (1.9.2)
bson (~> 1.9.2)
multi_json (1.11.2)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
opal (0.7.2)
hike (~> 1.2)
sourcemap (~> 0.1.0)
sprockets (>= 2.2.3, < 3.0.0)
tilt (~> 1.4)
opal-rspec (0.4.3)
opal (>= 0.7.0, < 0.9)
poltergeist (1.5.1)
capybara (~> 2.1)
cliver (~> 0.3.1)
multi_json (~> 1.0)
websocket-driver (>= 0.2.0)
pry (0.10.1)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
rack (1.5.5)
rack-test (0.6.3)
rack (>= 1.0)
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)
rspec-expectations (~> 3.2.0)
rspec-mocks (~> 3.2.0)
rspec-core (3.2.3)
rspec-support (~> 3.2.0)
rspec-expectations (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-mocks (3.2.1)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.2.0)
rspec-support (3.2.2)
rubyzip (1.1.7)
sass (3.2.19)
selenium-webdriver (2.43.0)
childprocess (~> 0.5)
multi_json (~> 1.0)
rubyzip (~> 1.0)
websocket (~> 1.0)
slop (3.6.0)
sourcemap (0.1.1)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-sass (1.0.3)
sprockets (~> 2.0)
tilt (~> 1.1)
thin (1.6.3)
daemons (~> 1.0, >= 1.0.9)
eventmachine (~> 1.0)
rack (~> 1.0)
thor (0.19.1)
tilt (1.4.1)
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-mongo (0.1.1)
mongo (~> 1.9.0)
websocket (1.2.2)
websocket-driver (0.5.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
xpath (2.0.0)
nokogiri (~> 1.3)
PLATFORMS
ruby
DEPENDENCIES
bson_ext (~> 1.9.0)
capybara (~> 2.4.2)
chromedriver2-helper (~> 0.0.8)
concurrent-ruby-ext (~> 0.8.0)
csso-rails (~> 0.3.4)
opal-rspec (~> 0.4.2)
poltergeist (~> 1.5.0)
rbnacl
rbnacl-libsodium
rspec (~> 3.2.0)
selenium-webdriver (~> 2.43.0)
thin (~> 1.6.0)
uglifier (>= 2.4.0)
volt (= 0.9.4)
volt-bootstrap (~> 0.0.10)
volt-bootstrap_jumbotron_theme (~> 0.1.0)
volt-mongo (~> 0.1.0)

4
README.md Normal file
View File

@ -0,0 +1,4 @@
# Place your app's docs here.
## New to Volt?
Be sure to read the volt docs at http://docs.voltframework.com

View File

@ -0,0 +1 @@
// Place your apps css here

View File

@ -0,0 +1,8 @@
# 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'

View 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.

View File

@ -0,0 +1,7 @@
# See https://github.com/voltrb/volt#routes for more info on routes
client '/about', action: 'about'
# The main route, this should be last. It will match any params not
# previously matched.
client '/', {}

View 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
View 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

View File

@ -0,0 +1,7 @@
<:Title>
About
<:Body>
<h1>About</h1>
<p>About page...</p>

View File

@ -0,0 +1,6 @@
<:Title>
Home
<:Body>
<h1>Home</h1>

View File

@ -0,0 +1,27 @@
<: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>
</ul>
<h3 class="text-muted">salama-debugger</h3>
</div>
<:volt:notices />
{{ view main_path, 'body', {controller_group: 'main'} }}
<div class="footer">
<p>&copy; Company {{ Time.now.year }}</p>
</div>
</div>
<:Nav>
<li class="{{ if active_tab? }}active{{ end }}">
<a href="{{ attrs.href }}">{{ yield }}</a>
</li>

4
config.ru Normal file
View File

@ -0,0 +1,4 @@
# Run via rack server
require 'bundler/setup'
require 'volt/server'
run Volt::Server.new.app

132
config/app.rb Normal file
View 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 = 'pKDKhKInTaI5EVH9WmyN-cJSYnJt8PmDogwW63Zqr_ieUNqYvh1KybeWJoslylzFgsU'
###############
# 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
View 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>

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe 'sample http controller test', type: :http_controller do
# Specs here
end

View File

@ -0,0 +1,11 @@
require 'spec_helper'
describe 'sample integration test', type: :feature do
# An example integration spec, this will only be run if ENV['BROWSER'] is
# specified. Current values for ENV['BROWSER'] are 'firefox' and 'phantom'
it 'should load the page' do
visit '/'
expect(page).to have_content('Home')
end
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe 'sample model' do
# Specs here
end

View File

@ -0,0 +1,5 @@
require 'spec_helper'
describe 'sample task', type: :task do
# Specs here
end

14
spec/spec_helper.rb Normal file
View File

@ -0,0 +1,14 @@
# Volt sets up rspec and capybara for testing.
require 'volt/spec/setup'
Volt.spec_setup
RSpec.configure do |config|
config.run_all_when_everything_filtered = true
config.filter_run :focus
# Run specs in random order to surface order dependencies. If you find an
# order dependency and want to debug it, you can fix the order by providing
# the seed, which is printed after each run.
# --seed 1234
config.order = 'random'
end