2
0
mirror of https://github.com/moebooru/moebooru synced 2025-08-22 01:47:48 +00:00

Update to latest rails and other gems

This commit is contained in:
nanaya 2021-02-11 16:57:35 +09:00
parent 524f113130
commit ef53765c91
19 changed files with 192 additions and 137 deletions

View File

@ -1,6 +1,6 @@
source "https://rubygems.org"
gem "rails", "~> 6.0.0"
gem "rails", "~> 6.1.0"
gem "webpacker"
gem "coffee-rails"

View File

@ -1,66 +1,70 @@
GEM
remote: https://rubygems.org/
specs:
actioncable (6.0.3.3)
actionpack (= 6.0.3.3)
actioncable (6.1.2.1)
actionpack (= 6.1.2.1)
activesupport (= 6.1.2.1)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
actionmailbox (6.0.3.3)
actionpack (= 6.0.3.3)
activejob (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
actionmailbox (6.1.2.1)
actionpack (= 6.1.2.1)
activejob (= 6.1.2.1)
activerecord (= 6.1.2.1)
activestorage (= 6.1.2.1)
activesupport (= 6.1.2.1)
mail (>= 2.7.1)
actionmailer (6.0.3.3)
actionpack (= 6.0.3.3)
actionview (= 6.0.3.3)
activejob (= 6.0.3.3)
actionmailer (6.1.2.1)
actionpack (= 6.1.2.1)
actionview (= 6.1.2.1)
activejob (= 6.1.2.1)
activesupport (= 6.1.2.1)
mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0)
actionpack (6.0.3.3)
actionview (= 6.0.3.3)
activesupport (= 6.0.3.3)
rack (~> 2.0, >= 2.0.8)
actionpack (6.1.2.1)
actionview (= 6.1.2.1)
activesupport (= 6.1.2.1)
rack (~> 2.0, >= 2.0.9)
rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.2.0)
actiontext (6.0.3.3)
actionpack (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
actiontext (6.1.2.1)
actionpack (= 6.1.2.1)
activerecord (= 6.1.2.1)
activestorage (= 6.1.2.1)
activesupport (= 6.1.2.1)
nokogiri (>= 1.8.5)
actionview (6.0.3.3)
activesupport (= 6.0.3.3)
actionview (6.1.2.1)
activesupport (= 6.1.2.1)
builder (~> 3.1)
erubi (~> 1.4)
rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.1, >= 1.2.0)
activejob (6.0.3.3)
activesupport (= 6.0.3.3)
activejob (6.1.2.1)
activesupport (= 6.1.2.1)
globalid (>= 0.3.6)
activemodel (6.0.3.3)
activesupport (= 6.0.3.3)
activerecord (6.0.3.3)
activemodel (= 6.0.3.3)
activesupport (= 6.0.3.3)
activerecord-jdbc-adapter (60.2-java)
activerecord (~> 6.0.0)
activerecord-jdbcpostgresql-adapter (60.2-java)
activerecord-jdbc-adapter (= 60.2)
activemodel (6.1.2.1)
activesupport (= 6.1.2.1)
activerecord (6.1.2.1)
activemodel (= 6.1.2.1)
activesupport (= 6.1.2.1)
activerecord-jdbc-adapter (61.0-java)
activerecord (~> 6.1.0)
activerecord-jdbcpostgresql-adapter (61.0-java)
activerecord-jdbc-adapter (= 61.0)
jdbc-postgres (>= 9.4, < 43)
activestorage (6.0.3.3)
actionpack (= 6.0.3.3)
activejob (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (6.1.2.1)
actionpack (= 6.1.2.1)
activejob (= 6.1.2.1)
activerecord (= 6.1.2.1)
activesupport (= 6.1.2.1)
marcel (~> 0.3.1)
activesupport (6.0.3.3)
mimemagic (~> 0.3.2)
activesupport (6.1.2.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
zeitwerk (~> 2.2, >= 2.2.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
acts_as_versioned_rails3 (0.6.2)
activerecord (>= 3.0.9)
addressable (2.7.0)
@ -74,33 +78,33 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.1.7)
concurrent-ruby (1.1.8)
connection_pool (2.2.3)
crass (1.0.6)
daemons (1.3.1)
dalli (2.7.10)
dalli (2.7.11)
diff-lcs (1.4.4)
erubi (1.9.0)
erubi (1.10.0)
exception_notification (4.4.3)
actionmailer (>= 4.0, < 7)
activesupport (>= 4.0, < 7)
execjs (2.7.0)
ffi (1.13.1)
ffi (1.13.1-java)
ffi (1.13.1-x86-mingw32)
ffi (1.14.2)
ffi (1.14.2-java)
ffi (1.14.2-x86-mingw32)
get_process_mem (0.2.7)
ffi (~> 1.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.8.5)
i18n (1.8.8)
concurrent-ruby (~> 1.0)
i18n-js (3.7.1)
i18n-js (3.8.0)
i18n (>= 0.6.6)
jbuilder (2.10.0)
jbuilder (2.11.2)
activesupport (>= 5.0.0)
jdbc-postgres (42.2.14)
kgio (2.11.3)
loofah (2.7.0)
loofah (2.9.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
@ -109,59 +113,59 @@ GEM
mimemagic (~> 0.3.2)
method_source (1.0.0)
mimemagic (0.3.5)
mini_magick (4.10.1)
mini_magick (4.11.0)
mini_mime (1.0.2)
mini_portile2 (2.5.0)
minitest (5.14.2)
newrelic_rpm (6.12.0.367)
nio4r (2.5.3)
nio4r (2.5.3-java)
nokogiri (1.11.0)
minitest (5.14.3)
newrelic_rpm (6.15.0)
nio4r (2.5.5)
nio4r (2.5.5-java)
nokogiri (1.11.1)
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
nokogiri (1.11.0-java)
nokogiri (1.11.1-java)
racc (~> 1.4)
nokogiri (1.11.0-x86-mingw32)
nokogiri (1.11.1-x86-mingw32)
racc (~> 1.4)
non-stupid-digest-assets (1.0.9)
sprockets (>= 2.0)
pg (1.2.3)
pg (1.2.3-x86-mingw32)
pry (0.13.1)
pry (0.14.0)
coderay (~> 1.1)
method_source (~> 1.0)
pry (0.13.1-java)
pry (0.14.0-java)
coderay (~> 1.1)
method_source (~> 1.0)
spoon (~> 0.0)
public_suffix (4.0.6)
puma (4.3.6)
puma (5.2.1)
nio4r (~> 2.0)
puma (4.3.6-java)
puma (5.2.1-java)
nio4r (~> 2.0)
racc (1.5.2)
racc (1.5.2-java)
rack (2.2.3)
rack-mini-profiler (2.0.4)
rack-mini-profiler (2.3.1)
rack (>= 1.2.0)
rack-proxy (0.6.5)
rack
rack-test (1.1.0)
rack (>= 1.0, < 3)
rails (6.0.3.3)
actioncable (= 6.0.3.3)
actionmailbox (= 6.0.3.3)
actionmailer (= 6.0.3.3)
actionpack (= 6.0.3.3)
actiontext (= 6.0.3.3)
actionview (= 6.0.3.3)
activejob (= 6.0.3.3)
activemodel (= 6.0.3.3)
activerecord (= 6.0.3.3)
activestorage (= 6.0.3.3)
activesupport (= 6.0.3.3)
bundler (>= 1.3.0)
railties (= 6.0.3.3)
rails (6.1.2.1)
actioncable (= 6.1.2.1)
actionmailbox (= 6.1.2.1)
actionmailer (= 6.1.2.1)
actionpack (= 6.1.2.1)
actiontext (= 6.1.2.1)
actionview (= 6.1.2.1)
activejob (= 6.1.2.1)
activemodel (= 6.1.2.1)
activerecord (= 6.1.2.1)
activestorage (= 6.1.2.1)
activesupport (= 6.1.2.1)
bundler (>= 1.15.0)
railties (= 6.1.2.1)
sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.5)
actionpack (>= 5.0.1.rc1)
@ -175,14 +179,14 @@ GEM
rails-i18n (6.0.0)
i18n (>= 0.7, < 2)
railties (>= 6.0.0, < 7)
railties (6.0.3.3)
actionpack (= 6.0.3.3)
activesupport (= 6.0.3.3)
railties (6.1.2.1)
actionpack (= 6.1.2.1)
activesupport (= 6.1.2.1)
method_source
rake (>= 0.8.7)
thor (>= 0.20.3, < 2.0)
thor (~> 1.0)
raindrops (0.19.1)
rake (13.0.1)
rake (13.0.3)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
sassc (2.4.0)
@ -193,7 +197,7 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
semantic_range (2.3.0)
semantic_range (2.3.1)
sitemap_generator (6.1.2)
builder (~> 3.0)
spoon (0.0.6)
@ -205,15 +209,13 @@ GEM
actionpack (>= 4.0)
activesupport (>= 4.0)
sprockets (>= 3.0.0)
thor (1.0.1)
thread_safe (0.3.6)
thread_safe (0.3.6-java)
thor (1.1.0)
tilt (2.0.10)
tzinfo (1.2.7)
thread_safe (~> 0.1)
tzinfo (2.0.4)
concurrent-ruby (~> 1.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicorn (5.7.0)
unicorn (5.8.0)
kgio (~> 2.6)
raindrops (~> 0.7)
unicorn-worker-killer (0.4.4)
@ -231,7 +233,7 @@ GEM
websocket-extensions (0.1.5)
will-paginate-i18n (0.1.15)
will_paginate (3.3.0)
zeitwerk (2.4.0)
zeitwerk (2.4.2)
PLATFORMS
java
@ -259,7 +261,7 @@ DEPENDENCIES
pry
puma
rack-mini-profiler
rails (~> 6.0.0)
rails (~> 6.1.0)
rails-controller-testing
rails-i18n
sass-rails

View File

@ -258,12 +258,10 @@ class UserController < ApplicationController
UserMailer.new_password(@user, new_password).deliver_now
respond_to_success("Password reset. Check your email in a few minutes.",
{ :action => "login" }, :api => { :result => "success" })
return
end
rescue Net::SMTPSyntaxError, Net::SMTPFatalError
respond_to_success("Your email address was invalid",
{ :action => "login" }, :api => { :result => "invalid-email" })
return
end
else
@user = User.new

View File

@ -52,7 +52,7 @@ module Post::TagMethods
m.before_save :commit_metatags
m.after_save :commit_tags
m.after_save :save_post_history
m.has_many :tag_history, lambda { order "id DESC" }, :class_name => "PostTagHistory", :table_name => "post_tag_histories"
m.has_many :tag_history, lambda { order "id DESC" }, :class_name => "PostTagHistory"
m.versioned :source, :default => ""
m.versioned :cached_tags
end

View File

@ -205,6 +205,6 @@
<% cache "forum_posts_latest", :skip_digest => true do %>
<script id="forum-posts-latest" type="application/json">
<%= json_escape render("layouts/menu_forum_listing.json").html_safe %>
<%= json_escape render(partial: "layouts/menu_forum_listing", formats: :json).html_safe %>
</script>
<% end %>

View File

@ -1,4 +1,4 @@
#!/usr/bin/env ruby
APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot'
require 'rails/commands'
require_relative "../config/boot"
require "rails/commands"

View File

@ -1,4 +1,4 @@
#!/usr/bin/env ruby
require_relative '../config/boot'
require 'rake'
require_relative "../config/boot"
require "rake"
Rake.application.run

View File

@ -1,5 +1,5 @@
#!/usr/bin/env ruby
require 'fileutils'
require "fileutils"
# path to your application root.
APP_ROOT = File.expand_path('..', __dir__)
@ -9,8 +9,8 @@ def system!(*args)
end
FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically.
# This script is idempotent, so that you can run it at anytime and get an expectable outcome.
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.
puts '== Installing dependencies =='
@ -18,7 +18,7 @@ FileUtils.chdir APP_ROOT do
system('bundle check') || system!('bundle install')
# Install JavaScript dependencies
# system('bin/yarn')
system! 'bin/yarn'
# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')

View File

@ -1,9 +1,15 @@
#!/usr/bin/env ruby
APP_ROOT = File.expand_path('..', __dir__)
Dir.chdir(APP_ROOT) do
begin
exec "yarnpkg", *ARGV
rescue Errno::ENOENT
yarn = ENV["PATH"].split(File::PATH_SEPARATOR).
select { |dir| File.expand_path(dir) != __dir__ }.
product(["yarn", "yarn.cmd", "yarn.ps1"]).
map { |dir, file| File.expand_path(file, dir) }.
find { |file| File.executable?(file) }
if yarn
exec yarn, *ARGV
else
$stderr.puts "Yarn executable was not detected in the system."
$stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install"
exit 1

View File

@ -5,14 +5,16 @@ if defined? Unicorn
use Unicorn::WorkerKiller::Oom, (384*(1024**2)), (512*(1024**2))
end
require ::File.expand_path("../config/environment", __FILE__)
require_relative "config/environment"
# Passenger hates map. And only it, AFAICT.
if defined? PhusionPassenger
run Moebooru::Application
run Rails.application
Rails.application.load_server
else
ENV["RAILS_RELATIVE_URL_ROOT"] ||= "/"
map ENV["RAILS_RELATIVE_URL_ROOT"] do
run Moebooru::Application
run Rails.application
Rails.application.load_server
end
end

View File

@ -12,7 +12,7 @@ Bundler.require(*CONFIG['bundler_groups'])
module Moebooru
class Application < Rails::Application
config.load_defaults 6.0
config.load_defaults 6.1
config.active_record.belongs_to_required_by_default = false
# Settings in config/environments/* take precedence over those specified here.
# Application configuration can go into files in config/initializers
@ -23,7 +23,7 @@ module Moebooru
# config.autoload_paths += %W(#{config.root}/extras)
# Also load files in lib/ in addition to app/.
config.eager_load_paths += ["#{config.root}/lib"]
config.eager_load_paths << Rails.root.join('lib')
# Only load the plugins named here, in the order given (default is alphabetical).
# :all can be used as a placeholder for all plugins not explicitly named.
@ -44,7 +44,7 @@ module Moebooru
config.active_record.schema_format = :sql
if CONFIG["memcache_servers"]
config.cache_store = :dalli_store, CONFIG["memcache_servers"], {
config.cache_store = :mem_cache_store, CONFIG["memcache_servers"], {
:namespace => CONFIG["app_name"],
:pool_size => CONFIG["threads"],
:value_max_bytes => 2_000_000

View File

@ -1,8 +1,10 @@
require "active_support/core_ext/integer/time"
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
# every request. This slows down response time but is perfect for development
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
@ -14,19 +16,19 @@ Rails.application.configure do
# Enable/disable caching. By default caching is disabled.
# Run rails dev:cache to toggle caching.
if true || Rails.root.join('tmp', 'caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.action_controller.enable_fragment_cache_logging = true
# if Rails.root.join('tmp', 'caching-dev.txt').exist?
# config.action_controller.perform_caching = true
# config.action_controller.enable_fragment_cache_logging = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => "public, max-age=#{2.days.to_i}"
}
else
config.action_controller.perform_caching = false
# config.cache_store = :memory_store
# config.public_file_server.headers = {
# 'Cache-Control' => "public, max-age=#{2.days.to_i}"
# }
# else
# config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# 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
@ -39,6 +41,12 @@ Rails.application.configure do
# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raise an error on page load if there are pending migrations.
config.active_record.migration_error = :page_load
@ -54,9 +62,15 @@ Rails.application.configure do
config.assets.quiet = true
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = 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
# Uncomment if you wish to allow Action Cable access from any origin.
# config.action_cable.disable_request_forgery_protection = true
end

View File

@ -1,3 +1,5 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
@ -30,7 +32,7 @@ Rails.application.configure do
config.assets.compile = false
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
# config.action_controller.asset_host = 'http://assets.example.com'
# config.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
@ -74,6 +76,12 @@ Rails.application.configure do
# Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify
# Log disallowed deprecations.
config.active_support.disallowed_deprecation = :log
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new

View File

@ -1,3 +1,5 @@
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
@ -43,6 +45,15 @@ Rails.application.configure do
# Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr
# Raise exceptions for disallowed deprecations.
config.active_support.disallowed_deprecation = :raise
# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []
# Raises error for missing translations.
# config.action_view.raise_on_missing_translations = true
# config.i18n.raise_on_missing_translations = true
# Annotate rendered view with file names.
# config.action_view.annotate_rendered_view_with_filenames = true
end

View File

@ -1,7 +1,8 @@
# Be sure to restart your server when you modify this file.
# You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
# Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
# Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) }
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
# Rails.backtrace_cleaner.remove_silencers!
# You can also remove all the silencers if you're trying to debug a problem that might stem from framework code
# by setting BACKTRACE=1 before calling your invocation, like "BACKTRACE=1 ./bin/rails runner 'MyClass.perform'".
Rails.backtrace_cleaner.remove_silencers! if ENV["BACKTRACE"]

View File

@ -1,4 +1,6 @@
# 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, :secret]
Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View File

@ -0,0 +1,11 @@
# Define an application-wide HTTP permissions policy. For further
# information see https://developers.google.com/web/updates/2018/06/feature-policy
#
# Rails.application.config.permissions_policy do |f|
# f.camera :none
# f.gyroscope :none
# f.microphone :none
# f.usb :none
# f.fullscreen :self
# f.payment :self, "https://secure.example.com"
# end

View File

@ -23,7 +23,7 @@ class PostControllerTest < ActionController::TestCase
get :upload, :session => { :user_id => 3 }
assert_response :success
post :create, :params => { :post => { :source => "", :file => fixture_file_upload("../mocks/test/test1.jpg"), :tags => "hoge", :rating => "Safe" } }
post :create, :params => { :post => { :source => "", :file => fixture_file_upload("../../mocks/test/test1.jpg"), :tags => "hoge", :rating => "Safe" } }
p = Post.last
assert_equal("hoge", p.cached_tags)
assert_equal("jpg", p.file_ext)

0
test/fixtures/files/.keep vendored Normal file
View File