Kouhei Sutou
null+****@clear*****
Tue Feb 23 01:01:02 JST 2016
Kouhei Sutou 2016-02-23 01:01:02 +0900 (Tue, 23 Feb 2016) New Revision: f0b880bc356972790758d61178d587b0501dc89c https://github.com/groonga/heroku-sample-rroonga-blog/commit/f0b880bc356972790758d61178d587b0501dc89c Message: Update to Rails 5.0.0.beta2 Added files: bin/setup bin/update config/cable.yml config/initializers/application_controller_renderer.rb config/initializers/assets.rb config/initializers/cors.rb config/initializers/per_form_csrf_tokens.rb config/initializers/request_forgery_protection.rb config/puma.rb Modified files: Gemfile Gemfile.lock bin/rails config/application.rb config/boot.rb config/environments/development.rb config/environments/production.rb config/environments/test.rb config/initializers/cookies_serializer.rb config/initializers/session_store.rb config/initializers/wrap_parameters.rb config/routes.rb config/secrets.yml Modified: Gemfile (+25 -18) =================================================================== --- Gemfile 2016-02-23 00:49:20 +0900 (6eaf110) +++ Gemfile 2016-02-23 01:01:02 +0900 (120d573) @@ -3,17 +3,19 @@ source 'https://rubygems.org' ruby '2.3.0' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' -gem 'rails', '4.1.1' +gem 'rails', '5.0.0.beta2' # Use postgresql as the database for Active Record gem 'pg' +# Use Puma as the app server +gem 'puma' # Use SCSS for stylesheets -gem 'sass-rails', '~> 4.0.3' +gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' -# Use CoffeeScript for .js.coffee assets and views -gem 'coffee-rails', '~> 4.0.0' -# See https://github.com/sstephenson/execjs#readme for more supported runtimes -# gem 'therubyracer', platforms: :ruby +# Use CoffeeScript for .coffee assets and views +gem 'coffee-rails', '~> 4.1.0' +# See https://github.com/rails/execjs#readme for more supported runtimes +# gem 'therubyracer', platforms: :ruby # Use jquery as the JavaScript library gem 'jquery-rails' @@ -21,24 +23,14 @@ gem 'jquery-rails' gem 'turbolinks' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.0' -# bundle exec rake doc:rails generates the API under doc/api. -gem 'sdoc', '~> 0.4.0', group: :doc - -# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring -gem 'spring', group: :development - +# Action Cable dependencies for the Redis adapter +# gem 'redis', '~> 3.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' -# Use unicorn as the app server -# gem 'unicorn' - # Use Capistrano for deployment # gem 'capistrano-rails', group: :development -# Use debugger -# gem 'debugger', group: [:development, :test] - gem 'bootstrap-sass' gem 'rails_12factor', group: :production @@ -46,3 +38,18 @@ gem 'rails_12factor', group: :production gem 'rroonga' gem 'mechanize', group: :development + +group :development, :test do + # Call 'byebug' anywhere in the code to stop execution and get a debugger console + gem 'byebug' +end + +group :development do + # Access an IRB console on exception pages or by using <%= console %> in views + gem 'web-console', '~> 3.0' + # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring + gem 'spring' +end + +# Windows does not include zoneinfo files, so bundle the tzinfo-data gem +gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] Modified: Gemfile.lock (+152 -111) =================================================================== --- Gemfile.lock 2016-02-23 00:49:20 +0900 (7c8feb9) +++ Gemfile.lock 2016-02-23 01:01:02 +0900 (be493f7) @@ -1,174 +1,215 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.1.1) - actionpack (= 4.1.1) - actionview (= 4.1.1) - mail (~> 2.5.4) - actionpack (4.1.1) - actionview (= 4.1.1) - activesupport (= 4.1.1) - rack (~> 1.5.2) - rack-test (~> 0.6.2) - actionview (4.1.1) - activesupport (= 4.1.1) + actioncable (5.0.0.beta2) + actionpack (= 5.0.0.beta2) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.beta2) + actionpack (= 5.0.0.beta2) + actionview (= 5.0.0.beta2) + activejob (= 5.0.0.beta2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 1.0, >= 1.0.5) + actionpack (5.0.0.beta2) + actionview (= 5.0.0.beta2) + activesupport (= 5.0.0.beta2) + rack (~> 2.x) + rack-test (~> 0.6.3) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.0.0.beta2) + activesupport (= 5.0.0.beta2) builder (~> 3.1) erubis (~> 2.7.0) - activemodel (4.1.1) - activesupport (= 4.1.1) - builder (~> 3.1) - activerecord (4.1.1) - activemodel (= 4.1.1) - activesupport (= 4.1.1) - arel (~> 5.0.0) - activesupport (4.1.1) - i18n (~> 0.6, >= 0.6.9) + rails-dom-testing (~> 1.0, >= 1.0.5) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + activejob (5.0.0.beta2) + activesupport (= 5.0.0.beta2) + globalid (>= 0.3.6) + activemodel (5.0.0.beta2) + activesupport (= 5.0.0.beta2) + activerecord (5.0.0.beta2) + activemodel (= 5.0.0.beta2) + activesupport (= 5.0.0.beta2) + arel (~> 7.0) + activesupport (5.0.0.beta2) + concurrent-ruby (~> 1.0) + i18n (~> 0.7) json (~> 1.7, >= 1.7.7) + method_source minitest (~> 5.1) - thread_safe (~> 0.1) tzinfo (~> 1.1) - archive-zip (0.6.0) - io-like (>= 0.3.0) - arel (5.0.1.20140414130214) - bootstrap-sass (3.1.1.1) - sass (~> 3.2) + archive-zip (0.8.0) + io-like (~> 0.3.0) + arel (7.0.0) + autoprefixer-rails (6.3.3) + execjs + json + bootstrap-sass (3.3.6) + autoprefixer-rails (>= 5.2.1) + sass (>= 3.3.4) builder (3.2.2) - coffee-rails (4.0.1) + byebug (8.2.2) + coffee-rails (4.1.1) coffee-script (>= 2.2.0) - railties (>= 4.0.0, < 5.0) - coffee-script (2.2.0) + railties (>= 4.0.0, < 5.1.x) + coffee-script (2.4.1) coffee-script-source execjs - coffee-script-source (1.7.0) - domain_name (0.5.18) + coffee-script-source (1.10.0) + concurrent-ruby (1.0.0) + debug_inspector (0.0.2) + domain_name (0.5.20160128) unf (>= 0.0.5, < 1.0.0) erubis (2.7.0) - execjs (2.0.2) + execjs (2.6.0) + globalid (0.3.6) + activesupport (>= 4.1.0) gqtp (1.0.6) - groonga-client (0.0.8) + groonga-client (0.1.9) gqtp (>= 1.0.4) - groonga-command (>= 1.0.4) - groonga-command (1.0.7) + groonga-command (>= 1.0.8) + groonga-command (1.1.6) json - hike (1.2.3) http-cookie (1.0.2) domain_name (~> 0.5) - i18n (0.6.9) + i18n (0.7.0) io-like (0.3.0) - jbuilder (2.0.7) - activesupport (>= 3.0.0, < 5) + jbuilder (2.4.1) + activesupport (>= 3.0.0, < 5.1) multi_json (~> 1.2) - jquery-rails (3.1.0) - railties (>= 3.0, < 5.0) + jquery-rails (4.1.0) + rails-dom-testing (~> 1.0) + railties (>= 4.2.0) thor (>= 0.14, < 2.0) - json (1.8.1) - mail (2.5.4) - mime-types (~> 1.16) - treetop (~> 1.4.8) - mechanize (2.7.2) + json (1.8.3) + loofah (2.0.3) + nokogiri (>= 1.5.9) + mail (2.6.3) + mime-types (>= 1.16, < 3) + mechanize (2.7.4) domain_name (~> 0.5, >= 0.5.1) - http-cookie (~> 1.0.0) - mime-types (~> 1.17, >= 1.17.2) + http-cookie (~> 1.0) + mime-types (>= 1.17.2, < 3) net-http-digest_auth (~> 1.1, >= 1.1.1) net-http-persistent (~> 2.5, >= 2.5.2) - nokogiri (~> 1.4) + nokogiri (~> 1.6) ntlm-http (~> 0.1, >= 0.1.1) webrobots (>= 0.0.9, < 0.2) - mime-types (1.25.1) - mini_portile (0.6.0) - minitest (5.3.4) - multi_json (1.10.1) + method_source (0.8.2) + mime-types (2.99.1) + mini_portile2 (2.0.0) + minitest (5.8.4) + multi_json (1.11.2) net-http-digest_auth (1.4) net-http-persistent (2.9.4) - nokogiri (1.6.2.1) - mini_portile (= 0.6.0) + nio4r (1.2.1) + nokogiri (1.6.7.2) + mini_portile2 (~> 2.0.0.rc2) ntlm-http (0.1.1) - pg (0.17.1) - pkg-config (1.1.5) - polyglot (0.3.4) - rack (1.5.2) - rack-test (0.6.2) + pg (0.18.4) + pkg-config (1.1.7) + puma (2.16.0) + rack (2.0.0.alpha) + json + rack-test (0.6.3) rack (>= 1.0) - rails (4.1.1) - actionmailer (= 4.1.1) - actionpack (= 4.1.1) - actionview (= 4.1.1) - activemodel (= 4.1.1) - activerecord (= 4.1.1) - activesupport (= 4.1.1) + rails (5.0.0.beta2) + actioncable (= 5.0.0.beta2) + actionmailer (= 5.0.0.beta2) + actionpack (= 5.0.0.beta2) + actionview (= 5.0.0.beta2) + activejob (= 5.0.0.beta2) + activemodel (= 5.0.0.beta2) + activerecord (= 5.0.0.beta2) + activesupport (= 5.0.0.beta2) bundler (>= 1.3.0, < 2.0) - railties (= 4.1.1) - sprockets-rails (~> 2.0) - rails_12factor (0.0.2) + railties (= 5.0.0.beta2) + sprockets-rails (>= 2.0.0) + rails-deprecated_sanitizer (1.0.3) + activesupport (>= 4.2.0.alpha) + rails-dom-testing (1.0.7) + activesupport (>= 4.2.0.beta, < 5.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) rails_serve_static_assets rails_stdout_logging - rails_serve_static_assets (0.0.2) - rails_stdout_logging (0.0.3) - railties (4.1.1) - actionpack (= 4.1.1) - activesupport (= 4.1.1) + rails_serve_static_assets (0.0.5) + rails_stdout_logging (0.0.4) + railties (5.0.0.beta2) + actionpack (= 5.0.0.beta2) + activesupport (= 5.0.0.beta2) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.3.2) - rdoc (4.1.1) - json (~> 1.4) - rroonga (4.0.1) + rake (10.5.0) + rroonga (5.1.1) archive-zip groonga-client (>= 0.0.3) json pkg-config - sass (3.2.19) - sass-rails (4.0.3) + sass (3.4.21) + sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) - sass (~> 3.2.0) - sprockets (~> 2.8, <= 2.11.0) - sprockets-rails (~> 2.0) - sdoc (0.4.0) - json (~> 1.8) - rdoc (~> 4.0, < 5.0) - spring (1.1.3) - sprockets (2.11.0) - hike (~> 1.2) - multi_json (~> 1.0) - rack (~> 1.0) - tilt (~> 1.1, != 1.3.0) - sprockets-rails (2.1.3) - actionpack (>= 3.0) - activesupport (>= 3.0) - sprockets (~> 2.8) + sass (~> 3.1) + sprockets (>= 2.8, < 4.0) + sprockets-rails (>= 2.0, < 4.0) + tilt (>= 1.1, < 3) + spring (1.6.3) + sprockets (3.5.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.0.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) thor (0.19.1) - thread_safe (0.3.3) - tilt (1.4.1) - treetop (1.4.15) - polyglot - polyglot (>= 0.3.1) - turbolinks (2.2.2) + thread_safe (0.3.5) + tilt (2.0.2) + turbolinks (2.5.3) coffee-rails - tzinfo (1.1.0) + tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.5.0) + uglifier (2.7.2) execjs (>= 0.3.0) json (>= 1.8.0) unf (0.1.4) unf_ext - unf_ext (0.0.6) - webrobots (0.1.1) + unf_ext (0.0.7.2) + web-console (3.1.1) + activemodel (>= 4.2) + debug_inspector + railties (>= 4.2) + webrobots (0.1.2) + websocket-driver (0.6.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) PLATFORMS ruby DEPENDENCIES bootstrap-sass - coffee-rails (~> 4.0.0) + byebug + coffee-rails (~> 4.1.0) jbuilder (~> 2.0) jquery-rails mechanize pg - rails (= 4.1.1) + puma + rails (= 5.0.0.beta2) rails_12factor rroonga - sass-rails (~> 4.0.3) - sdoc (~> 0.4.0) + sass-rails (~> 5.0) spring turbolinks + tzinfo-data uglifier (>= 1.3.0) + web-console (~> 3.0) + +BUNDLED WITH + 1.10.6 Modified: bin/rails (+1 -1) =================================================================== --- bin/rails 2016-02-23 00:49:20 +0900 (728cd85) +++ bin/rails 2016-02-23 01:01:02 +0900 (5191e69) @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../../config/application', __FILE__) require_relative '../config/boot' require 'rails/commands' Added: bin/setup (+34 -0) 100755 =================================================================== --- /dev/null +++ bin/setup 2016-02-23 01:01:02 +0900 (130ce84) @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby2.3 +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a starting point to setup your application. + # Add necessary setup steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system('bundle check') or system!('bundle install') + + # puts "\n== Copying sample files ==" + # unless File.exist?('config/database.yml') + # cp 'config/database.yml.sample', 'config/database.yml' + # end + + puts "\n== Preparing database ==" + system! 'bin/rails db:setup' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end Added: bin/update (+29 -0) 100755 =================================================================== --- /dev/null +++ bin/update 2016-02-23 01:01:02 +0900 (104a828) @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby2.3 +require 'pathname' +require 'fileutils' +include FileUtils + +# path to your application root. +APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) + +def system!(*args) + system(*args) || abort("\n== Command #{args} failed ==") +end + +chdir APP_ROOT do + # This script is a way to update your development environment automatically. + # Add necessary update steps to this file. + + puts '== Installing dependencies ==' + system! 'gem install bundler --conservative' + system 'bundle check' or system! 'bundle install' + + puts "\n== Updating database ==" + system! 'bin/rails db:migrate' + + puts "\n== Removing old logs and tempfiles ==" + system! 'bin/rails log:clear tmp:clear' + + puts "\n== Restarting application server ==" + system! 'bin/rails restart' +end Modified: config/application.rb (+0 -8) =================================================================== --- config/application.rb 2016-02-23 00:49:20 +0900 (dbc2bde) +++ config/application.rb 2016-02-23 01:01:02 +0900 (ec96765) @@ -12,14 +12,6 @@ module HerokuBlog # Application configuration should go into files in config/initializers # -- all .rb files in that directory are automatically loaded. - # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone. - # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC. - # config.time_zone = 'Central Time (US & Canada)' - - # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - # config.i18n.default_locale = :de - config.autoload_paths += ["#{config.root}/lib"] end end Modified: config/boot.rb (+1 -2) =================================================================== --- config/boot.rb 2016-02-23 00:49:20 +0900 (5e5f0c1) +++ config/boot.rb 2016-02-23 01:01:02 +0900 (6b750f0) @@ -1,4 +1,3 @@ -# Set up gems listed in the Gemfile. ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) -require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE']) +require 'bundler/setup' # Set up gems listed in the Gemfile. Added: config/cable.yml (+10 -0) 100644 =================================================================== --- /dev/null +++ config/cable.yml 2016-02-23 01:01:02 +0900 (aa4e832) @@ -0,0 +1,10 @@ +# Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket. +production: + adapter: redis + url: redis://localhost:6379/1 + +development: + adapter: async + +test: + adapter: async Modified: config/environments/development.rb (+22 -3) =================================================================== --- config/environments/development.rb 2016-02-23 00:49:20 +0900 (ddf0e90) +++ config/environments/development.rb 2016-02-23 01:01:02 +0900 (c9d06f3) @@ -9,9 +9,20 @@ Rails.application.configure do # Do not eager load code on boot. 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 # Don't care if the mailer can't send. config.action_mailer.raise_delivery_errors = false @@ -27,6 +38,10 @@ Rails.application.configure do # number of complex 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. @@ -34,4 +49,8 @@ Rails.application.configure do # Raises error for missing translations # config.action_view.raise_on_missing_translations = true + + # 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 Modified: config/environments/production.rb (+24 -25) =================================================================== --- config/environments/production.rb 2016-02-23 00:49:20 +0900 (47d3553) +++ config/environments/production.rb 2016-02-23 01:01:02 +0900 (0a74537) @@ -14,13 +14,9 @@ Rails.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 Rails's static asset server (Apache or nginx will already do this). - config.serve_static_assets = false + # Disable serving static files from the `/public` folder by default since + # Apache or NGINX already handles this. + config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier @@ -29,37 +25,43 @@ Rails.application.configure do # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = false - # Generate digests for assets URLs. + # 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 - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = '1.0' + # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb + + # Enable serving of images, stylesheets, and JavaScripts from an asset server. + # config.action_controller.asset_host = 'http://assets.example.com' # 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 + # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache + # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX + + # Action Cable endpoint configuration + # 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 = true - # Set to :debug to see everything in the log. - config.log_level = :info + # Use the lowest log level to ensure availability of diagnostic information + # when problems arise. + config.log_level = :debug # Prepend all log lines with the following tags. - # config.log_tags = [ :subdomain, :uuid ] + config.log_tags = [ :request_id ] # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') # Use a different cache store in production. # config.cache_store = :mem_cache_store - # Enable serving of images, stylesheets, and JavaScripts from an asset server. - # config.action_controller.asset_host = "http://assets.example.com" - - # Precompile additional assets. - # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. - # config.assets.precompile += %w( search.js ) + # Use a real queuing backend for Active Job (and separate queues per environment) + # config.active_job.queue_adapter = :resque + # config.active_job.queue_name_prefix = "heroku_blog_#{Rails.env}" # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. @@ -72,9 +74,6 @@ Rails.application.configure do # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify - # Disable automatic flushing of the log to improve performance. - # config.autoflush_log = false - # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new Modified: config/environments/test.rb (+8 -3) =================================================================== --- config/environments/test.rb 2016-02-23 00:49:20 +0900 (053f5b6) +++ config/environments/test.rb 2016-02-23 01:01:02 +0900 (1f90453) @@ -12,9 +12,11 @@ Rails.application.configure do # preloads Rails for running tests, you may have to set it to true. config.eager_load = false - # Configure static asset server for tests with Cache-Control for performance. - config.serve_static_assets = true - config.static_cache_control = 'public, max-age=3600' + # Configure public file server for tests with Cache-Control for performance. + 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 @@ -31,6 +33,9 @@ Rails.application.configure do # ActionMailer::Base.deliveries array. config.action_mailer.delivery_method = :test + # Randomize the order test cases are executed. + config.active_support.test_order = :random + # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr Added: config/initializers/application_controller_renderer.rb (+6 -0) 100644 =================================================================== --- /dev/null +++ config/initializers/application_controller_renderer.rb 2016-02-23 01:01:02 +0900 (51639b6) @@ -0,0 +1,6 @@ +# Be sure to restart your server when you modify this file. + +# ApplicationController.renderer.defaults.merge!( +# http_host: 'example.org', +# https: false +# ) Added: config/initializers/assets.rb (+11 -0) 100644 =================================================================== --- /dev/null +++ config/initializers/assets.rb 2016-02-23 01:01:02 +0900 (01ef3e6) @@ -0,0 +1,11 @@ +# Be sure to restart your server when you modify this file. + +# Version of your assets, change this if you want to expire all your assets. +Rails.application.config.assets.version = '1.0' + +# Add additional assets to the asset load path +# Rails.application.config.assets.paths << Emoji.images_path + +# Precompile additional assets. +# application.js, application.css, and all non-JS/CSS in app/assets folder are already added. +# Rails.application.config.assets.precompile += %w( search.js ) Modified: config/initializers/cookies_serializer.rb (+3 -1) =================================================================== --- config/initializers/cookies_serializer.rb 2016-02-23 00:49:20 +0900 (7a06a89) +++ config/initializers/cookies_serializer.rb 2016-02-23 01:01:02 +0900 (5a6a32d) @@ -1,3 +1,5 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.action_dispatch.cookies_serializer = :json \ No newline at end of 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 = :json Added: config/initializers/cors.rb (+16 -0) 100644 =================================================================== --- /dev/null +++ config/initializers/cors.rb 2016-02-23 01:01:02 +0900 (3b1c1b5) @@ -0,0 +1,16 @@ +# Be sure to restart your server when you modify this file. + +# Avoid CORS issues when API is called from the frontend app. +# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests. + +# Read more: https://github.com/cyu/rack-cors + +# Rails.application.config.middleware.insert_before 0, Rack::Cors do +# allow do +# origins 'example.com' +# +# resource '*', +# headers: :any, +# methods: [:get, :post, :put, :patch, :delete, :options, :head] +# end +# end Added: config/initializers/per_form_csrf_tokens.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ config/initializers/per_form_csrf_tokens.rb 2016-02-23 01:01:02 +0900 (1f569de) @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Enable per-form CSRF tokens. +Rails.application.config.action_controller.per_form_csrf_tokens = true Added: config/initializers/request_forgery_protection.rb (+4 -0) 100644 =================================================================== --- /dev/null +++ config/initializers/request_forgery_protection.rb 2016-02-23 01:01:02 +0900 (3eab78a) @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Enable origin-checking CSRF mitigation. +Rails.application.config.action_controller.forgery_protection_origin_check = true Modified: config/initializers/session_store.rb (+1 -1) =================================================================== --- config/initializers/session_store.rb 2016-02-23 00:49:20 +0900 (9d4131c) +++ config/initializers/session_store.rb 2016-02-23 01:01:02 +0900 (0c76bbf) @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.session_store :cookie_store, key: '_heroku-blog_session' +Rails.application.config.session_store :cookie_store, key: '_heroku_blog_session' Modified: config/initializers/wrap_parameters.rb (+2 -2) =================================================================== --- config/initializers/wrap_parameters.rb 2016-02-23 00:49:20 +0900 (33725e9) +++ config/initializers/wrap_parameters.rb 2016-02-23 01:01:02 +0900 (bbfc396) @@ -5,10 +5,10 @@ # 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. # ActiveSupport.on_load(:active_record) do -# self.include_root_in_json = true +# self.include_root_in_json = true # end Added: config/puma.rb (+44 -0) 100644 =================================================================== --- /dev/null +++ config/puma.rb 2016-02-23 01:01:02 +0900 (1bf274b) @@ -0,0 +1,44 @@ +# Puma can serve each request in a thread from an internal thread pool. +# The `threads` method setting takes two numbers a minimum and maximum. +# Any libraries that use thread pools should be configured to match +# the maximum value specified for Puma. Default is set to 5 threads for minimum +# and maximum, this matches the default thread size of Active Record. +# +threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i +threads threads_count, threads_count + +# Specifies the `port` that Puma will listen on to receive requests, default is 3000. +# +port ENV.fetch("PORT") { 3000 } + +# Specifies the `environment` that Puma will run in. +# +environment ENV.fetch("RAILS_ENV") { "development" } + +# Specifies the number of `workers` to boot in clustered mode. +# Workers are forked webserver processes. If using threads and workers together +# the concurrency of the application would be max `threads` * `workers`. +# Workers do not work on JRuby or Windows (both of which do not support +# processes). +# +# workers ENV.fetch("WEB_CONCURRENCY") { 2 } + +# Use the `preload_app!` method when specifying a `workers` number. +# This directive tells Puma to first boot the application and load code +# before forking the application. This takes advantage of Copy On Write +# process behavior so workers use less memory. If you use this option +# you need to make sure to reconnect any threads in the `on_worker_boot` +# block. +# +# preload_app! + +# The code in the `on_worker_boot` will be called if you are using +# clustered mode by specifying a number of `workers`. After each worker +# process is booted this block will be run, if you are using `preload_app!` +# option you will want to use this block to reconnect to any threads +# or connections that may have been created at application boot, Ruby +# cannot share connections between processes. +# +# on_worker_boot do +# ActiveRecord::Base.establish_connection if defined?(ActiveRecord) +# end Modified: config/routes.rb (+5 -53) =================================================================== --- config/routes.rb 2016-02-23 00:49:20 +0900 (f4140ae) +++ config/routes.rb 2016-02-23 01:01:02 +0900 (ffeeecd) @@ -1,58 +1,10 @@ Rails.application.routes.draw do - resources :posts - - # The priority is based upon order of creation: first created -> highest priority. - # See how all your routes lay out with "rake routes". - - # You can have the root of your site routed with "root" - root 'posts#index' - - # Example of regular route: - # get 'products/:id' => 'catalog#view' - - # Example of named route that can be invoked with purchase_url(id: product.id) - # get 'products/:id/purchase' => 'catalog#purchase', as: :purchase + # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html - # Example resource route (maps HTTP verbs to controller actions automatically): - # resources :products + # Serve websocket cable requests in-process + # mount ActionCable.server => '/cable' - # Example resource route with options: - # resources :products do - # member do - # get 'short' - # post 'toggle' - # end - # - # collection do - # get 'sold' - # end - # end - - # Example resource route with sub-resources: - # resources :products do - # resources :comments, :sales - # resource :seller - # end - - # Example resource route with more complex sub-resources: - # resources :products do - # resources :comments - # resources :sales do - # get 'recent', on: :collection - # end - # end - - # Example resource route with concerns: - # concern :toggleable do - # post 'toggle' - # end - # resources :posts, concerns: :toggleable - # resources :photos, concerns: :toggleable + resources :posts - # Example resource route within a namespace: - # namespace :admin do - # # Directs /admin/products/* to Admin::ProductsController - # # (app/controllers/admin/products_controller.rb) - # resources :products - # end + root 'posts#index' end Modified: config/secrets.yml (+3 -3) =================================================================== --- config/secrets.yml 2016-02-23 00:49:20 +0900 (7ee8030) +++ config/secrets.yml 2016-02-23 01:01:02 +0900 (b541a27) @@ -5,16 +5,16 @@ # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. -# You can use `rake secret` to generate a secure secret key. +# You can use `rails secret` to generate a secure secret key. # Make sure the secrets in this file are kept private # if you're sharing your code publicly. development: - secret_key_base: 2d9942abf54fc6197fe6b48d3f7a4e09e573d797463f896b34e288bf984520196e9fd87c8d09825db89c4994289a1508dc3b26f50ce33a9cf8d50e17d01f423d + secret_key_base: b0b2cc3edb3f7fa38aed7abe5d34f92bcbeca67f089ce357b6253bb00f8f97103de87186232bc1f37dd1e5814c43ecdcec531f282844f800d92b0d7b827addfe test: - secret_key_base: 21faeee3b6f26ee1b1e284ab991e0f44281013bffe5b07bdffc8a6876a25819c75df88262ef62bf37a80914ff9d36e113991d3f4bcd478fbe62f4923ca3b3ef1 + secret_key_base: d7e583329720955b581b5049648a30a09481504acd04cd2589190d898b4337e69f64c68920881aaeee51a611c9619598dbea26585f91285722b38ce99743f5c5 # Do not keep production secrets in the repository, # instead read values from the environment. -------------- next part -------------- HTML����������������������������... Télécharger