commit d4803fe919e60d350a35ad43433c23e64c880a49 Author: Torsten Ruger Date: Mon Jul 6 14:20:21 2015 +0300 only slightly trimmed volt new output diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fe47b3a --- /dev/null +++ b/.gitignore @@ -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/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..ab1d62a --- /dev/null +++ b/Gemfile @@ -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 diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..255a89f --- /dev/null +++ b/Gemfile.lock @@ -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) diff --git a/README.md b/README.md new file mode 100644 index 0000000..02cca58 --- /dev/null +++ b/README.md @@ -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 \ No newline at end of file diff --git a/app/main/assets/css/app.css.scss b/app/main/assets/css/app.css.scss new file mode 100644 index 0000000..f64375c --- /dev/null +++ b/app/main/assets/css/app.css.scss @@ -0,0 +1 @@ +// Place your apps css here \ No newline at end of file diff --git a/app/main/config/dependencies.rb b/app/main/config/dependencies.rb new file mode 100644 index 0000000..23a228e --- /dev/null +++ b/app/main/config/dependencies.rb @@ -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' diff --git a/app/main/config/initializers/boot.rb b/app/main/config/initializers/boot.rb new file mode 100644 index 0000000..a4bbae3 --- /dev/null +++ b/app/main/config/initializers/boot.rb @@ -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. \ No newline at end of file diff --git a/app/main/config/routes.rb b/app/main/config/routes.rb new file mode 100644 index 0000000..2724777 --- /dev/null +++ b/app/main/config/routes.rb @@ -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 '/', {} diff --git a/app/main/controllers/main_controller.rb b/app/main/controllers/main_controller.rb new file mode 100644 index 0000000..41ff0ca --- /dev/null +++ b/app/main/controllers/main_controller.rb @@ -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 diff --git a/app/main/models/user.rb b/app/main/models/user.rb new file mode 100644 index 0000000..1dbf70a --- /dev/null +++ b/app/main/models/user.rb @@ -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 diff --git a/app/main/views/main/about.html b/app/main/views/main/about.html new file mode 100644 index 0000000..7720e4c --- /dev/null +++ b/app/main/views/main/about.html @@ -0,0 +1,7 @@ +<:Title> + About + +<:Body> +

About

+ +

About page...

diff --git a/app/main/views/main/index.html b/app/main/views/main/index.html new file mode 100644 index 0000000..8838ea1 --- /dev/null +++ b/app/main/views/main/index.html @@ -0,0 +1,6 @@ +<:Title> + Home + +<:Body> +

Home

+ diff --git a/app/main/views/main/main.html b/app/main/views/main/main.html new file mode 100644 index 0000000..8a1743d --- /dev/null +++ b/app/main/views/main/main.html @@ -0,0 +1,27 @@ +<:Title> + {{ view main_path, "title", {controller_group: 'main'} }} + +<:Body> +
+
+ +

salama-debugger

+
+ + <:volt:notices /> + + {{ view main_path, 'body', {controller_group: 'main'} }} + + + +
+ +<:Nav> +
  • + {{ yield }} +
  • diff --git a/config.ru b/config.ru new file mode 100644 index 0000000..38c084f --- /dev/null +++ b/config.ru @@ -0,0 +1,4 @@ +# Run via rack server +require 'bundler/setup' +require 'volt/server' +run Volt::Server.new.app diff --git a/config/app.rb b/config/app.rb new file mode 100644 index 0000000..62f8b00 --- /dev/null +++ b/config/app.rb @@ -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 ' + + ############ + # 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 diff --git a/config/base/index.html b/config/base/index.html new file mode 100644 index 0000000..3b3e895 --- /dev/null +++ b/config/base/index.html @@ -0,0 +1,20 @@ + + + <%# 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. %> + + + <% javascript_files.each do |javascript_file| %> + + <% end %> + + <% css_files.each do |css_file| %> + + <% end %> + + + + + diff --git a/spec/app/main/controllers/server/sample_http_controller_spec.rb b/spec/app/main/controllers/server/sample_http_controller_spec.rb new file mode 100644 index 0000000..22b7774 --- /dev/null +++ b/spec/app/main/controllers/server/sample_http_controller_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe 'sample http controller test', type: :http_controller do + # Specs here +end diff --git a/spec/app/main/integration/sample_integration_spec.rb b/spec/app/main/integration/sample_integration_spec.rb new file mode 100644 index 0000000..92b3c40 --- /dev/null +++ b/spec/app/main/integration/sample_integration_spec.rb @@ -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 diff --git a/spec/app/main/models/sample_model_spec.rb b/spec/app/main/models/sample_model_spec.rb new file mode 100644 index 0000000..df5d18f --- /dev/null +++ b/spec/app/main/models/sample_model_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe 'sample model' do + # Specs here +end diff --git a/spec/app/main/tasks/sample_task_spec.rb b/spec/app/main/tasks/sample_task_spec.rb new file mode 100644 index 0000000..627dff0 --- /dev/null +++ b/spec/app/main/tasks/sample_task_spec.rb @@ -0,0 +1,5 @@ +require 'spec_helper' + +describe 'sample task', type: :task do + # Specs here +end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..f9b6968 --- /dev/null +++ b/spec/spec_helper.rb @@ -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