Update to rails 5.2.0
This commit is contained in:
parent
aee222551a
commit
98de681e47
34 changed files with 305 additions and 109 deletions
|
@ -63,6 +63,11 @@ Style/HashSyntax:
|
|||
- 'lib/tasks/testing.rake'
|
||||
- 'config/initializers/wrap_parameters.rb'
|
||||
|
||||
Style/MixinUsage:
|
||||
Exclude:
|
||||
- 'bin/setup'
|
||||
- 'bin/update'
|
||||
|
||||
Style/StringLiterals:
|
||||
EnforcedStyle: double_quotes
|
||||
|
||||
|
|
7
Gemfile
7
Gemfile
|
@ -1,7 +1,7 @@
|
|||
source "https://rubygems.org"
|
||||
|
||||
# Require rails
|
||||
gem "rails", "5.1.6"
|
||||
gem "rails", "5.2.0"
|
||||
|
||||
# Require things which have moved to gems in ruby 1.9
|
||||
gem "bigdecimal", "~> 1.1.0", :platforms => :ruby_19
|
||||
|
@ -31,6 +31,9 @@ gem "jquery-rails"
|
|||
# gem 'jbuilder', '~> 2.0'
|
||||
gem "jsonify-rails"
|
||||
|
||||
# Reduces boot times through caching; required in config/boot.rb
|
||||
gem 'bootsnap', '>= 1.1.0', require: false
|
||||
|
||||
# Use R2 for RTL conversion
|
||||
gem "r2", "~> 0.2.7"
|
||||
|
||||
|
@ -42,7 +45,7 @@ gem "image_optim_rails"
|
|||
|
||||
# Load rails plugins
|
||||
gem "actionpack-page_caching"
|
||||
gem "composite_primary_keys", "~> 10.0.4"
|
||||
gem "composite_primary_keys", "~> 11.0.0"
|
||||
gem "dynamic_form"
|
||||
gem "http_accept_language", "~> 2.0.0"
|
||||
gem "i18n-js", ">= 3.0.0"
|
||||
|
|
93
Gemfile.lock
93
Gemfile.lock
|
@ -4,41 +4,45 @@ GEM
|
|||
SystemTimer (1.2.3)
|
||||
aasm (4.12.3)
|
||||
concurrent-ruby (~> 1.0)
|
||||
actioncable (5.1.6)
|
||||
actionpack (= 5.1.6)
|
||||
actioncable (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
nio4r (~> 2.0)
|
||||
websocket-driver (~> 0.6.1)
|
||||
actionmailer (5.1.6)
|
||||
actionpack (= 5.1.6)
|
||||
actionview (= 5.1.6)
|
||||
activejob (= 5.1.6)
|
||||
websocket-driver (>= 0.6.1)
|
||||
actionmailer (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activejob (= 5.2.0)
|
||||
mail (~> 2.5, >= 2.5.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
actionpack (5.1.6)
|
||||
actionview (= 5.1.6)
|
||||
activesupport (= 5.1.6)
|
||||
actionpack (5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
rack (~> 2.0)
|
||||
rack-test (>= 0.6.3)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||
actionpack-page_caching (1.1.0)
|
||||
actionpack (>= 4.0.0, < 6)
|
||||
actionview (5.1.6)
|
||||
activesupport (= 5.1.6)
|
||||
actionview (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
builder (~> 3.1)
|
||||
erubi (~> 1.4)
|
||||
rails-dom-testing (~> 2.0)
|
||||
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
||||
activejob (5.1.6)
|
||||
activesupport (= 5.1.6)
|
||||
activejob (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
globalid (>= 0.3.6)
|
||||
activemodel (5.1.6)
|
||||
activesupport (= 5.1.6)
|
||||
activerecord (5.1.6)
|
||||
activemodel (= 5.1.6)
|
||||
activesupport (= 5.1.6)
|
||||
arel (~> 8.0)
|
||||
activesupport (5.1.6)
|
||||
activemodel (5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
activerecord (5.2.0)
|
||||
activemodel (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
arel (>= 9.0)
|
||||
activestorage (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
activerecord (= 5.2.0)
|
||||
marcel (~> 0.3.1)
|
||||
activesupport (5.2.0)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
|
@ -48,9 +52,9 @@ GEM
|
|||
annotate (2.7.4)
|
||||
activerecord (>= 3.2, < 6.0)
|
||||
rake (>= 10.4, < 13.0)
|
||||
arel (8.0.0)
|
||||
arel (9.0.0)
|
||||
ast (2.4.0)
|
||||
autoprefixer-rails (8.6.2)
|
||||
autoprefixer-rails (8.6.3)
|
||||
execjs
|
||||
better_errors (2.4.0)
|
||||
coderay (>= 1.0.0)
|
||||
|
@ -59,6 +63,8 @@ GEM
|
|||
bigdecimal (1.1.0)
|
||||
binding_of_caller (0.8.0)
|
||||
debug_inspector (>= 0.0.1)
|
||||
bootsnap (1.3.0)
|
||||
msgpack (~> 1.0)
|
||||
builder (3.2.3)
|
||||
canonical-rails (0.2.3)
|
||||
rails (>= 4.1, < 5.3)
|
||||
|
@ -79,8 +85,8 @@ GEM
|
|||
coffee-script-source
|
||||
execjs
|
||||
coffee-script-source (1.12.2)
|
||||
composite_primary_keys (10.0.4)
|
||||
activerecord (~> 5.1.0, >= 5.1.6)
|
||||
composite_primary_keys (11.0.0)
|
||||
activerecord (~> 5.2.0)
|
||||
concurrent-ruby (1.0.5)
|
||||
coveralls (0.8.21)
|
||||
json (>= 1.8, < 3)
|
||||
|
@ -163,6 +169,8 @@ GEM
|
|||
nokogiri (>= 1.5.9)
|
||||
mail (2.7.0)
|
||||
mini_mime (>= 0.1.1)
|
||||
marcel (0.3.2)
|
||||
mimemagic (~> 0.3.2)
|
||||
method_source (0.9.0)
|
||||
mime-types (3.1)
|
||||
mime-types-data (~> 3.2015)
|
||||
|
@ -171,6 +179,7 @@ GEM
|
|||
mini_mime (1.0.0)
|
||||
mini_portile2 (2.3.0)
|
||||
minitest (5.11.3)
|
||||
msgpack (1.2.4)
|
||||
multi_json (1.13.1)
|
||||
multi_xml (0.6.0)
|
||||
multipart-post (2.0.0)
|
||||
|
@ -248,17 +257,18 @@ GEM
|
|||
rack-test (1.0.0)
|
||||
rack (>= 1.0, < 3)
|
||||
rack-uri_sanitizer (0.0.2)
|
||||
rails (5.1.6)
|
||||
actioncable (= 5.1.6)
|
||||
actionmailer (= 5.1.6)
|
||||
actionpack (= 5.1.6)
|
||||
actionview (= 5.1.6)
|
||||
activejob (= 5.1.6)
|
||||
activemodel (= 5.1.6)
|
||||
activerecord (= 5.1.6)
|
||||
activesupport (= 5.1.6)
|
||||
rails (5.2.0)
|
||||
actioncable (= 5.2.0)
|
||||
actionmailer (= 5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
actionview (= 5.2.0)
|
||||
activejob (= 5.2.0)
|
||||
activemodel (= 5.2.0)
|
||||
activerecord (= 5.2.0)
|
||||
activestorage (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
bundler (>= 1.3.0)
|
||||
railties (= 5.1.6)
|
||||
railties (= 5.2.0)
|
||||
sprockets-rails (>= 2.0.0)
|
||||
rails-controller-testing (1.0.2)
|
||||
actionpack (~> 5.x, >= 5.0.1)
|
||||
|
@ -272,9 +282,9 @@ GEM
|
|||
rails-i18n (4.0.2)
|
||||
i18n (~> 0.6)
|
||||
rails (>= 4.0)
|
||||
railties (5.1.6)
|
||||
actionpack (= 5.1.6)
|
||||
activesupport (= 5.1.6)
|
||||
railties (5.2.0)
|
||||
actionpack (= 5.2.0)
|
||||
activesupport (= 5.2.0)
|
||||
method_source
|
||||
rake (>= 0.8.7)
|
||||
thor (>= 0.18.1, < 2.0)
|
||||
|
@ -354,7 +364,7 @@ GEM
|
|||
addressable (>= 2.3.6)
|
||||
crack (>= 0.3.2)
|
||||
hashdiff
|
||||
websocket-driver (0.6.5)
|
||||
websocket-driver (0.7.0)
|
||||
websocket-extensions (>= 0.1.0)
|
||||
websocket-extensions (0.1.3)
|
||||
xpath (3.1.0)
|
||||
|
@ -372,10 +382,11 @@ DEPENDENCIES
|
|||
better_errors
|
||||
bigdecimal (~> 1.1.0)
|
||||
binding_of_caller
|
||||
bootsnap (>= 1.1.0)
|
||||
canonical-rails
|
||||
capybara (~> 2.13)
|
||||
coffee-rails (~> 4.2)
|
||||
composite_primary_keys (~> 10.0.4)
|
||||
composite_primary_keys (~> 11.0.0)
|
||||
coveralls
|
||||
dalli
|
||||
dynamic_form
|
||||
|
@ -413,7 +424,7 @@ DEPENDENCIES
|
|||
r2 (~> 0.2.7)
|
||||
rack-cors
|
||||
rack-uri_sanitizer
|
||||
rails (= 5.1.6)
|
||||
rails (= 5.2.0)
|
||||
rails-controller-testing
|
||||
rails-i18n (~> 4.0.0)
|
||||
record_tag_helper
|
||||
|
|
|
@ -211,7 +211,7 @@ class User < ActiveRecord::Base
|
|||
.where("id != ?", id)
|
||||
.where(sql_for_area)
|
||||
.where("#{sql_for_distance} <= ?", radius)
|
||||
.order(sql_for_distance)
|
||||
.order(Arel.sql(sql_for_distance))
|
||||
.limit(num)
|
||||
else
|
||||
nearby = []
|
||||
|
|
|
@ -36,5 +36,6 @@
|
|||
<%= yield :head %>
|
||||
<%= yield :auto_discovery_link_tag %>
|
||||
<%= csrf_meta_tag %>
|
||||
<%= csp_meta_tag %>
|
||||
<title><%= @title + ' | ' if @title %><%= t 'layouts.project_name.title' %></title>
|
||||
<% end %>
|
||||
|
|
3
bin/bundle
Executable file
3
bin/bundle
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/usr/bin/env ruby
|
||||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
load Gem.bin_path("bundler", "bundle")
|
4
bin/rails
Executable file
4
bin/rails
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_PATH = File.expand_path("../config/application", __dir__)
|
||||
require_relative "../config/boot"
|
||||
require "rails/commands"
|
4
bin/rake
Executable file
4
bin/rake
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env ruby
|
||||
require_relative "../config/boot"
|
||||
require "rake"
|
||||
Rake.application.run
|
36
bin/setup
Executable file
36
bin/setup
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env ruby
|
||||
require "fileutils"
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
|
||||
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")
|
||||
|
||||
# Install JavaScript dependencies if using Yarn
|
||||
# system('bin/yarn')
|
||||
|
||||
# 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
|
31
bin/update
Executable file
31
bin/update
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env ruby
|
||||
require "fileutils"
|
||||
include FileUtils
|
||||
|
||||
# path to your application root.
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
|
||||
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")
|
||||
|
||||
# Install JavaScript dependencies if using Yarn
|
||||
# system('bin/yarn')
|
||||
|
||||
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
|
11
bin/yarn
Executable file
11
bin/yarn
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/env ruby
|
||||
APP_ROOT = File.expand_path("..", __dir__)
|
||||
Dir.chdir(APP_ROOT) do
|
||||
begin
|
||||
exec "yarnpkg", *ARGV
|
||||
rescue Errno::ENOENT
|
||||
warn "Yarn executable was not detected in the system."
|
||||
warn "Download Yarn at https://yarnpkg.com/en/docs/install"
|
||||
exit 1
|
||||
end
|
||||
end
|
|
@ -19,8 +19,9 @@ Bundler.require(*Rails.groups)
|
|||
module OpenStreetMap
|
||||
class Application < Rails::Application
|
||||
# Settings in config/environments/* take precedence over those specified here.
|
||||
# Application configuration should go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded.
|
||||
# Application configuration can go into files in config/initializers
|
||||
# -- all .rb files in that directory are automatically loaded after loading
|
||||
# the framework and any gems in your application.
|
||||
|
||||
# Custom directories with classes and modules you want to be autoloadable.
|
||||
config.autoload_paths += %W[#{config.root}/lib]
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../Gemfile", __dir__)
|
||||
|
||||
require "bundler/setup" # Set up gems listed in the Gemfile.
|
||||
require "bootsnap/setup" # Speed up boot time by caching expensive operations.
|
||||
|
|
10
config/cable.yml
Normal file
10
config/cable.yml
Normal file
|
@ -0,0 +1,10 @@
|
|||
development:
|
||||
adapter: async
|
||||
|
||||
test:
|
||||
adapter: async
|
||||
|
||||
production:
|
||||
adapter: redis
|
||||
url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %>
|
||||
channel_prefix: openstreetmap_production
|
1
config/credentials.yml.enc
Normal file
1
config/credentials.yml.enc
Normal file
|
@ -0,0 +1 @@
|
|||
E6VWa9zDZ3CNpJ+ztv1UbvGamyL3N+U7DepOApwj4YE4NNvH2eYr4dqw6hALKKpp2O9OoPmwAzoJy9WarOnAHo67iwkU1ZdxRGoJNPlavsNgmAwFkEMH2AgBT4AkNzAhdHq9+wM32SvwOpxzvfLx9wJ439b0hY4QR3SBgPmp69LrOLjjLgIyUn3SVTendPBJ1fZxyHSxoKjQmmpT6+2YQA94ynfAy/m/6IY9VGbz9sinZBPdwx4krg+AG7qUqx3PDgZ388bl2g8uA35BPIpGnMNBkqQXjuRrFSi1ZkkJdj6NFDqZRkLNsDUDcOfxmYIRWgx3JSDekU8/24NkGeJ1/tOw2xILlQRASi6vdfHXYIqVmbHSrEdXsLQFUqv7FNHzfUtzdTDms6g3+bYhy+ZGpLdsD3maXm36p7/Z--i03uonfXALIIhWbt--6AuvcDUvj0AL5xl8DPeU7g==
|
|
@ -1,5 +0,0 @@
|
|||
dir_mode: script
|
||||
dir: ../../log
|
||||
multiple: false
|
||||
backtrace: true
|
||||
monitor: true
|
|
@ -13,12 +13,13 @@ Rails.application.configure do
|
|||
config.consider_all_requests_local = true
|
||||
|
||||
# Enable/disable caching. By default caching is disabled.
|
||||
# Run rails dev:cache to toggle caching.
|
||||
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=#{2.days.seconds.to_i}"
|
||||
"Cache-Control" => "public, max-age=#{2.days.to_i}"
|
||||
}
|
||||
else
|
||||
config.action_controller.perform_caching = false
|
||||
|
@ -26,6 +27,9 @@ Rails.application.configure do
|
|||
config.cache_store = :null_store
|
||||
end
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||
config.active_storage.service = :local
|
||||
|
||||
# Don't care if the mailer can't send.
|
||||
config.action_mailer.raise_delivery_errors = false
|
||||
|
||||
|
@ -37,6 +41,9 @@ Rails.application.configure do
|
|||
# Raise an error on page load if there are pending migrations.
|
||||
config.active_record.migration_error = :page_load unless STATUS == :database_offline
|
||||
|
||||
# Highlight code that triggered database queries in logs.
|
||||
config.active_record.verbose_query_logs = true
|
||||
|
||||
# Debug mode disables concatenation and preprocessing of assets.
|
||||
# This option may cause significant delays in view rendering with a large
|
||||
# number of complex assets.
|
||||
|
|
|
@ -14,10 +14,9 @@ Rails.application.configure do
|
|||
config.consider_all_requests_local = false
|
||||
config.action_controller.perform_caching = true
|
||||
|
||||
# Attempt to read encrypted secrets from `config/secrets.yml.enc`.
|
||||
# Requires an encryption key in `ENV["RAILS_MASTER_KEY"]` or
|
||||
# `config/secrets.yml.key`.
|
||||
config.read_encrypted_secrets = true
|
||||
# Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"]
|
||||
# or in config/master.key. This key is used to decrypt credentials (and other encrypted files).
|
||||
# config.require_master_key = true
|
||||
|
||||
# Disable serving static files from the `/public` folder by default since
|
||||
# Apache or NGINX already handles this.
|
||||
|
@ -39,6 +38,9 @@ Rails.application.configure do
|
|||
# config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
|
||||
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
|
||||
|
||||
# Store uploaded files on the local file system (see config/storage.yml for options)
|
||||
config.active_storage.service = :local
|
||||
|
||||
# Mount Action Cable outside main process or domain
|
||||
# config.action_cable.mount_path = nil
|
||||
# config.action_cable.url = 'wss://example.com/cable'
|
||||
|
|
|
@ -15,7 +15,7 @@ Rails.application.configure do
|
|||
# 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=#{1.hour.seconds.to_i}"
|
||||
"Cache-Control" => "public, max-age=#{1.hour.to_i}"
|
||||
}
|
||||
|
||||
# Show full error reports and disable caching.
|
||||
|
@ -27,6 +27,10 @@ Rails.application.configure do
|
|||
|
||||
# Disable request forgery protection in test environment.
|
||||
config.action_controller.allow_forgery_protection = false
|
||||
|
||||
# Store uploaded files on the local file system in a temporary directory
|
||||
config.active_storage.service = :test
|
||||
|
||||
config.action_mailer.perform_caching = false
|
||||
|
||||
# Tell Action Mailer not to deliver emails to the real world.
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
# Stop rails from automatically parsing XML in request bodies
|
||||
Rails.configuration.middleware.delete ActionDispatch::ParamsParser
|
8
config/initializers/application_controller_renderer.rb
Normal file
8
config/initializers/application_controller_renderer.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# ActiveSupport::Reloader.to_prepare do
|
||||
# ApplicationController.renderer.defaults.merge!(
|
||||
# http_host: 'example.org',
|
||||
# https: false
|
||||
# )
|
||||
# end
|
|
@ -6,11 +6,12 @@ Rails.application.config.assets.version = "1.0"
|
|||
# Location of manifest file.
|
||||
Rails.application.config.assets.manifest = Rails.root.join("tmp", "manifest.json")
|
||||
|
||||
# Add additional assets to the asset load path
|
||||
# Add additional assets to the asset load path.
|
||||
Rails.application.config.assets.paths << Rails.root.join("config")
|
||||
|
||||
# Precompile additional assets.
|
||||
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
||||
# application.js, application.css, and all non-JS/CSS in the app/assets
|
||||
# folder are already added.
|
||||
Rails.application.config.assets.precompile += %w[index.js browse.js welcome.js fixthemap.js]
|
||||
Rails.application.config.assets.precompile += %w[user.js login.js diary_entry.js messages.js edit/*.js]
|
||||
Rails.application.config.assets.precompile += %w[screen-ltr.css print-ltr.css]
|
||||
|
|
25
config/initializers/content_security_policy.rb
Normal file
25
config/initializers/content_security_policy.rb
Normal file
|
@ -0,0 +1,25 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Define an application-wide content security policy
|
||||
# For further information see the following documentation
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy
|
||||
|
||||
# Rails.application.config.content_security_policy do |policy|
|
||||
# policy.default_src :self, :https
|
||||
# policy.font_src :self, :https, :data
|
||||
# policy.img_src :self, :https, :data
|
||||
# policy.object_src :none
|
||||
# policy.script_src :self, :https
|
||||
# policy.style_src :self, :https
|
||||
|
||||
# # Specify URI for violation reports
|
||||
# # policy.report_uri "/csp-violation-report-endpoint"
|
||||
# end
|
||||
|
||||
# If you are using UJS then enable automatic nonce generation
|
||||
# Rails.application.config.content_security_policy_nonce_generator = -> request { SecureRandom.base64(16) }
|
||||
|
||||
# Report CSP violations to a specified URI
|
||||
# For further information see the following documentation:
|
||||
# https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy-Report-Only
|
||||
# Rails.application.config.content_security_policy_report_only = true
|
1
config/master.key
Normal file
1
config/master.key
Normal file
|
@ -0,0 +1 @@
|
|||
a895530f14add56693da9a6dbfd3cf97
|
|
@ -1,5 +0,0 @@
|
|||
---
|
||||
log_file: log/mongrel.log
|
||||
port: 8000
|
||||
pid_file: tmp/mongrel.pid
|
||||
servers: 8
|
34
config/puma.rb
Normal file
34
config/puma.rb
Normal file
|
@ -0,0 +1,34 @@
|
|||
# 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 }
|
||||
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.
|
||||
#
|
||||
# preload_app!
|
||||
|
||||
# Allow puma to be restarted by `rails restart` command.
|
||||
plugin :tmp_restart
|
|
@ -1,32 +0,0 @@
|
|||
# Be sure to restart your server when you modify this file.
|
||||
|
||||
# Your secret key is used for verifying the integrity of signed cookies.
|
||||
# If you change this key, all old signed cookies will become invalid!
|
||||
|
||||
# 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 `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.
|
||||
|
||||
# Shared secrets are available across all environments.
|
||||
|
||||
# shared:
|
||||
# api_key: a1B2c3D4e5F6
|
||||
|
||||
# Environmental secrets are only available for that specific environment.
|
||||
|
||||
development:
|
||||
secret_key_base: 1ce5ed17771b4fdc3f755c5b98459d67816f99ec5889ec2fa7bf2bd3cba3ad5cc453693ce3c5d121669be478fb811136f4f483e6f39ac1f0e34ba66e8acab574
|
||||
|
||||
test:
|
||||
secret_key_base: 10d52b1bf88c429e73ffbc5e5f58b037db21f38ea88b8b454e55d52ed8bcc6e7fe3b48a79b2f36eb78a4685224d707767d083f79c51f7d81a9d4a06d1c1e2534
|
||||
|
||||
# Do not keep production secrets in the unencrypted secrets file.
|
||||
# Instead, either read values from the environment.
|
||||
# Or, use `bin/rails secrets:setup` to configure encrypted secrets
|
||||
# and move the `production:` environment over there.
|
||||
|
||||
production:
|
||||
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
6
config/spring.rb
Normal file
6
config/spring.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
%w[
|
||||
.ruby-version
|
||||
.rbenv-vars
|
||||
tmp/restart.txt
|
||||
tmp/caching-dev.txt
|
||||
].each { |path| Spring.watch(path) }
|
34
config/storage.yml
Normal file
34
config/storage.yml
Normal file
|
@ -0,0 +1,34 @@
|
|||
test:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("tmp/storage") %>
|
||||
|
||||
local:
|
||||
service: Disk
|
||||
root: <%= Rails.root.join("storage") %>
|
||||
|
||||
# Use rails credentials:edit to set the AWS secrets (as aws:access_key_id|secret_access_key)
|
||||
# amazon:
|
||||
# service: S3
|
||||
# access_key_id: <%= Rails.application.credentials.dig(:aws, :access_key_id) %>
|
||||
# secret_access_key: <%= Rails.application.credentials.dig(:aws, :secret_access_key) %>
|
||||
# region: us-east-1
|
||||
# bucket: your_own_bucket
|
||||
|
||||
# Remember not to checkin your GCS keyfile to a repository
|
||||
# google:
|
||||
# service: GCS
|
||||
# project: your_project
|
||||
# credentials: <%= Rails.root.join("path/to/gcs.keyfile") %>
|
||||
# bucket: your_own_bucket
|
||||
|
||||
# Use rails credentials:edit to set the Azure Storage secret (as azure_storage:storage_access_key)
|
||||
# microsoft:
|
||||
# service: AzureStorage
|
||||
# storage_account_name: your_account_name
|
||||
# storage_access_key: <%= Rails.application.credentials.dig(:azure_storage, :storage_access_key) %>
|
||||
# container: your_container_name
|
||||
|
||||
# mirror:
|
||||
# service: Mirror
|
||||
# primary: local
|
||||
# mirrors: [ amazon, google, microsoft ]
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env ruby
|
||||
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
|
||||
|
||||
APP_PATH = File.expand_path("../config/application", __dir__)
|
||||
require File.expand_path("../config/boot", __dir__)
|
||||
require "rails/commands"
|
0
storage/.keep
Normal file
0
storage/.keep
Normal file
|
@ -8,9 +8,11 @@ WebMock.disable_net_connect!(:allow_localhost => true)
|
|||
# https://github.com/ariya/phantomjs/issues/14376
|
||||
ENV["QT_QPA_PLATFORM"] = "phantom" if IO.popen(["phantomjs", "--version"], :err => :close).read.empty?
|
||||
|
||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||
ActiveSupport.on_load(:action_dispatch_system_test_case) do
|
||||
ActionDispatch::SystemTesting::Server.silence_puma = true
|
||||
end
|
||||
|
||||
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
|
||||
driven_by :poltergeist, :screen_size => [1400, 1400]
|
||||
|
||||
def initialize(*args)
|
||||
|
|
|
@ -39,12 +39,12 @@ class ApplicationHelperTest < ActionView::TestCase
|
|||
|
||||
def test_rss_link_to
|
||||
link = rss_link_to(:controller => :diary_entry, :action => :rss)
|
||||
assert_dom_equal "<a class=\"rsssmall\" href=\"/diary/rss\"><img alt=\"Rss\" border=\"0\" height=\"16\" src=\"/images/RSS.png\" width=\"16\" /></a>", link
|
||||
assert_dom_equal "<a class=\"rsssmall\" href=\"/diary/rss\"><img border=\"0\" height=\"16\" src=\"/images/RSS.png\" width=\"16\" /></a>", link
|
||||
end
|
||||
|
||||
def test_atom_link_to
|
||||
link = atom_link_to(:controller => :changeset, :action => :feed)
|
||||
assert_dom_equal "<a class=\"rsssmall\" href=\"/history/feed\"><img alt=\"Rss\" border=\"0\" height=\"16\" src=\"/images/RSS.png\" width=\"16\" /></a>", link
|
||||
assert_dom_equal "<a class=\"rsssmall\" href=\"/history/feed\"><img border=\"0\" height=\"16\" src=\"/images/RSS.png\" width=\"16\" /></a>", link
|
||||
end
|
||||
|
||||
def test_richtext_area
|
||||
|
|
|
@ -2,7 +2,7 @@ require "coveralls"
|
|||
Coveralls.wear!("rails")
|
||||
|
||||
ENV["RAILS_ENV"] = "test"
|
||||
require File.expand_path("../config/environment", __dir__)
|
||||
require_relative "../config/environment"
|
||||
require "rails/test_help"
|
||||
require "webmock/minitest"
|
||||
|
||||
|
@ -130,7 +130,7 @@ module ActiveSupport
|
|||
end
|
||||
|
||||
def stub_gravatar_request(email, status = 200, body = nil)
|
||||
hash = Digest::MD5.hexdigest(email.downcase)
|
||||
hash = ::Digest::MD5.hexdigest(email.downcase)
|
||||
url = "https://www.gravatar.com/avatar/#{hash}?d=404"
|
||||
stub_request(:get, url).and_return(:status => status, :body => body)
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue