From 26612f480da6c96a614543e53a7197efb61ecaf8 Mon Sep 17 00:00:00 2001 From: Justin Coyne Date: Mon, 16 Dec 2019 22:42:02 -0600 Subject: [PATCH] Freeze all the strings This will help us be prepared for Ruby 3 --- .rubocop.yml | 3 --- app/channels/application_cable/channel.rb | 2 ++ app/channels/application_cable/connection.rb | 2 ++ app/controllers/application_controller.rb | 2 ++ app/controllers/bundle_contexts_controller.rb | 2 ++ app/controllers/job_runs_controller.rb | 2 ++ app/helpers/application_helper.rb | 2 ++ app/jobs/application_job.rb | 2 ++ app/jobs/discovery_report_job.rb | 2 ++ app/jobs/preassembly_job.rb | 2 ++ app/lib/csv_importer.rb | 2 ++ app/lib/pre_assembly/assembly_directory.rb | 2 ++ app/lib/pre_assembly/bundle.rb | 2 ++ app/lib/pre_assembly/content_metadata_creator.rb | 2 ++ app/lib/pre_assembly/copy_stager.rb | 2 ++ app/lib/pre_assembly/digital_object.rb | 2 ++ app/lib/pre_assembly/link_stager.rb | 2 ++ app/lib/pre_assembly/logging.rb | 6 ++++-- app/lib/pre_assembly/media.rb | 2 ++ .../media_project_technical_metadata_creator.rb | 2 ++ app/lib/pre_assembly/object_file.rb | 2 ++ app/mailers/application_mailer.rb | 2 ++ app/mailers/job_mailer.rb | 2 ++ app/models/application_record.rb | 2 ++ app/models/bundle_context.rb | 2 ++ app/models/job_run.rb | 2 ++ app/models/user.rb | 2 ++ app/services/discovery_report.rb | 2 ++ app/services/object_file_validator.rb | 2 ++ config/application.rb | 2 ++ config/boot.rb | 2 ++ config/deploy.rb | 2 ++ config/deploy/prod.rb | 2 ++ config/deploy/stage.rb | 2 ++ config/environment.rb | 2 ++ config/initializers/application_controller_renderer.rb | 1 + config/initializers/assets.rb | 2 ++ config/initializers/backtrace_silencers.rb | 1 + config/initializers/config.rb | 2 ++ config/initializers/content_security_policy.rb | 1 + config/initializers/cookies_serializer.rb | 2 ++ config/initializers/dor_config.rb | 2 ++ config/initializers/filter_parameter_logging.rb | 2 ++ config/initializers/inflections.rb | 1 + config/initializers/load_config.rb | 2 ++ config/initializers/mime_types.rb | 1 + config/initializers/okcomputer.rb | 2 ++ config/initializers/resque.rb | 2 ++ config/initializers/wrap_parameters.rb | 2 ++ config/puma.rb | 2 ++ config/routes.rb | 2 ++ config/spring.rb | 2 ++ lib/dev_shibboleth_headers.rb | 2 ++ lib/tasks/resque.rake | 2 ++ spec/controllers/bundle_contexts_controller_spec.rb | 2 ++ spec/controllers/job_runs_controller_spec.rb | 2 ++ spec/factories/bundle_contexts.rb | 2 ++ spec/factories/job_runs.rb | 2 ++ spec/factories/users.rb | 2 ++ spec/jobs/discovery_report_job_spec.rb | 2 ++ spec/jobs/preassembly_job_spec.rb | 2 ++ spec/lib/csv_importer_spec.rb | 2 ++ spec/lib/pre_assembly/assembly_directory_spec.rb | 2 ++ spec/lib/pre_assembly/bundle_spec.rb | 2 ++ spec/lib/pre_assembly/content_metadata_creator_spec.rb | 2 ++ spec/lib/pre_assembly/digital_object_spec.rb | 2 ++ .../media_project_technical_metadata_creator_spec.rb | 2 ++ spec/lib/pre_assembly/media_spec.rb | 2 ++ spec/lib/pre_assembly/object_file_spec.rb | 2 ++ spec/mailers/job_mailer_spec.rb | 2 ++ spec/models/bundle_context_spec.rb | 2 ++ spec/models/job_run_spec.rb | 2 ++ spec/models/user_spec.rb | 2 ++ spec/rails_helper.rb | 2 ++ spec/services/discovery_report_spec.rb | 2 ++ spec/services/object_file_validator_spec.rb | 2 ++ spec/spec_helper.rb | 2 ++ spec/support/bundle_setup.rb | 2 ++ spec/support/devise.rb | 2 ++ spec/views/bundle_context_spec.rb | 2 ++ spec/views/bundle_contexts/new.html.erb_spec.rb | 2 ++ spec/views/bundle_contexts/show.html.erb_spec.rb | 2 ++ spec/views/job_runs/index.html.erb_spec.rb | 2 ++ spec/views/job_runs/index.json.jbuilder_spec.rb | 2 ++ spec/views/job_runs/show.html.erb_spec.rb | 2 ++ spec/views/shared/_header_spec.rb | 2 ++ 86 files changed, 167 insertions(+), 5 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index a415d379..96754d36 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -60,9 +60,6 @@ RSpec/MultipleExpectations: RSpec/NestedGroups: Max: 4 # default: 3 -Style/FrozenStringLiteralComment: - Enabled: false - Style/NumericPredicate: # "> 0" is not less readable than ".positive?" Enabled: false diff --git a/app/channels/application_cable/channel.rb b/app/channels/application_cable/channel.rb index d6726972..9aec2305 100644 --- a/app/channels/application_cable/channel.rb +++ b/app/channels/application_cable/channel.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Channel < ActionCable::Channel::Base end diff --git a/app/channels/application_cable/connection.rb b/app/channels/application_cable/connection.rb index 0ff5442f..8d6c2a1b 100644 --- a/app/channels/application_cable/connection.rb +++ b/app/channels/application_cable/connection.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module ApplicationCable class Connection < ActionCable::Connection::Base end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 328f1d18..4108e096 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationController < ActionController::Base before_action :authenticate_user! # ensures that remote user is logged in locally (via database) end diff --git a/app/controllers/bundle_contexts_controller.rb b/app/controllers/bundle_contexts_controller.rb index f9d000f6..89f01faa 100644 --- a/app/controllers/bundle_contexts_controller.rb +++ b/app/controllers/bundle_contexts_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BundleContextsController < ApplicationController def new @bundle_context = BundleContext.new( diff --git a/app/controllers/job_runs_controller.rb b/app/controllers/job_runs_controller.rb index f1e5ee04..ef35a24c 100644 --- a/app/controllers/job_runs_controller.rb +++ b/app/controllers/job_runs_controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class JobRunsController < ApplicationController def create raise ActionController::ParameterMissing, :bundle_context_id unless job_run_params[:bundle_context_id] diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index de6be794..15b06f0f 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + module ApplicationHelper end diff --git a/app/jobs/application_job.rb b/app/jobs/application_job.rb index a009ace5..d92ffddc 100644 --- a/app/jobs/application_job.rb +++ b/app/jobs/application_job.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + class ApplicationJob < ActiveJob::Base end diff --git a/app/jobs/discovery_report_job.rb b/app/jobs/discovery_report_job.rb index d548e325..1dd0bfa6 100644 --- a/app/jobs/discovery_report_job.rb +++ b/app/jobs/discovery_report_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class DiscoveryReportJob < ApplicationJob queue_as :discovery_report diff --git a/app/jobs/preassembly_job.rb b/app/jobs/preassembly_job.rb index e549bfab..f3611437 100644 --- a/app/jobs/preassembly_job.rb +++ b/app/jobs/preassembly_job.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class PreassemblyJob < ApplicationJob queue_as :preassembly diff --git a/app/lib/csv_importer.rb b/app/lib/csv_importer.rb index 04cd92a0..a8fd5c2e 100644 --- a/app/lib/csv_importer.rb +++ b/app/lib/csv_importer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class CsvImporter # load CSV allowing UTF-8 to pass through, deleting blank columns # @param [String] filename diff --git a/app/lib/pre_assembly/assembly_directory.rb b/app/lib/pre_assembly/assembly_directory.rb index 1f33ef44..c1b1c789 100644 --- a/app/lib/pre_assembly/assembly_directory.rb +++ b/app/lib/pre_assembly/assembly_directory.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly # Represents the assembly structure on the filesystem class AssemblyDirectory diff --git a/app/lib/pre_assembly/bundle.rb b/app/lib/pre_assembly/bundle.rb index 31b864b1..a1afaabe 100644 --- a/app/lib/pre_assembly/bundle.rb +++ b/app/lib/pre_assembly/bundle.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly class Bundle include PreAssembly::Logging diff --git a/app/lib/pre_assembly/content_metadata_creator.rb b/app/lib/pre_assembly/content_metadata_creator.rb index 84c7a1b5..cab859be 100644 --- a/app/lib/pre_assembly/content_metadata_creator.rb +++ b/app/lib/pre_assembly/content_metadata_creator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly class ContentMetadataCreator def initialize(druid_id:, content_md_creation:, object_files:, content_md_creation_style:, media_manifest:) diff --git a/app/lib/pre_assembly/copy_stager.rb b/app/lib/pre_assembly/copy_stager.rb index 01fda695..46d0a0e2 100644 --- a/app/lib/pre_assembly/copy_stager.rb +++ b/app/lib/pre_assembly/copy_stager.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly class CopyStager def self.stage(source, destination) diff --git a/app/lib/pre_assembly/digital_object.rb b/app/lib/pre_assembly/digital_object.rb index 9de32f72..6757aff8 100644 --- a/app/lib/pre_assembly/digital_object.rb +++ b/app/lib/pre_assembly/digital_object.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly class DigitalObject include PreAssembly::Logging diff --git a/app/lib/pre_assembly/link_stager.rb b/app/lib/pre_assembly/link_stager.rb index 1a898b2a..3b16caa4 100644 --- a/app/lib/pre_assembly/link_stager.rb +++ b/app/lib/pre_assembly/link_stager.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly class LinkStager def self.stage(source, destination) diff --git a/app/lib/pre_assembly/logging.rb b/app/lib/pre_assembly/logging.rb index f0a3101d..a31f4aed 100644 --- a/app/lib/pre_assembly/logging.rb +++ b/app/lib/pre_assembly/logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly module Logging LEVELS = { @@ -8,8 +10,8 @@ module Logging debug: Logger::DEBUG }.freeze - LOG_FORMAT = "%-6s -- %s -- %s\n".freeze - TIME_FORMAT = '%Y-%m-%d %H:%M:%S'.freeze + LOG_FORMAT = "%-6s -- %s -- %s\n" + TIME_FORMAT = '%Y-%m-%d %H:%M:%S' @@log ||= Logger.new(File.join(Rails.root, 'log', "#{Rails.env}.log")) @@log.level = LEVELS[:info] diff --git a/app/lib/pre_assembly/media.rb b/app/lib/pre_assembly/media.rb index db56ebe2..a976a8e7 100644 --- a/app/lib/pre_assembly/media.rb +++ b/app/lib/pre_assembly/media.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This class generates contentMetadata from a Media supplied manifest # see the "SMPL Content" section here for a description of the manifest: # https://consul.stanford.edu/pages/viewpage.action?pageId=136365158#AutomatedAccessioningandObjectRemediation(pre-assemblyandassembly)-SMPLContent diff --git a/app/lib/pre_assembly/media_project_technical_metadata_creator.rb b/app/lib/pre_assembly/media_project_technical_metadata_creator.rb index 49a35a68..f21c2715 100644 --- a/app/lib/pre_assembly/media_project_technical_metadata_creator.rb +++ b/app/lib/pre_assembly/media_project_technical_metadata_creator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly # Looks for *_techmd.xml files in the bundle_dir and concatenates them class MediaProjectTechnicalMetadataCreator diff --git a/app/lib/pre_assembly/object_file.rb b/app/lib/pre_assembly/object_file.rb index 183bf06f..831580f2 100644 --- a/app/lib/pre_assembly/object_file.rb +++ b/app/lib/pre_assembly/object_file.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module PreAssembly class ObjectFile < Assembly::ObjectFile include ActiveModel::AttributeMethods diff --git a/app/mailers/application_mailer.rb b/app/mailers/application_mailer.rb index e5970986..0e60eb2f 100644 --- a/app/mailers/application_mailer.rb +++ b/app/mailers/application_mailer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationMailer < ActionMailer::Base default from: 'no-reply-preassembly@.stanford.edu' layout 'mailer' diff --git a/app/mailers/job_mailer.rb b/app/mailers/job_mailer.rb index 75abcf00..fad765c7 100644 --- a/app/mailers/job_mailer.rb +++ b/app/mailers/job_mailer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class JobMailer < ApplicationMailer default from: 'no-reply-preassembly-job@stanford.edu' diff --git a/app/models/application_record.rb b/app/models/application_record.rb index 10a4cba8..71fbba5b 100644 --- a/app/models/application_record.rb +++ b/app/models/application_record.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ApplicationRecord < ActiveRecord::Base self.abstract_class = true end diff --git a/app/models/bundle_context.rb b/app/models/bundle_context.rb index 570637fe..8d9a88e8 100644 --- a/app/models/bundle_context.rb +++ b/app/models/bundle_context.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class BundleContext < ApplicationRecord belongs_to :user has_many :job_runs, dependent: :destroy diff --git a/app/models/job_run.rb b/app/models/job_run.rb index dc9eba8f..baf667f9 100644 --- a/app/models/job_run.rb +++ b/app/models/job_run.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class JobRun < ApplicationRecord belongs_to :bundle_context validates :job_type, presence: true diff --git a/app/models/user.rb b/app/models/user.rb index 51c0dbe8..f68c35f0 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class User < ApplicationRecord devise :remote_user_authenticatable # We don't want other (default) Devise modules has_many :bundle_contexts, dependent: :destroy diff --git a/app/services/discovery_report.rb b/app/services/discovery_report.rb index f0ebd9cc..c37c00a1 100644 --- a/app/services/discovery_report.rb +++ b/app/services/discovery_report.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Previously a single untested 200-line method from ./lib/pre_assembly/reporting.rb # Takes a Bundle, enumerates report data via #each_row class DiscoveryReport diff --git a/app/services/object_file_validator.rb b/app/services/object_file_validator.rb index f570e575..b0447026 100644 --- a/app/services/object_file_validator.rb +++ b/app/services/object_file_validator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ObjectFileValidator def initialize(object:, bundle:) @object = object diff --git a/config/application.rb b/config/application.rb index 123af39a..b50d5c6d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require_relative 'boot' require 'rails/all' diff --git a/config/boot.rb b/config/boot.rb index 30f5120d..30e594e2 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require 'bundler/setup' # Set up gems listed in the Gemfile. diff --git a/config/deploy.rb b/config/deploy.rb index 16bef2aa..b2f6f045 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :application, 'pre-assembly' set :repo_url, 'ssh://git@github.com/sul-dlss/pre-assembly' diff --git a/config/deploy/prod.rb b/config/deploy/prod.rb index 107c3afe..b941680e 100644 --- a/config/deploy/prod.rb +++ b/config/deploy/prod.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + server 'sul-preassembly-prod.stanford.edu', user: 'preassembly', roles: %w[web app db] Capistrano::OneTimeKey.generate_one_time_key! diff --git a/config/deploy/stage.rb b/config/deploy/stage.rb index cc7cb9e6..79cadd38 100644 --- a/config/deploy/stage.rb +++ b/config/deploy/stage.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + server 'sul-preassembly-stage.stanford.edu', user: 'preassembly', roles: %w[web app db] Capistrano::OneTimeKey.generate_one_time_key! diff --git a/config/environment.rb b/config/environment.rb index 426333bb..d5abe558 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load the Rails application. require_relative 'application' diff --git a/config/initializers/application_controller_renderer.rb b/config/initializers/application_controller_renderer.rb index 89d2efab..f4556db3 100644 --- a/config/initializers/application_controller_renderer.rb +++ b/config/initializers/application_controller_renderer.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index 4b828e80..a9b0d0f1 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # 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. diff --git a/config/initializers/backtrace_silencers.rb b/config/initializers/backtrace_silencers.rb index 59385cdf..d0f0d3b5 100644 --- a/config/initializers/backtrace_silencers.rb +++ b/config/initializers/backtrace_silencers.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # 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. diff --git a/config/initializers/config.rb b/config/initializers/config.rb index 623201d3..ce3af8c5 100644 --- a/config/initializers/config.rb +++ b/config/initializers/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Config.setup do |config| # Name of the constant exposing loaded settings config.const_name = 'Settings' diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb index d3bcaa5e..497f5667 100644 --- a/config/initializers/content_security_policy.rb +++ b/config/initializers/content_security_policy.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Define an application-wide content security policy diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 5a6a32d3..ee8dff9c 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. diff --git a/config/initializers/dor_config.rb b/config/initializers/dor_config.rb index 809ecc07..6dd56ec5 100644 --- a/config/initializers/dor_config.rb +++ b/config/initializers/dor_config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'dor-services' Dor::Config.configure do diff --git a/config/initializers/filter_parameter_logging.rb b/config/initializers/filter_parameter_logging.rb index 4a994e1e..7a4f47b4 100644 --- a/config/initializers/filter_parameter_logging.rb +++ b/config/initializers/filter_parameter_logging.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. diff --git a/config/initializers/inflections.rb b/config/initializers/inflections.rb index ac033bf9..aa7435fb 100644 --- a/config/initializers/inflections.rb +++ b/config/initializers/inflections.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections diff --git a/config/initializers/load_config.rb b/config/initializers/load_config.rb index a4a7a0e7..3810bf3a 100644 --- a/config/initializers/load_config.rb +++ b/config/initializers/load_config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + bundle_dir_roots = YAML.safe_load(ERB.new(File.read("#{Rails.root}/config/initializers/bundle_dir_roots.yml.erb")).result)[Rails.env] ALLOWABLE_BUNDLE_DIRS = bundle_dir_roots.map { |path| path.chomp('/') } diff --git a/config/initializers/mime_types.rb b/config/initializers/mime_types.rb index dc189968..6e1d16f0 100644 --- a/config/initializers/mime_types.rb +++ b/config/initializers/mime_types.rb @@ -1,3 +1,4 @@ +# frozen_string_literal: true # Be sure to restart your server when you modify this file. # Add new mime types for use in respond_to blocks: diff --git a/config/initializers/okcomputer.rb b/config/initializers/okcomputer.rb index 62e0c402..bb9d994f 100644 --- a/config/initializers/okcomputer.rb +++ b/config/initializers/okcomputer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # by default, okcomputer does "app up?" and "database conntected?" checks OkComputer.mount_at = 'status' # use /status or /status/all or /status/ OkComputer.check_in_parallel = true diff --git a/config/initializers/resque.rb b/config/initializers/resque.rb index eabf8f5c..e6e747c3 100644 --- a/config/initializers/resque.rb +++ b/config/initializers/resque.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'resque/failure/redis_multi_queue' # load environment specific configuration diff --git a/config/initializers/wrap_parameters.rb b/config/initializers/wrap_parameters.rb index bbfc3961..2f3c0db4 100644 --- a/config/initializers/wrap_parameters.rb +++ b/config/initializers/wrap_parameters.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which diff --git a/config/puma.rb b/config/puma.rb index f1230396..940c8ba4 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # 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 diff --git a/config/routes.rb b/config/routes.rb index 3eb63608..e71f3831 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'resque/server' Rails.application.routes.draw do # For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html diff --git a/config/spring.rb b/config/spring.rb index 9fa7863f..c5933e49 100644 --- a/config/spring.rb +++ b/config/spring.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + %w[ .ruby-version .rbenv-vars diff --git a/lib/dev_shibboleth_headers.rb b/lib/dev_shibboleth_headers.rb index bed9ab51..8d024282 100644 --- a/lib/dev_shibboleth_headers.rb +++ b/lib/dev_shibboleth_headers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This is a Rack middleware that we use in development. It sets an env var in such a way as to # simulate the way mod_shib injects request headers that then result in an env var being set # for the request. diff --git a/lib/tasks/resque.rake b/lib/tasks/resque.rake index 6e34fd3f..ab2a7f8f 100644 --- a/lib/tasks/resque.rake +++ b/lib/tasks/resque.rake @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'resque/tasks' task 'resque:setup' => :environment diff --git a/spec/controllers/bundle_contexts_controller_spec.rb b/spec/controllers/bundle_contexts_controller_spec.rb index c84c05e1..ffc43895 100644 --- a/spec/controllers/bundle_contexts_controller_spec.rb +++ b/spec/controllers/bundle_contexts_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe BundleContextsController, type: :controller do let(:params) do { diff --git a/spec/controllers/job_runs_controller_spec.rb b/spec/controllers/job_runs_controller_spec.rb index 9d073123..295fa399 100644 --- a/spec/controllers/job_runs_controller_spec.rb +++ b/spec/controllers/job_runs_controller_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe JobRunsController, type: :controller do let(:bc) { create(:bundle_context_with_deleted_output_dir) } diff --git a/spec/factories/bundle_contexts.rb b/spec/factories/bundle_contexts.rb index e39c1815..523f7756 100644 --- a/spec/factories/bundle_contexts.rb +++ b/spec/factories/bundle_contexts.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :bundle_context do bundle_dir { 'spec/test_data/multimedia' } diff --git a/spec/factories/job_runs.rb b/spec/factories/job_runs.rb index 9a30bc57..fa44fba4 100644 --- a/spec/factories/job_runs.rb +++ b/spec/factories/job_runs.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :job_run do job_type { 'discovery_report' } diff --git a/spec/factories/users.rb b/spec/factories/users.rb index 0f290aaa..29b0d9f9 100644 --- a/spec/factories/users.rb +++ b/spec/factories/users.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + FactoryBot.define do factory :user do sequence(:sunet_id) { |n| "fake_#{n}" } diff --git a/spec/jobs/discovery_report_job_spec.rb b/spec/jobs/discovery_report_job_spec.rb index f9dff3da..dedf054e 100644 --- a/spec/jobs/discovery_report_job_spec.rb +++ b/spec/jobs/discovery_report_job_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe DiscoveryReportJob, type: :job do let(:job) { described_class.new } let(:job_run) { create(:job_run) } diff --git a/spec/jobs/preassembly_job_spec.rb b/spec/jobs/preassembly_job_spec.rb index 9f8ee0b7..6824383a 100644 --- a/spec/jobs/preassembly_job_spec.rb +++ b/spec/jobs/preassembly_job_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreassemblyJob, type: :job do let(:job) { described_class.new } let(:job_run) { create(:job_run) } diff --git a/spec/lib/csv_importer_spec.rb b/spec/lib/csv_importer_spec.rb index 3daf3f71..fb45388d 100644 --- a/spec/lib/csv_importer_spec.rb +++ b/spec/lib/csv_importer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe CsvImporter do describe '#parse_to_hash' do let(:manifest) do diff --git a/spec/lib/pre_assembly/assembly_directory_spec.rb b/spec/lib/pre_assembly/assembly_directory_spec.rb index c168223d..a9bd22d8 100644 --- a/spec/lib/pre_assembly/assembly_directory_spec.rb +++ b/spec/lib/pre_assembly/assembly_directory_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreAssembly::AssemblyDirectory do subject(:object) { described_class.new(druid_id: 'gn330dv6119') } diff --git a/spec/lib/pre_assembly/bundle_spec.rb b/spec/lib/pre_assembly/bundle_spec.rb index f626ea2c..a6d99168 100644 --- a/spec/lib/pre_assembly/bundle_spec.rb +++ b/spec/lib/pre_assembly/bundle_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreAssembly::Bundle do let(:md5_regex) { /^[0-9a-f]{32}$/ } let(:flat_dir_images) { bundle_setup(:flat_dir_images) } diff --git a/spec/lib/pre_assembly/content_metadata_creator_spec.rb b/spec/lib/pre_assembly/content_metadata_creator_spec.rb index 74021016..1b1d3faa 100644 --- a/spec/lib/pre_assembly/content_metadata_creator_spec.rb +++ b/spec/lib/pre_assembly/content_metadata_creator_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreAssembly::ContentMetadataCreator do subject(:object) do described_class.new(druid_id: druid_id, diff --git a/spec/lib/pre_assembly/digital_object_spec.rb b/spec/lib/pre_assembly/digital_object_spec.rb index dfaaca93..4e9b83a9 100644 --- a/spec/lib/pre_assembly/digital_object_spec.rb +++ b/spec/lib/pre_assembly/digital_object_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreAssembly::DigitalObject do subject(:object) do described_class.new(bc.bundle, object_files: [], stager: stager) diff --git a/spec/lib/pre_assembly/media_project_technical_metadata_creator_spec.rb b/spec/lib/pre_assembly/media_project_technical_metadata_creator_spec.rb index 0682ede7..fabbedcb 100644 --- a/spec/lib/pre_assembly/media_project_technical_metadata_creator_spec.rb +++ b/spec/lib/pre_assembly/media_project_technical_metadata_creator_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreAssembly::MediaProjectTechnicalMetadataCreator do subject(:creator) do described_class.new(pid: "druid:#{druid}", diff --git a/spec/lib/pre_assembly/media_spec.rb b/spec/lib/pre_assembly/media_spec.rb index 37a1994f..d0b92c71 100644 --- a/spec/lib/pre_assembly/media_spec.rb +++ b/spec/lib/pre_assembly/media_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreAssembly::Media do let(:bundle_dir) { Rails.root.join('spec/test_data/multimedia') } let(:bc_params) do diff --git a/spec/lib/pre_assembly/object_file_spec.rb b/spec/lib/pre_assembly/object_file_spec.rb index cae6ccf3..30ab3358 100644 --- a/spec/lib/pre_assembly/object_file_spec.rb +++ b/spec/lib/pre_assembly/object_file_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe PreAssembly::ObjectFile do let(:object_file) { described_class.new('spec/test_data/flat_dir_images/image1.tif') } diff --git a/spec/mailers/job_mailer_spec.rb b/spec/mailers/job_mailer_spec.rb index 91186785..b13a94a6 100644 --- a/spec/mailers/job_mailer_spec.rb +++ b/spec/mailers/job_mailer_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe JobMailer, type: :mailer do let(:job_run) { create(:job_run) } let(:job_notification) { described_class.with(job_run: job_run).completion_email } diff --git a/spec/models/bundle_context_spec.rb b/spec/models/bundle_context_spec.rb index 05ad3471..8adf077c 100644 --- a/spec/models/bundle_context_spec.rb +++ b/spec/models/bundle_context_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe BundleContext, type: :model do subject(:bc) { build(:bundle_context_with_deleted_output_dir, attr_hash) } diff --git a/spec/models/job_run_spec.rb b/spec/models/job_run_spec.rb index 7f1b771b..acc2ff30 100644 --- a/spec/models/job_run_spec.rb +++ b/spec/models/job_run_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe JobRun, type: :model do let(:job_run) { build(:job_run) } diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 30e4e011..c5385535 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe User, type: :model do subject(:user) { build(:user, sunet_id: 'jdoe') } diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 0811d7a2..10002df5 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # This file is copied to spec/ when you run 'rails generate rspec:install' require 'spec_helper' ENV['RAILS_ENV'] ||= 'test' diff --git a/spec/services/discovery_report_spec.rb b/spec/services/discovery_report_spec.rb index cc012862..acda95ec 100644 --- a/spec/services/discovery_report_spec.rb +++ b/spec/services/discovery_report_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe DiscoveryReport do subject(:report) { described_class.new(bundle) } diff --git a/spec/services/object_file_validator_spec.rb b/spec/services/object_file_validator_spec.rb index 3b522cf5..75872597 100644 --- a/spec/services/object_file_validator_spec.rb +++ b/spec/services/object_file_validator_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe ObjectFileValidator do subject(:validator) { described_class.new(object: object, bundle: bundle) } diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 12c84fa3..c6f232c5 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'tmpdir' require 'equivalent-xml/rspec_matchers' require 'byebug' diff --git a/spec/support/bundle_setup.rb b/spec/support/bundle_setup.rb index 69873d8f..8e8834fd 100644 --- a/spec/support/bundle_setup.rb +++ b/spec/support/bundle_setup.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # @return [PreAssembly::Bundle] def bundle_setup(proj) PreAssembly::Bundle.new(bundle_context_from_hash(proj)) diff --git a/spec/support/devise.rb b/spec/support/devise.rb index 9b9b34f3..5965cebc 100644 --- a/spec/support/devise.rb +++ b/spec/support/devise.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Devise provides helper method `sign_in(user)` to improve testability RSpec.configure do |config| config.include Devise::Test::ControllerHelpers, type: :controller diff --git a/spec/views/bundle_context_spec.rb b/spec/views/bundle_context_spec.rb index 14ba2ece..a346e498 100644 --- a/spec/views/bundle_context_spec.rb +++ b/spec/views/bundle_context_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe 'bundle_contexts/new' do context 'Displays the Bundle Context Form' do it 'displays the form correctly' do diff --git a/spec/views/bundle_contexts/new.html.erb_spec.rb b/spec/views/bundle_contexts/new.html.erb_spec.rb index 23bda2f5..eb4e8200 100644 --- a/spec/views/bundle_contexts/new.html.erb_spec.rb +++ b/spec/views/bundle_contexts/new.html.erb_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe 'bundle_contexts/new.html.erb', type: :view do let(:job_runs) { create_list(:job_run, 2) } diff --git a/spec/views/bundle_contexts/show.html.erb_spec.rb b/spec/views/bundle_contexts/show.html.erb_spec.rb index 1c0c06a1..b3180e0c 100644 --- a/spec/views/bundle_contexts/show.html.erb_spec.rb +++ b/spec/views/bundle_contexts/show.html.erb_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe 'bundle_contexts/show.html.erb', type: :view do let(:bc) { create(:bundle_context) } diff --git a/spec/views/job_runs/index.html.erb_spec.rb b/spec/views/job_runs/index.html.erb_spec.rb index d2563a95..eff5a5b7 100644 --- a/spec/views/job_runs/index.html.erb_spec.rb +++ b/spec/views/job_runs/index.html.erb_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe 'job_runs/index.html.erb', type: :view do let!(:job_runs) { create_list(:job_run, 2) } diff --git a/spec/views/job_runs/index.json.jbuilder_spec.rb b/spec/views/job_runs/index.json.jbuilder_spec.rb index 1c172584..06bda500 100644 --- a/spec/views/job_runs/index.json.jbuilder_spec.rb +++ b/spec/views/job_runs/index.json.jbuilder_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe 'job_runs/index.json.jbuilder' do let(:job_runs) { create_list(:job_run, 2) } diff --git a/spec/views/job_runs/show.html.erb_spec.rb b/spec/views/job_runs/show.html.erb_spec.rb index 4de647cc..3f87c7f1 100644 --- a/spec/views/job_runs/show.html.erb_spec.rb +++ b/spec/views/job_runs/show.html.erb_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe 'job_runs/show.html.erb', type: :view do let(:job_run) { create(:job_run) } diff --git a/spec/views/shared/_header_spec.rb b/spec/views/shared/_header_spec.rb index 69954693..a34fd927 100644 --- a/spec/views/shared/_header_spec.rb +++ b/spec/views/shared/_header_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + RSpec.describe 'shared/_header.erb' do context 'should have the right links on the header' do before { render }