├── log └── .keep ├── app ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── concerns │ │ └── .keep │ └── message.rb ├── assets │ ├── images │ │ └── .keep │ ├── stylesheets │ │ └── application.css.scss │ └── javascripts │ │ ├── application.js │ │ └── async_events.coffee ├── controllers │ ├── concerns │ │ └── .keep │ ├── chat_controller.rb │ └── application_controller.rb ├── helpers │ └── application_helper.rb ├── views │ ├── layouts │ │ └── application.html.erb │ └── chat │ │ └── index.html.erb └── lib │ └── async_events.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── public ├── favicon.ico ├── robots.txt ├── 500.html ├── 422.html └── 404.html ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── Procfile ├── SCREENSHOT.png ├── bin ├── rake ├── bundle ├── rails ├── spring └── setup ├── config ├── boot.rb ├── initializers │ ├── cookies_serializer.rb │ ├── session_store.rb │ ├── mime_types.rb │ ├── filter_parameter_logging.rb │ ├── rails_reload.rb │ ├── backtrace_silencers.rb │ ├── assets.rb │ ├── wrap_parameters.rb │ ├── timeout.rb │ └── inflections.rb ├── environment.rb ├── locales │ └── en.yml ├── puma.rb ├── secrets.yml ├── application.rb ├── environments │ ├── development.rb │ ├── test.rb │ └── production.rb ├── routes.rb └── database.yml ├── config.ru ├── Rakefile ├── db ├── migrate │ └── 20150308043754_create_messages.rb ├── seeds.rb └── schema.rb ├── app.json ├── README.md ├── .gitignore ├── Gemfile └── Gemfile.lock /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css.scss: -------------------------------------------------------------------------------- 1 | @import 'bootstrap'; 2 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /SCREENSHOT.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bensheldon/rails_postgres_websockets_chat/HEAD/SCREENSHOT.png -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /app/controllers/chat_controller.rb: -------------------------------------------------------------------------------- 1 | class ChatController < ApplicationController 2 | def index 3 | @messages = Message.first(10) 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../../config/application', __FILE__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_consensus_wall_session' 4 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /db/migrate/20150308043754_create_messages.rb: -------------------------------------------------------------------------------- 1 | class CreateMessages < ActiveRecord::Migration 2 | def change 3 | create_table :messages do |t| 4 | t.string :author 5 | t.text :body 6 | 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :messages, :created_at 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "rails-postgres-websockets-chat", 3 | "description": "A simple async Rails chat server using postgres listen/notify", 4 | "website": "https://github.com/bensheldon/rails_postgres_websockets_chat", 5 | "success_url": "/", 6 | "addons": ["heroku-postgresql"], 7 | "env": {}, 8 | "scripts": {} 9 | } 10 | -------------------------------------------------------------------------------- /config/initializers/rails_reload.rb: -------------------------------------------------------------------------------- 1 | unless Rails.configuration.cache_classes 2 | ActionDispatch::Reloader.to_prepare do 3 | ActiveRecord::Base.connection_pool.with_connection do |connection| 4 | conn = connection.instance_variable_get(:@connection) 5 | connection.execute %Q(NOTIFY #{AsyncEvents::RESET_CHANNEL}, '{}') 6 | end 7 | end 8 | end 9 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /app/models/message.rb: -------------------------------------------------------------------------------- 1 | class Message < ActiveRecord::Base 2 | after_create :send_notify 3 | 4 | default_scope { order("created_at DESC") } 5 | 6 | private 7 | def send_notify 8 | # Escape single quoted strings by inserting 2 of them 9 | self.class.connection.execute %Q(NOTIFY #{AsyncEvents::CHANNEL}, '#{to_json.gsub("'", "''")}') 10 | true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ConsensusWall 5 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> 6 | <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rails+Postgres WebSockets Chat Demo 2 | 3 | [![Deploy](https://www.herokucdn.com/deploy/button.png)](https://heroku.com/deploy) 4 | 5 | Based on [Heroku's Ruby Websockets Chat Demo](https://github.com/heroku-examples/ruby-websockets-chat-demo), but uses Postgres `LISTEN/NOTIFY` for message passing instead of Redis, and also persists chat messages in Postgres too. This has *no dependency on Redis*. 6 | 7 | ![Screenshot](SCREENSHOT.png) 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | !/log/.keep 13 | /tmp 14 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require "rubygems" 8 | require "bundler" 9 | 10 | if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) 11 | Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } 12 | gem "spring", match[1] 13 | require "spring/binstub" 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] if respond_to?(:wrap_parameters) 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/initializers/timeout.rb: -------------------------------------------------------------------------------- 1 | # There is no request timeout mechanism inside of Puma. 2 | # The Heroku router will timeout all requests that exceed 3 | # 30 seconds. Although the an error will be returned back 4 | # to the client, Puma will continue to work on the request 5 | # as there is no way for the router to notify Puma that the 6 | # request terminated early. To avoid clogging your processing 7 | # ability we recommend using Rack::Timeout to terminate long 8 | # running requests and locate their source. 9 | 10 | Rack::Timeout.timeout = 20 # seconds 11 | 12 | if Rails.env.development? 13 | # Disable logging 14 | Rack::Timeout.unregister_state_change_observer(:logger) 15 | end 16 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. 9 | // 10 | // Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require_tree . 17 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | DEFAULT_PUMA_WORKERS = 2 2 | DEFAULT_PUMA_THREADS = 3 3 | 4 | workers Integer(ENV['PUMA_WORKERS'] || DEFAULT_PUMA_WORKERS) 5 | threads Integer(ENV['PUMA_THREADS'] || DEFAULT_PUMA_THREADS), Integer(ENV['PUMA_THREADS'] || DEFAULT_PUMA_THREADS) 6 | 7 | preload_app! 8 | 9 | rackup DefaultRackup 10 | port ENV['PORT'] || 3000 11 | environment ENV['RACK_ENV'] || 'development' 12 | 13 | on_worker_boot do 14 | # worker specific setup 15 | ActiveSupport.on_load(:active_record) do 16 | config = ActiveRecord::Base.configurations[Rails.env] || Rails.application.config.database_configuration[Rails.env] 17 | config['pool'] = (ENV['PUMA_THREADS'] || DEFAULT_PUMA_THREADS) + 2 # TODO: why is this not 1? 18 | ActiveRecord::Base.establish_connection(config) 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts "== Installing dependencies ==" 12 | system "gem install bundler --conservative" 13 | system "bundle check || bundle install" 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system "bin/rake db:setup" 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system "rm -f log/*" 25 | system "rm -rf tmp/cache" 26 | 27 | puts "\n== Restarting application server ==" 28 | system "touch tmp/restart.txt" 29 | end 30 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rake secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 0b302e8b45f33dc3027e3b44f11ebbcea5eb29a833b8427ad5fd4f5a3752c3a0856c1295544aa89e20c4a2bf602048efabea686028addb78c84a40fa417b2b4e 15 | 16 | test: 17 | secret_key_base: 2d06f1b553a9f51c54d717d994868f858d24553fcfe7fc83922bc05d89ecb2e50686da38d6f74c8011f10d3d8123c7158e40b1cec97565d91e33700a0f7ed579 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /app/views/chat/index.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Rails+Postgres WebSockets Chat Demo

4 |

Check out the code on Github.

5 |
6 |
7 |
8 | 9 |
10 |
11 | 12 |
13 | 14 |
15 | 18 |
19 | <%- @messages.each do |message| %> 20 |
21 |
<%= message.author %>
22 |
<%= message.body %>
23 |
24 | <%- end %> 25 |
26 |
27 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20150308043754) do 15 | 16 | # These are extensions that must be enabled in order to support this database 17 | enable_extension "plpgsql" 18 | 19 | create_table "messages", force: :cascade do |t| 20 | t.string "author" 21 | t.text "body" 22 | t.datetime "created_at", null: false 23 | t.datetime "updated_at", null: false 24 | end 25 | 26 | add_index "messages", ["created_at"], name: "index_messages_on_created_at", using: :btree 27 | 28 | end 29 | -------------------------------------------------------------------------------- /app/assets/javascripts/async_events.coffee: -------------------------------------------------------------------------------- 1 | attempts = 1 2 | generateInterval = (attempts) -> 3 | maxInterval = (Math.pow(2, attempts) - 1) * 1000 4 | 5 | # If the generated interval is more than 30 seconds, truncate it down to 30 seconds. 6 | maxInterval = 30*1000 if (maxInterval > 30*1000) 7 | 8 | # generate the interval to a random number between 0 and the maxInterval determined from above 9 | Math.random() * maxInterval 10 | 11 | ws = null 12 | createWebsocket = -> 13 | scheme = "ws://" # TODO: make "wss://" in production 14 | uri = scheme + window.document.location.host + '/' 15 | ws = new WebSocket(uri) 16 | 17 | ws.onopen = -> 18 | attempts = 1 # reset 19 | 20 | ws.onmessage = (message) -> 21 | data = JSON.parse(message.data) 22 | $('#chat-text').prepend '
' + data.author + '
' + data.body + '
' 23 | $('#chat-text').stop().animate { scrollTop: $('#chat-text')[0].scrollHeight }, 800 24 | 25 | ws.onclose = -> 26 | setTimeout -> 27 | attempts++ 28 | createWebsocket() 29 | , generateInterval(attempts) 30 | 31 | # Initialize the websocket 32 | createWebsocket() 33 | 34 | $ -> 35 | $('#input-form').on 'submit', (event) -> 36 | event.preventDefault() 37 | author = $('#input-author')[0].value 38 | body = $('#input-body')[0].value 39 | ws.send JSON.stringify( 40 | author: author 41 | body: body) 42 | $('#input-body')[0].value = '' 43 | return 44 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 2 | 3 | # Pick the frameworks you want: 4 | require "active_model/railtie" 5 | require "active_job/railtie" 6 | require "active_record/railtie" 7 | require "action_controller/railtie" 8 | require "action_mailer/railtie" 9 | require "action_view/railtie" 10 | require "sprockets/railtie" 11 | # require "rails/test_unit/railtie" 12 | 13 | # Require the gems listed in Gemfile, including any gems 14 | # you've limited to :test, :development, or :production. 15 | Bundler.require(*Rails.groups) 16 | 17 | require_relative '../app/lib/async_events' 18 | 19 | module ConsensusWall 20 | class Application < Rails::Application 21 | 22 | config.middleware.use AsyncEvents 23 | 24 | # Settings in config/environments/* take precedence over those specified here. 25 | # Application configuration should go into files in config/initializers 26 | # -- all .rb files in that directory are automatically loaded. 27 | 28 | # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. 29 | # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. 30 | # config.time_zone = 'Central Time (US & Canada)' 31 | 32 | # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. 33 | # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] 34 | # config.i18n.default_locale = :de 35 | 36 | # Do not swallow errors in after_commit/after_rollback callbacks. 37 | config.active_record.raise_in_transactional_callbacks = true 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | end 42 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | root 'chat#index' 3 | 4 | # The priority is based upon order of creation: first created -> highest priority. 5 | # See how all your routes lay out with "rake routes". 6 | 7 | # You can have the root of your site routed with "root" 8 | # root 'welcome#index' 9 | 10 | # Example of regular route: 11 | # get 'products/:id' => 'catalog#view' 12 | 13 | # Example of named route that can be invoked with purchase_url(id: product.id) 14 | # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase 15 | 16 | # Example resource route (maps HTTP verbs to controller actions automatically): 17 | # resources :products 18 | 19 | # Example resource route with options: 20 | # resources :products do 21 | # member do 22 | # get 'short' 23 | # post 'toggle' 24 | # end 25 | # 26 | # collection do 27 | # get 'sold' 28 | # end 29 | # end 30 | 31 | # Example resource route with sub-resources: 32 | # resources :products do 33 | # resources :comments, :sales 34 | # resource :seller 35 | # end 36 | 37 | # Example resource route with more complex sub-resources: 38 | # resources :products do 39 | # resources :comments 40 | # resources :sales do 41 | # get 'recent', on: :collection 42 | # end 43 | # end 44 | 45 | # Example resource route with concerns: 46 | # concern :toggleable do 47 | # post 'toggle' 48 | # end 49 | # resources :posts, concerns: :toggleable 50 | # resources :photos, concerns: :toggleable 51 | 52 | # Example resource route within a namespace: 53 | # namespace :admin do 54 | # # Directs /admin/products/* to Admin::ProductsController 55 | # # (app/controllers/admin/products_controller.rb) 56 | # resources :products 57 | # end 58 | end 59 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | ruby '2.2.1' 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', '4.2.0' 6 | # Use postgresql as the database for Active Record 7 | gem 'pg' 8 | # Use Puma as the webserver 9 | gem 'puma' 10 | gem 'rack-timeout' 11 | 12 | # Use SCSS for stylesheets 13 | gem 'sass-rails', '~> 5.0' 14 | # Use Uglifier as compressor for JavaScript assets 15 | gem 'uglifier', '>= 1.3.0' 16 | # Use CoffeeScript for .coffee assets and views 17 | gem 'coffee-rails', '~> 4.1.0' 18 | 19 | gem 'bootstrap-sass' 20 | 21 | # See https://github.com/sstephenson/execjs#readme for more supported runtimes 22 | # gem 'therubyracer', platforms: :ruby 23 | 24 | # Use jquery as the JavaScript library 25 | gem 'jquery-rails' 26 | # Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 27 | gem 'turbolinks' 28 | # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 29 | gem 'jbuilder', '~> 2.0' 30 | # bundle exec rake doc:rails generates the API under doc/api. 31 | gem 'sdoc', '~> 0.4.0', group: :doc 32 | 33 | gem 'faye-websocket' 34 | 35 | gem 'pry-rails' 36 | 37 | # Use ActiveModel has_secure_password 38 | # gem 'bcrypt', '~> 3.1.7' 39 | 40 | # Use Unicorn as the app server 41 | # gem 'unicorn' 42 | 43 | # Use Capistrano for deployment 44 | # gem 'capistrano-rails', group: :development 45 | 46 | group :development, :test do 47 | # Call 'byebug' anywhere in the code to stop execution and get a debugger console 48 | gem 'byebug' 49 | 50 | # Access an IRB console on exception pages or by using <%= console %> in views 51 | gem 'web-console', '~> 2.0' 52 | 53 | # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 54 | gem 'spring' 55 | end 56 | 57 | group :production do 58 | gem 'rails_12factor' 59 | end 60 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure static file server for tests with Cache-Control for performance. 16 | config.serve_static_files = true 17 | config.static_cache_control = 'public, max-age=3600' 18 | 19 | # Show full error reports and disable caching. 20 | config.consider_all_requests_local = true 21 | config.action_controller.perform_caching = false 22 | 23 | # Raise exceptions instead of rendering exception templates. 24 | config.action_dispatch.show_exceptions = false 25 | 26 | # Disable request forgery protection in test environment. 27 | config.action_controller.allow_forgery_protection = false 28 | 29 | # Tell Action Mailer not to deliver emails to the real world. 30 | # The :test delivery method accumulates sent emails in the 31 | # ActionMailer::Base.deliveries array. 32 | config.action_mailer.delivery_method = :test 33 | 34 | # Randomize the order test cases are executed. 35 | config.active_support.test_order = :random 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /app/lib/async_events.rb: -------------------------------------------------------------------------------- 1 | require 'faye/websocket' 2 | require 'thread' 3 | require 'json' 4 | require 'erb' 5 | 6 | # https://github.com/heroku-examples/ruby-websockets-chat-demo/blob/master/middlewares/chat_backend.rb 7 | # https://github.com/curoverse/arvados/blob/master/services/api/lib/eventbus.rb 8 | 9 | class AsyncEvents 10 | KEEPALIVE_TIME = 1 # in seconds 11 | CHANNEL = 'chatdemo' 12 | RESET_CHANNEL = 'pg_restart' 13 | 14 | def initialize(app) 15 | @app = app 16 | @clients = [] 17 | 18 | @mutex = Mutex.new 19 | @bgthread = false 20 | end 21 | 22 | def call(env) 23 | return @app.call(env) unless Faye::WebSocket.websocket?(env) 24 | 25 | setup_listener 26 | 27 | ws = Faye::WebSocket.new(env, nil, { ping: KEEPALIVE_TIME }) 28 | ws.on :open do |event| 29 | p [:open, ws.object_id] 30 | @clients << ws 31 | end 32 | 33 | ws.on :message do |event| 34 | p [:message, event.data] 35 | data = JSON.parse event.data 36 | message = Message.create author: data['author'], body: data['body'] 37 | p data 38 | end 39 | 40 | ws.on :close do |event| 41 | p [:close, ws.object_id, event.code, event.reason] 42 | @clients.delete(ws) 43 | ws = nil 44 | end 45 | 46 | # Return async Rack response 47 | ws.rack_response 48 | end 49 | 50 | def setup_listener 51 | # Start up thread to monitor the Postgres database, if none exists already. 52 | @mutex.synchronize do 53 | unless @bgthread 54 | @bgthread = true 55 | Thread.new do 56 | # from http://stackoverflow.com/questions/16405520/postgres-listen-notify-rails 57 | ActiveRecord::Base.connection_pool.with_connection do |connection| 58 | conn = connection.instance_variable_get(:@connection) 59 | begin 60 | conn.async_exec "LISTEN #{RESET_CHANNEL}" 61 | conn.async_exec "LISTEN #{CHANNEL}" 62 | catch(:break_loop) do 63 | loop do 64 | conn.wait_for_notify do |channel, pid, payload| 65 | p [:send, channel, payload] 66 | # Break out of the loop if receive a restart (like on Rails reload) 67 | throw :break_loop if channel == RESET_CHANNEL 68 | @clients.each {|ws| ws.send(sanitize payload) } 69 | end 70 | end 71 | end 72 | rescue => error 73 | p [:error, error] 74 | ensure 75 | # Don't want the connection to still be listening once we return 76 | # it to the pool - could result in weird behavior for the next 77 | # thread to check it out. 78 | conn.async_exec "UNLISTEN *" 79 | end 80 | end 81 | @bgthread = false 82 | end 83 | end 84 | end 85 | end 86 | 87 | private 88 | def sanitize(message) 89 | json = JSON.parse(message) 90 | json.each {|key, value| json[key] = ERB::Util.html_escape(value) } 91 | JSON.generate(json) 92 | end 93 | end 94 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 8.2 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see rails configuration guide 21 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: 5 23 | 24 | development: 25 | <<: *default 26 | database: consensus_wall_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: consensus_wall 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: consensus_wall_test 61 | 62 | # As with config/secrets.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: consensus_wall_production 84 | username: consensus_wall 85 | password: <%= ENV['CONSENSUS_WALL_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 35 | # yet still be able to expire them through the digest params. 36 | config.assets.digest = true 37 | 38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 39 | 40 | # Specifies the header that your server uses for sending files. 41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 43 | 44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 45 | # config.force_ssl = true 46 | 47 | # Use the lowest log level to ensure availability of diagnostic information 48 | # when problems arise. 49 | config.log_level = :debug 50 | 51 | # Prepend all log lines with the following tags. 52 | # config.log_tags = [ :subdomain, :uuid ] 53 | 54 | # Use a different logger for distributed setups. 55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 61 | # config.action_controller.asset_host = 'http://assets.example.com' 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Use default logging formatter so that PID and timestamp are not suppressed. 75 | config.log_formatter = ::Logger::Formatter.new 76 | 77 | # Do not dump schema after migrations. 78 | config.active_record.dump_schema_after_migration = false 79 | end 80 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | actionmailer (4.2.0) 5 | actionpack (= 4.2.0) 6 | actionview (= 4.2.0) 7 | activejob (= 4.2.0) 8 | mail (~> 2.5, >= 2.5.4) 9 | rails-dom-testing (~> 1.0, >= 1.0.5) 10 | actionpack (4.2.0) 11 | actionview (= 4.2.0) 12 | activesupport (= 4.2.0) 13 | rack (~> 1.6.0) 14 | rack-test (~> 0.6.2) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | rails-html-sanitizer (~> 1.0, >= 1.0.1) 17 | actionview (4.2.0) 18 | activesupport (= 4.2.0) 19 | builder (~> 3.1) 20 | erubis (~> 2.7.0) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.1) 23 | activejob (4.2.0) 24 | activesupport (= 4.2.0) 25 | globalid (>= 0.3.0) 26 | activemodel (4.2.0) 27 | activesupport (= 4.2.0) 28 | builder (~> 3.1) 29 | activerecord (4.2.0) 30 | activemodel (= 4.2.0) 31 | activesupport (= 4.2.0) 32 | arel (~> 6.0) 33 | activesupport (4.2.0) 34 | i18n (~> 0.7) 35 | json (~> 1.7, >= 1.7.7) 36 | minitest (~> 5.1) 37 | thread_safe (~> 0.3, >= 0.3.4) 38 | tzinfo (~> 1.1) 39 | arel (6.0.0) 40 | binding_of_caller (0.7.2) 41 | debug_inspector (>= 0.0.1) 42 | bootstrap-sass (3.3.1.0) 43 | sass (~> 3.2) 44 | builder (3.2.2) 45 | byebug (3.5.1) 46 | columnize (~> 0.8) 47 | debugger-linecache (~> 1.2) 48 | slop (~> 3.6) 49 | coderay (1.1.0) 50 | coffee-rails (4.1.0) 51 | coffee-script (>= 2.2.0) 52 | railties (>= 4.0.0, < 5.0) 53 | coffee-script (2.3.0) 54 | coffee-script-source 55 | execjs 56 | coffee-script-source (1.9.1) 57 | columnize (0.9.0) 58 | debug_inspector (0.0.2) 59 | debugger-linecache (1.2.0) 60 | erubis (2.7.0) 61 | eventmachine (1.0.7) 62 | execjs (2.4.0) 63 | faye-websocket (0.9.2) 64 | eventmachine (>= 0.12.0) 65 | websocket-driver (>= 0.5.1) 66 | globalid (0.3.3) 67 | activesupport (>= 4.1.0) 68 | hike (1.2.3) 69 | i18n (0.7.0) 70 | jbuilder (2.2.11) 71 | activesupport (>= 3.0.0, < 5) 72 | multi_json (~> 1.2) 73 | jquery-rails (4.0.3) 74 | rails-dom-testing (~> 1.0) 75 | railties (>= 4.2.0) 76 | thor (>= 0.14, < 2.0) 77 | json (1.8.2) 78 | loofah (2.0.1) 79 | nokogiri (>= 1.5.9) 80 | mail (2.6.3) 81 | mime-types (>= 1.16, < 3) 82 | method_source (0.8.2) 83 | mime-types (2.4.3) 84 | mini_portile (0.6.2) 85 | minitest (5.5.1) 86 | multi_json (1.11.0) 87 | nokogiri (1.6.6.2) 88 | mini_portile (~> 0.6.0) 89 | pg (0.18.1) 90 | pry (0.10.1) 91 | coderay (~> 1.1.0) 92 | method_source (~> 0.8.1) 93 | slop (~> 3.4) 94 | pry-rails (0.3.2) 95 | pry (>= 0.9.10) 96 | puma (2.10.2) 97 | rack (>= 1.1, < 2.0) 98 | rack (1.6.0) 99 | rack-test (0.6.3) 100 | rack (>= 1.0) 101 | rack-timeout (0.2.0) 102 | rails (4.2.0) 103 | actionmailer (= 4.2.0) 104 | actionpack (= 4.2.0) 105 | actionview (= 4.2.0) 106 | activejob (= 4.2.0) 107 | activemodel (= 4.2.0) 108 | activerecord (= 4.2.0) 109 | activesupport (= 4.2.0) 110 | bundler (>= 1.3.0, < 2.0) 111 | railties (= 4.2.0) 112 | sprockets-rails 113 | rails-deprecated_sanitizer (1.0.3) 114 | activesupport (>= 4.2.0.alpha) 115 | rails-dom-testing (1.0.5) 116 | activesupport (>= 4.2.0.beta, < 5.0) 117 | nokogiri (~> 1.6.0) 118 | rails-deprecated_sanitizer (>= 1.0.1) 119 | rails-html-sanitizer (1.0.1) 120 | loofah (~> 2.0) 121 | rails_12factor (0.0.3) 122 | rails_serve_static_assets 123 | rails_stdout_logging 124 | rails_serve_static_assets (0.0.3) 125 | rails_stdout_logging (0.0.3) 126 | railties (4.2.0) 127 | actionpack (= 4.2.0) 128 | activesupport (= 4.2.0) 129 | rake (>= 0.8.7) 130 | thor (>= 0.18.1, < 2.0) 131 | rake (10.4.2) 132 | rdoc (4.2.0) 133 | sass (3.4.13) 134 | sass-rails (5.0.1) 135 | railties (>= 4.0.0, < 5.0) 136 | sass (~> 3.1) 137 | sprockets (>= 2.8, < 4.0) 138 | sprockets-rails (>= 2.0, < 4.0) 139 | tilt (~> 1.1) 140 | sdoc (0.4.1) 141 | json (~> 1.7, >= 1.7.7) 142 | rdoc (~> 4.0) 143 | slop (3.6.0) 144 | spring (1.3.3) 145 | sprockets (2.12.3) 146 | hike (~> 1.2) 147 | multi_json (~> 1.0) 148 | rack (~> 1.0) 149 | tilt (~> 1.1, != 1.3.0) 150 | sprockets-rails (2.2.4) 151 | actionpack (>= 3.0) 152 | activesupport (>= 3.0) 153 | sprockets (>= 2.8, < 4.0) 154 | thor (0.19.1) 155 | thread_safe (0.3.4) 156 | tilt (1.4.1) 157 | turbolinks (2.5.3) 158 | coffee-rails 159 | tzinfo (1.2.2) 160 | thread_safe (~> 0.1) 161 | uglifier (2.7.1) 162 | execjs (>= 0.3.0) 163 | json (>= 1.8.0) 164 | web-console (2.1.1) 165 | activemodel (>= 4.0) 166 | binding_of_caller (>= 0.7.2) 167 | railties (>= 4.0) 168 | sprockets-rails (>= 2.0, < 4.0) 169 | websocket-driver (0.5.3) 170 | websocket-extensions (>= 0.1.0) 171 | websocket-extensions (0.1.2) 172 | 173 | PLATFORMS 174 | ruby 175 | 176 | DEPENDENCIES 177 | bootstrap-sass 178 | byebug 179 | coffee-rails (~> 4.1.0) 180 | faye-websocket 181 | jbuilder (~> 2.0) 182 | jquery-rails 183 | pg 184 | pry-rails 185 | puma 186 | rack-timeout 187 | rails (= 4.2.0) 188 | rails_12factor 189 | sass-rails (~> 5.0) 190 | sdoc (~> 0.4.0) 191 | spring 192 | turbolinks 193 | uglifier (>= 1.3.0) 194 | web-console (~> 2.0) 195 | --------------------------------------------------------------------------------