Mercurial > zeropaste
changeset 431:68eb23b52864
Rails 5 \o/
line wrap: on
line diff
--- a/.rubocop.yml Tue Mar 01 16:36:10 2016 +0900 +++ b/.rubocop.yml Fri May 13 03:56:07 2016 +0900 @@ -1,3 +1,5 @@ +inherit_from: .rubocop_todo.yml + AllCops: Include: - Gemfile @@ -6,7 +8,9 @@ - bin/* - config/local_config.rb - db/schema.rb - RunRailsCops: true + +Rails: + Enabled: true HashSyntax: EnforcedStyle: hash_rockets
--- a/Gemfile Tue Mar 01 16:36:10 2016 +0900 +++ b/Gemfile Fri May 13 03:56:07 2016 +0900 @@ -1,6 +1,6 @@ source "https://rubygems.org" -gem "rails", "~> 4.2.0" +gem "rails", ">= 5.0.0.rc1", "< 5.1" gem "jquery-rails" gem "coffee-rails", "~> 4.1.0" # Rails 4.2 default gem "bootstrap-sass"
--- a/Gemfile.lock Tue Mar 01 16:36:10 2016 +0900 +++ b/Gemfile.lock Fri May 13 03:56:07 2016 +0900 @@ -2,43 +2,45 @@ remote: https://rubygems.org/ remote: https://rails-assets.org/ specs: - actionmailer (4.2.5.2) - actionpack (= 4.2.5.2) - actionview (= 4.2.5.2) - activejob (= 4.2.5.2) + actioncable (5.0.0.rc1) + actionpack (= 5.0.0.rc1) + nio4r (~> 1.2) + websocket-driver (~> 0.6.1) + actionmailer (5.0.0.rc1) + actionpack (= 5.0.0.rc1) + actionview (= 5.0.0.rc1) + activejob (= 5.0.0.rc1) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 1.0, >= 1.0.5) - actionpack (4.2.5.2) - actionview (= 4.2.5.2) - activesupport (= 4.2.5.2) - rack (~> 1.6) - rack-test (~> 0.6.2) + actionpack (5.0.0.rc1) + actionview (= 5.0.0.rc1) + activesupport (= 5.0.0.rc1) + 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 (4.2.5.2) - activesupport (= 4.2.5.2) + actionview (5.0.0.rc1) + activesupport (= 5.0.0.rc1) builder (~> 3.1) erubis (~> 2.7.0) rails-dom-testing (~> 1.0, >= 1.0.5) rails-html-sanitizer (~> 1.0, >= 1.0.2) - activejob (4.2.5.2) - activesupport (= 4.2.5.2) - globalid (>= 0.3.0) - activemodel (4.2.5.2) - activesupport (= 4.2.5.2) - builder (~> 3.1) - activerecord (4.2.5.2) - activemodel (= 4.2.5.2) - activesupport (= 4.2.5.2) - arel (~> 6.0) - activesupport (4.2.5.2) + activejob (5.0.0.rc1) + activesupport (= 5.0.0.rc1) + globalid (>= 0.3.6) + activemodel (5.0.0.rc1) + activesupport (= 5.0.0.rc1) + activerecord (5.0.0.rc1) + activemodel (= 5.0.0.rc1) + activesupport (= 5.0.0.rc1) + arel (~> 7.0) + activesupport (5.0.0.rc1) + 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) - arel (6.0.3) - autoprefixer-rails (6.3.3.1) + arel (7.0.0) + autoprefixer-rails (6.3.6) execjs bootstrap-sass (3.3.6) autoprefixer-rails (>= 5.2.1) @@ -51,46 +53,52 @@ coffee-script-source execjs coffee-script-source (1.10.0) - concurrent-ruby (1.0.1) + concurrent-ruby (1.0.2) erubis (2.7.0) execjs (2.6.0) globalid (0.3.6) activesupport (>= 4.1.0) i18n (0.7.0) - jquery-rails (4.1.0) - rails-dom-testing (~> 1.0) + jquery-rails (4.1.1) + rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) json (1.8.3) loofah (2.0.3) nokogiri (>= 1.5.9) - mail (2.6.3) - mime-types (>= 1.16, < 3) - mime-types (2.99.1) + mail (2.6.4) + mime-types (>= 1.16, < 4) + method_source (0.8.2) + mime-types (3.0) + mime-types-data (~> 3.2015) + mime-types-data (3.2016.0221) mini_portile2 (2.0.0) minitest (5.8.4) - newrelic_rpm (3.15.0.314) + newrelic_rpm (3.15.2.317) + nio4r (1.2.1) nokogiri (1.6.7.2) mini_portile2 (~> 2.0.0.rc2) pg (0.18.4) quiet_assets (1.1.0) railties (>= 3.1, < 5.0) - rack (1.6.4) + rack (2.0.0.rc1) + json rack-test (0.6.3) rack (>= 1.0) - rails (4.2.5.2) - actionmailer (= 4.2.5.2) - actionpack (= 4.2.5.2) - actionview (= 4.2.5.2) - activejob (= 4.2.5.2) - activemodel (= 4.2.5.2) - activerecord (= 4.2.5.2) - activesupport (= 4.2.5.2) + rails (5.0.0.rc1) + actioncable (= 5.0.0.rc1) + actionmailer (= 5.0.0.rc1) + actionpack (= 5.0.0.rc1) + actionview (= 5.0.0.rc1) + activejob (= 5.0.0.rc1) + activemodel (= 5.0.0.rc1) + activerecord (= 5.0.0.rc1) + activesupport (= 5.0.0.rc1) bundler (>= 1.3.0, < 2.0) - railties (= 4.2.5.2) - sprockets-rails - rails-assets-commonmark (0.24.0) - rails-assets-highlightjs (9.1.0) + railties (= 5.0.0.rc1) + sprockets-rails (>= 2.0.0) + rails-assets-commonmark (0.25.1) + rails-assets-highlightjs (9.2.0) rails-deprecated_sanitizer (1.0.3) activesupport (>= 4.2.0.alpha) rails-dom-testing (1.0.7) @@ -99,34 +107,37 @@ rails-deprecated_sanitizer (>= 1.0.1) rails-html-sanitizer (1.0.3) loofah (~> 2.0) - railties (4.2.5.2) - actionpack (= 4.2.5.2) - activesupport (= 4.2.5.2) + railties (5.0.0.rc1) + actionpack (= 5.0.0.rc1) + activesupport (= 5.0.0.rc1) + method_source rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) - rake (10.5.0) - sass (3.4.21) + rake (11.1.2) + sass (3.4.22) sass-rails (5.0.4) railties (>= 4.0.0, < 5.0) sass (~> 3.1) sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) - sprockets (3.5.2) + sprockets (3.6.0) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.0.3) + sprockets-rails (3.0.4) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) thor (0.19.1) thread_safe (0.3.5) - tilt (2.0.2) + tilt (2.0.3) tzinfo (1.2.2) thread_safe (~> 0.1) - uglifier (2.7.2) - execjs (>= 0.3.0) - json (>= 1.8.0) + uglifier (3.0.0) + execjs (>= 0.3.0, < 3) + websocket-driver (0.6.3) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.2) PLATFORMS ruby @@ -140,7 +151,7 @@ newrelic_rpm pg quiet_assets - rails (~> 4.2.0) + rails (>= 5.0.0.rc1, < 5.1) rails-assets-commonmark! rails-assets-highlightjs! sass-rails (~> 5.0)
--- a/app/helpers/pastes_helper.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/app/helpers/pastes_helper.rb Fri May 13 03:56:07 2016 +0900 @@ -3,7 +3,7 @@ if @paste.errors.any? "Failed" else - url = paste_path @paste, :only_path => false + url = paste_path @paste, :only_path => false if @fresh "#{url} (key: #{@paste.key})" else
--- a/app/models/paste.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/app/models/paste.rb Fri May 13 03:56:07 2016 +0900 @@ -17,7 +17,7 @@ def self.safe_find(raw_id) /\A(?<id>[0-9]+)(?:-(?<secret>[0-9a-f]+))?\z/ =~ raw_id.to_s - where(:secret => secret, :id => id).take + find_by(:secret => secret, :id => id) end def self.graceful_create(params) @@ -73,7 +73,7 @@ end def convert_newlines - self.paste = paste.to_s.gsub("\r\n", "\n").gsub("\r", "\n") + self.paste = paste.to_s.gsub("\r\n", "\n").tr("\r", "\n") end def paste_limit
--- a/bin/rails Tue Mar 01 16:36:10 2016 +0900 +++ b/bin/rails Fri May 13 03:56:07 2016 +0900 @@ -1,4 +1,4 @@ #!/usr/bin/env ruby -APP_PATH = File.expand_path('../../config/application', __FILE__) +APP_PATH = File.expand_path('../config/application', __dir__) require_relative '../config/boot' require 'rails/commands'
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/setup Fri May 13 03:56:07 2016 +0900 @@ -0,0 +1,34 @@ +#!/usr/bin/env ruby +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') || 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/bin/update Fri May 13 03:56:07 2016 +0900 @@ -0,0 +1,29 @@ +#!/usr/bin/env ruby +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') || 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
--- a/config/application.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/application.rb Fri May 13 03:56:07 2016 +0900 @@ -1,4 +1,4 @@ -require File.expand_path("../boot", __FILE__) +require_relative "boot" # To allow setting environment variable ZP_DATABASE_URL instead of DATABASE_URL. ENV["DATABASE_URL"] = ENV["ZP_DATABASE_URL"] if ENV["ZP_DATABASE_URL"] @@ -10,17 +10,14 @@ require "sprockets/railtie" require "rails/test_unit/railtie" -require File.expand_path("../init_config", __FILE__) -suppress(LoadError) { require File.expand_path("../local_config", __FILE__) } -require File.expand_path("../default_config", __FILE__) +require_relative "init_config" +suppress(LoadError) { require_relative "local_config" } +require_relative "default_config" -# Pick the frameworks you want: -if defined?(Bundler) - # If you precompile assets before deploying to production, use this line - Bundler.require(*CONFIG["bundler_groups"]) - # If you want your assets lazily compiled in production, use this line - # Bundler.require(:default, :assets, Rails.env) -end +# If you precompile assets before deploying to production, use this line +Bundler.require(*CONFIG["bundler_groups"]) +# If you want your assets lazily compiled in production, use this line +# Bundler.require(:default, :assets, Rails.env) module Zeropaste class Application < Rails::Application @@ -49,9 +46,6 @@ # Configure the default encoding used in templates for Ruby 1.9. config.encoding = "utf-8" - # Configure sensitive parameters which will be filtered from the log file. - config.filter_parameters += [:password] - # Enable escaping HTML in JSON. config.active_support.escape_html_entities_in_json = true @@ -63,9 +57,6 @@ # Enable the asset pipeline config.assets.enabled = true - # Version of your assets, change this if you want to expire all your assets - config.assets.version = "1.0" - # No need to initialize application when precompiling assets config.assets.initialize_on_precompile = false
--- a/config/boot.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/boot.rb Fri May 13 03:56:07 2016 +0900 @@ -1,6 +1,3 @@ -require "rubygems" +ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__) -# 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.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/cable.yml Fri May 13 03:56:07 2016 +0900 @@ -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
--- a/config/default_config.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/default_config.rb Fri May 13 03:56:07 2016 +0900 @@ -1,5 +1,6 @@ CONFIG["standalone"] = true if CONFIG["standalone"].nil? CONFIG["newrelic"] = false if CONFIG["newrelic"].nil? +CONFIG["log_to_stdout"] = true if CONFIG["log_to_stdout"].nil? CONFIG["bundler_groups"] ||= [:default, Rails.env] CONFIG["bundler_groups"] << "standalone" if CONFIG["standalone"] CONFIG["bundler_groups"] << "newrelic" if CONFIG["newrelic"]
--- a/config/environment.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/environment.rb Fri May 13 03:56:07 2016 +0900 @@ -1,5 +1,5 @@ -# Load the rails application -require File.expand_path("../application", __FILE__) +# Load the rails application. +require_relative "application" -# Initialize the rails application -Zeropaste::Application.initialize! +# Initialize the rails application. +Rails.application.initialize!
--- a/config/environments/development.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/environments/development.rb Fri May 13 03:56:07 2016 +0900 @@ -1,4 +1,4 @@ -Zeropaste::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # In the development environment your application's code is reloaded on @@ -10,8 +10,20 @@ config.eager_load = false # Show full error reports and disable caching. - config.consider_all_requests_local = true - config.action_controller.perform_caching = false + 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 = false + + 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 @@ -19,11 +31,18 @@ # Print deprecation notices to the Rails logger. config.active_support.deprecation = :log - # Raise an error on page load if there are pending migrations + # Raise an error on page load if there are pending migrations. config.active_record.migration_error = :page_load # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. config.assets.debug = true + + # 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
--- a/config/environments/production.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/environments/production.rb Fri May 13 03:56:07 2016 +0900 @@ -1,11 +1,11 @@ -Zeropaste::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and - # your application in memory, allowing both thread web servers + # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true @@ -14,13 +14,9 @@ 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_files = 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,59 +25,64 @@ # Do not 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 - # Version of your assets, change this if you want to expire all your assets. - config.assets.version = "1.0" + # 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.*/ ] + + # Don't mount Action Cable in the main server process. + # config.action_cable.mount_path = nil # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true - # # Default logging formatter to keep PID and timestamp - config.log_formatter = Logger::Formatter.new - - # Set to :debug to see everything in the log. - config.log_level = :warn - config.logger = Logger.new(STDOUT) - - # Recommended by http://help.papertrailapp.com/kb/configuration/unicorn - config.logger.level = Logger.const_get("WARN") + # 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 ] - - # Use a different logger for distributed setups. - # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) + config.log_tags = [:request_id] # Use a different cache store in production. - # config.cache_store = :memory_store + # 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 = "zeropaste_#{Rails.env}" + # config.action_mailer.perform_caching = false # 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. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to - # the I18n.default_locale when a translation can not be found). + # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # 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 + + # Use a different logger for distributed setups. + # require 'syslog/logger' + # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') + + if CONFIG["log_to_stdout"] + logger = ActiveSupport::Logger.new(STDOUT) + logger.formatter = config.log_formatter + config.logger = ActiveSupport::TaggedLogging.new(logger) + end + + # Do not dump schema after migrations. + config.active_record.dump_schema_after_migration = false end
--- a/config/environments/test.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/environments/test.rb Fri May 13 03:56:07 2016 +0900 @@ -1,4 +1,4 @@ -Zeropaste::Application.configure do +Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # The test environment is used exclusively to run your application's @@ -12,9 +12,11 @@ # 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_files = 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 @@ -25,6 +27,7 @@ # 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 @@ -34,5 +37,6 @@ # Print deprecation notices to the stderr. config.active_support.deprecation = :stderr - config.active_support.test_order = :random + # Raises error for missing translations + # config.action_view.raise_on_missing_translations = true end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/initializers/application_controller_renderer.rb Fri May 13 03:56:07 2016 +0900 @@ -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 +# )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/initializers/assets.rb Fri May 13 03:56:07 2016 +0900 @@ -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 )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/initializers/cookies_serializer.rb Fri May 13 03:56:07 2016 +0900 @@ -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 = :marshal
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/initializers/filter_parameter_logging.rb Fri May 13 03:56:07 2016 +0900 @@ -0,0 +1,4 @@ +# Be sure to restart your server when you modify this file. + +# Configure sensitive parameters which will be filtered from the log file. +Rails.application.config.filter_parameters += [:password]
--- a/config/initializers/inflections.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/initializers/inflections.rb Fri May 13 03:56:07 2016 +0900 @@ -1,15 +1,16 @@ # Be sure to restart your server when you modify this file. -# Add new inflection rules using the following format -# (all these examples are active by default): -# ActiveSupport::Inflector.inflections do |inflect| +# Add new inflection rules using the following format. Inflections +# are locale specific, and you may define rules for as many different +# locales as you wish. All of these examples are active by default: +# ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.plural /^(ox)$/i, '\1en' # inflect.singular /^(ox)en/i, '\1' # inflect.irregular 'person', 'people' # inflect.uncountable %w( fish sheep ) # end -# + # These inflection rules are supported but not enabled by default: -# ActiveSupport::Inflector.inflections do |inflect| +# ActiveSupport::Inflector.inflections(:en) do |inflect| # inflect.acronym 'RESTful' # end
--- a/config/initializers/mime_types.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/initializers/mime_types.rb Fri May 13 03:56:07 2016 +0900 @@ -2,5 +2,4 @@ # Add new mime types for use in respond_to blocks: # Mime::Type.register "text/richtext", :rtf -# Mime::Type.register_alias "text/html", :iphone Mime::Type.register "text/plain", :txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/initializers/per_form_csrf_tokens.rb Fri May 13 03:56:07 2016 +0900 @@ -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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/initializers/request_forgery_protection.rb Fri May 13 03:56:07 2016 +0900 @@ -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
--- a/config/initializers/session_store.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/initializers/session_store.rb Fri May 13 03:56:07 2016 +0900 @@ -1,8 +1,3 @@ # Be sure to restart your server when you modify this file. -Zeropaste::Application.config.session_store :cookie_store, :key => "_zeropaste_session" - -# Use the database for sessions instead of the cookie-based default, -# which shouldn't be used to store highly confidential information -# (create the session table with "rails generate session_migration") -# Zeropaste::Application.config.session_store :active_record_store +Rails.application.config.session_store :cookie_store, :key => "_zeropaste_session"
--- a/config/initializers/wrap_parameters.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/initializers/wrap_parameters.rb Fri May 13 03:56:07 2016 +0900 @@ -1,5 +1,5 @@ # Be sure to restart your server when you modify this file. -# + # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. @@ -8,7 +8,7 @@ wrap_parameters :format => [:json] end -# Disable root element in JSON by default. -ActiveSupport.on_load(:active_record) do - self.include_root_in_json = false -end +# To enable root element in JSON for ActiveRecord objects. +# ActiveSupport.on_load(:active_record) do +# self.include_root_in_json = true +# end
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/config/puma.rb Fri May 13 03:56:07 2016 +0900 @@ -0,0 +1,47 @@ +# 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 + +# Allow puma to be restarted by `rails restart` command. +plugin :tmp_restart
--- a/config/routes.rb Tue Mar 01 16:36:10 2016 +0900 +++ b/config/routes.rb Fri May 13 03:56:07 2016 +0900 @@ -1,4 +1,4 @@ -Zeropaste::Application.routes.draw do +Rails.application.routes.draw do post "(pastes)" => "pastes#create", :format => /(html|json|xml|txt)/, :as => "pastes" resources :pastes, :only => [:show, :destroy], :path => "/" root :to => "pastes#new"