diff --git a/.gitignore b/.gitignore index 1842cdc36..f7f2e1b00 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ /log/*.log /tmp -config/database.yml .env diff --git a/.ruby-version b/.ruby-version index eca07e4c1..6b4d15773 100644 --- a/.ruby-version +++ b/.ruby-version @@ -1 +1 @@ -2.1.2 +2.2.3 \ No newline at end of file diff --git a/Gemfile b/Gemfile index fea38e57d..22684d640 100644 --- a/Gemfile +++ b/Gemfile @@ -1,7 +1,9 @@ source 'https://rubygems.org' -ruby '2.1.2' +ruby '2.2.3' gem 'rails', '4.1.2' +gem 'puma', '~> 2.13.4' +gem 'rack-timeout', '~> 0.2.4' gem 'pg' @@ -30,7 +32,6 @@ gem 'zeroclipboard-rails' group :production do gem 'rails_12factor' - gem 'unicorn' end group :development do @@ -42,7 +43,6 @@ group :development do gem 'pry' gem 'pry-rails' gem 'quiet_assets' - gem 'thin' gem 'rack-mini-profiler' gem 'haml-rails' gem "spring-commands-rspec", require: false @@ -50,7 +50,7 @@ end group :development, :test do gem 'capybara', '>= 2.2' - gem 'capybara-webkit' + gem 'capybara-webkit', '~> 1.6.0' # Requires local installation of QT (`brew install qt`) gem 'database_cleaner' gem 'dotenv-rails' gem 'factory_girl_rails' @@ -61,4 +61,5 @@ group :development, :test do gem 'rspec' gem 'rspec-rails' gem 'timecop' + gem 'spring' end diff --git a/Gemfile.lock b/Gemfile.lock index ef35a54ca..490a5bcea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -14,7 +14,7 @@ GEM activesupport (= 4.1.2) builder (~> 3.1) erubis (~> 2.7.0) - active_model_serializers (0.8.2) + active_model_serializers (0.8.3) activemodel (>= 3.0) activemodel (4.1.2) activesupport (= 4.1.2) @@ -29,12 +29,12 @@ GEM minitest (~> 5.1) thread_safe (~> 0.1) tzinfo (~> 1.1) - addressable (2.3.6) - annotate (2.6.5) - activerecord (>= 2.3.0) - rake (>= 0.8.7) + addressable (2.3.8) + annotate (2.6.10) + activerecord (>= 3.2, <= 4.3) + rake (~> 10.4) arel (5.0.1.20140414130214) - better_errors (2.0.0) + better_errors (2.1.1) coderay (>= 1.0.0) erubis (>= 2.6.6) rack (>= 0.9.0) @@ -51,11 +51,9 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (~> 2.0) - capybara-webkit (1.3.0) - capybara (>= 2.0.2, < 2.5.0) + capybara-webkit (1.6.0) + capybara (>= 2.3.0, < 2.5.0) json - celluloid (0.16.0) - timers (~> 4.0.0) chartkick (1.3.2) coderay (1.1.0) countries (0.9.3) @@ -63,14 +61,14 @@ GEM country_select (1.3.1) countries (= 0.9.3) currencies (0.4.2) - daemons (1.1.9) - database_cleaner (1.3.0) + database_cleaner (1.4.1) debug_inspector (0.0.2) diff-lcs (1.2.5) - dotenv (1.0.2) - dotenv-rails (1.0.2) - dotenv (= 1.0.2) - draper (1.4.0) + dotenv (2.0.2) + dotenv-rails (2.0.2) + dotenv (= 2.0.2) + railties (~> 4.0) + draper (2.1.0) actionpack (>= 3.0) activemodel (>= 3.0) activesupport (>= 3.0) @@ -79,46 +77,55 @@ GEM eventmachine (>= 0.12.9) http_parser.rb (~> 0.6.0) erubis (2.7.0) - eventmachine (1.0.3) - execjs (2.2.2) + eventmachine (1.0.8) + execjs (2.6.0) factory_girl (4.5.0) activesupport (>= 3.0.0) factory_girl_rails (4.5.0) factory_girl (~> 4.5.0) railties (>= 3.0.0) - faraday (0.9.0) + faraday (0.9.1) multipart-post (>= 1.2, < 3) - ffi (1.9.6) - foreman (0.63.0) - dotenv (>= 0.7) - thor (>= 0.13.6) + ffi (1.9.10) + foreman (0.78.0) + thor (~> 0.19.1) formatador (0.2.5) - groupdate (2.3.0) + groupdate (2.4.0) activesupport (>= 3) growl (1.0.3) - guard (2.6.1) + guard (2.13.0) formatador (>= 0.2.4) - listen (~> 2.7) + listen (>= 2.7, <= 4.0) lumberjack (~> 1.0) + nenv (~> 0.1) + notiffany (~> 0.0) pry (>= 0.9.12) + shellany (~> 0.0) thor (>= 0.18.1) + guard-compat (1.2.1) guard-livereload (2.1.3) em-websocket (~> 0.5) guard (~> 2.0) multi_json (~> 1.8) - guard-rspec (4.3.1) + guard-rspec (4.6.4) guard (~> 2.1) - rspec (>= 2.14, < 4.0) - haml (4.0.5) + guard-compat (~> 1.1) + rspec (>= 2.99.0, < 4.0) + haml (4.0.7) tilt - haml-rails (0.5.3) + haml-rails (0.9.0) actionpack (>= 4.0.1) activesupport (>= 4.0.1) - haml (>= 3.1, < 5.0) + haml (>= 4.0.6, < 5.0) + html2haml (>= 1.0.1) railties (>= 4.0.1) - hashie (3.3.1) + hashie (3.4.2) hike (1.2.3) - hitimes (1.2.2) + html2haml (2.0.0) + erubis (~> 2.7.0) + haml (~> 4.0.0) + nokogiri (~> 1.6.0) + ruby_parser (~> 3.5) http_parser.rb (0.6.0) i18n (0.7.0) jquery-datatables-rails (3.3.0) @@ -126,18 +133,16 @@ GEM jquery-rails railties (>= 3.1) sass-rails - jquery-rails (3.1.2) + jquery-rails (3.1.3) railties (>= 3.0, < 5.0) thor (>= 0.14, < 2.0) - jquery-ui-rails (5.0.2) + jquery-ui-rails (5.0.5) railties (>= 3.2.16) - json (1.8.2) - jwt (1.0.0) - kgio (2.9.2) - launchy (2.4.2) + json (1.8.3) + jwt (1.5.1) + launchy (2.4.3) addressable (~> 2.3) - listen (2.7.11) - celluloid (>= 0.15.2) + listen (3.0.3) rb-fsevent (>= 0.9.3) rb-inotify (>= 0.9) lumberjack (1.0.9) @@ -146,13 +151,17 @@ GEM treetop (~> 1.4.8) method_source (0.8.2) mime-types (1.25.1) - mini_portile (0.6.0) - minitest (5.6.1) - multi_json (1.10.1) + mini_portile (0.6.2) + minitest (5.8.0) + multi_json (1.11.2) multi_xml (0.5.5) multipart-post (2.0.0) - nokogiri (1.6.3.1) - mini_portile (= 0.6.0) + nenv (0.2.0) + nokogiri (1.6.6.2) + mini_portile (~> 0.6.0) + notiffany (0.0.7) + nenv (~> 0.1) + shellany (~> 0.0) oauth (0.4.7) oauth2 (1.0.0) faraday (>= 0.8, < 0.10) @@ -166,32 +175,32 @@ GEM omniauth-github (1.1.2) omniauth (~> 1.0) omniauth-oauth2 (~> 1.1) - omniauth-oauth (1.0.1) + omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.2.0) - faraday (>= 0.8, < 0.10) - multi_json (~> 1.3) + omniauth-oauth2 (1.3.1) oauth2 (~> 1.0) omniauth (~> 1.2) - omniauth-twitter (1.1.0) - multi_json (~> 1.3) - omniauth-oauth (~> 1.0) - pg (0.17.1) + omniauth-twitter (1.2.1) + json (~> 1.3) + omniauth-oauth (~> 1.1) + pg (0.18.2) polyglot (0.3.5) pry (0.10.1) coderay (~> 1.1.0) method_source (~> 0.8.1) slop (~> 3.4) - pry-rails (0.3.2) + pry-rails (0.3.4) pry (>= 0.9.10) - quiet_assets (1.0.3) + puma (2.13.4) + quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.5.2) - rack-mini-profiler (0.9.2) + rack (1.5.5) + rack-mini-profiler (0.9.7) rack (>= 1.1.3) rack-test (0.6.3) rack (>= 1.0) + rack-timeout (0.2.4) rails (4.1.2) actionmailer (= 4.1.2) actionpack (= 4.1.2) @@ -205,87 +214,81 @@ GEM rails_12factor (0.0.3) rails_serve_static_assets rails_stdout_logging - rails_serve_static_assets (0.0.2) - rails_stdout_logging (0.0.3) + rails_serve_static_assets (0.0.4) + rails_stdout_logging (0.0.4) railties (4.1.2) actionpack (= 4.1.2) activesupport (= 4.1.2) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - raindrops (0.13.0) rake (10.4.2) - rb-fsevent (0.9.4) + rb-fsevent (0.9.5) rb-inotify (0.9.5) ffi (>= 0.5.0) redcarpet (3.0.0) - request_store (1.1.0) - rspec (3.1.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-core (3.1.7) - rspec-support (~> 3.1.0) - rspec-expectations (3.1.2) + request_store (1.2.0) + rspec (3.3.0) + rspec-core (~> 3.3.0) + rspec-expectations (~> 3.3.0) + rspec-mocks (~> 3.3.0) + rspec-core (3.3.2) + rspec-support (~> 3.3.0) + rspec-expectations (3.3.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.1.0) - rspec-mocks (3.1.3) - rspec-support (~> 3.1.0) - rspec-rails (3.1.0) - actionpack (>= 3.0) - activesupport (>= 3.0) - railties (>= 3.0) - rspec-core (~> 3.1.0) - rspec-expectations (~> 3.1.0) - rspec-mocks (~> 3.1.0) - rspec-support (~> 3.1.0) - rspec-support (3.1.2) + rspec-support (~> 3.3.0) + rspec-mocks (3.3.2) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.3.0) + rspec-rails (3.3.3) + actionpack (>= 3.0, < 4.3) + activesupport (>= 3.0, < 4.3) + railties (>= 3.0, < 4.3) + rspec-core (~> 3.3.0) + rspec-expectations (~> 3.3.0) + rspec-mocks (~> 3.3.0) + rspec-support (~> 3.3.0) + rspec-support (3.3.0) + ruby_parser (3.7.1) + sexp_processor (~> 4.1) sass (3.2.19) - sass-rails (4.0.3) + sass-rails (4.0.5) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) + sass (~> 3.2.2) + sprockets (~> 2.8, < 3.0) sprockets-rails (~> 2.0) + sexp_processor (4.6.0) + shellany (0.0.1) simple_form (3.1.0.rc1) actionpack (~> 4.0) activemodel (~> 4.0) slop (3.6.0) - spring (1.1.3) - spring-commands-rspec (1.0.2) + spring (1.3.6) + spring-commands-rspec (1.0.4) spring (>= 0.9.1) - sprockets (2.11.0) + sprockets (2.12.4) hike (~> 1.2) multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.2.0) + sprockets-rails (2.3.2) actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - thin (1.6.3) - daemons (~> 1.0, >= 1.0.9) - eventmachine (~> 1.0) - rack (~> 1.0) thor (0.19.1) thread_safe (0.3.5) tilt (1.4.1) - timecop (0.7.1) - timers (4.0.1) - hitimes + timecop (0.8.0) treetop (1.4.15) polyglot polyglot (>= 0.3.1) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.5.3) + uglifier (2.7.1) execjs (>= 0.3.0) json (>= 1.8.0) - unicorn (4.8.3) - kgio (~> 2.6) - rack - raindrops (~> 0.7) xpath (2.0.0) nokogiri (~> 1.3) - zeroclipboard-rails (0.1.0) + zeroclipboard-rails (0.1.1) railties (>= 3.1) PLATFORMS @@ -299,7 +302,7 @@ DEPENDENCIES bootstrap-multiselect-rails (= 0.0.4) bootstrap-sass (~> 3.0.2.1) capybara (>= 2.2) - capybara-webkit + capybara-webkit (~> 1.6.0) chartkick coderay (~> 1.0) country_select (~> 1.3.1) @@ -324,8 +327,10 @@ DEPENDENCIES pg pry pry-rails + puma (~> 2.13.4) quiet_assets rack-mini-profiler + rack-timeout (~> 0.2.4) rails (= 4.1.2) rails_12factor redcarpet (~> 3.0.0) @@ -333,9 +338,11 @@ DEPENDENCIES rspec-rails sass-rails (~> 4.0.1) simple_form (= 3.1.0.rc1) + spring spring-commands-rspec - thin timecop uglifier (>= 1.3.0) - unicorn zeroclipboard-rails + +BUNDLED WITH + 1.10.6 diff --git a/Procfile b/Procfile index 9249f1e3f..528ca4bfb 100644 --- a/Procfile +++ b/Procfile @@ -1 +1 @@ -web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb \ No newline at end of file +web: bundle exec puma -C config/puma.rb \ No newline at end of file diff --git a/app/assets/javascripts/organizer/speakers.js.erb b/app/assets/javascripts/organizer/speakers.js similarity index 100% rename from app/assets/javascripts/organizer/speakers.js.erb rename to app/assets/javascripts/organizer/speakers.js diff --git a/app/assets/javascripts/schedule.js.erb b/app/assets/javascripts/schedule.js similarity index 100% rename from app/assets/javascripts/schedule.js.erb rename to app/assets/javascripts/schedule.js diff --git a/bin/spring b/bin/spring index 253ec37c3..7b45d374f 100755 --- a/bin/spring +++ b/bin/spring @@ -1,17 +1,14 @@ #!/usr/bin/env ruby -# This file loads spring without using Bundler, in order to be fast -# It gets overwritten when you run the `spring binstub` command +# This file loads spring without using Bundler, in order to be fast. +# It gets overwritten when you run the `spring binstub` command. unless defined?(Spring) require "rubygems" require "bundler" - if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m) - ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR) - ENV["GEM_HOME"] = "" - Gem.paths = ENV - + if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) + Gem.paths = { "GEM_PATH" => [Bundler.bundle_path.to_s, *Gem.path].uniq } gem "spring", match[1] require "spring/binstub" end diff --git a/config/database.yml b/config/database.yml new file mode 100644 index 000000000..9fd6bd6de --- /dev/null +++ b/config/database.yml @@ -0,0 +1,17 @@ +default: &default + adapter: postgresql + encoding: unicode + pool: 5 + +development: + <<: *default + database: cfp_app_development + +test: + <<: *default + database: cfp_app_test + + +production: + url: <%= ENV["DATABASE_URL"] %> + pool: <%= ENV["DB_POOL"] || ENV['MAX_THREADS'] || 5 %> diff --git a/config/database_example.yml b/config/database_example.yml deleted file mode 100644 index 0886d1f6c..000000000 --- a/config/database_example.yml +++ /dev/null @@ -1,15 +0,0 @@ -development: - adapter: postgresql - database: cfp_app_development - host: localhost - username: <%= ENV['POSTGRES_USER'] %> - pool: 5 - timeout: 5000 - -test: - adapter: postgresql - database: cfp_app_test - host: localhost - username: <%= ENV['POSTGRES_USER'] %> - pool: 5 - timeout: 5000 diff --git a/config/initializers/timeout.rb b/config/initializers/timeout.rb new file mode 100644 index 000000000..a7c71bae8 --- /dev/null +++ b/config/initializers/timeout.rb @@ -0,0 +1 @@ +Rack::Timeout.timeout = 15 \ No newline at end of file diff --git a/config/puma.rb b/config/puma.rb new file mode 100644 index 000000000..60dbdb20e --- /dev/null +++ b/config/puma.rb @@ -0,0 +1,15 @@ +workers Integer(ENV['WEB_CONCURRENCY'] || 2) +threads_count = Integer(ENV['MAX_THREADS'] || 5) +threads threads_count, threads_count + +preload_app! + +rackup DefaultRackup +port ENV['PORT'] || 3000 +environment ENV['RACK_ENV'] || 'development' + +on_worker_boot do + # Worker specific setup for Rails 4.1+ + # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot + ActiveRecord::Base.establish_connection +end \ No newline at end of file diff --git a/config/unicorn.rb b/config/unicorn.rb deleted file mode 100644 index d19ba8270..000000000 --- a/config/unicorn.rb +++ /dev/null @@ -1,23 +0,0 @@ -# config/unicorn.rb -worker_processes Integer(ENV["WEB_CONCURRENCY"] || 3) -timeout 15 -preload_app true - -before_fork do |server, worker| - Signal.trap 'TERM' do - puts 'Unicorn master intercepting TERM and sending myself QUIT instead' - Process.kill 'QUIT', Process.pid - end - - defined?(ActiveRecord::Base) and - ActiveRecord::Base.connection.disconnect! -end - -after_fork do |server, worker| - Signal.trap 'TERM' do - puts 'Unicorn worker intercepting TERM and doing nothing. Wait for master to send QUIT' - end - - defined?(ActiveRecord::Base) and - ActiveRecord::Base.establish_connection -end \ No newline at end of file diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 23687c901..621807cc7 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -20,10 +20,14 @@ RSpec.configure do |config| Capybara.javascript_driver = :webkit - # If you're not using ActiveRecord, or you'd prefer not to run each of your - # examples within a transaction, remove the following line or assign false - # instead of true. - config.use_transactional_fixtures = true + Capybara::Webkit.configure do |config| + config.debug = true + config.block_unknown_urls + config.allow_url("127.0.0.1") + config.allow_url("localhost") + config.allow_url("example.com") + end + # RSpec Rails can automatically mix in different behaviours to your tests # based on their file location, for example enabling you to call `get` and @@ -43,17 +47,18 @@ config.include FeatureHelper, type: :feature config.include FactoryGirl::Syntax::Methods - config.before(:each, js: true) do - self.use_transactional_fixtures = false - ActiveRecord::Base.establish_connection - DatabaseCleaner.strategy = :truncation + # DB cleaning + config.before(:suite) do + DatabaseCleaner.clean_with(:truncation) + end + + config.before(:each) do |example| + DatabaseCleaner.strategy= example.metadata[:js] ? :truncation : :transaction DatabaseCleaner.start end - config.after(:each, js: true) do + config.after(:each) do DatabaseCleaner.clean - ActiveRecord::Base.establish_connection - self.use_transactional_fixtures = true end config.before(:all) do