Update dependencies (2021-10) (#23)

This commit is contained in:
Andrew Tomaka 2021-10-23 10:38:28 -04:00 committed by GitHub
parent e952ddc041
commit 46afb11171
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 171 additions and 89 deletions

View file

@ -2,19 +2,19 @@ require "bundler/gem_helper"
require "rspec/core/rake_task" require "rspec/core/rake_task"
require "rubocop/rake_task" require "rubocop/rake_task"
class ParameterStoreEnvRailsGemHelper < Bundler::GemHelper
def guard_already_tagged
end
def tag_version
end
end
namespace "psenv" do namespace "psenv" do
Bundler::GemHelper.install_tasks name: "psenv" Bundler::GemHelper.install_tasks name: "psenv"
end end
namespace "psenv-rails" do namespace "psenv-rails" do
class ParameterStoreEnvRailsGemHelper < Bundler::GemHelper
def guard_already_tagged
end
def tag_version
end
end
ParameterStoreEnvRailsGemHelper.install_tasks name: "psenv-rails" ParameterStoreEnvRailsGemHelper.install_tasks name: "psenv-rails"
end end

View file

@ -20,11 +20,10 @@ module Psenv
end end
def call def call
Hash[ parameters
parameters .map { |parameter| Parameter.new(parameter) }
.map { |parameter| Parameter.new(parameter) } .map { |parameter| [parameter.name, parameter.value] }
.map { |parameter| [parameter.name, parameter.value] } .to_h
]
end end
def self.call(path) def self.call(path)

View file

@ -22,5 +22,5 @@ Gem::Specification.new do |spec|
spec.require_paths = ["lib"] spec.require_paths = ["lib"]
spec.add_dependency "psenv", Psenv::VERSION spec.add_dependency "psenv", Psenv::VERSION
spec.add_dependency "railties", ">= 3.2", "<= 6.1" spec.add_dependency "railties", ">= 3.2", "< 6.2"
end end

View file

@ -21,8 +21,8 @@ Gem::Specification.new do |spec|
spec.add_development_dependency "pry" spec.add_development_dependency "pry"
spec.add_development_dependency "rake", ">= 12.3.3" spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "rspec", "~> 3.0" spec.add_development_dependency "rspec", "~> 3"
spec.add_development_dependency "standard", "~> 0.1.9" spec.add_development_dependency "standard"
spec.add_development_dependency "webmock", "~> 3.3" spec.add_development_dependency "webmock", "~> 3.3"
spec.add_dependency "aws-sdk-ssm", "~> 1" spec.add_dependency "aws-sdk-ssm", "~> 1"

View file

@ -2,7 +2,7 @@ source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" } git_source(:github) { |repo| "https://github.com/#{repo}.git" }
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 6.0.0" gem "rails", "6.1.4.1"
# Use Puma as the app server # Use Puma as the app server
gem "puma", ">= 4.3.8" gem "puma", ">= 4.3.8"
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder

View file

@ -30,7 +30,7 @@ m = Module.new {
if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN
bundler_version = a bundler_version = a
end end
next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/o
bundler_version = $1 || ">= 0.a" bundler_version = $1 || ">= 0.a"
update_index = i update_index = i
end end
@ -56,15 +56,13 @@ m = Module.new {
def lockfile_version def lockfile_version
return unless File.file?(lockfile) return unless File.file?(lockfile)
lockfile_contents = File.read(lockfile) lockfile_contents = File.read(lockfile)
return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/o
Regexp.last_match(1) Regexp.last_match(1)
end end
def bundler_version def bundler_version
@bundler_version ||= begin @bundler_version ||= env_var_version || cli_arg_version ||
env_var_version || cli_arg_version || lockfile_version || "#{Gem::Requirement.default}.a"
lockfile_version || "#{Gem::Requirement.default}.a"
end
end end
def load_bundler! def load_bundler!

View file

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError => e
raise unless e.message.include?("spring")
end
APP_PATH = File.expand_path("../config/application", __dir__) APP_PATH = File.expand_path("../config/application", __dir__)
require_relative "../config/boot" require_relative "../config/boot"
require "rails/commands" require "rails/commands"

View file

@ -1,9 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError => e
raise unless e.message.include?("spring")
end
require_relative "../config/boot" require_relative "../config/boot"
require "rake" require "rake"
Rake.application.run Rake.application.run

View file

@ -9,8 +9,8 @@ def system!(*args)
end end
FileUtils.chdir APP_ROOT do FileUtils.chdir APP_ROOT do
# This script is a way to setup or update your development environment automatically. # 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 anytime and get an expectable outcome. # 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. # Add necessary setup steps to this file.
puts "== Installing dependencies ==" puts "== Installing dependencies =="

View file

@ -1,17 +0,0 @@
#!/usr/bin/env ruby
# This file loads Spring without using Bundler, in order to be fast.
# It gets overwritten when you run the `spring binstub` command.
unless defined?(Spring)
require "rubygems"
require "bundler"
lockfile = Bundler::LockfileParser.new(Bundler.default_lockfile.read)
spring = lockfile.specs.detect { |spec| spec.name == "spring" }
if spring
Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path
gem "spring", spring.version
require "spring/binstub"
end
end

View file

@ -3,3 +3,4 @@
require_relative "config/environment" require_relative "config/environment"
run Rails.application run Rails.application
Rails.application.load_server

View file

@ -2,15 +2,15 @@ require_relative "boot"
require "rails" require "rails"
# Pick the frameworks you want: # Pick the frameworks you want:
# require "active_model/railtie" require "active_model/railtie"
# require "active_job/railtie" require "active_job/railtie"
# require "active_record/railtie" # require "active_record/railtie"
# require "active_storage/engine" # require "active_storage/engine"
# require "action_controller/railtie" require "action_controller/railtie"
# require "action_mailer/railtie" # require "action_mailer/railtie"
# require "action_mailbox/engine" # require "action_mailbox/engine"
# require "action_text/engine" # require "action_text/engine"
# require "action_view/railtie" require "action_view/railtie"
# require "action_cable/engine" # require "action_cable/engine"
# require "sprockets/railtie" # require "sprockets/railtie"
require "rails/test_unit/railtie" require "rails/test_unit/railtie"
@ -24,10 +24,13 @@ module PsenvTest
# Initialize configuration defaults for originally generated Rails version. # Initialize configuration defaults for originally generated Rails version.
config.load_defaults 6.0 config.load_defaults 6.0
# Settings in config/environments/* take precedence over those specified here. # Configuration for the application, engines, and railties goes here.
# Application configuration can go into files in config/initializers #
# -- all .rb files in that directory are automatically loaded after loading # These settings can be overridden in specific environments using the files
# the framework and any gems in your application. # in config/environments, which are processed later.
#
# config.time_zone = "Central Time (US & Canada)"
# config.eager_load_paths << Rails.root.join("extras")
# Only loads a smaller set of middleware suitable for API only apps. # Only loads a smaller set of middleware suitable for API only apps.
# Middleware like session, flash, cookies can be added back manually. # Middleware like session, flash, cookies can be added back manually.

View file

@ -1,8 +1,10 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
# In the development environment your application's code is reloaded on # In the development environment your application's code is reloaded any time
# every request. This slows down response time but is perfect for development # 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. # since you don't have to restart the web server when you make code changes.
config.cache_classes = false config.cache_classes = false
@ -17,10 +19,10 @@ Rails.application.configure do
if Rails.root.join("tmp", "caching-dev.txt").exist? if Rails.root.join("tmp", "caching-dev.txt").exist?
config.cache_store = :memory_store config.cache_store = :memory_store
config.public_file_server.headers = { config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{2.days.to_i}", "Cache-Control" => "public, max-age=#{2.days.to_i}"
} }
else else
# config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :null_store config.cache_store = :null_store
end end
@ -28,10 +30,22 @@ Rails.application.configure do
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log 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 = []
# Raises error for missing translations. # 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, # Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem. # routes, locales, etc. This feature depends on the listen gem.
config.file_watcher = ActiveSupport::EventedFileUpdateChecker 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 end

View file

@ -1,3 +1,5 @@
require "active_support/core_ext/integer/time"
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
@ -22,7 +24,7 @@ Rails.application.configure do
config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present? config.public_file_server.enabled = ENV["RAILS_SERVE_STATIC_FILES"].present?
# Enable serving of images, stylesheets, and JavaScripts from an asset server. # 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. # 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-Sendfile' # for Apache
@ -31,9 +33,9 @@ Rails.application.configure do
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
# config.force_ssl = true # config.force_ssl = true
# Use the lowest log level to ensure availability of diagnostic information # Include generic and useful information about system operation, but avoid logging too much
# when problems arise. # information to avoid inadvertent exposure of personally identifiable information (PII).
config.log_level = :debug config.log_level = :info
# Prepend all log lines with the following tags. # Prepend all log lines with the following tags.
config.log_tags = [:request_id] config.log_tags = [:request_id]
@ -52,15 +54,21 @@ Rails.application.configure do
# Send deprecation notices to registered listeners. # Send deprecation notices to registered listeners.
config.active_support.deprecation = :notify 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. # Use default logging formatter so that PID and timestamp are not suppressed.
config.log_formatter = ::Logger::Formatter.new config.log_formatter = ::Logger::Formatter.new
# Use a different logger for distributed setups. # Use a different logger for distributed setups.
# require 'syslog/logger' # require "syslog/logger"
# config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
if ENV["RAILS_LOG_TO_STDOUT"].present? if ENV["RAILS_LOG_TO_STDOUT"].present?
logger = ActiveSupport::Logger.new(STDOUT) logger = ActiveSupport::Logger.new($stdout)
logger.formatter = config.log_formatter logger.formatter = config.log_formatter
config.logger = ActiveSupport::TaggedLogging.new(logger) config.logger = ActiveSupport::TaggedLogging.new(logger)
end end

View file

@ -1,3 +1,5 @@
require "active_support/core_ext/integer/time"
# The test environment is used exclusively to run your application's # The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that # 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 # your test database is "scratch space" for the test suite and is wiped
@ -6,7 +8,7 @@
Rails.application.configure do Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb. # Settings specified here will take precedence over those in config/application.rb.
config.cache_classes = false config.cache_classes = true
# Do not eager load code on boot. This avoids loading your whole application # Do not eager load code on boot. This avoids loading your whole application
# just for the purpose of running a single test. If you are using a tool that # just for the purpose of running a single test. If you are using a tool that
@ -16,23 +18,32 @@ Rails.application.configure do
# Configure public file server for tests with Cache-Control for performance. # Configure public file server for tests with Cache-Control for performance.
config.public_file_server.enabled = true config.public_file_server.enabled = true
config.public_file_server.headers = { config.public_file_server.headers = {
"Cache-Control" => "public, max-age=#{1.hour.to_i}", "Cache-Control" => "public, max-age=#{1.hour.to_i}"
} }
# Show full error reports and disable caching. # Show full error reports and disable caching.
config.consider_all_requests_local = true config.consider_all_requests_local = true
# config.action_controller.perform_caching = false config.action_controller.perform_caching = false
config.cache_store = :null_store config.cache_store = :null_store
# Raise exceptions instead of rendering exception templates. # Raise exceptions instead of rendering exception templates.
config.action_dispatch.show_exceptions = false config.action_dispatch.show_exceptions = false
# Disable request forgery protection in test environment. # Disable request forgery protection in test environment.
# config.action_controller.allow_forgery_protection = false config.action_controller.allow_forgery_protection = false
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :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. # 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 end

View file

@ -1,7 +1,8 @@
# Be sure to restart your server when you modify this file. # 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. # 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. # 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! # 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. # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file. # Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password] Rails.application.config.filter_parameters += [
:passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn
]

View file

@ -0,0 +1,67 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 6.1 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Guide for Upgrading Ruby on Rails for more info on each option.
# Support for inversing belongs_to -> has_many Active Record associations.
# Rails.application.config.active_record.has_many_inversing = true
# Track Active Storage variants in the database.
# Rails.application.config.active_storage.track_variants = true
# Apply random variation to the delay when retrying failed jobs.
# Rails.application.config.active_job.retry_jitter = 0.15
# Stop executing `after_enqueue`/`after_perform` callbacks if
# `before_enqueue`/`before_perform` respectively halts with `throw :abort`.
# Rails.application.config.active_job.skip_after_callbacks_if_terminated = true
# Specify cookies SameSite protection level: either :none, :lax, or :strict.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_dispatch.cookies_same_site_protection = :lax
# Generate CSRF tokens that are encoded in URL-safe Base64.
#
# This change is not backwards compatible with earlier Rails versions.
# It's best enabled when your entire app is migrated and stable on 6.1.
# Rails.application.config.action_controller.urlsafe_csrf_tokens = true
# Specify whether `ActiveSupport::TimeZone.utc_to_local` returns a time with an
# UTC offset or a UTC time.
# ActiveSupport.utc_to_local_returns_utc_offset_times = true
# Change the default HTTP status code to `308` when redirecting non-GET/HEAD
# requests to HTTPS in `ActionDispatch::SSL` middleware.
# Rails.application.config.action_dispatch.ssl_default_redirect_status = 308
# Use new connection handling API. For most applications this won't have any
# effect. For applications using multiple databases, this new API provides
# support for granular connection swapping.
# Rails.application.config.active_record.legacy_connection_handling = false
# Make `form_with` generate non-remote forms by default.
# Rails.application.config.action_view.form_with_generates_remote_forms = false
# Set the default queue name for the analysis job to the queue adapter default.
# Rails.application.config.active_storage.queues.analysis = nil
# Set the default queue name for the purge job to the queue adapter default.
# Rails.application.config.active_storage.queues.purge = nil
# Set the default queue name for the incineration job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.incineration = nil
# Set the default queue name for the routing job to the queue adapter default.
# Rails.application.config.action_mailbox.queues.routing = nil
# Set the default queue name for the mail deliver job to the queue adapter default.
# Rails.application.config.action_mailer.deliver_later_queue_name = nil
# Generate a `Link` header that gives a hint to modern browsers about
# preloading assets when using `javascript_include_tag` and `stylesheet_link_tag`.
# Rails.application.config.action_view.preload_links_header = true

View file

@ -4,13 +4,18 @@
# the maximum value specified for Puma. Default is set to 5 threads for minimum # 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. # and maximum; this matches the default thread size of Active Record.
# #
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 } max_threads_count = ENV.fetch("RAILS_MAX_THREADS", 5)
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count } min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count threads min_threads_count, max_threads_count
# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch("RAILS_ENV", "development") == "development"
# Specifies the `port` that Puma will listen on to receive requests; default is 3000. # Specifies the `port` that Puma will listen on to receive requests; default is 3000.
# #
port ENV.fetch("PORT") { 3000 } port ENV.fetch("PORT", 3000)
# Specifies the `environment` that Puma will run in. # Specifies the `environment` that Puma will run in.
# #

View file

@ -9,7 +9,7 @@ RSpec.describe Psenv::Parameter do
name: "/psenv/test/VARIABLE", name: "/psenv/test/VARIABLE",
value: "value", value: "value",
type: "String", type: "String",
version: 1, version: 1
} }
end end
subject { Psenv::Parameter.new(parameter) } subject { Psenv::Parameter.new(parameter) }
@ -49,8 +49,8 @@ RSpec.describe Psenv::Retriever do
name: "/psenv/test/API_KEY", name: "/psenv/test/API_KEY",
value: "value", value: "value",
type: "String", type: "String",
version: 1, version: 1
}], }]
) )
} }
end end
@ -68,7 +68,7 @@ RSpec.describe Psenv::Retriever do
name: "/psenv/test/API_KEY", name: "/psenv/test/API_KEY",
value: "value", value: "value",
type: "String", type: "String",
version: 1, version: 1
}], }],
next_page?: true, next_page?: true,
next_page: OpenStruct.new( next_page: OpenStruct.new(
@ -76,9 +76,9 @@ RSpec.describe Psenv::Retriever do
name: "/psenv/test/CLIENT_KEY", name: "/psenv/test/CLIENT_KEY",
value: "value", value: "value",
type: "String", type: "String",
version: 1, version: 1
}], }]
), )
) )
} }
end end