diff --git a/.travis.yml b/.travis.yml index 32eedae4..1d4abefa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,18 +24,17 @@ matrix: - env: DOCKER_IMAGE=cantino/huginn DOCKERFILE=docker/multi-process/Dockerfile - env: RSPEC_TASK=spec:features include: - - rvm: 2.3.0 + - rvm: 2.3.1 env: DATABASE_ADAPTER=mysql2 DOCKER_IMAGE=cantino/huginn-single-process DOCKERFILE=docker/single-process/Dockerfile - - rvm: 2.3.0 + - rvm: 2.3.1 env: DATABASE_ADAPTER=mysql2 DOCKER_IMAGE=cantino/huginn DOCKERFILE=docker/multi-process/Dockerfile - - rvm: 2.3.0 + - rvm: 2.3.1 env: RSPEC_TASK=spec:features DATABASE_ADAPTER=mysql2 - - rvm: 2.3.0 + - rvm: 2.3.1 env: RSPEC_TASK=spec:features DATABASE_ADAPTER=postgresql DATABASE_USERNAME=postgres rvm: -- 2.1 - 2.2 -- 2.3.0 +- 2.3.1 cache: bundler bundler_args: --without development production before_install: diff --git a/Gemfile b/Gemfile index 39aee407..1cedeeef 100644 --- a/Gemfile +++ b/Gemfile @@ -38,7 +38,8 @@ gem 'slack-notifier', '~> 1.0.0' # SlackAgent gem 'hypdf', '~> 1.0.10' # PDFInfoAgent # Weibo Agents -gem 'weibo_2', github: 'cantino/weibo_2', branch: 'master' +# FIXME needs to loosen omniauth dependency +#gem 'weibo_2', github: 'cantino/weibo_2', branch: 'master' # GoogleCalendarPublishAgent gem "google-api-client", require: 'google/api_client' @@ -46,11 +47,11 @@ gem "google-api-client", require: 'google/api_client' # Twitter Agents gem 'twitter', '~> 5.14.0' # Must to be loaded before cantino-twitter-stream. gem 'twitter-stream', github: 'cantino/twitter-stream', branch: 'huginn' -gem 'omniauth-twitter' +gem 'omniauth-twitter', '~> 1.2.1' # Tumblr Agents gem 'tumblr_client', github: 'tumblr/tumblr_client', branch: 'master' # '>= 0.8.5' -gem 'omniauth-tumblr' +gem 'omniauth-tumblr', '~> 1.2' # Dropbox Agents gem 'dropbox-api' @@ -71,7 +72,7 @@ gem 'aws-sdk-core', '~> 2.2.15' # Optional Services. gem 'omniauth-37signals' # BasecampAgent -gem 'omniauth-wunderlist', github: 'wunderlist/omniauth-wunderlist', ref: 'd0910d0396107b9302aa1bc50e74bb140990ccb8' +gem 'omniauth-wunderlist' # Bundler <1.5 does not recognize :x64_mingw as a valid platform name. # Unfortunately, it can't self-update because it errors when encountering :x64_mingw. @@ -83,11 +84,11 @@ end gem 'ace-rails-ap', '~> 2.0.1' gem 'bootstrap-kaminari-views', '~> 0.0.3' gem 'bundler', '>= 1.5.0' -gem 'coffee-rails', '~> 4.1.1' +gem 'coffee-rails', '~> 4.2' gem 'daemons', '~> 1.1.9' gem 'delayed_job', '~> 4.1.0' gem 'delayed_job_active_record', github: 'collectiveidea/delayed_job_active_record', branch: 'master' -gem 'devise', '~> 3.5.4' +gem 'devise','~> 4.2.0' gem 'em-http-request', '~> 1.1.2' gem 'faraday', '~> 0.9.0' gem 'faraday_middleware', github: 'lostisland/faraday_middleware', branch: 'master' # '>= 0.10.1' @@ -100,7 +101,7 @@ gem 'geokit', '~> 1.8.4' gem 'geokit-rails', '~> 2.0.1' gem 'httparty', '~> 0.13' gem 'httmultiparty', '~> 0.3.16' -gem 'jquery-rails', '~> 3.1.3' +gem 'jquery-rails', '~> 4.2.1' gem 'huginn_agent', '~> 0.4.0' gem 'json', '~> 1.8.1' gem 'jsonpathv2', '~> 0.0.8' @@ -110,8 +111,8 @@ gem 'liquid', '~> 3.0.3' gem 'mini_magick' gem 'multi_xml' gem 'nokogiri', '1.6.8' -gem 'omniauth' -gem 'rails', '4.2.7.1' +gem 'omniauth', '~> 1.3.1' +gem 'rails', '~> 5.0.0.1' gem 'rufus-scheduler', '~> 3.0.8', require: false gem 'sass-rails', '~> 5.0.6' gem 'select2-rails', '~> 3.5.4' @@ -124,12 +125,12 @@ gem 'uglifier', '~> 2.7.2' group :development do gem 'better_errors', '~> 1.1' gem 'binding_of_caller' - gem 'quiet_assets' gem 'guard', '~> 2.13.0' gem 'guard-livereload', '~> 2.5.1' gem 'guard-rspec', '~> 4.6.4' gem 'rack-livereload', '~> 0.3.16' - gem 'letter_opener_web' + gem 'letter_opener_web', '~> 1.3.0' + gem 'web-console' gem 'capistrano', '~> 3.4.0' gem 'capistrano-rails', '~> 1.1' @@ -138,6 +139,7 @@ group :development do if_true(ENV['SPRING']) do gem 'spring-commands-rspec', '~> 1.0.4' gem 'spring', '~> 1.6.3' + gem 'spring-watcher-listen', '~> 2.0.0' end group :test do @@ -150,8 +152,9 @@ group :development do gem 'rr' gem 'rspec', '~> 3.5' gem 'rspec-collection_matchers', '~> 1.1.0' - gem 'rspec-rails', '~> 3.5.1' - gem 'rspec-html-matchers', '~> 0.7' + gem 'rspec-rails', '~> 3.5.2' + gem 'rspec-html-matchers', '~> 0.8' + gem 'rails-controller-testing' gem 'shoulda-matchers' gem 'vcr' gem 'webmock', '~> 1.17.4', require: false @@ -160,8 +163,7 @@ group :development do end group :production do - gem 'rack', '> 1.5.0' - gem 'unicorn', '~> 4.9.0' + gem 'unicorn', '~> 5.1.0' end # Platform requirements. diff --git a/Gemfile.lock b/Gemfile.lock index c4dccdde..181169f0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -8,23 +8,12 @@ GIT http_parser.rb (~> 0.6.0) simple_oauth (~> 0.3.0) -GIT - remote: git://github.com/cantino/weibo_2.git - revision: 00e57d29d8252126014b038cd738b02e05e4cfc5 - branch: master - specs: - weibo_2 (0.1.7) - hashie (~> 2.0.4) - multi_json (~> 1) - oauth2 (~> 0.9.1) - rest-client (~> 1.8) - GIT remote: git://github.com/collectiveidea/delayed_job_active_record.git - revision: 61e688e03b2ef4004b08de6d1e0a123fda8fffad + revision: 36f434c4fd660e8f11ce932be117e9c71dde7212 branch: master specs: - delayed_job_active_record (4.1.0) + delayed_job_active_record (4.1.1) activerecord (>= 3.0, < 5.1) delayed_job (>= 3.0, < 5) @@ -49,15 +38,6 @@ GIT oauth simple_oauth -GIT - remote: git://github.com/wunderlist/omniauth-wunderlist.git - revision: d0910d0396107b9302aa1bc50e74bb140990ccb8 - ref: d0910d0396107b9302aa1bc50e74bb140990ccb8 - specs: - omniauth-wunderlist (0.0.1) - omniauth (~> 1.0) - omniauth-oauth2 (~> 1.1) - PATH remote: vendor/gems/dotenv-2.0.1 specs: @@ -69,50 +49,52 @@ GEM remote: https://rubygems.org/ specs: ace-rails-ap (2.0.1) - actionmailer (4.2.7.1) - actionpack (= 4.2.7.1) - actionview (= 4.2.7.1) - activejob (= 4.2.7.1) + actioncable (5.0.0.1) + actionpack (= 5.0.0.1) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) mail (~> 2.5, >= 2.5.4) - rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.7.1) - actionview (= 4.2.7.1) - activesupport (= 4.2.7.1) - rack (~> 1.6) - rack-test (~> 0.6.2) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) + actionpack (5.0.0.1) + actionview (= 5.0.0.1) + activesupport (= 5.0.0.1) + rack (~> 2.0) + rack-test (~> 0.6.3) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (4.2.7.1) - activesupport (= 4.2.7.1) + actionview (5.0.0.1) + activesupport (= 5.0.0.1) builder (~> 3.1) erubis (~> 2.7.0) - rails-dom-testing (~> 1.0, >= 1.0.5) + rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.7.1) - activesupport (= 4.2.7.1) - globalid (>= 0.3.0) - activemodel (4.2.7.1) - activesupport (= 4.2.7.1) - builder (~> 3.1) - activerecord (4.2.7.1) - activemodel (= 4.2.7.1) - activesupport (= 4.2.7.1) - arel (~> 6.0) - activesupport (4.2.7.1) + activejob (5.0.0.1) + activesupport (= 5.0.0.1) + globalid (>= 0.3.6) + activemodel (5.0.0.1) + activesupport (= 5.0.0.1) + activerecord (5.0.0.1) + activemodel (= 5.0.0.1) + activesupport (= 5.0.0.1) + arel (~> 7.0) + activesupport (5.0.0.1) + concurrent-ruby (~> 1.0, >= 1.0.2) i18n (~> 0.7) - json (~> 1.7, >= 1.7.7) minitest (~> 5.1) - thread_safe (~> 0.3, >= 0.3.4) tzinfo (~> 1.1) addressable (2.3.8) - arel (6.0.3) + arel (7.1.1) autoparse (0.3.3) addressable (>= 2.3.1) extlib (>= 0.9.15) multi_json (>= 1.0.0) aws-sdk-core (2.2.15) jmespath (~> 1.0) - bcrypt (3.1.10) + bcrypt (3.1.11) better_errors (1.1.0) coderay (>= 1.0.0) erubis (>= 2.6.6) @@ -147,9 +129,9 @@ GEM chronic (0.10.2) cliver (0.3.2) coderay (1.1.0) - coffee-rails (4.1.1) + coffee-rails (4.2.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.1.x) + railties (>= 4.0.0, < 5.2.x) coffee-script (2.4.1) coffee-script-source execjs @@ -168,16 +150,15 @@ GEM daemons (1.1.9) database_cleaner (1.5.3) debug_inspector (0.0.2) - delayed_job (4.1.1) - activesupport (>= 3.0, < 5.0) + delayed_job (4.1.2) + activesupport (>= 3.0, < 5.1) delorean (2.1.0) chronic - devise (3.5.4) + devise (4.2.0) bcrypt (~> 3.0) orm_adapter (~> 0.1) - railties (>= 3.2.6, < 5) + railties (>= 4.1.0, < 5.1) responders - thread_safe (~> 0.1) warden (~> 1.2.3) diff-lcs (1.2.5) docile (1.1.5) @@ -260,11 +241,11 @@ GEM guard (~> 2.8) guard-compat (~> 1.0) multi_json (~> 1.8) - guard-rspec (4.6.4) + guard-rspec (4.6.5) guard (~> 2.1) guard-compat (~> 1.1) rspec (>= 2.99.0, < 4.0) - hashie (2.0.5) + hashie (3.4.4) haversine (0.3.0) hipchat (1.2.0) httparty @@ -288,8 +269,9 @@ GEM httparty (~> 0.13) i18n (0.7.0) jmespath (1.1.3) - jquery-rails (3.1.3) - railties (>= 3.0, < 5.0) + jquery-rails (4.2.1) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.3) jsonpathv2 (0.0.8) @@ -298,7 +280,7 @@ GEM kaminari (0.16.1) actionpack (>= 3.0.0) activesupport (>= 3.0.0) - kgio (2.9.3) + kgio (2.10.0) kramdown (1.3.3) launchy (2.4.2) addressable (~> 2.3) @@ -323,7 +305,7 @@ GEM memoizable (0.4.2) thread_safe (~> 0.3, >= 0.3.1) method_source (0.8.2) - mime-types (2.99.2) + mime-types (2.99.3) mimemagic (0.3.1) mini_magick (4.2.3) mini_portile2 (2.1.0) @@ -340,6 +322,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (3.0.2) netrc (0.10.3) + nio4r (1.2.1) nokogiri (1.6.8) mini_portile2 (~> 2.1.0) pkg-config (~> 1.1.7) @@ -347,15 +330,15 @@ GEM nenv (~> 0.1) shellany (~> 0.0) oauth (0.4.7) - oauth2 (0.9.4) + oauth2 (1.2.0) faraday (>= 0.8, < 0.10) jwt (~> 1.0) multi_json (~> 1.3) multi_xml (~> 0.5) - rack (~> 1.2) - omniauth (1.2.2) + rack (>= 1.2, < 3) + omniauth (1.3.1) hashie (>= 1.2, < 4) - rack (~> 1.0) + rack (>= 1.0, < 3) omniauth-37signals (1.0.5) omniauth (~> 1.0) omniauth-oauth2 (~> 1.0) @@ -365,19 +348,21 @@ GEM evernote-thrift multi_json (~> 1.0) omniauth-oauth (~> 1.0) - omniauth-oauth (1.0.1) + omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) - omniauth-oauth2 (1.1.2) - faraday (>= 0.8, < 0.10) - multi_json (~> 1.3) - oauth2 (~> 0.9.3) + omniauth-oauth2 (1.3.1) + oauth2 (~> 1.0) omniauth (~> 1.2) - omniauth-tumblr (1.1) - omniauth-oauth (~> 1.0) - omniauth-twitter (1.0.1) - multi_json (~> 1.3) + omniauth-tumblr (1.2) + multi_json omniauth-oauth (~> 1.0) + omniauth-twitter (1.2.1) + json (~> 1.3) + omniauth-oauth (~> 1.1) + omniauth-wunderlist (0.0.2) + omniauth (~> 1.0) + omniauth-oauth2 (~> 1.1) orm_adapter (0.5.0) pg (0.18.3) pkg-config (1.1.7) @@ -396,30 +381,30 @@ GEM pry (~> 0.10) pry-rails (0.3.4) pry (>= 0.9.10) - quiet_assets (1.1.0) - railties (>= 3.1, < 5.0) - rack (1.6.4) + rack (2.0.1) rack-livereload (0.3.16) rack rack-test (0.6.3) rack (>= 1.0) - rails (4.2.7.1) - actionmailer (= 4.2.7.1) - actionpack (= 4.2.7.1) - actionview (= 4.2.7.1) - activejob (= 4.2.7.1) - activemodel (= 4.2.7.1) - activerecord (= 4.2.7.1) - activesupport (= 4.2.7.1) + rails (5.0.0.1) + actioncable (= 5.0.0.1) + actionmailer (= 5.0.0.1) + actionpack (= 5.0.0.1) + actionview (= 5.0.0.1) + activejob (= 5.0.0.1) + activemodel (= 5.0.0.1) + activerecord (= 5.0.0.1) + activesupport (= 5.0.0.1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.7.1) - sprockets-rails - rails-deprecated_sanitizer (1.0.3) - activesupport (>= 4.2.0.alpha) - rails-dom-testing (1.0.7) - activesupport (>= 4.2.0.beta, < 5.0) + railties (= 5.0.0.1) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.1) + actionpack (~> 5.x) + actionview (~> 5.x) + activesupport (~> 5.x) + rails-dom-testing (2.0.1) + activesupport (>= 4.2.0, < 6.0) nokogiri (~> 1.6.0) - rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) rails_12factor (0.0.3) @@ -427,18 +412,19 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.4) rails_stdout_logging (0.0.3) - railties (4.2.7.1) - actionpack (= 4.2.7.1) - activesupport (= 4.2.7.1) + railties (5.0.0.1) + actionpack (= 5.0.0.1) + activesupport (= 5.0.0.1) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - raindrops (0.13.0) + raindrops (0.17.0) rake (11.2.2) rb-fsevent (0.9.7) rb-inotify (0.9.5) ffi (>= 0.5.0) ref (2.0.0) - responders (2.1.1) + responders (2.3.0) railties (>= 4.2.0, < 5.1) rest-client (1.8.0) http-cookie (>= 1.0.2, < 2.0) @@ -457,13 +443,13 @@ GEM rspec-expectations (3.5.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.5.0) - rspec-html-matchers (0.7.0) + rspec-html-matchers (0.8.1) nokogiri (~> 1) - rspec (~> 3) + rspec (>= 3.0.0.a, < 4) rspec-mocks (3.5.0) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.5.0) - rspec-rails (3.5.1) + rspec-rails (3.5.2) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) @@ -512,10 +498,13 @@ GEM spring (1.6.3) spring-commands-rspec (1.0.4) spring (>= 0.9.1) + spring-watcher-listen (2.0.0) + listen (>= 2.7, < 4.0) + spring (~> 1.2) sprockets (3.7.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.1.1) + sprockets-rails (3.2.0) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) @@ -561,16 +550,20 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.1) - unicorn (4.9.0) + unicorn (5.1.0) kgio (~> 2.6) - rack raindrops (~> 0.7) uuid (2.3.7) macaddr (~> 1.0) uuidtools (2.1.5) vcr (2.9.2) - warden (1.2.4) + warden (1.2.6) rack (>= 1.0) + web-console (3.3.1) + actionview (>= 5.0) + activemodel (>= 5.0) + debug_inspector + railties (>= 5.0) webmock (1.17.4) addressable (>= 2.2.7) crack (>= 0.3.2) @@ -599,14 +592,14 @@ DEPENDENCIES capistrano-bundler (~> 1.1.4) capistrano-rails (~> 1.1) capybara-select2 - coffee-rails (~> 4.1.1) + coffee-rails (~> 4.2) coveralls (~> 0.7.4) daemons (~> 1.1.9) database_cleaner (~> 1.5.3) delayed_job (~> 4.1.0) delayed_job_active_record! delorean - devise (~> 3.5.4) + devise (~> 4.2.0) dotenv! dotenv-rails! dropbox-api @@ -631,12 +624,12 @@ DEPENDENCIES httparty (~> 0.13) huginn_agent (~> 0.4.0) hypdf (~> 1.0.10) - jquery-rails (~> 3.1.3) + jquery-rails (~> 4.2.1) json (~> 1.8.1) jsonpathv2 (~> 0.0.8) kaminari (~> 0.16.1) kramdown (~> 1.3.3) - letter_opener_web + letter_opener_web (~> 1.3.0) liquid (~> 3.0.3) listen (~> 3.0.5) mini_magick @@ -645,27 +638,26 @@ DEPENDENCIES mysql2 (~> 0.3.20) net-ftp-list (~> 3.2.8) nokogiri (= 1.6.8) - omniauth + omniauth (~> 1.3.1) omniauth-37signals omniauth-dropbox omniauth-evernote - omniauth-tumblr - omniauth-twitter - omniauth-wunderlist! + omniauth-tumblr (~> 1.2) + omniauth-twitter (~> 1.2.1) + omniauth-wunderlist pg (~> 0.18.3) poltergeist pry-byebug pry-rails - quiet_assets - rack (> 1.5.0) rack-livereload (~> 0.3.16) - rails (= 4.2.7.1) + rails (~> 5.0.0.1) + rails-controller-testing rails_12factor rr rspec (~> 3.5) rspec-collection_matchers (~> 1.1.0) - rspec-html-matchers (~> 0.7) - rspec-rails (~> 3.5.1) + rspec-html-matchers (~> 0.8) + rspec-rails (~> 3.5.2) rturk (~> 2.12.1) ruby-growl (~> 4.1.0) rufus-scheduler (~> 3.0.8) @@ -676,6 +668,7 @@ DEPENDENCIES spectrum-rails spring (~> 1.6.3) spring-commands-rspec (~> 1.0.4) + spring-watcher-listen (~> 2.0.0) string-scrub therubyracer (~> 0.12.2) tumblr_client! @@ -686,12 +679,15 @@ DEPENDENCIES tzinfo (>= 1.2.0) tzinfo-data uglifier (~> 2.7.2) - unicorn (~> 4.9.0) + unicorn (~> 5.1.0) vcr + web-console webmock (~> 1.17.4) - weibo_2! wunderground (~> 1.2.0) xmpp4r (~> 0.5.6) +RUBY VERSION + ruby 2.3.1p112 + BUNDLED WITH 1.12.5 diff --git a/Rakefile b/Rakefile index 748c0435..1166b7c9 100644 --- a/Rakefile +++ b/Rakefile @@ -2,6 +2,6 @@ # Add your own tasks in files placed in lib/tasks ending in .rake, # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. -require File.expand_path('../config/application', __FILE__) +require_relative 'config/application' Huginn::Application.load_tasks diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bc7146ab..b5c261e2 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -21,9 +21,9 @@ class ApplicationController < ActionController::Base protected def configure_permitted_parameters - devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:username, :email, :password, :password_confirmation, :remember_me, :invitation_code) } - devise_parameter_sanitizer.for(:sign_in) { |u| u.permit(:login, :username, :email, :password, :remember_me) } - devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:username, :email, :password, :password_confirmation, :current_password) } + devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :email, :password, :password_confirmation, :remember_me, :invitation_code]) + devise_parameter_sanitizer.permit(:sign_in, keys: [:login, :username, :email, :password, :remember_me]) + devise_parameter_sanitizer.permit(:account_update, keys: [:username, :email, :password, :password_confirmation, :current_password]) end def authenticate_admin! diff --git a/bin/rails b/bin/rails index f2b0313d..5badb2fd 100755 --- a/bin/rails +++ b/bin/rails @@ -4,6 +4,6 @@ begin rescue LoadError => e raise unless e.message.include?('spring') end -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands' diff --git a/config.ru b/config.ru index 75c45d1e..c623302b 100644 --- a/config.ru +++ b/config.ru @@ -1,5 +1,5 @@ # This file is used by Rack-based servers to start the application. -require ::File.expand_path('../config/environment', __FILE__) +require_relative 'config/environment' run Huginn::Application diff --git a/config/application.rb b/config/application.rb index af490e7d..d9a580d1 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,4 @@ -require File.expand_path('../boot', __FILE__) +require_relative 'boot' require 'rails/all' diff --git a/config/boot.rb b/config/boot.rb index 06d9caeb..302651f4 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,6 @@ require 'rubygems' # Set up gems listed in the Gemfile. -ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) +ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/environment.rb b/config/environment.rb index c5fa778b..c1ed46c3 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,8 +1,5 @@ # Load the rails application -require File.expand_path('../application', __FILE__) - -# Remove the XML parser from the list that will be used to initialize the application's XML parser list. -ActionDispatch::ParamsParser::DEFAULT_PARSERS.delete(Mime::XML) +require_relative 'application' # Initialize the rails application Huginn::Application.initialize! diff --git a/config/environments/development.rb b/config/environments/development.rb index 0f4ebaef..acec048c 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -16,9 +16,22 @@ Huginn::Application.configure do # Rake tasks automatically ignore this option for performance. config.eager_load = false - # Show full error reports and disable caching - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + # Show full error reports. + config.consider_all_requests_local = true + + # Enable/disable caching. By default caching is disabled. + if Rails.root.join('tmp/caching-dev.txt').exist? + config.action_controller.perform_caching = true + + config.cache_store = :memory_store + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=172800' + } + else + config.action_controller.perform_caching = false + + config.cache_store = :null_store + end # Print deprecation notices to the Rails logger config.active_support.deprecation = :log @@ -35,14 +48,8 @@ Huginn::Application.configure do # Expands the lines which load the assets config.assets.debug = true - # Asset digests allow you to set far-future HTTP expiration dates on all assets, - # yet still be able to expire them through the digest params. - config.assets.digest = true - - # Adds additional error checking when serving assets at runtime. - # Checks for improperly declared sprockets dependencies. - # Raises helpful error messages. - config.assets.raise_runtime_errors = true + # Suppress logger output for asset requests. + config.assets.quiet = true config.action_mailer.default_url_options = { :host => ENV['DOMAIN'] } config.action_mailer.asset_host = ENV['DOMAIN'] @@ -52,5 +59,10 @@ Huginn::Application.configure do else config.action_mailer.delivery_method = :letter_opener_web end + config.action_mailer.perform_caching = false # smtp_settings moved to config/initializers/action_mailer.rb + + # Use an evented file watcher to asynchronously detect changes in source code, + # routes, locales, etc. This feature depends on the listen gem. + config.file_watcher = ActiveSupport::EventedFileUpdateChecker end diff --git a/config/environments/production.rb b/config/environments/production.rb index 03f4283c..418dbe46 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -14,15 +14,9 @@ Huginn::Application.configure do config.consider_all_requests_local = false config.action_controller.perform_caching = true - # Enable Rack::Cache to put a simple HTTP cache in front of your application - # Add `rack-cache` to your Gemfile before enabling this. - # For large-scale production use, consider using a caching reverse proxy like - # NGINX, varnish or squid. - # config.action_dispatch.rack_cache = true - # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. - config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS config.assets.js_compressor = :uglifier @@ -31,15 +25,17 @@ Huginn::Application.configure do # Don't fallback to assets pipeline if a precompiled asset is missed config.assets.compile = false - # Generate digests for assets URLs - config.assets.digest = true - # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx + # Mount Action Cable outside main process or domain + # config.action_cable.mount_path = nil + # config.action_cable.url = 'wss://example.com/cable' + # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] + # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. config.force_ssl = ENV['FORCE_SSL'] == 'true' @@ -47,7 +43,7 @@ Huginn::Application.configure do config.log_level = :info # Prepend all log lines with the following tags - config.log_tags = [ :uuid ] # :subdomain + config.log_tags = [ :request_id ] # :subdomain # Use a different logger for distributed setups # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) @@ -85,5 +81,6 @@ Huginn::Application.configure do config.action_mailer.perform_deliveries = true config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp + config.action_mailer.perform_caching = false # smtp_settings moved to config/initializers/action_mailer.rb end diff --git a/config/environments/test.rb b/config/environments/test.rb index 7799aab0..e1d071f6 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -13,8 +13,10 @@ Huginn::Application.configure do config.eager_load = false # Configure static asset server for tests with Cache-Control for performance - config.serve_static_files = true - config.static_cache_control = "public, max-age=3600" + config.public_file_server.enabled = true + config.public_file_server.headers = { + 'Cache-Control' => 'public, max-age=3600' + } # Show full error reports and disable caching config.consider_all_requests_local = true @@ -25,6 +27,7 @@ Huginn::Application.configure do # Disable request forgery protection in test environment config.action_controller.allow_forgery_protection = false + config.action_mailer.perform_caching = false # Tell Action Mailer not to deliver emails to the real world. # The :test delivery method accumulates sent emails in the @@ -36,9 +39,6 @@ Huginn::Application.configure do # Raise exception for unpermitted parameters config.action_controller.action_on_unpermitted_parameters = :raise - # Randomize the order test cases are executed. - config.active_support.test_order = :random - # Print deprecation notices to the stderr config.active_support.deprecation = :stderr diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb new file mode 100644 index 00000000..f51a497e --- /dev/null +++ b/config/initializers/cookies_serializer.rb @@ -0,0 +1,5 @@ +# Be sure to restart your server when you modify this file. + +# Specify a serializer for the signed and encrypted cookie jars. +# Valid options are :json, :marshal, and :hybrid. +Rails.application.config.action_dispatch.cookies_serializer = :hybrid diff --git a/config/initializers/new_framework_defaults.rb b/config/initializers/new_framework_defaults.rb new file mode 100644 index 00000000..0706cafd --- /dev/null +++ b/config/initializers/new_framework_defaults.rb @@ -0,0 +1,24 @@ +# Be sure to restart your server when you modify this file. +# +# This file contains migration options to ease your Rails 5.0 upgrade. +# +# Read the Rails 5.0 release notes for more info on each option. + +# Enable per-form CSRF tokens. Previous versions had false. +Rails.application.config.action_controller.per_form_csrf_tokens = true + +# Enable origin-checking CSRF mitigation. Previous versions had false. +Rails.application.config.action_controller.forgery_protection_origin_check = true + +# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`. +# Previous versions had false. +ActiveSupport.to_time_preserves_timezone = true + +# Require `belongs_to` associations by default. Previous versions had false. +Rails.application.config.active_record.belongs_to_required_by_default = true + +# Do not halt callback chains when a callback returns false. Previous versions had true. +ActiveSupport.halt_callback_chains_on_return_false = false + +# Configure SSL options to enable HSTS with subdomains. Previous versions had false. +Rails.application.config.ssl_options = { hsts: { subdomains: true } } diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index 33725e95..cf733efd 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -5,7 +5,7 @@ # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do - wrap_parameters format: [:json] if respond_to?(:wrap_parameters) + wrap_parameters format: [:json] end # To enable root element in JSON for ActiveRecord objects. diff --git a/config/spring.rb b/config/spring.rb new file mode 100644 index 00000000..c9119b40 --- /dev/null +++ b/config/spring.rb @@ -0,0 +1,6 @@ +%w( + .ruby-version + .rbenv-vars + tmp/restart.txt + tmp/caching-dev.txt +).each { |path| Spring.watch(path) }