From 61915cdaab387cfedd92bf25f35e2eb69ecd8f87 Mon Sep 17 00:00:00 2001 From: Alexey Vasiliev Date: Sun, 16 Aug 2020 22:08:50 +0300 Subject: [PATCH] Update rubocop + use enable-frozen-string-literal (#2354) --- .rubocop.yml | 21 ++++++++---- .travis.yml | 4 +-- Gemfile | 4 +-- Gemfile.lock | 32 +++++++++++-------- Rakefile | 4 +-- middleman-cli/Rakefile | 6 ++-- middleman-cli/bin/middleman | 1 + middleman-cli/features/support/env.rb | 2 ++ .../preview-server-app/bin/dns_server.rb | 1 + .../preview-server-hook-app/config.rb | 2 ++ middleman-cli/lib/middleman-cli.rb | 2 ++ middleman-cli/lib/middleman-cli/build.rb | 4 ++- middleman-cli/lib/middleman-cli/config.rb | 2 ++ middleman-cli/lib/middleman-cli/console.rb | 2 ++ middleman-cli/lib/middleman-cli/extension.rb | 2 ++ middleman-cli/lib/middleman-cli/init.rb | 12 ++++--- middleman-cli/lib/middleman-cli/server.rb | 2 ++ middleman-cli/lib/middleman-core/cli.rb | 2 ++ middleman-core/Rakefile | 4 ++- middleman-core/features/support/env.rb | 2 ++ .../features/support/preserve_mime_types.rb | 2 ++ .../fixtures/asset-hash-app/config.rb | 2 ++ .../asset-hash-minified-app/config.rb | 2 ++ .../fixtures/asset-hash-prefix/config.rb | 2 ++ .../asset-hash-remove-filename/config.rb | 2 ++ .../fixtures/asset-hash-source-map/config.rb | 2 ++ .../fixtures/asset-host-app/config.rb | 2 ++ .../fixtures/auto-css-app/config.rb | 2 ++ middleman-core/fixtures/auto-js-app/config.rb | 2 ++ .../auto-js-directory-index-app/config.rb | 2 ++ .../automatic-directory-matcher-app/config.rb | 2 ++ .../fixtures/basic-data-app/config.rb | 2 ++ .../fixtures/build-with-errors-app/config.rb | 2 ++ .../fixtures/capture-html-app/config.rb | 2 ++ .../clean-app/config-complications.rb | 2 ++ .../clean-app/config-hidden-dir-after.rb | 2 ++ .../clean-app/config-hidden-dir-before.rb | 2 ++ middleman-core/fixtures/clean-app/config.rb | 2 ++ .../fixtures/clean-dir-app/config.rb | 2 ++ .../fixtures/clean-nested-app/config.rb | 2 ++ .../fixtures/content-for-app/config.rb | 2 ++ .../fixtures/custom-layout-app/config.rb | 2 ++ .../fixtures/custom-src-app/config.rb | 2 ++ middleman-core/fixtures/data-app/config.rb | 2 ++ .../my-app/config.rb | 2 ++ .../fixtures/dynamic-pages-app/config.rb | 2 ++ .../extension-api-deprecations-app/config.rb | 2 ++ .../fixtures/extension-hooks-app/config.rb | 2 ++ .../fixtures/external-helpers/config.rb | 2 ++ .../fixtures/external-helpers/helpers/derp.rb | 2 ++ .../external-helpers/helpers/four_helpers.rb | 2 ++ .../external-helpers/helpers/one_helper.rb | 2 ++ .../helpers/yet_another_thingy.rb | 2 ++ .../external-helpers/lib/hello_helper.rb | 2 ++ .../external-pipeline-error/config.rb | 2 ++ .../fixtures/feature-params-app/config.rb | 2 ++ .../fixtures/frontmatter-app/config.rb | 2 ++ .../frontmatter-neighbor-app/config.rb | 2 ++ .../frontmatter-settings-app/config.rb | 2 ++ .../config.rb | 2 ++ middleman-core/fixtures/glob-app/config.rb | 2 ++ middleman-core/fixtures/gzip-app/config.rb | 2 ++ .../fixtures/i-8859-1-app/config.rb | 2 ++ .../fixtures/i18n-default-app/config.rb | 2 ++ .../fixtures/i18n-force-locale/config.rb | 2 ++ .../fixtures/i18n-mixed-sources/config.rb | 2 ++ middleman-core/fixtures/import-app/config.rb | 2 ++ .../fixtures/indexable-app/config.rb | 2 ++ .../fixtures/large-build-app/config.rb | 2 ++ middleman-core/fixtures/lorem-app/config.rb | 1 + .../fixtures/manual-layout-missing/config.rb | 2 ++ .../fixtures/manual-layout-override/config.rb | 2 ++ .../fixtures/manual-layout/config.rb | 2 ++ .../fixtures/markdown-app/config.rb | 2 ++ .../config.rb | 2 ++ .../missing-tilt-library-app/config.rb | 2 ++ .../config.rb | 2 ++ .../more-frontmatter-settings-app/config.rb | 2 ++ .../fixtures/more-traversal-app/config.rb | 2 ++ .../multiple-data-sources-app/config.rb | 2 ++ .../fixtures/multiple-sources-app/config.rb | 2 ++ .../config.rb | 2 ++ .../config.rb | 2 ++ .../config.rb | 2 ++ .../fixtures/nested-data-app/config.rb | 2 ++ .../fixtures/nested-layout-app/config.rb | 2 ++ .../fixtures/padrino-helpers-app/config.rb | 2 ++ .../fixtures/page-classes-app/config.rb | 2 ++ .../page-helper-layout-block-app/config.rb | 2 ++ .../fixtures/page-id-app/config-proc.rb | 4 ++- middleman-core/fixtures/page-id-app/config.rb | 2 ++ .../fixtures/proxy-pages-app/config.rb | 2 ++ .../fixtures/redirect-app/config.rb | 2 ++ .../fixtures/relative-assets-app/config.rb | 2 ++ .../fixtures/sass-assets-path-app/config.rb | 2 ++ .../fixtures/traversal-app/config.rb | 2 ++ .../fixtures/v4-extension-callbacks/config.rb | 2 ++ .../fixtures/wildcard-app/config.rb | 2 ++ .../wildcard-directory-index-app/config.rb | 2 ++ middleman-core/lib/middleman-core.rb | 2 ++ .../lib/middleman-core/application.rb | 6 ++-- middleman-core/lib/middleman-core/builder.rb | 7 +++- .../lib/middleman-core/callback_manager.rb | 2 ++ .../lib/middleman-core/config_context.rb | 2 ++ .../lib/middleman-core/configuration.rb | 2 ++ .../lib/middleman-core/contracts.rb | 8 +++-- .../lib/middleman-core/core_extensions.rb | 2 ++ .../core_extensions/collections.rb | 2 ++ .../core_extensions/collections/lazy_root.rb | 2 ++ .../core_extensions/collections/lazy_step.rb | 2 ++ .../core_extensions/collections/pagination.rb | 2 ++ .../collections/step_context.rb | 2 ++ .../middleman-core/core_extensions/data.rb | 2 ++ .../core_extensions/data/controller.rb | 2 ++ .../core_extensions/data/proxies/array.rb | 2 ++ .../core_extensions/data/proxies/base.rb | 2 ++ .../core_extensions/data/proxies/hash.rb | 2 ++ .../core_extensions/data/stores/base.rb | 2 ++ .../core_extensions/data/stores/in_memory.rb | 2 ++ .../core_extensions/data/stores/local_file.rb | 2 ++ .../core_extensions/default_helpers.rb | 24 +++++++------- .../core_extensions/external_helpers.rb | 2 ++ .../core_extensions/file_watcher.rb | 2 ++ .../core_extensions/front_matter.rb | 2 ++ .../middleman-core/core_extensions/i18n.rb | 8 +++-- .../core_extensions/rendering.rb | 2 ++ .../middleman-core/core_extensions/routing.rb | 4 ++- .../core_extensions/show_exceptions.rb | 2 ++ .../lib/middleman-core/data_proxy.rb | 2 ++ .../lib/middleman-core/dependencies.rb | 2 ++ .../lib/middleman-core/dependencies/edge.rb | 2 ++ .../lib/middleman-core/dependencies/graph.rb | 2 ++ .../middleman-core/dependencies/vertices.rb | 2 ++ .../vertices/data_collection_path_vertex.rb | 2 ++ .../vertices/data_collection_vertex.rb | 2 ++ .../dependencies/vertices/file_vertex.rb | 2 ++ .../dependencies/vertices/vertex.rb | 2 ++ .../lib/middleman-core/dns_resolver.rb | 2 ++ .../dns_resolver/basic_network_resolver.rb | 2 ++ .../dns_resolver/hosts_resolver.rb | 2 ++ .../dns_resolver/local_link_resolver.rb | 2 ++ .../dns_resolver/network_resolver.rb | 2 ++ .../lib/middleman-core/extension.rb | 2 ++ .../lib/middleman-core/extension_manager.rb | 2 ++ .../lib/middleman-core/extensions.rb | 2 ++ .../middleman-core/extensions/asset_hash.rb | 2 ++ .../middleman-core/extensions/asset_host.rb | 2 ++ .../extensions/automatic_image_sizes.rb | 2 ++ .../middleman-core/extensions/cache_buster.rb | 4 ++- .../extensions/directory_indexes.rb | 2 ++ .../extensions/external_pipeline.rb | 2 ++ .../lib/middleman-core/extensions/gzip.rb | 6 ++-- .../lib/middleman-core/extensions/lorem.rb | 14 ++++---- .../middleman-core/extensions/minify_css.rb | 2 ++ .../extensions/minify_javascript.rb | 2 ++ .../extensions/relative_assets.rb | 2 ++ .../lib/middleman-core/file_renderer.rb | 2 ++ middleman-core/lib/middleman-core/filter.rb | 2 ++ .../lib/middleman-core/inline_url_filter.rb | 2 ++ .../lib/middleman-core/load_paths.rb | 2 ++ middleman-core/lib/middleman-core/logger.rb | 2 ++ .../lib/middleman-core/meta_pages.rb | 2 ++ .../meta_pages/config_setting.rb | 6 ++-- .../meta_pages/sitemap_resource.rb | 8 +++-- .../middleman-core/meta_pages/sitemap_tree.rb | 16 ++++++---- .../lib/middleman-core/preview_server.rb | 4 ++- .../middleman-core/preview_server/checks.rb | 2 ++ .../preview_server/information.rb | 2 ++ .../network_interface_inventory.rb | 2 ++ .../preview_server/server_hostname.rb | 4 ++- .../preview_server/server_information.rb | 2 ++ .../server_information_callback_proxy.rb | 2 ++ .../server_information_validator.rb | 2 ++ .../preview_server/server_ip_address.rb | 2 ++ .../preview_server/server_url.rb | 2 ++ .../preview_server/tcp_port_prober.rb | 2 ++ .../lib/middleman-core/profiling.rb | 4 ++- middleman-core/lib/middleman-core/rack.rb | 7 +++- .../middleman-core/renderers/coffee_script.rb | 2 ++ .../lib/middleman-core/renderers/erb.rb | 4 ++- .../lib/middleman-core/renderers/haml.rb | 8 ++--- .../lib/middleman-core/renderers/kramdown.rb | 6 ++-- .../lib/middleman-core/renderers/less.rb | 2 ++ .../lib/middleman-core/renderers/liquid.rb | 2 ++ .../lib/middleman-core/renderers/markdown.rb | 2 ++ .../lib/middleman-core/renderers/redcarpet.rb | 6 ++-- .../lib/middleman-core/renderers/sass.rb | 8 +++-- .../renderers/sass_functions.rb | 4 ++- .../lib/middleman-core/renderers/slim.rb | 12 ++++--- .../lib/middleman-core/renderers/stylus.rb | 2 ++ .../sitemap/extensions/ignores.rb | 2 ++ .../sitemap/extensions/import.rb | 2 ++ .../sitemap/extensions/move_file.rb | 2 ++ .../sitemap/extensions/on_disk.rb | 2 ++ .../sitemap/extensions/proxies.rb | 2 ++ .../sitemap/extensions/redirects.rb | 2 ++ .../sitemap/extensions/request_endpoints.rb | 2 ++ .../sitemap/extensions/traversal.rb | 4 ++- .../lib/middleman-core/sitemap/resource.rb | 6 ++-- .../sitemap/resource_list_container.rb | 2 ++ .../lib/middleman-core/sitemap/store.rb | 2 ++ middleman-core/lib/middleman-core/sources.rb | 2 ++ .../middleman-core/sources/source_watcher.rb | 6 ++-- .../lib/middleman-core/step_definitions.rb | 2 ++ .../step_definitions/builder_steps.rb | 2 ++ .../step_definitions/commandline_steps.rb | 6 ++-- .../step_definitions/middleman_steps.rb | 2 ++ .../step_definitions/server_steps.rb | 2 ++ .../lib/middleman-core/template_context.rb | 4 ++- .../lib/middleman-core/template_renderer.rb | 4 ++- middleman-core/lib/middleman-core/util.rb | 2 ++ .../lib/middleman-core/util/binary.rb | 4 ++- .../lib/middleman-core/util/data.rb | 2 ++ .../lib/middleman-core/util/empty_hash.rb | 2 ++ .../lib/middleman-core/util/files.rb | 6 ++-- .../lib/middleman-core/util/paths.rb | 16 ++++++---- .../lib/middleman-core/util/rack.rb | 8 +++-- .../lib/middleman-core/util/uri_templates.rb | 3 ++ middleman-core/lib/middleman-core/version.rb | 4 ++- middleman-core/lib/middleman/rack.rb | 2 ++ .../spec/middleman-core/callbacks_spec.rb | 2 ++ .../core_extensions/data_spec.rb | 2 ++ .../spec/middleman-core/data_proxy_spec.rb | 2 ++ .../spec/middleman-core/dependencies_spec.rb | 2 ++ .../spec/middleman-core/dns_resolver_spec.rb | 2 ++ .../preview_server/server_hostname_spec.rb | 2 ++ .../preview_server/server_ip_address_spec.rb | 2 ++ .../spec/middleman-core/util_spec.rb | 4 ++- middleman-core/spec/spec_helper.rb | 2 ++ middleman-core/spec/support/given.rb | 2 ++ middleman/Rakefile | 6 ++-- middleman/lib/middleman.rb | 2 ++ 232 files changed, 597 insertions(+), 124 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 018fa172..cf300cd0 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,6 +1,8 @@ -require: rubocop-performance +require: + - rubocop-performance AllCops: + NewCops: disable TargetRubyVersion: 2.5 Include: - "**/*.rb" @@ -11,11 +13,16 @@ AllCops: - "vendor/**/*" - "**/tmp/**/*" - "middleman-cli/lib/middleman-cli/templates/**/*" + +Style/FrozenStringLiteralComment: + Enabled: true + EnforcedStyle: always + Security/YAMLLoad: Enabled: false Style/GuardClause: Enabled: false -Metrics/LineLength: +Layout/LineLength: Enabled: false Metrics/MethodLength: Enabled: false @@ -39,13 +46,13 @@ Lint/AmbiguousBlockAssociation: Enabled: false Lint/UriEscapeUnescape: Enabled: false -Lint/HandleExceptions: +Lint/SuppressedException: Enabled: false Lint/ShadowedException: Enabled: false Naming/FileName: Enabled: false -Naming/UncommunicativeMethodParamName: +Naming/MethodParameterName: Enabled: false Naming/MemoizedInstanceVariableName: Enabled: false @@ -57,9 +64,7 @@ Style/ClassAndModuleChildren: Enabled: false Style/MissingRespondToMissing: Enabled: false -Style/MethodMissingSuper: - Enabled: false -Style/FrozenStringLiteralComment: +Lint/MissingSuper: Enabled: false Style/EvalWithLocation: Enabled: false @@ -67,3 +72,5 @@ Style/ClassVars: Enabled: false Style/GlobalVars: Enabled: false +Style/Proc: + Enabled: false diff --git a/.travis.yml b/.travis.yml index c0614b19..bf62da6c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,5 @@ language: ruby +dist: xenial cache: bundler rvm: - ruby-head @@ -7,11 +8,10 @@ rvm: - 2.5 os: - linux -matrix: +jobs: fast_finish: true allow_failures: - rvm: ruby-head env: global: - TEST=true -script: bundle exec rake test diff --git a/Gemfile b/Gemfile index 354aa9ee..15a3b9d1 100644 --- a/Gemfile +++ b/Gemfile @@ -38,8 +38,8 @@ gem 'mini_racer', '~> 0.2.4', platforms: :ruby gem 'therubyrhino', '>= 2.0', platforms: :jruby # Code Quality -gem 'rubocop', '~> 0.70.0', require: false -gem 'rubocop-performance', require: false +gem 'rubocop', '~> 0.89', require: false +gem 'rubocop-performance', '~> 1.7', require: false gem 'simplecov', '~> 0.10', require: false # Middleman itself diff --git a/Gemfile.lock b/Gemfile.lock index 72eb0675..1d8899e3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -49,7 +49,7 @@ GEM ffi (~> 1.9) rspec-expectations (>= 2.99) thor (>= 0.19, < 2.0) - ast (2.4.0) + ast (2.4.1) backports (3.17.1) binding_of_caller (0.8.0) debug_inspector (>= 0.0.1) @@ -109,7 +109,6 @@ GEM i18n (0.9.5) concurrent-ruby (~> 1.0) interception (0.5) - jaro_winkler (1.5.4) kramdown (2.3.0) rexml lazy_priority_queue (0.1.1) @@ -140,9 +139,9 @@ GEM padrino-support (= 0.14.4) tilt (>= 1.4.1, < 3) padrino-support (0.14.4) - parallel (1.19.1) - parser (2.7.1.2) - ast (~> 2.4.0) + parallel (1.19.2) + parser (2.7.1.4) + ast (~> 2.4.1) pry (0.13.1) coderay (~> 1.1) method_source (~> 1.0) @@ -164,6 +163,7 @@ GEM rb-inotify (0.10.1) ffi (~> 1.0) redcarpet (3.5.0) + regexp_parser (1.7.1) rexml (3.2.4) rgl (0.5.6) lazy_priority_queue (~> 0.1.0) @@ -181,15 +181,19 @@ GEM diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.9.0) rspec-support (3.9.3) - rubocop (0.70.0) - jaro_winkler (~> 1.5.1) + rubocop (0.89.1) parallel (~> 1.10) - parser (>= 2.6) + parser (>= 2.7.1.1) rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.7) + rexml + rubocop-ast (>= 0.3.0, < 1.0) ruby-progressbar (~> 1.7) - unicode-display_width (>= 1.4.0, < 1.7) - rubocop-performance (1.3.0) - rubocop (>= 0.68.0) + unicode-display_width (>= 1.4.0, < 2.0) + rubocop-ast (0.3.0) + parser (>= 2.7.1.4) + rubocop-performance (1.7.1) + rubocop (>= 0.82.0) ruby-progressbar (1.10.1) ruby2_keywords (0.0.2) rubydns (1.0.3) @@ -226,7 +230,7 @@ GEM thread_safe (~> 0.1) uglifier (4.2.0) execjs (>= 0.3.0, < 3) - unicode-display_width (1.6.1) + unicode-display_width (1.7.0) xpath (2.1.0) nokogiri (~> 1.3) yard (0.9.25) @@ -254,8 +258,8 @@ DEPENDENCIES rake (~> 12.3) redcarpet (>= 3.1) rspec (~> 3.0) - rubocop (~> 0.70.0) - rubocop-performance + rubocop (~> 0.89) + rubocop-performance (~> 1.7) rubydns (~> 1.0.1) sassc (~> 2.0) simplecov (~> 0.10) diff --git a/Rakefile b/Rakefile index 5d12bdc9..1ef3f41b 100644 --- a/Rakefile +++ b/Rakefile @@ -44,8 +44,6 @@ end desc 'Run tests for all middleman gems' task :test do - Rake::Task['rubocop'].invoke - GEM_PATHS.each do |g| Dir.chdir(File.join(ROOT, g).to_s) { sh "#{Gem.ruby} -S rake test" } end @@ -63,4 +61,4 @@ desc 'Run RuboCop to check code consistency' RuboCop::RakeTask.new(:rubocop) desc 'Run tests for all middleman gems' -task default: :test +task default: %i[rubocop test] diff --git a/middleman-cli/Rakefile b/middleman-cli/Rakefile index 8c9c28c6..40ea591f 100644 --- a/middleman-cli/Rakefile +++ b/middleman-cli/Rakefile @@ -1,3 +1,5 @@ -RAKE_ROOT = __FILE__.freeze -GEM_NAME = 'middleman-cli'.freeze +# frozen_string_literal: true + +RAKE_ROOT = __FILE__ +GEM_NAME = 'middleman-cli' require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') diff --git a/middleman-cli/bin/middleman b/middleman-cli/bin/middleman index b2bd47fa..5ba233d8 100755 --- a/middleman-cli/bin/middleman +++ b/middleman-cli/bin/middleman @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require 'middleman-core/profiling' Middleman::Profiling.profiler = Middleman::Profiling::RubyProfProfiler.new if ARGV.include? '--profile' diff --git a/middleman-cli/features/support/env.rb b/middleman-cli/features/support/env.rb index 779db033..31d0e823 100644 --- a/middleman-cli/features/support/env.rb +++ b/middleman-cli/features/support/env.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['TEST'] = 'true' require 'active_support/all' diff --git a/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb b/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb index 4fb1c378..013c8964 100755 --- a/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb +++ b/middleman-cli/fixtures/preview-server-app/bin/dns_server.rb @@ -1,4 +1,5 @@ #!/usr/bin/env ruby +# frozen_string_literal: true require 'rubydns' require 'psych' diff --git a/middleman-cli/fixtures/preview-server-hook-app/config.rb b/middleman-cli/fixtures/preview-server-hook-app/config.rb index b421b824..af22636b 100644 --- a/middleman-cli/fixtures/preview-server-hook-app/config.rb +++ b/middleman-cli/fixtures/preview-server-hook-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :layout, false class MyFeature < Middleman::Extension diff --git a/middleman-cli/lib/middleman-cli.rb b/middleman-cli/lib/middleman-cli.rb index a3c117e7..1044a933 100644 --- a/middleman-cli/lib/middleman-cli.rb +++ b/middleman-cli/lib/middleman-cli.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Setup our load paths libdir = __dir__ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) diff --git a/middleman-cli/lib/middleman-cli/build.rb b/middleman-cli/lib/middleman-cli/build.rb index 6072880d..571824a7 100644 --- a/middleman-cli/lib/middleman-cli/build.rb +++ b/middleman-cli/lib/middleman-cli/build.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/application' # CLI Module @@ -126,7 +128,7 @@ module Middleman::Cli puts 'Project built successfully.' else msg = 'There were errors during this build' - msg << ', re-run with `middleman build --verbose` to see the full exception.' unless options['verbose'] + msg = "#{msg}, re-run with `middleman build --verbose` to see the full exception." unless options['verbose'] shell.say msg, :red exit(1) diff --git a/middleman-cli/lib/middleman-cli/config.rb b/middleman-cli/lib/middleman-cli/config.rb index add8730a..ebaf40eb 100644 --- a/middleman-cli/lib/middleman-cli/config.rb +++ b/middleman-cli/lib/middleman-cli/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # CLI Module module Middleman::Cli # The CLI Config class diff --git a/middleman-cli/lib/middleman-cli/console.rb b/middleman-cli/lib/middleman-cli/console.rb index 4e267539..c3bd842a 100644 --- a/middleman-cli/lib/middleman-cli/console.rb +++ b/middleman-cli/lib/middleman-cli/console.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # CLI Module module Middleman::Cli # The CLI Console class diff --git a/middleman-cli/lib/middleman-cli/extension.rb b/middleman-cli/lib/middleman-cli/extension.rb index b9f84435..bcb64381 100644 --- a/middleman-cli/lib/middleman-cli/extension.rb +++ b/middleman-cli/lib/middleman-cli/extension.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # CLI Module module Middleman::Cli # A thor task for creating new projects diff --git a/middleman-cli/lib/middleman-cli/init.rb b/middleman-cli/lib/middleman-cli/init.rb index f9bdaf60..cbf8f54a 100644 --- a/middleman-cli/lib/middleman-cli/init.rb +++ b/middleman-cli/lib/middleman-cli/init.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + # CLI Module module Middleman::Cli # A thor task for creating new projects class Init < Thor::Group include Thor::Actions - GIT_CMD = 'git'.freeze + GIT_CMD = 'git' check_unknown_options! @@ -32,9 +34,11 @@ module Middleman::Cli require 'tmpdir' unless git_present? - msg = 'You need to install the git command line tool to initialize a new project. ' - msg << "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git" - say msg, :red + msg_array = [ + 'You need to install the git command line tool to initialize a new project. ', + "For help installing git, please refer to GitHub's tutorial at https://help.github.com/articles/set-up-git" + ] + say msg_array.join, :red exit 1 end diff --git a/middleman-cli/lib/middleman-cli/server.rb b/middleman-cli/lib/middleman-cli/server.rb index d45ac43b..2354eae3 100644 --- a/middleman-cli/lib/middleman-cli/server.rb +++ b/middleman-cli/lib/middleman-cli/server.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # CLI Module module Middleman::Cli # Server thor task diff --git a/middleman-cli/lib/middleman-core/cli.rb b/middleman-cli/lib/middleman-core/cli.rb index 19f65d52..7200f8e1 100644 --- a/middleman-cli/lib/middleman-core/cli.rb +++ b/middleman-cli/lib/middleman-core/cli.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + # Backwards compat require 'middleman-cli' diff --git a/middleman-core/Rakefile b/middleman-core/Rakefile index 01049499..e9d3a984 100644 --- a/middleman-core/Rakefile +++ b/middleman-core/Rakefile @@ -1,3 +1,5 @@ -RAKE_ROOT = __FILE__.freeze +# frozen_string_literal: true + +RAKE_ROOT = __FILE__ GEM_NAME = ENV['NAME'] || 'middleman-core' require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') diff --git a/middleman-core/features/support/env.rb b/middleman-core/features/support/env.rb index c5a16ce0..25926566 100644 --- a/middleman-core/features/support/env.rb +++ b/middleman-core/features/support/env.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ENV['TEST'] = 'true' require 'active_support/all' diff --git a/middleman-core/features/support/preserve_mime_types.rb b/middleman-core/features/support/preserve_mime_types.rb index a791e49c..55bfee1e 100644 --- a/middleman-core/features/support/preserve_mime_types.rb +++ b/middleman-core/features/support/preserve_mime_types.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + Around('@preserve_mime_types') do |_scenario, block| mime_types = ::Rack::Mime::MIME_TYPES.clone diff --git a/middleman-core/fixtures/asset-hash-app/config.rb b/middleman-core/fixtures/asset-hash-app/config.rb index b3723e3b..c864741c 100644 --- a/middleman-core/fixtures/asset-hash-app/config.rb +++ b/middleman-core/fixtures/asset-hash-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :asset_hash activate :relative_assets diff --git a/middleman-core/fixtures/asset-hash-minified-app/config.rb b/middleman-core/fixtures/asset-hash-minified-app/config.rb index 96f8266c..835b835d 100644 --- a/middleman-core/fixtures/asset-hash-minified-app/config.rb +++ b/middleman-core/fixtures/asset-hash-minified-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + configure :build do # Minify JavaScript on build activate :minify_javascript diff --git a/middleman-core/fixtures/asset-hash-prefix/config.rb b/middleman-core/fixtures/asset-hash-prefix/config.rb index fe55e48e..1ec3aab7 100644 --- a/middleman-core/fixtures/asset-hash-prefix/config.rb +++ b/middleman-core/fixtures/asset-hash-prefix/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :asset_hash, prefix: 'myprefix-' diff --git a/middleman-core/fixtures/asset-hash-remove-filename/config.rb b/middleman-core/fixtures/asset-hash-remove-filename/config.rb index 46929b95..8d048dfe 100644 --- a/middleman-core/fixtures/asset-hash-remove-filename/config.rb +++ b/middleman-core/fixtures/asset-hash-remove-filename/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :asset_hash, rename_proc: lambda do |path, _basename, digest, extension, _options| "#{path}#{digest}#{extension}" diff --git a/middleman-core/fixtures/asset-hash-source-map/config.rb b/middleman-core/fixtures/asset-hash-source-map/config.rb index b3723e3b..c864741c 100644 --- a/middleman-core/fixtures/asset-hash-source-map/config.rb +++ b/middleman-core/fixtures/asset-hash-source-map/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :asset_hash activate :relative_assets diff --git a/middleman-core/fixtures/asset-host-app/config.rb b/middleman-core/fixtures/asset-host-app/config.rb index f760f3db..13ded318 100644 --- a/middleman-core/fixtures/asset-host-app/config.rb +++ b/middleman-core/fixtures/asset-host-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + activate :asset_host, host: 'http://assets1.example.com' diff --git a/middleman-core/fixtures/auto-css-app/config.rb b/middleman-core/fixtures/auto-css-app/config.rb index f8f33d86..c5051d29 100644 --- a/middleman-core/fixtures/auto-css-app/config.rb +++ b/middleman-core/fixtures/auto-css-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + %w[ /auto-css.html /auto-css diff --git a/middleman-core/fixtures/auto-js-app/config.rb b/middleman-core/fixtures/auto-js-app/config.rb index df105e71..3a84894c 100644 --- a/middleman-core/fixtures/auto-js-app/config.rb +++ b/middleman-core/fixtures/auto-js-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + %w[ /auto-js.html /auto-js diff --git a/middleman-core/fixtures/auto-js-directory-index-app/config.rb b/middleman-core/fixtures/auto-js-directory-index-app/config.rb index 9d37508b..51ae91fc 100644 --- a/middleman-core/fixtures/auto-js-directory-index-app/config.rb +++ b/middleman-core/fixtures/auto-js-directory-index-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + activate :directory_indexes diff --git a/middleman-core/fixtures/automatic-directory-matcher-app/config.rb b/middleman-core/fixtures/automatic-directory-matcher-app/config.rb index 2685fe4b..2dd72ab7 100644 --- a/middleman-core/fixtures/automatic-directory-matcher-app/config.rb +++ b/middleman-core/fixtures/automatic-directory-matcher-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :automatic_directory_matcher, '--' diff --git a/middleman-core/fixtures/basic-data-app/config.rb b/middleman-core/fixtures/basic-data-app/config.rb index 6611756d..1bdd3ef9 100644 --- a/middleman-core/fixtures/basic-data-app/config.rb +++ b/middleman-core/fixtures/basic-data-app/config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + data.store :static_array, ::YAML.load_file(File.expand_path('static_array.yml', File.dirname(__FILE__))) data.store :static_hash, ::YAML.load_file(File.expand_path('static_hash.yml', File.dirname(__FILE__))) diff --git a/middleman-core/fixtures/build-with-errors-app/config.rb b/middleman-core/fixtures/build-with-errors-app/config.rb index 09ff69dd..e67655ce 100644 --- a/middleman-core/fixtures/build-with-errors-app/config.rb +++ b/middleman-core/fixtures/build-with-errors-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :layout, false diff --git a/middleman-core/fixtures/capture-html-app/config.rb b/middleman-core/fixtures/capture-html-app/config.rb index 2d7e0035..97cb9329 100644 --- a/middleman-core/fixtures/capture-html-app/config.rb +++ b/middleman-core/fixtures/capture-html-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'slim' page '/capture_html_erb.html', layout: :capture_html diff --git a/middleman-core/fixtures/clean-app/config-complications.rb b/middleman-core/fixtures/clean-app/config-complications.rb index 4867e865..8578168a 100644 --- a/middleman-core/fixtures/clean-app/config-complications.rb +++ b/middleman-core/fixtures/clean-app/config-complications.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + proxy '/fake.html', '/real.html', layout: false ignore '/should_be_ignored.html' diff --git a/middleman-core/fixtures/clean-app/config-hidden-dir-after.rb b/middleman-core/fixtures/clean-app/config-hidden-dir-after.rb index 6d762dc1..20f649f5 100644 --- a/middleman-core/fixtures/clean-app/config-hidden-dir-after.rb +++ b/middleman-core/fixtures/clean-app/config-hidden-dir-after.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :build_dir, '.build' ignore '/should_be_ignored.html' diff --git a/middleman-core/fixtures/clean-app/config-hidden-dir-before.rb b/middleman-core/fixtures/clean-app/config-hidden-dir-before.rb index 4d130740..a4a86df6 100644 --- a/middleman-core/fixtures/clean-app/config-hidden-dir-before.rb +++ b/middleman-core/fixtures/clean-app/config-hidden-dir-before.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :build_dir, '.build' diff --git a/middleman-core/fixtures/clean-app/config.rb b/middleman-core/fixtures/clean-app/config.rb index 4867e865..8578168a 100644 --- a/middleman-core/fixtures/clean-app/config.rb +++ b/middleman-core/fixtures/clean-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + proxy '/fake.html', '/real.html', layout: false ignore '/should_be_ignored.html' diff --git a/middleman-core/fixtures/clean-dir-app/config.rb b/middleman-core/fixtures/clean-dir-app/config.rb index 9d37508b..51ae91fc 100644 --- a/middleman-core/fixtures/clean-dir-app/config.rb +++ b/middleman-core/fixtures/clean-dir-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + activate :directory_indexes diff --git a/middleman-core/fixtures/clean-nested-app/config.rb b/middleman-core/fixtures/clean-nested-app/config.rb index 3ee145a3..a03323ba 100644 --- a/middleman-core/fixtures/clean-nested-app/config.rb +++ b/middleman-core/fixtures/clean-nested-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :build_dir, 'sub/dir' diff --git a/middleman-core/fixtures/content-for-app/config.rb b/middleman-core/fixtures/content-for-app/config.rb index afa60634..0e807561 100644 --- a/middleman-core/fixtures/content-for-app/config.rb +++ b/middleman-core/fixtures/content-for-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'slim' page '/content_for_erb.html', layout: :content_for diff --git a/middleman-core/fixtures/custom-layout-app/config.rb b/middleman-core/fixtures/custom-layout-app/config.rb index d8a232b3..6e20156d 100644 --- a/middleman-core/fixtures/custom-layout-app/config.rb +++ b/middleman-core/fixtures/custom-layout-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :erb, layout_engine: :str diff --git a/middleman-core/fixtures/custom-src-app/config.rb b/middleman-core/fixtures/custom-src-app/config.rb index e23d2bd3..383a5c9e 100644 --- a/middleman-core/fixtures/custom-src-app/config.rb +++ b/middleman-core/fixtures/custom-src-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :source, 'src' diff --git a/middleman-core/fixtures/data-app/config.rb b/middleman-core/fixtures/data-app/config.rb index 2aa77658..a60aa6a8 100644 --- a/middleman-core/fixtures/data-app/config.rb +++ b/middleman-core/fixtures/data-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + data.pages.each do |p| proxy p.from, p.to end diff --git a/middleman-core/fixtures/destination-dir-different-from-source-dir-name/my-app/config.rb b/middleman-core/fixtures/destination-dir-different-from-source-dir-name/my-app/config.rb index 4f8d8e2b..5aef0d30 100644 --- a/middleman-core/fixtures/destination-dir-different-from-source-dir-name/my-app/config.rb +++ b/middleman-core/fixtures/destination-dir-different-from-source-dir-name/my-app/config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + files.watch :source, path: File.join(root, '..', 'external'), destination_dir: 'my_dir' diff --git a/middleman-core/fixtures/dynamic-pages-app/config.rb b/middleman-core/fixtures/dynamic-pages-app/config.rb index a7d912bd..cac98ec7 100644 --- a/middleman-core/fixtures/dynamic-pages-app/config.rb +++ b/middleman-core/fixtures/dynamic-pages-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + proxy '/fake.html', '/real.html', layout: false proxy 'fake2.html', '/real.html', layout: false proxy 'fake3.html', 'real.html', layout: false diff --git a/middleman-core/fixtures/extension-api-deprecations-app/config.rb b/middleman-core/fixtures/extension-api-deprecations-app/config.rb index bcadf949..fb335f38 100644 --- a/middleman-core/fixtures/extension-api-deprecations-app/config.rb +++ b/middleman-core/fixtures/extension-api-deprecations-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class LayoutDisabler < Middleman::Extension def initialize(app, options_hash = {}, &block) super diff --git a/middleman-core/fixtures/extension-hooks-app/config.rb b/middleman-core/fixtures/extension-hooks-app/config.rb index 4a81dda3..798df2cf 100644 --- a/middleman-core/fixtures/extension-hooks-app/config.rb +++ b/middleman-core/fixtures/extension-hooks-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :layout, false class MyFeature < Middleman::Extension diff --git a/middleman-core/fixtures/external-helpers/config.rb b/middleman-core/fixtures/external-helpers/config.rb index 1e9ceb84..466e0cab 100644 --- a/middleman-core/fixtures/external-helpers/config.rb +++ b/middleman-core/fixtures/external-helpers/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'lib/hello_helper' helpers HelloHelper diff --git a/middleman-core/fixtures/external-helpers/helpers/derp.rb b/middleman-core/fixtures/external-helpers/helpers/derp.rb index dbb712e6..f8971f57 100644 --- a/middleman-core/fixtures/external-helpers/helpers/derp.rb +++ b/middleman-core/fixtures/external-helpers/helpers/derp.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Derp def three 'Three' diff --git a/middleman-core/fixtures/external-helpers/helpers/four_helpers.rb b/middleman-core/fixtures/external-helpers/helpers/four_helpers.rb index 871a76eb..080a7200 100644 --- a/middleman-core/fixtures/external-helpers/helpers/four_helpers.rb +++ b/middleman-core/fixtures/external-helpers/helpers/four_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module FourHelpers def four 'Four' diff --git a/middleman-core/fixtures/external-helpers/helpers/one_helper.rb b/middleman-core/fixtures/external-helpers/helpers/one_helper.rb index 581447ca..4645b7b9 100644 --- a/middleman-core/fixtures/external-helpers/helpers/one_helper.rb +++ b/middleman-core/fixtures/external-helpers/helpers/one_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module OneHelper def one 'One' diff --git a/middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb b/middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb index b3eb049f..933eca51 100644 --- a/middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb +++ b/middleman-core/fixtures/external-helpers/helpers/yet_another_thingy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module YetAnotherThingy def two 'Two' diff --git a/middleman-core/fixtures/external-helpers/lib/hello_helper.rb b/middleman-core/fixtures/external-helpers/lib/hello_helper.rb index 0ef0b421..6fc1c9d4 100644 --- a/middleman-core/fixtures/external-helpers/lib/hello_helper.rb +++ b/middleman-core/fixtures/external-helpers/lib/hello_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module HelloHelper def hello 'Hello World' diff --git a/middleman-core/fixtures/external-pipeline-error/config.rb b/middleman-core/fixtures/external-pipeline-error/config.rb index 668ace5d..522983be 100644 --- a/middleman-core/fixtures/external-pipeline-error/config.rb +++ b/middleman-core/fixtures/external-pipeline-error/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :external_pipeline, name: :failing, command: 'mv does-not-exist tmp/file.js', diff --git a/middleman-core/fixtures/feature-params-app/config.rb b/middleman-core/fixtures/feature-params-app/config.rb index ca6a61a3..d15d48c9 100644 --- a/middleman-core/fixtures/feature-params-app/config.rb +++ b/middleman-core/fixtures/feature-params-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :layout, false class ExtensionA < ::Middleman::Extension diff --git a/middleman-core/fixtures/frontmatter-app/config.rb b/middleman-core/fixtures/frontmatter-app/config.rb index 9f0d3d58..1241bbcf 100644 --- a/middleman-core/fixtures/frontmatter-app/config.rb +++ b/middleman-core/fixtures/frontmatter-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + config[:frontmatter_delims][:yaml] << %w[\\--- \\---] diff --git a/middleman-core/fixtures/frontmatter-neighbor-app/config.rb b/middleman-core/fixtures/frontmatter-neighbor-app/config.rb index a0446228..a278339e 100644 --- a/middleman-core/fixtures/frontmatter-neighbor-app/config.rb +++ b/middleman-core/fixtures/frontmatter-neighbor-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + ignore '*.frontmatter' # Reads neighbor for every file on every refresh. diff --git a/middleman-core/fixtures/frontmatter-settings-app/config.rb b/middleman-core/fixtures/frontmatter-settings-app/config.rb index a5e8129a..d66ac34c 100644 --- a/middleman-core/fixtures/frontmatter-settings-app/config.rb +++ b/middleman-core/fixtures/frontmatter-settings-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Proxy ignored.html, which should ignore itself through a frontmatter proxy 'proxied.html', 'ignored.html' page 'override_layout.html', layout: :alternate diff --git a/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb b/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb index 4de94e76..70a5e5d4 100644 --- a/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb +++ b/middleman-core/fixtures/frontmatter-settings-neighbor-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Proxy ignored.html, which should ignore itself through a frontmatter proxy 'proxied.html', 'ignored.html' proxy 'proxied_with_frontmatter.html', 'ignored.html' diff --git a/middleman-core/fixtures/glob-app/config.rb b/middleman-core/fixtures/glob-app/config.rb index 53251d74..fe1bee0c 100644 --- a/middleman-core/fixtures/glob-app/config.rb +++ b/middleman-core/fixtures/glob-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + page '/index.html', layout: false diff --git a/middleman-core/fixtures/gzip-app/config.rb b/middleman-core/fixtures/gzip-app/config.rb index e5775a58..55bedb55 100644 --- a/middleman-core/fixtures/gzip-app/config.rb +++ b/middleman-core/fixtures/gzip-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + activate :gzip diff --git a/middleman-core/fixtures/i-8859-1-app/config.rb b/middleman-core/fixtures/i-8859-1-app/config.rb index 93470bb6..5a604e61 100644 --- a/middleman-core/fixtures/i-8859-1-app/config.rb +++ b/middleman-core/fixtures/i-8859-1-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :encoding, 'ISO-8859-1' diff --git a/middleman-core/fixtures/i18n-default-app/config.rb b/middleman-core/fixtures/i18n-default-app/config.rb index bd01dcda..ac84945c 100644 --- a/middleman-core/fixtures/i18n-default-app/config.rb +++ b/middleman-core/fixtures/i18n-default-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + activate :i18n diff --git a/middleman-core/fixtures/i18n-force-locale/config.rb b/middleman-core/fixtures/i18n-force-locale/config.rb index 72d94071..53a7c5a9 100644 --- a/middleman-core/fixtures/i18n-force-locale/config.rb +++ b/middleman-core/fixtures/i18n-force-locale/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + %i[en es].each do |locale| proxy "/#{locale}/index.html", 'index.html', ignore: true, lang: locale end diff --git a/middleman-core/fixtures/i18n-mixed-sources/config.rb b/middleman-core/fixtures/i18n-mixed-sources/config.rb index e132b6b1..2dcbe8b5 100644 --- a/middleman-core/fixtures/i18n-mixed-sources/config.rb +++ b/middleman-core/fixtures/i18n-mixed-sources/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + activate :i18n, mount_at_root: :en, langs: %i[en es] diff --git a/middleman-core/fixtures/import-app/config.rb b/middleman-core/fixtures/import-app/config.rb index 082efce4..31716dd3 100644 --- a/middleman-core/fixtures/import-app/config.rb +++ b/middleman-core/fixtures/import-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + import_file File.expand_path('static.html', root), '/static2.html' import_path File.expand_path('bower_components/', root) diff --git a/middleman-core/fixtures/indexable-app/config.rb b/middleman-core/fixtures/indexable-app/config.rb index 41944664..f5567878 100644 --- a/middleman-core/fixtures/indexable-app/config.rb +++ b/middleman-core/fixtures/indexable-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :directory_indexes page '/leave_me_alone.html', directory_index: false diff --git a/middleman-core/fixtures/large-build-app/config.rb b/middleman-core/fixtures/large-build-app/config.rb index 85ac2730..6b5dab82 100644 --- a/middleman-core/fixtures/large-build-app/config.rb +++ b/middleman-core/fixtures/large-build-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + page '/spaces in file.html', layout: false config[:port] = 5555 diff --git a/middleman-core/fixtures/lorem-app/config.rb b/middleman-core/fixtures/lorem-app/config.rb index 6382e3a3..e75608d5 100644 --- a/middleman-core/fixtures/lorem-app/config.rb +++ b/middleman-core/fixtures/lorem-app/config.rb @@ -1 +1,2 @@ +# frozen_string_literal: true # activate :minify_css diff --git a/middleman-core/fixtures/manual-layout-missing/config.rb b/middleman-core/fixtures/manual-layout-missing/config.rb index acaa2783..91c0f574 100644 --- a/middleman-core/fixtures/manual-layout-missing/config.rb +++ b/middleman-core/fixtures/manual-layout-missing/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :layout, :custom diff --git a/middleman-core/fixtures/manual-layout-override/config.rb b/middleman-core/fixtures/manual-layout-override/config.rb index 2b4e1fb8..803cc5b8 100644 --- a/middleman-core/fixtures/manual-layout-override/config.rb +++ b/middleman-core/fixtures/manual-layout-override/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :layout, :custom page '/', layout: :another diff --git a/middleman-core/fixtures/manual-layout/config.rb b/middleman-core/fixtures/manual-layout/config.rb index acaa2783..91c0f574 100644 --- a/middleman-core/fixtures/manual-layout/config.rb +++ b/middleman-core/fixtures/manual-layout/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :layout, :custom diff --git a/middleman-core/fixtures/markdown-app/config.rb b/middleman-core/fixtures/markdown-app/config.rb index 01b533a6..2cb44284 100644 --- a/middleman-core/fixtures/markdown-app/config.rb +++ b/middleman-core/fixtures/markdown-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :markdown, smartypants: true diff --git a/middleman-core/fixtures/markdown-frontmatter-options-app/config.rb b/middleman-core/fixtures/markdown-frontmatter-options-app/config.rb index 01b533a6..2cb44284 100644 --- a/middleman-core/fixtures/markdown-frontmatter-options-app/config.rb +++ b/middleman-core/fixtures/markdown-frontmatter-options-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :markdown, smartypants: true diff --git a/middleman-core/fixtures/missing-tilt-library-app/config.rb b/middleman-core/fixtures/missing-tilt-library-app/config.rb index 661a0afa..3becd5c7 100644 --- a/middleman-core/fixtures/missing-tilt-library-app/config.rb +++ b/middleman-core/fixtures/missing-tilt-library-app/config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + ignore 'danger-zone/*' ignore '*.textile' diff --git a/middleman-core/fixtures/more-extensionless-text-files-app/config.rb b/middleman-core/fixtures/more-extensionless-text-files-app/config.rb index 9d37508b..51ae91fc 100644 --- a/middleman-core/fixtures/more-extensionless-text-files-app/config.rb +++ b/middleman-core/fixtures/more-extensionless-text-files-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + activate :directory_indexes diff --git a/middleman-core/fixtures/more-frontmatter-settings-app/config.rb b/middleman-core/fixtures/more-frontmatter-settings-app/config.rb index c5c9fb86..4684dd9e 100644 --- a/middleman-core/fixtures/more-frontmatter-settings-app/config.rb +++ b/middleman-core/fixtures/more-frontmatter-settings-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :directory_indexes # Proxy ignored.html, which should ignore itself through a frontmatter diff --git a/middleman-core/fixtures/more-traversal-app/config.rb b/middleman-core/fixtures/more-traversal-app/config.rb index 2cff6765..d45b455f 100644 --- a/middleman-core/fixtures/more-traversal-app/config.rb +++ b/middleman-core/fixtures/more-traversal-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + activate :directory_indexes proxy '/sub/fake.html', '/proxied.html', ignore: true diff --git a/middleman-core/fixtures/multiple-data-sources-app/config.rb b/middleman-core/fixtures/multiple-data-sources-app/config.rb index 37a2c5c9..c54d93b4 100644 --- a/middleman-core/fixtures/multiple-data-sources-app/config.rb +++ b/middleman-core/fixtures/multiple-data-sources-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + files.watch :data, path: File.join(root, 'data0'), priority: 100 files.watch :data, path: File.join(root, 'data1') files.watch :data, path: File.join(root, 'data2') diff --git a/middleman-core/fixtures/multiple-sources-app/config.rb b/middleman-core/fixtures/multiple-sources-app/config.rb index 585a5153..5e924a6a 100644 --- a/middleman-core/fixtures/multiple-sources-app/config.rb +++ b/middleman-core/fixtures/multiple-sources-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + files.watch :source, path: File.join(root, 'source0'), priority: 100 files.watch :source, path: File.join(root, 'source1') files.watch :source, path: File.join(root, 'source2') diff --git a/middleman-core/fixtures/multiple-sources-with-destination-dir/config.rb b/middleman-core/fixtures/multiple-sources-with-destination-dir/config.rb index 8df8d40f..3371710a 100644 --- a/middleman-core/fixtures/multiple-sources-with-destination-dir/config.rb +++ b/middleman-core/fixtures/multiple-sources-with-destination-dir/config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + files.watch :source, path: File.join(root, 'external'), destination_dir: 'external' diff --git a/middleman-core/fixtures/multiple-sources-with-duplicate-file-names-app/config.rb b/middleman-core/fixtures/multiple-sources-with-duplicate-file-names-app/config.rb index f1b72543..b5f5e632 100644 --- a/middleman-core/fixtures/multiple-sources-with-duplicate-file-names-app/config.rb +++ b/middleman-core/fixtures/multiple-sources-with-duplicate-file-names-app/config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + files.watch :source, path: File.join(root, 'source2'), destination_dir: 'source2' diff --git a/middleman-core/fixtures/multiple-sources-without-destination-dir/config.rb b/middleman-core/fixtures/multiple-sources-without-destination-dir/config.rb index 8a5a2fb5..7f52b898 100644 --- a/middleman-core/fixtures/multiple-sources-without-destination-dir/config.rb +++ b/middleman-core/fixtures/multiple-sources-without-destination-dir/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + files.watch :source, path: File.join(root, 'external') diff --git a/middleman-core/fixtures/nested-data-app/config.rb b/middleman-core/fixtures/nested-data-app/config.rb index 09ff69dd..e67655ce 100644 --- a/middleman-core/fixtures/nested-data-app/config.rb +++ b/middleman-core/fixtures/nested-data-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :layout, false diff --git a/middleman-core/fixtures/nested-layout-app/config.rb b/middleman-core/fixtures/nested-layout-app/config.rb index acf8683b..7d2e3e35 100644 --- a/middleman-core/fixtures/nested-layout-app/config.rb +++ b/middleman-core/fixtures/nested-layout-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + set :layout, :inner diff --git a/middleman-core/fixtures/padrino-helpers-app/config.rb b/middleman-core/fixtures/padrino-helpers-app/config.rb index 673bfc6f..28ff5e2f 100644 --- a/middleman-core/fixtures/padrino-helpers-app/config.rb +++ b/middleman-core/fixtures/padrino-helpers-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + helpers do def title content_tag :h1 do diff --git a/middleman-core/fixtures/page-classes-app/config.rb b/middleman-core/fixtures/page-classes-app/config.rb index 1c8956e9..2f0f1270 100644 --- a/middleman-core/fixtures/page-classes-app/config.rb +++ b/middleman-core/fixtures/page-classes-app/config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + page '/sub1/page-classes.html', layout: false page '/sub1/sub2/page-classes.html', layout: false diff --git a/middleman-core/fixtures/page-helper-layout-block-app/config.rb b/middleman-core/fixtures/page-helper-layout-block-app/config.rb index 62e7696b..a088d57b 100644 --- a/middleman-core/fixtures/page-helper-layout-block-app/config.rb +++ b/middleman-core/fixtures/page-helper-layout-block-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + page '/path/*', layout: 'alt' # Doesn't work, and shouldn't diff --git a/middleman-core/fixtures/page-id-app/config-proc.rb b/middleman-core/fixtures/page-id-app/config-proc.rb index 99b057c6..f5bd4a83 100644 --- a/middleman-core/fixtures/page-id-app/config-proc.rb +++ b/middleman-core/fixtures/page-id-app/config-proc.rb @@ -1,7 +1,9 @@ +# frozen_string_literal: true + %w[1 2 3].each do |n| proxy "/#{n}.html", '/index.html', id: "page#{n}" end page '/overwrites/*', id: :"something-else" -config[:page_id_generator] = ->(path) { path + '-foo' } +config[:page_id_generator] = ->(path) { "#{path}-foo" } diff --git a/middleman-core/fixtures/page-id-app/config.rb b/middleman-core/fixtures/page-id-app/config.rb index f0b35812..893aa3ea 100644 --- a/middleman-core/fixtures/page-id-app/config.rb +++ b/middleman-core/fixtures/page-id-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + %w[1 2 3].each do |n| proxy "/#{n}.html", '/index.html', id: "page#{n}" end diff --git a/middleman-core/fixtures/proxy-pages-app/config.rb b/middleman-core/fixtures/proxy-pages-app/config.rb index 72dafe00..00606130 100644 --- a/middleman-core/fixtures/proxy-pages-app/config.rb +++ b/middleman-core/fixtures/proxy-pages-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + proxy '/fake.html', '/real.html', layout: false proxy 'fake2.html', '/real.html', layout: false proxy 'fake3.html', 'real.html', layout: false diff --git a/middleman-core/fixtures/redirect-app/config.rb b/middleman-core/fixtures/redirect-app/config.rb index 9bc9b30b..cb33748a 100644 --- a/middleman-core/fixtures/redirect-app/config.rb +++ b/middleman-core/fixtures/redirect-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + redirect 'external.html', to: 'http://example.com' diff --git a/middleman-core/fixtures/relative-assets-app/config.rb b/middleman-core/fixtures/relative-assets-app/config.rb index 86b77274..6552107b 100644 --- a/middleman-core/fixtures/relative-assets-app/config.rb +++ b/middleman-core/fixtures/relative-assets-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :fonts_dir, 'fonts' configure :build do diff --git a/middleman-core/fixtures/sass-assets-path-app/config.rb b/middleman-core/fixtures/sass-assets-path-app/config.rb index 8e0aa398..f1d5474a 100644 --- a/middleman-core/fixtures/sass-assets-path-app/config.rb +++ b/middleman-core/fixtures/sass-assets-path-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + set :sass_assets_paths, [ File.join(root, 'assets', 'stylesheets'), File.join(root, 'my-vendor', 'stylesheets') diff --git a/middleman-core/fixtures/traversal-app/config.rb b/middleman-core/fixtures/traversal-app/config.rb index 58b69c43..cb3cd91e 100644 --- a/middleman-core/fixtures/traversal-app/config.rb +++ b/middleman-core/fixtures/traversal-app/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + proxy '/sub/fake.html', '/proxied.html', ignore: true proxy '/sub/fake2.html', '/proxied.html', ignore: true diff --git a/middleman-core/fixtures/v4-extension-callbacks/config.rb b/middleman-core/fixtures/v4-extension-callbacks/config.rb index 6248a421..49a0068b 100644 --- a/middleman-core/fixtures/v4-extension-callbacks/config.rb +++ b/middleman-core/fixtures/v4-extension-callbacks/config.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class ExtensionOne < ::Middleman::Extension helpers do def extension_two_was_activated diff --git a/middleman-core/fixtures/wildcard-app/config.rb b/middleman-core/fixtures/wildcard-app/config.rb index b59c42d8..e36c26b6 100644 --- a/middleman-core/fixtures/wildcard-app/config.rb +++ b/middleman-core/fixtures/wildcard-app/config.rb @@ -1 +1,3 @@ +# frozen_string_literal: true + page '/admin/*', layout: :admin diff --git a/middleman-core/fixtures/wildcard-directory-index-app/config.rb b/middleman-core/fixtures/wildcard-directory-index-app/config.rb index 1c47b1fb..6a99074f 100644 --- a/middleman-core/fixtures/wildcard-directory-index-app/config.rb +++ b/middleman-core/fixtures/wildcard-directory-index-app/config.rb @@ -1,2 +1,4 @@ +# frozen_string_literal: true + activate :directory_indexes page '/admin/*', layout: :admin diff --git a/middleman-core/lib/middleman-core.rb b/middleman-core/lib/middleman-core.rb index 4f325982..27d551b3 100644 --- a/middleman-core/lib/middleman-core.rb +++ b/middleman-core/lib/middleman-core.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Setup our load paths libdir = __dir__ $LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir) diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index 6fbf97fb..9ff2b441 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' require 'middleman-core/callback_manager' @@ -33,7 +35,7 @@ module Middleman # @return [String] def root r = ENV['MM_ROOT'] ? ENV['MM_ROOT'].dup : ::Middleman::Util.current_directory - r.encode!('UTF-8', 'UTF-8-MAC') if RUBY_PLATFORM =~ /darwin/ + r = r.encode('UTF-8', 'UTF-8-MAC') if RUBY_PLATFORM.match?(/darwin/) r end @@ -191,7 +193,7 @@ module Middleman end, layout: lambda { |file, app| - file[:relative_path].to_s.start_with?('layout.', app.config[:layouts_dir] + '/') + file[:relative_path].to_s.start_with?('layout.', "#{app.config[:layouts_dir]}/") } }, 'Callbacks that can exclude paths from the sitemap' diff --git a/middleman-core/lib/middleman-core/builder.rb b/middleman-core/lib/middleman-core/builder.rb index 9628c266..8734d675 100644 --- a/middleman-core/lib/middleman-core/builder.rb +++ b/middleman-core/lib/middleman-core/builder.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'pathname' require 'fileutils' require 'tempfile' @@ -436,7 +438,10 @@ module Middleman Contract String => String def binary_encode(string) - string.force_encoding('ascii-8bit') if string.respond_to?(:force_encoding) + if string.respond_to?(:force_encoding) + string = string.dup if string.frozen? + string = string.force_encoding('ascii-8bit') + end string end diff --git a/middleman-core/lib/middleman-core/callback_manager.rb b/middleman-core/lib/middleman-core/callback_manager.rb index f58a4f3d..1ec1949d 100644 --- a/middleman-core/lib/middleman-core/callback_manager.rb +++ b/middleman-core/lib/middleman-core/callback_manager.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/config_context.rb b/middleman-core/lib/middleman-core/config_context.rb index c656108d..3d99e225 100644 --- a/middleman-core/lib/middleman-core/config_context.rb +++ b/middleman-core/lib/middleman-core/config_context.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rack/mime' require 'middleman-core/callback_manager' diff --git a/middleman-core/lib/middleman-core/configuration.rb b/middleman-core/lib/middleman-core/configuration.rb index 30305e09..69a7cef7 100644 --- a/middleman-core/lib/middleman-core/configuration.rb +++ b/middleman-core/lib/middleman-core/configuration.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'set' module Middleman diff --git a/middleman-core/lib/middleman-core/contracts.rb b/middleman-core/lib/middleman-core/contracts.rb index d3e23199..e2f32eb5 100644 --- a/middleman-core/lib/middleman-core/contracts.rb +++ b/middleman-core/lib/middleman-core/contracts.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + if ENV['CONTRACTS'] != 'false' require 'contracts' require 'hamster' @@ -21,7 +23,7 @@ if ENV['CONTRACTS'] != 'false' VectorOf = Contracts::CollectionOf::Factory.new(::Hamster::Vector) class ImmutableHashOf < Contracts::CallableClass - INVALID_KEY_VALUE_PAIR = 'You should provide only one key-value pair to HashOf contract'.freeze + INVALID_KEY_VALUE_PAIR = 'You should provide only one key-value pair to HashOf contract' def initialize(key, value) @key = key @@ -53,9 +55,9 @@ else base.extend self end - # rubocop:disable MethodName + # rubocop:disable Naming/MethodName def Contract(*); end - # rubocop:enable MethodName + # rubocop:enable Naming/MethodName class Callable def self.[](*); end diff --git a/middleman-core/lib/middleman-core/core_extensions.rb b/middleman-core/lib/middleman-core/core_extensions.rb index b4bf8b29..7be425d8 100644 --- a/middleman-core/lib/middleman-core/core_extensions.rb +++ b/middleman-core/lib/middleman-core/core_extensions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/extensions' # File Change Notifier diff --git a/middleman-core/lib/middleman-core/core_extensions/collections.rb b/middleman-core/lib/middleman-core/core_extensions/collections.rb index 1e2c91a8..4ac871dc 100644 --- a/middleman-core/lib/middleman-core/core_extensions/collections.rb +++ b/middleman-core/lib/middleman-core/core_extensions/collections.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'monitor' require 'middleman-core/core_extensions/collections/pagination' require 'middleman-core/core_extensions/collections/step_context' diff --git a/middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb b/middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb index d86b6466..464d05dc 100644 --- a/middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb +++ b/middleman-core/lib/middleman-core/core_extensions/collections/lazy_root.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/core_extensions/collections/lazy_step' module Middleman diff --git a/middleman-core/lib/middleman-core/core_extensions/collections/lazy_step.rb b/middleman-core/lib/middleman-core/core_extensions/collections/lazy_step.rb index d7fec3b0..bd064b99 100644 --- a/middleman-core/lib/middleman-core/core_extensions/collections/lazy_step.rb +++ b/middleman-core/lib/middleman-core/core_extensions/collections/lazy_step.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module CoreExtensions module Collections diff --git a/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb b/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb index 5cce42ea..a8e81555 100644 --- a/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb +++ b/middleman-core/lib/middleman-core/core_extensions/collections/pagination.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/util' module Middleman diff --git a/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb b/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb index 0549b826..e8d72e52 100644 --- a/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb +++ b/middleman-core/lib/middleman-core/core_extensions/collections/step_context.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module CoreExtensions module Collections diff --git a/middleman-core/lib/middleman-core/core_extensions/data.rb b/middleman-core/lib/middleman-core/core_extensions/data.rb index 464d73be..6dfa1180 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/contracts' require 'middleman-core/core_extensions/data/controller' diff --git a/middleman-core/lib/middleman-core/core_extensions/data/controller.rb b/middleman-core/lib/middleman-core/core_extensions/data/controller.rb index 9feb2a34..5b275967 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/controller.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/controller.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/util/data' require 'middleman-core/core_extensions/data/stores/local_file' diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb index 0f575561..180b97a3 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/array.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'set' require 'middleman-core/core_extensions/data/proxies/base' diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb index 2a5d72d9..4a116b1d 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/base.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/util/data' diff --git a/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb b/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb index cb3be832..4936c021 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/proxies/hash.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/core_extensions/data/proxies/base' module Middleman diff --git a/middleman-core/lib/middleman-core/core_extensions/data/stores/base.rb b/middleman-core/lib/middleman-core/core_extensions/data/stores/base.rb index 5edb7901..0dc5ccad 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/stores/base.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/stores/base.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/dependencies/vertices/vertex' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/core_extensions/data/stores/in_memory.rb b/middleman-core/lib/middleman-core/core_extensions/data/stores/in_memory.rb index 246e319f..7da36a22 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/stores/in_memory.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/stores/in_memory.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/contracts' require 'middleman-core/core_extensions/data/stores/base' require 'middleman-core/dependencies/vertices/vertex' diff --git a/middleman-core/lib/middleman-core/core_extensions/data/stores/local_file.rb b/middleman-core/lib/middleman-core/core_extensions/data/stores/local_file.rb index 4461a731..e21f3df7 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data/stores/local_file.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data/stores/local_file.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'set' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb b/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb index db14b11c..985f9aee 100644 --- a/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb +++ b/middleman-core/lib/middleman-core/core_extensions/default_helpers.rb @@ -1,10 +1,12 @@ +# frozen_string_literal: true + require 'padrino-helpers' require 'middleman-core/contracts' class Padrino::Helpers::OutputHelpers::ErbHandler # Force Erb capture not to use safebuffer def capture_from_template(*args, &block) - self.output_buffer = '' + self.output_buffer = +'' buf_was = output_buffer raw = yield(*args) captured = template.instance_variable_get(:@_out_buf) @@ -19,13 +21,13 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension def initialize(app, options_hash = ::Middleman::EMPTY_HASH, &block) super - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::OutputHelpers - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::TagHelpers - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::AssetTagHelpers - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::FormHelpers - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::FormatHelpers - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::RenderHelpers - ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::NumberHelpers + ::Middleman::TemplateContext.include ::Padrino::Helpers::OutputHelpers + ::Middleman::TemplateContext.include ::Padrino::Helpers::TagHelpers + ::Middleman::TemplateContext.include ::Padrino::Helpers::AssetTagHelpers + ::Middleman::TemplateContext.include ::Padrino::Helpers::FormHelpers + ::Middleman::TemplateContext.include ::Padrino::Helpers::FormatHelpers + ::Middleman::TemplateContext.include ::Padrino::Helpers::RenderHelpers + ::Middleman::TemplateContext.include ::Padrino::Helpers::NumberHelpers # ::Middleman::TemplateContext.send :include, ::Padrino::Helpers::TranslationHelpers end @@ -149,7 +151,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension # If the basename of the request as no extension, assume we are serving a # directory and join index_file to the path. path = File.join(asset_dir, current_resource.path) - path = path[0..-(File.extname(path).length + 1)] + ".#{asset_ext}" + path = "#{path[0..-(File.extname(path).length + 1)]}.#{asset_ext}" yield path if sitemap.by_path(path) end @@ -178,7 +180,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension c = c.gsub(/[^a-zA-Z0-9\-_]/, '-') # Class names can't start with a digit - c = "#{prefix}#{c}" if c =~ /\A\d/ + c = "#{prefix}#{c}" if /\A\d/.match?(c) c end.join(' ') end @@ -266,7 +268,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension src_def else image_def, size_def = src_def.strip.split(/\s+/) - asset_path(:images, image_def) + ' ' + size_def + "#{asset_path(:images, image_def)} #{size_def}" end end diff --git a/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb b/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb index 30aa245a..e8eee0d1 100644 --- a/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb +++ b/middleman-core/lib/middleman-core/core_extensions/external_helpers.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module CoreExtensions # Load helpers in `helpers/` diff --git a/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb b/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb index 8f7aa759..239e7fba 100644 --- a/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb +++ b/middleman-core/lib/middleman-core/core_extensions/file_watcher.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/contracts' require 'middleman-core/sources' diff --git a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb index 9804751f..5355a0c7 100644 --- a/middleman-core/lib/middleman-core/core_extensions/front_matter.rb +++ b/middleman-core/lib/middleman-core/core_extensions/front_matter.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Core Pathname library used for traversal require 'pathname' diff --git a/middleman-core/lib/middleman-core/core_extensions/i18n.rb b/middleman-core/lib/middleman-core/core_extensions/i18n.rb index 877382fe..d9f4cb2c 100644 --- a/middleman-core/lib/middleman-core/core_extensions/i18n.rb +++ b/middleman-core/lib/middleman-core/core_extensions/i18n.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension option :no_fallbacks, false, 'Disable I18n fallbacks' option :locales, nil, 'List of locales, will autodiscover by default' @@ -30,7 +32,7 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension # See https://github.com/svenfuchs/i18n/wiki/Fallbacks unless options[:no_fallbacks] require 'i18n/backend/fallbacks' - ::I18n::Backend::Simple.send(:include, ::I18n::Backend::Fallbacks) + ::I18n::Backend::Simple.include ::I18n::Backend::Fallbacks end locales_file_path = options[:data] @@ -232,13 +234,13 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension # We also generate a map with the same infos, but with the locales as keys. # e.g. {:en => '/en/index.html', :de => '/de/index.html', :es => '/index.html'} locale_map = resources.each_with_object({}) do |resource, map| - map[resource.locale] = '/' + resource.path + map[resource.locale] = "/#{resource.path}" end # Then we add those to the lookup table, so every path has a # cross-reference to any other path in other locales. exposed_paths.each do |path| - @lookup['/' + path] = locale_map + @lookup["/#{path}"] = locale_map end end diff --git a/middleman-core/lib/middleman-core/core_extensions/rendering.rb b/middleman-core/lib/middleman-core/core_extensions/rendering.rb index 33d3d02d..d039f941 100644 --- a/middleman-core/lib/middleman-core/core_extensions/rendering.rb +++ b/middleman-core/lib/middleman-core/core_extensions/rendering.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/template_context' # ERb Support diff --git a/middleman-core/lib/middleman-core/core_extensions/routing.rb b/middleman-core/lib/middleman-core/core_extensions/routing.rb index 4c06ec95..ca51406d 100644 --- a/middleman-core/lib/middleman-core/core_extensions/routing.rb +++ b/middleman-core/lib/middleman-core/core_extensions/routing.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Routing extension module Middleman module CoreExtensions @@ -19,7 +21,7 @@ module Middleman normalized_path = ::File.join(normalized_path, app.config[:index_file]) if normalized_path.end_with?('/') || app.files.by_type(:source).watchers.any? { |w| (w.directory + Pathname(normalized_path)).directory? } end - normalized_path = '/' + ::Middleman::Util.strip_leading_slash(normalized_path) if normalized_path.is_a?(String) + normalized_path = "/#{::Middleman::Util.strip_leading_slash(normalized_path)}" if normalized_path.is_a?(String) resource_list .select { |r| ::Middleman::Util.path_match(normalized_path, "/#{r.path}") } diff --git a/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb b/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb index 5c908922..e3f41d45 100644 --- a/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb +++ b/middleman-core/lib/middleman-core/core_extensions/show_exceptions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rack/show_exceptions' # Support rack/showexceptions during development diff --git a/middleman-core/lib/middleman-core/data_proxy.rb b/middleman-core/lib/middleman-core/data_proxy.rb index 4fa98649..c2da0a76 100644 --- a/middleman-core/lib/middleman-core/data_proxy.rb +++ b/middleman-core/lib/middleman-core/data_proxy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' require 'middleman-core/core_extensions/data/proxies/array' diff --git a/middleman-core/lib/middleman-core/dependencies.rb b/middleman-core/lib/middleman-core/dependencies.rb index eb5a5d1c..19f6c2a0 100644 --- a/middleman-core/lib/middleman-core/dependencies.rb +++ b/middleman-core/lib/middleman-core/dependencies.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'set' require 'pathname' diff --git a/middleman-core/lib/middleman-core/dependencies/edge.rb b/middleman-core/lib/middleman-core/dependencies/edge.rb index e5eed2a8..a78fb005 100644 --- a/middleman-core/lib/middleman-core/dependencies/edge.rb +++ b/middleman-core/lib/middleman-core/dependencies/edge.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/contracts' require 'middleman-core/dependencies/vertices/vertex' diff --git a/middleman-core/lib/middleman-core/dependencies/graph.rb b/middleman-core/lib/middleman-core/dependencies/graph.rb index efd2684d..77baad1b 100644 --- a/middleman-core/lib/middleman-core/dependencies/graph.rb +++ b/middleman-core/lib/middleman-core/dependencies/graph.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'set' require 'rgl/adjacency' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/dependencies/vertices.rb b/middleman-core/lib/middleman-core/dependencies/vertices.rb index a430f663..dbe1c0aa 100644 --- a/middleman-core/lib/middleman-core/dependencies/vertices.rb +++ b/middleman-core/lib/middleman-core/dependencies/vertices.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/dependencies/vertices/data_collection_vertex' require 'middleman-core/dependencies/vertices/data_collection_path_vertex' require 'middleman-core/dependencies/vertices/file_vertex' diff --git a/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb b/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb index 0507bc16..b39f70ba 100644 --- a/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb +++ b/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_path_vertex.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' require 'middleman-core/dependencies/vertices/vertex' diff --git a/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_vertex.rb b/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_vertex.rb index f8bd54d1..14f9383d 100644 --- a/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_vertex.rb +++ b/middleman-core/lib/middleman-core/dependencies/vertices/data_collection_vertex.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' require 'middleman-core/dependencies/vertices/vertex' diff --git a/middleman-core/lib/middleman-core/dependencies/vertices/file_vertex.rb b/middleman-core/lib/middleman-core/dependencies/vertices/file_vertex.rb index efb3443e..f4644785 100644 --- a/middleman-core/lib/middleman-core/dependencies/vertices/file_vertex.rb +++ b/middleman-core/lib/middleman-core/dependencies/vertices/file_vertex.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'pathname' require 'middleman-core/contracts' require 'middleman-core/dependencies/vertices/vertex' diff --git a/middleman-core/lib/middleman-core/dependencies/vertices/vertex.rb b/middleman-core/lib/middleman-core/dependencies/vertices/vertex.rb index f9e454fb..f80fcf43 100644 --- a/middleman-core/lib/middleman-core/dependencies/vertices/vertex.rb +++ b/middleman-core/lib/middleman-core/dependencies/vertices/vertex.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'pathname' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/dns_resolver.rb b/middleman-core/lib/middleman-core/dns_resolver.rb index c61b4a76..1baf3610 100644 --- a/middleman-core/lib/middleman-core/dns_resolver.rb +++ b/middleman-core/lib/middleman-core/dns_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'resolv' require 'middleman-core/dns_resolver/network_resolver' require 'middleman-core/dns_resolver/hosts_resolver' diff --git a/middleman-core/lib/middleman-core/dns_resolver/basic_network_resolver.rb b/middleman-core/lib/middleman-core/dns_resolver/basic_network_resolver.rb index 6429ff20..9c2fd7ba 100644 --- a/middleman-core/lib/middleman-core/dns_resolver/basic_network_resolver.rb +++ b/middleman-core/lib/middleman-core/dns_resolver/basic_network_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman class DnsResolver # Use network name server to resolve ips and names diff --git a/middleman-core/lib/middleman-core/dns_resolver/hosts_resolver.rb b/middleman-core/lib/middleman-core/dns_resolver/hosts_resolver.rb index 79148046..15dabb12 100644 --- a/middleman-core/lib/middleman-core/dns_resolver/hosts_resolver.rb +++ b/middleman-core/lib/middleman-core/dns_resolver/hosts_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman class DnsResolver # Use network name server to resolve ips and names diff --git a/middleman-core/lib/middleman-core/dns_resolver/local_link_resolver.rb b/middleman-core/lib/middleman-core/dns_resolver/local_link_resolver.rb index 82f2c2f2..b82c7acb 100644 --- a/middleman-core/lib/middleman-core/dns_resolver/local_link_resolver.rb +++ b/middleman-core/lib/middleman-core/dns_resolver/local_link_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/dns_resolver/basic_network_resolver' module Middleman diff --git a/middleman-core/lib/middleman-core/dns_resolver/network_resolver.rb b/middleman-core/lib/middleman-core/dns_resolver/network_resolver.rb index 0994778c..bd17e153 100644 --- a/middleman-core/lib/middleman-core/dns_resolver/network_resolver.rb +++ b/middleman-core/lib/middleman-core/dns_resolver/network_resolver.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/dns_resolver/basic_network_resolver' module Middleman diff --git a/middleman-core/lib/middleman-core/extension.rb b/middleman-core/lib/middleman-core/extension.rb index 4168324e..3e7a33c7 100644 --- a/middleman-core/lib/middleman-core/extension.rb +++ b/middleman-core/lib/middleman-core/extension.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'forwardable' require 'memoist' require 'middleman-core/configuration' diff --git a/middleman-core/lib/middleman-core/extension_manager.rb b/middleman-core/lib/middleman-core/extension_manager.rb index b018c486..36378a29 100644 --- a/middleman-core/lib/middleman-core/extension_manager.rb +++ b/middleman-core/lib/middleman-core/extension_manager.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman class ExtensionManager extend Forwardable diff --git a/middleman-core/lib/middleman-core/extensions.rb b/middleman-core/lib/middleman-core/extensions.rb index 24e0d2ee..ee61b3c9 100644 --- a/middleman-core/lib/middleman-core/extensions.rb +++ b/middleman-core/lib/middleman-core/extensions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/extension' require 'middleman-core/util/empty_hash' diff --git a/middleman-core/lib/middleman-core/extensions/asset_hash.rb b/middleman-core/lib/middleman-core/extensions/asset_hash.rb index 86f5e05a..dd621a15 100644 --- a/middleman-core/lib/middleman-core/extensions/asset_hash.rb +++ b/middleman-core/lib/middleman-core/extensions/asset_hash.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/util' class Middleman::Extensions::AssetHash < ::Middleman::Extension diff --git a/middleman-core/lib/middleman-core/extensions/asset_host.rb b/middleman-core/lib/middleman-core/extensions/asset_host.rb index 54465108..03b2a9a8 100644 --- a/middleman-core/lib/middleman-core/extensions/asset_host.rb +++ b/middleman-core/lib/middleman-core/extensions/asset_host.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Middleman::Extensions::AssetHost < ::Middleman::Extension option :host, nil, 'The asset host to use or a Proc to determine asset host', required: true option :exts, nil, 'List of extensions that get cache busters strings appended to them.' diff --git a/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb b/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb index 16001cde..0318b23b 100644 --- a/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb +++ b/middleman-core/lib/middleman-core/extensions/automatic_image_sizes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Automatic Image Sizes extension class Middleman::Extensions::AutomaticImageSizes < ::Middleman::Extension def initialize(app, options_hash = ::Middleman::EMPTY_HASH, &block) diff --git a/middleman-core/lib/middleman-core/extensions/cache_buster.rb b/middleman-core/lib/middleman-core/extensions/cache_buster.rb index 63f1b546..e737b030 100644 --- a/middleman-core/lib/middleman-core/extensions/cache_buster.rb +++ b/middleman-core/lib/middleman-core/extensions/cache_buster.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # The Cache Buster extension class Middleman::Extensions::CacheBuster < ::Middleman::Extension option :exts, nil, 'List of extensions that get cache busters strings appended to them.' @@ -31,6 +33,6 @@ class Middleman::Extensions::CacheBuster < ::Middleman::Extension Contract String, Or[String, Pathname], Any => String def rewrite_url(asset_path, _dirpath, _request_path) - asset_path + '?' + Time.now.strftime('%s') + "#{asset_path}?#{Time.now.strftime('%s')}" end end diff --git a/middleman-core/lib/middleman-core/extensions/directory_indexes.rb b/middleman-core/lib/middleman-core/extensions/directory_indexes.rb index 980de7f6..f283e847 100644 --- a/middleman-core/lib/middleman-core/extensions/directory_indexes.rb +++ b/middleman-core/lib/middleman-core/extensions/directory_indexes.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'set' # Directory Indexes extension diff --git a/middleman-core/lib/middleman-core/extensions/external_pipeline.rb b/middleman-core/lib/middleman-core/extensions/external_pipeline.rb index 85d4c7d7..18dbb422 100644 --- a/middleman-core/lib/middleman-core/extensions/external_pipeline.rb +++ b/middleman-core/lib/middleman-core/extensions/external_pipeline.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Middleman::Extensions::ExternalPipeline < ::Middleman::Extension self.supports_multiple_instances = true diff --git a/middleman-core/lib/middleman-core/extensions/gzip.rb b/middleman-core/lib/middleman-core/extensions/gzip.rb index feec82da..a7b1149b 100644 --- a/middleman-core/lib/middleman-core/extensions/gzip.rb +++ b/middleman-core/lib/middleman-core/extensions/gzip.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'padrino-helpers' # This extension Gzips assets and pages when building. @@ -81,7 +83,7 @@ class Middleman::Extensions::Gzip < ::Middleman::Extension Contract String => [Maybe[String], Maybe[Num], Maybe[Num]] def gzip_file(path) input_file = File.open(path, 'rb').read - output_filename = options.overwrite ? path : path + '.gz' + output_filename = options.overwrite ? path : "#{path}.gz" input_file_time = File.mtime(path) # Check if the right file's already there @@ -115,7 +117,7 @@ class Middleman::Extensions::Gzip < ::Middleman::Extension def should_gzip?(path) return false unless @set_of_exts.include?(path.extname) - path = path.sub app.config[:build_dir] + '/', '' + path = path.sub "#{app.config[:build_dir]}/", '' options.ignore.none? { |ignore| Middleman::Util.path_match(ignore, path.to_s) } end end diff --git a/middleman-core/lib/middleman-core/extensions/lorem.rb b/middleman-core/lib/middleman-core/extensions/lorem.rb index 55cea5b0..630a1121 100644 --- a/middleman-core/lib/middleman-core/extensions/lorem.rb +++ b/middleman-core/lib/middleman-core/extensions/lorem.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + class Middleman::Extensions::Lorem < ::Middleman::Extension helpers do # Access to the Lorem object @@ -147,7 +149,7 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension # @return [String] def image(size, options_hash = ::Middleman::EMPTY_HASH) domain = options_hash[:domain] || 'http://placehold.it' - src = "#{domain}/#{size}" + src_array = ["#{domain}/#{size}"] hex = %w[a b c d e f 0 1 2 3 4 5 6 7 8 9] background_color = options_hash[:background_color] color = options_hash[:color] @@ -157,12 +159,12 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension color = hex.sample(6).join end - src << "/#{background_color.sub(/^#/, '')}" if background_color - src << '/ccc' if background_color.nil? && color - src << "/#{color.sub(/^#/, '')}" if color - src << "&text=#{Rack::Utils.escape(options_hash[:text])}" if options_hash[:text] + src_array << "/#{background_color.sub(/^#/, '')}" if background_color + src_array << '/ccc' if background_color.nil? && color + src_array << "/#{color.sub(/^#/, '')}" if color + src_array << "&text=#{Rack::Utils.escape(options_hash[:text])}" if options_hash[:text] - src + src_array.join end # Pick a random item from a given range diff --git a/middleman-core/lib/middleman-core/extensions/minify_css.rb b/middleman-core/lib/middleman-core/extensions/minify_css.rb index 861c36c2..8207f0d9 100644 --- a/middleman-core/lib/middleman-core/extensions/minify_css.rb +++ b/middleman-core/lib/middleman-core/extensions/minify_css.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'memoist' require 'middleman-core/contracts' require 'rack/mime' diff --git a/middleman-core/lib/middleman-core/extensions/minify_javascript.rb b/middleman-core/lib/middleman-core/extensions/minify_javascript.rb index a73f3698..734a01bd 100644 --- a/middleman-core/lib/middleman-core/extensions/minify_javascript.rb +++ b/middleman-core/lib/middleman-core/extensions/minify_javascript.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/contracts' require 'memoist' diff --git a/middleman-core/lib/middleman-core/extensions/relative_assets.rb b/middleman-core/lib/middleman-core/extensions/relative_assets.rb index 9d62e2ad..9a578d46 100644 --- a/middleman-core/lib/middleman-core/extensions/relative_assets.rb +++ b/middleman-core/lib/middleman-core/extensions/relative_assets.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Relative Assets extension class Middleman::Extensions::RelativeAssets < ::Middleman::Extension option :exts, nil, 'List of extensions that get converted to relative paths.' diff --git a/middleman-core/lib/middleman-core/file_renderer.rb b/middleman-core/lib/middleman-core/file_renderer.rb index a6e44435..c4932bd6 100644 --- a/middleman-core/lib/middleman-core/file_renderer.rb +++ b/middleman-core/lib/middleman-core/file_renderer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'tilt' require 'hamster' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/filter.rb b/middleman-core/lib/middleman-core/filter.rb index 0e13f012..eb6f4672 100644 --- a/middleman-core/lib/middleman-core/filter.rb +++ b/middleman-core/lib/middleman-core/filter.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' require 'middleman-core/dependencies/vertices/vertex' diff --git a/middleman-core/lib/middleman-core/inline_url_filter.rb b/middleman-core/lib/middleman-core/inline_url_filter.rb index 0816bd20..d20b668b 100644 --- a/middleman-core/lib/middleman-core/inline_url_filter.rb +++ b/middleman-core/lib/middleman-core/inline_url_filter.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/util' require 'middleman-core/filter' diff --git a/middleman-core/lib/middleman-core/load_paths.rb b/middleman-core/lib/middleman-core/load_paths.rb index b03891c9..87daa53b 100644 --- a/middleman-core/lib/middleman-core/load_paths.rb +++ b/middleman-core/lib/middleman-core/load_paths.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Core Pathname library used for traversal require 'pathname' diff --git a/middleman-core/lib/middleman-core/logger.rb b/middleman-core/lib/middleman-core/logger.rb index 989656b5..657a74ef 100644 --- a/middleman-core/lib/middleman-core/logger.rb +++ b/middleman-core/lib/middleman-core/logger.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Use the Ruby/Rails logger module Middleman # The Middleman Logger diff --git a/middleman-core/lib/middleman-core/meta_pages.rb b/middleman-core/lib/middleman-core/meta_pages.rb index ae734cca..01d63bd5 100644 --- a/middleman-core/lib/middleman-core/meta_pages.rb +++ b/middleman-core/lib/middleman-core/meta_pages.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rack/builder' require 'rack/static' require 'tilt' diff --git a/middleman-core/lib/middleman-core/meta_pages/config_setting.rb b/middleman-core/lib/middleman-core/meta_pages/config_setting.rb index d10a484a..d1fcd3cd 100644 --- a/middleman-core/lib/middleman-core/meta_pages/config_setting.rb +++ b/middleman-core/lib/middleman-core/meta_pages/config_setting.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'pp' module Middleman @@ -12,7 +14,7 @@ module Middleman end def render - content = '' + content = [] key_classes = ['key'] key_classes << 'modified' if @setting.value_set? content << content_tag(:span, @setting.key.pretty_inspect.strip, class: key_classes.join(' ')) @@ -30,7 +32,7 @@ module Middleman end end - content + content.join end end end diff --git a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb index fecaef96..7abd4ab6 100644 --- a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb +++ b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'padrino-helpers' module Middleman @@ -12,9 +14,9 @@ module Middleman end def render - classes = 'resource-details' - classes << ' ignored' if @resource.ignored? - content_tag :div, class: classes do + classes = ['resource-details'] + classes << 'ignored' if @resource.ignored? + content_tag :div, class: classes.join(' ') do content_tag :table do content = '' resource_properties.each do |label, value| diff --git a/middleman-core/lib/middleman-core/meta_pages/sitemap_tree.rb b/middleman-core/lib/middleman-core/meta_pages/sitemap_tree.rb index 66c9b4ca..3b44212d 100644 --- a/middleman-core/lib/middleman-core/meta_pages/sitemap_tree.rb +++ b/middleman-core/lib/middleman-core/meta_pages/sitemap_tree.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/meta_pages/sitemap_resource' module Middleman @@ -35,12 +37,14 @@ module Middleman sorted_children_keys.reduce('') do |content, path_part| subtree = @children[path_part] - content << "
" - content << '' - content << "" unless subtree.is_a? SitemapResource - content << "#{path_part}" - content << subtree.render - content << '
' + additional_content = [] + additional_content << "
" + additional_content << '' + additional_content << "" unless subtree.is_a? SitemapResource + additional_content << "#{path_part}" + additional_content << subtree.render + additional_content << '
' + "#{content}#{additional_content.join}" end end diff --git a/middleman-core/lib/middleman-core/preview_server.rb b/middleman-core/lib/middleman-core/preview_server.rb index 1f969923..c9498362 100644 --- a/middleman-core/lib/middleman-core/preview_server.rb +++ b/middleman-core/lib/middleman-core/preview_server.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'webrick' require 'webrick/https' require 'openssl' @@ -337,7 +339,7 @@ module Middleman class FilteredWebrickLog < ::WEBrick::Log def log(level, data) - super(level, data) unless data =~ /Could not determine content-length of response body./ + super(level, data) unless /Could not determine content-length of response body./.match?(data) end end end diff --git a/middleman-core/lib/middleman-core/preview_server/checks.rb b/middleman-core/lib/middleman-core/preview_server/checks.rb index 6f36b79b..17dc901d 100644 --- a/middleman-core/lib/middleman-core/preview_server/checks.rb +++ b/middleman-core/lib/middleman-core/preview_server/checks.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'ipaddr' module Middleman diff --git a/middleman-core/lib/middleman-core/preview_server/information.rb b/middleman-core/lib/middleman-core/preview_server/information.rb index 1e9a8236..93abee89 100644 --- a/middleman-core/lib/middleman-core/preview_server/information.rb +++ b/middleman-core/lib/middleman-core/preview_server/information.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'ipaddr' require 'middleman-core/preview_server/checks' require 'middleman-core/preview_server/server_hostname' diff --git a/middleman-core/lib/middleman-core/preview_server/network_interface_inventory.rb b/middleman-core/lib/middleman-core/preview_server/network_interface_inventory.rb index 60c4ea98..3138de5f 100644 --- a/middleman-core/lib/middleman-core/preview_server/network_interface_inventory.rb +++ b/middleman-core/lib/middleman-core/preview_server/network_interface_inventory.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/preview_server/server_ip_address' module Middleman diff --git a/middleman-core/lib/middleman-core/preview_server/server_hostname.rb b/middleman-core/lib/middleman-core/preview_server/server_hostname.rb index 29fded66..bf744087 100644 --- a/middleman-core/lib/middleman-core/preview_server/server_hostname.rb +++ b/middleman-core/lib/middleman-core/preview_server/server_hostname.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman class PreviewServer class ServerHostname @@ -15,7 +17,7 @@ module Middleman class ServerPlainHostname < SimpleDelegator def to_s - __getobj__.gsub(/\s/, '+') + '.local' + "#{__getobj__.gsub(/\s/, '+')}.local" end def self.match?(name) diff --git a/middleman-core/lib/middleman-core/preview_server/server_information.rb b/middleman-core/lib/middleman-core/preview_server/server_information.rb index 58d62bd2..80fd267c 100644 --- a/middleman-core/lib/middleman-core/preview_server/server_information.rb +++ b/middleman-core/lib/middleman-core/preview_server/server_information.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/dns_resolver' require 'middleman-core/preview_server/information' require 'middleman-core/preview_server/network_interface_inventory' diff --git a/middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb b/middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb index 819d18e8..6eab676a 100644 --- a/middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb +++ b/middleman-core/lib/middleman-core/preview_server/server_information_callback_proxy.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman class PreviewServer # This class wraps server information to be used in call back diff --git a/middleman-core/lib/middleman-core/preview_server/server_information_validator.rb b/middleman-core/lib/middleman-core/preview_server/server_information_validator.rb index ff2eeb2e..e96c76ef 100644 --- a/middleman-core/lib/middleman-core/preview_server/server_information_validator.rb +++ b/middleman-core/lib/middleman-core/preview_server/server_information_validator.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman class PreviewServer # Validate user input diff --git a/middleman-core/lib/middleman-core/preview_server/server_ip_address.rb b/middleman-core/lib/middleman-core/preview_server/server_ip_address.rb index 7d3c290c..7d315f66 100644 --- a/middleman-core/lib/middleman-core/preview_server/server_ip_address.rb +++ b/middleman-core/lib/middleman-core/preview_server/server_ip_address.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'ipaddr' require 'forwardable' diff --git a/middleman-core/lib/middleman-core/preview_server/server_url.rb b/middleman-core/lib/middleman-core/preview_server/server_url.rb index dedf63a4..ea4a8fdd 100644 --- a/middleman-core/lib/middleman-core/preview_server/server_url.rb +++ b/middleman-core/lib/middleman-core/preview_server/server_url.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'ipaddr' module Middleman diff --git a/middleman-core/lib/middleman-core/preview_server/tcp_port_prober.rb b/middleman-core/lib/middleman-core/preview_server/tcp_port_prober.rb index 8b33b7b8..f5f10625 100644 --- a/middleman-core/lib/middleman-core/preview_server/tcp_port_prober.rb +++ b/middleman-core/lib/middleman-core/preview_server/tcp_port_prober.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman class PreviewServer # Probe for tcp ports diff --git a/middleman-core/lib/middleman-core/profiling.rb b/middleman-core/lib/middleman-core/profiling.rb index c360b113..5d777ab5 100644 --- a/middleman-core/lib/middleman-core/profiling.rb +++ b/middleman-core/lib/middleman-core/profiling.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module Profiling class << self @@ -42,7 +44,7 @@ module Middleman printer = RubyProf::GraphHtmlPrinter.new(result) outfile = File.join('profile', report_name) - outfile = (outfile + '.html') unless outfile.end_with? '.html' + outfile = "#{outfile}.html" unless outfile.end_with? '.html' FileUtils.mkdir_p(File.dirname(outfile)) File.open(outfile, 'w') do |f| printer.print(f, min_percent: 1) diff --git a/middleman-core/lib/middleman-core/rack.rb b/middleman-core/lib/middleman-core/rack.rb index f1e26a53..39f1b496 100644 --- a/middleman-core/lib/middleman-core/rack.rb +++ b/middleman-core/lib/middleman-core/rack.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rack' require 'rack/file' require 'rack/lint' @@ -89,7 +91,10 @@ module Middleman start_time = Time.now request_path = WEBrick::HTTPUtils.unescape(env['PATH_INFO'].dup) - request_path.force_encoding('UTF-8') if request_path.respond_to? :force_encoding + if request_path.respond_to? :force_encoding + request_path = request_path.dup if request_path.frozen? + request_path = request_path.force_encoding('UTF-8') + end request_path = ::Middleman::Util.full_path(request_path, @middleman) full_request_path = File.join(env['SCRIPT_NAME'], request_path) # Path including rack mount diff --git a/middleman-core/lib/middleman-core/renderers/coffee_script.rb b/middleman-core/lib/middleman-core/renderers/coffee_script.rb index 43923246..b0375d86 100644 --- a/middleman-core/lib/middleman-core/renderers/coffee_script.rb +++ b/middleman-core/lib/middleman-core/renderers/coffee_script.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Require gem require 'coffee_script' diff --git a/middleman-core/lib/middleman-core/renderers/erb.rb b/middleman-core/lib/middleman-core/renderers/erb.rb index 0d541db4..e2c0c29b 100644 --- a/middleman-core/lib/middleman-core/renderers/erb.rb +++ b/middleman-core/lib/middleman-core/renderers/erb.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # ERb renderer module Middleman module Renderers @@ -12,7 +14,7 @@ module Middleman # def precompiled_preamble(locals) original = super - "__in_erb_template = true\n" << original + "__in_erb_template = true\n#{original}" # .rpartition("\n").first << "#{@outvar} = _buf = ::ActiveSupport::SafeBuffer.new\n" end end diff --git a/middleman-core/lib/middleman-core/renderers/haml.rb b/middleman-core/lib/middleman-core/renderers/haml.rb index 989bbc9a..d96583f9 100644 --- a/middleman-core/lib/middleman-core/renderers/haml.rb +++ b/middleman-core/lib/middleman-core/renderers/haml.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Require gem require 'haml' @@ -10,9 +12,7 @@ module SafeTemplate end end -class Tilt::HamlTemplate - include SafeTemplate -end +::Tilt::HamlTemplate.include SafeTemplate module Middleman module Renderers @@ -64,7 +64,7 @@ module Middleman ::Tilt.prefer(::Middleman::Renderers::HamlTemplate, :haml) # Add haml helpers to context - ::Middleman::TemplateContext.send :include, ::Haml::Helpers + ::Middleman::TemplateContext.include ::Haml::Helpers end def add_exposed_to_context(context) diff --git a/middleman-core/lib/middleman-core/renderers/kramdown.rb b/middleman-core/lib/middleman-core/renderers/kramdown.rb index 9e990dca..823b1ef6 100644 --- a/middleman-core/lib/middleman-core/renderers/kramdown.rb +++ b/middleman-core/lib/middleman-core/renderers/kramdown.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'kramdown' module Middleman @@ -36,8 +38,8 @@ module Middleman content = inner(el, indent) if el.attr['href'].start_with?('mailto:') - mail_addr = el.attr['href'].sub(/\Amailto:/, '') - href = obfuscate('mailto') << ':' << obfuscate(mail_addr) + mail_addr = el.attr['href'].delete_prefix('mailto:') + href = "#{obfuscate('mailto')}:#{obfuscate(mail_addr)}" content = obfuscate(content) if content == mail_addr return %(#{content}) end diff --git a/middleman-core/lib/middleman-core/renderers/less.rb b/middleman-core/lib/middleman-core/renderers/less.rb index b4db2fb3..4899a39c 100644 --- a/middleman-core/lib/middleman-core/renderers/less.rb +++ b/middleman-core/lib/middleman-core/renderers/less.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'less' module Middleman diff --git a/middleman-core/lib/middleman-core/renderers/liquid.rb b/middleman-core/lib/middleman-core/renderers/liquid.rb index a15358fa..31822ada 100644 --- a/middleman-core/lib/middleman-core/renderers/liquid.rb +++ b/middleman-core/lib/middleman-core/renderers/liquid.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Require Gem require 'liquid' diff --git a/middleman-core/lib/middleman-core/renderers/markdown.rb b/middleman-core/lib/middleman-core/renderers/markdown.rb index a944bcaa..2e4cc783 100644 --- a/middleman-core/lib/middleman-core/renderers/markdown.rb +++ b/middleman-core/lib/middleman-core/renderers/markdown.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module Renderers # Markdown renderer diff --git a/middleman-core/lib/middleman-core/renderers/redcarpet.rb b/middleman-core/lib/middleman-core/renderers/redcarpet.rb index 81c7af90..bb504ce6 100644 --- a/middleman-core/lib/middleman-core/renderers/redcarpet.rb +++ b/middleman-core/lib/middleman-core/renderers/redcarpet.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'redcarpet' module Middleman @@ -75,7 +77,7 @@ module Middleman scope.image_tag(link, title: title, alt: alt_text) else link_string = link.dup - link_string << %("#{title}") if title && !title.empty? && title != alt_text + link_string = %(#{link_string}"#{title}") if title && !title.empty? && title != alt_text "![#{alt_text}](#{link_string})" end end @@ -88,7 +90,7 @@ module Middleman scope.link_to(content, link, attributes) else link_string = link.dup - link_string << %("#{title}") if title && !title.empty? && title != alt_text + link_string = %(#{link_string}"#{title}") if title && !title.empty? && title != alt_text "[#{content}](#{link_string})" end end diff --git a/middleman-core/lib/middleman-core/renderers/sass.rb b/middleman-core/lib/middleman-core/renderers/sass.rb index 77f78e4d..84ecf4a5 100644 --- a/middleman-core/lib/middleman-core/renderers/sass.rb +++ b/middleman-core/lib/middleman-core/renderers/sass.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'sassc' require 'middleman-core/dependencies' @@ -7,7 +9,7 @@ module Middleman module Renderers # Sass renderer class Sass < ::Middleman::Extension - DEFAULT_SASS_CACHE_LOCATION = './.sass-cache'.freeze + DEFAULT_SASS_CACHE_LOCATION = './.sass-cache' opts = { output_style: :nested } opts[:line_comments] = false if ENV['TEST'] @@ -69,7 +71,7 @@ module Middleman def exception_to_css(e) header = "#{e.class}: #{e.message}" - <<~END + error_msg = <<~END /* #{header.gsub('*/', '*\\/')} @@ -80,6 +82,8 @@ module Middleman font-family: monospace; content: "#{header.gsub('"', '\"').gsub("\n", '\\A ')}"; } END + error_msg = error_msg.dup if error_msg.frozen? # slim will fail, if we pass frozen string as render result + error_msg end def vertices diff --git a/middleman-core/lib/middleman-core/renderers/sass_functions.rb b/middleman-core/lib/middleman-core/renderers/sass_functions.rb index 34c73aa4..190fd839 100644 --- a/middleman-core/lib/middleman-core/renderers/sass_functions.rb +++ b/middleman-core/lib/middleman-core/renderers/sass_functions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module Sass module Functions @@ -112,4 +114,4 @@ module Middleman end end -::SassC::Script::Functions.send :include, ::Middleman::Sass::Functions +::SassC::Script::Functions.include ::Middleman::Sass::Functions diff --git a/middleman-core/lib/middleman-core/renderers/slim.rb b/middleman-core/lib/middleman-core/renderers/slim.rb index 4937f910..a6d94ad1 100644 --- a/middleman-core/lib/middleman-core/renderers/slim.rb +++ b/middleman-core/lib/middleman-core/renderers/slim.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Load gem require 'slim' @@ -7,9 +9,7 @@ module SafeTemplate end end -class ::Slim::Template - include SafeTemplate - +module SlimTemplatePatch def initialize(file, line, opts, &block) if opts.key?(:context) ::Slim::Embedded::SassEngine.disable_option_validator! @@ -22,10 +22,14 @@ class ::Slim::Template end def precompiled_preamble(locals) - "__in_slim_template = true\n" << super + original = super + "__in_slim_template = true\n#{original}" end end +::Slim::Template.include SafeTemplate +::Slim::Template.prepend SlimTemplatePatch + module Middleman module Renderers # Slim renderer diff --git a/middleman-core/lib/middleman-core/renderers/stylus.rb b/middleman-core/lib/middleman-core/renderers/stylus.rb index c116aa3f..0f54dd1c 100644 --- a/middleman-core/lib/middleman-core/renderers/stylus.rb +++ b/middleman-core/lib/middleman-core/renderers/stylus.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'stylus' require 'stylus/tilt' diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb b/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb index f7060d75..70d42b56 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module Sitemap module Extensions diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/import.rb b/middleman-core/lib/middleman-core/sitemap/extensions/import.rb index 359f2fec..98e221cf 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/import.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/import.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'set' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/move_file.rb b/middleman-core/lib/middleman-core/sitemap/extensions/move_file.rb index 136c51ba..15e1d610 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/move_file.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/move_file.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/sitemap/resource' require 'middleman-core/core_extensions/collections/step_context' diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/on_disk.rb b/middleman-core/lib/middleman-core/sitemap/extensions/on_disk.rb index 1ff546bf..55db0e27 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/on_disk.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/on_disk.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'set' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb b/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb index fbd70954..d4cc5da5 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/sitemap/resource' require 'middleman-core/core_extensions/collections/step_context' diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb b/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb index f54e46f9..e37a57e5 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/redirects.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/sitemap/resource' require 'middleman-core/contracts' diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb b/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb index 7f3337d6..a25818d8 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/request_endpoints.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/sitemap/resource' module Middleman diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/traversal.rb b/middleman-core/lib/middleman-core/sitemap/extensions/traversal.rb index 6ea2a394..51069da4 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/traversal.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/traversal.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman module Sitemap module Extensions @@ -146,7 +148,7 @@ module Middleman # (e.g., for 'gallery.html' this would return 'gallery/') # @return [String] def eponymous_directory_path - path.sub(ext, '/').sub(%r{/$}, '') + '/' + "#{path.sub(ext, '/').sub(%r{/$}, '')}/" end end end diff --git a/middleman-core/lib/middleman-core/sitemap/resource.rb b/middleman-core/lib/middleman-core/sitemap/resource.rb index e54d9d5c..d1e1f1dc 100644 --- a/middleman-core/lib/middleman-core/sitemap/resource.rb +++ b/middleman-core/lib/middleman-core/sitemap/resource.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'rack/mime' require 'set' require 'hamster' @@ -72,11 +74,11 @@ module Middleman @metadata_options = ::Middleman::EMPTY_HASH # Locals are local variables for rendering this resource's template - @metadata_locals = ::Middleman::EMPTY_HASH + @metadata_locals = ::Middleman::EMPTY_HASH # Page are data that is exposed through this resource's data member. # Note: It is named 'page' for backwards compatibility with older MM. - @metadata_page = ::Middleman::EMPTY_HASH + @metadata_page = ::Middleman::EMPTY_HASH # Recursively enhanced page data cache @page_data = nil diff --git a/middleman-core/lib/middleman-core/sitemap/resource_list_container.rb b/middleman-core/lib/middleman-core/sitemap/resource_list_container.rb index 74b542ec..b52e4ceb 100644 --- a/middleman-core/lib/middleman-core/sitemap/resource_list_container.rb +++ b/middleman-core/lib/middleman-core/sitemap/resource_list_container.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' require 'middleman-core/sitemap/resource' diff --git a/middleman-core/lib/middleman-core/sitemap/store.rb b/middleman-core/lib/middleman-core/sitemap/store.rb index 3170ebd0..d2353265 100644 --- a/middleman-core/lib/middleman-core/sitemap/store.rb +++ b/middleman-core/lib/middleman-core/sitemap/store.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Used for merging results of metadata callbacks require 'monitor' require 'hamster' diff --git a/middleman-core/lib/middleman-core/sources.rb b/middleman-core/lib/middleman-core/sources.rb index ab603d8a..15ec44ed 100644 --- a/middleman-core/lib/middleman-core/sources.rb +++ b/middleman-core/lib/middleman-core/sources.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'hamster' require 'middleman-core/contracts' require 'set' diff --git a/middleman-core/lib/middleman-core/sources/source_watcher.rb b/middleman-core/lib/middleman-core/sources/source_watcher.rb index 0de06054..1e349516 100644 --- a/middleman-core/lib/middleman-core/sources/source_watcher.rb +++ b/middleman-core/lib/middleman-core/sources/source_watcher.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Watcher Library require 'listen' require 'middleman-core/contracts' @@ -135,7 +137,7 @@ module Middleman # @return [Middleman::SourceFile, nil] Contract Or[String, Pathname], Maybe[Bool] => Maybe[IsA['Middleman::SourceFile']] def find(path, glob = false) - path = path.to_s.encode!('UTF-8', 'UTF-8-MAC') if RUBY_PLATFORM =~ /darwin/ + path = path.to_s.encode('UTF-8', 'UTF-8-MAC') if RUBY_PLATFORM.match?(/darwin/) p = Pathname(path) @@ -342,7 +344,7 @@ module Middleman Contract Pathname => Pathname def strip_extensions(p) p = p.sub_ext('') while ::Tilt[p.to_s] || p.extname == '.html' - Pathname(p.to_s + '.*') + Pathname("#{p}.*") end # Check if this watcher should care about a file. diff --git a/middleman-core/lib/middleman-core/step_definitions.rb b/middleman-core/lib/middleman-core/step_definitions.rb index b282356a..69ced619 100644 --- a/middleman-core/lib/middleman-core/step_definitions.rb +++ b/middleman-core/lib/middleman-core/step_definitions.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'aruba/cucumber' require 'middleman-core/step_definitions/middleman_steps' require 'middleman-core/step_definitions/builder_steps' diff --git a/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb b/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb index c12c3f7e..bae5674c 100644 --- a/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/builder_steps.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'fileutils' Before do diff --git a/middleman-core/lib/middleman-core/step_definitions/commandline_steps.rb b/middleman-core/lib/middleman-core/step_definitions/commandline_steps.rb index 15678ab2..c6996470 100644 --- a/middleman-core/lib/middleman-core/step_definitions/commandline_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/commandline_steps.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + When /^I stop (?:middleman|all commands) if the output( of the last command)? contains:$/ do |_last_command, expected| step 'I wait for the output to contain:', expected all_commands.each(&:terminate) @@ -16,8 +18,8 @@ When /^I wait for the output to contain:$/ do |expected| rescue ChildProcess::TimeoutError, TimeoutError @interactive.terminate ensure - aruba.announcer.stdout @interactive.stdout - aruba.announcer.stderr @interactive.stderr + aruba.announcer.announce(:stdout, @interactive.stdout) + aruba.announcer.announce(:stderr, @interactive.stderr) end # Make it just a long running process diff --git a/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb b/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb index 41dc57ce..216e2040 100644 --- a/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/middleman_steps.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'fileutils' Given /^app "([^\"]*)" is using config "([^\"]*)"$/ do |_path, config_name| diff --git a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb index 2a6fe70f..69e16250 100644 --- a/middleman-core/lib/middleman-core/step_definitions/server_steps.rb +++ b/middleman-core/lib/middleman-core/step_definitions/server_steps.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/rack' require 'rspec/expectations' require 'capybara/cucumber' diff --git a/middleman-core/lib/middleman-core/template_context.rb b/middleman-core/lib/middleman-core/template_context.rb index deff8347..988a5ec9 100644 --- a/middleman-core/lib/middleman-core/template_context.rb +++ b/middleman-core/lib/middleman-core/template_context.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'pathname' require 'hamster' require 'middleman-core/file_renderer' @@ -159,7 +161,7 @@ module Middleman if current_resource resource = current_resource - current_dir = resource.file_descriptor[:relative_path].dirname + current_dir = resource.file_descriptor[:relative_path].dirname relative_dir = current_dir + Pathname(non_root) relative_dir_no_underscore = current_dir + Pathname(non_root_no_underscore) diff --git a/middleman-core/lib/middleman-core/template_renderer.rb b/middleman-core/lib/middleman-core/template_renderer.rb index 9c29ca67..8e8c1b08 100644 --- a/middleman-core/lib/middleman-core/template_renderer.rb +++ b/middleman-core/lib/middleman-core/template_renderer.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'tilt' require 'hamster' require 'middleman-core/contracts' @@ -76,7 +78,7 @@ module Middleman preferred_engines.each do |preferred_engine| path_with_ext = relative_path.dup - path_with_ext << ('.' + preferred_engine) unless preferred_engine.nil? + path_with_ext = "#{path_with_ext}.#{preferred_engine}" unless preferred_engine.nil? globbing = preferred_engine == '*' diff --git a/middleman-core/lib/middleman-core/util.rb b/middleman-core/lib/middleman-core/util.rb index 6f5f790f..d1cc266d 100644 --- a/middleman-core/lib/middleman-core/util.rb +++ b/middleman-core/lib/middleman-core/util.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/application' require 'middleman-core/sources' require 'middleman-core/sitemap/resource' diff --git a/middleman-core/lib/middleman-core/util/binary.rb b/middleman-core/lib/middleman-core/util/binary.rb index 906696ec..ec2e7edf 100644 --- a/middleman-core/lib/middleman-core/util/binary.rb +++ b/middleman-core/lib/middleman-core/util/binary.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Template and Mime detection require 'tilt' require 'rack/mime' @@ -358,7 +360,7 @@ module Middleman file = ::File.open(path) first_line = file.gets - first_line = file.gets if first_line =~ /\A(?:[^\r\n]*coding:[^\r\n]*\r?\n)/ + first_line = file.gets if /\A(?:[^\r\n]*coding:[^\r\n]*\r?\n)/.match?(first_line) file.close diff --git a/middleman-core/lib/middleman-core/util/data.rb b/middleman-core/lib/middleman-core/util/data.rb index f17d32aa..5238a816 100644 --- a/middleman-core/lib/middleman-core/util/data.rb +++ b/middleman-core/lib/middleman-core/util/data.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'yaml' require 'json' require 'pathname' diff --git a/middleman-core/lib/middleman-core/util/empty_hash.rb b/middleman-core/lib/middleman-core/util/empty_hash.rb index d8fa20f7..39150607 100644 --- a/middleman-core/lib/middleman-core/util/empty_hash.rb +++ b/middleman-core/lib/middleman-core/util/empty_hash.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Middleman EMPTY_HASH = {}.freeze end diff --git a/middleman-core/lib/middleman-core/util/files.rb b/middleman-core/lib/middleman-core/util/files.rb index 752ef947..9f681987 100644 --- a/middleman-core/lib/middleman-core/util/files.rb +++ b/middleman-core/lib/middleman-core/util/files.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'digest/sha1' require 'set' require 'open3' @@ -40,7 +42,7 @@ module Middleman def glob_directory(path) results = ::Dir[path] - return results unless RUBY_PLATFORM =~ /darwin/ + return results unless RUBY_PLATFORM.match?(/darwin/) results.map { |r| r.encode('UTF-8', 'UTF-8-MAC') } end @@ -52,7 +54,7 @@ module Middleman def current_directory result = ::Dir.pwd - return result unless RUBY_PLATFORM =~ /darwin/ + return result unless RUBY_PLATFORM.match?(/darwin/) result.encode('UTF-8', 'UTF-8-MAC') end diff --git a/middleman-core/lib/middleman-core/util/paths.rb b/middleman-core/lib/middleman-core/util/paths.rb index f2a99d4f..b6939efe 100644 --- a/middleman-core/lib/middleman-core/util/paths.rb +++ b/middleman-core/lib/middleman-core/util/paths.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # Core Pathname library used for traversal require 'pathname' require 'addressable/uri' @@ -95,7 +97,7 @@ module Middleman source = source.to_s.tr(' ', '') ignore_extension = IGNORED_ASSET_EXTENSIONS.include? kind # don't append extension - source << ".#{kind}" unless ignore_extension || source.end_with?(".#{kind}") + source = "#{source}.#{kind}" unless ignore_extension || source.end_with?(".#{kind}") asset_folder = '' if source.start_with?('/') # absolute path asset_url(app, source, asset_folder, options_hash) @@ -194,7 +196,7 @@ module Middleman elsif this_resource && uri.path && !uri.host # Handle relative urls url_path = Pathname(uri.path) - current_source_dir = Pathname('/' + this_resource.path).dirname + current_source_dir = Pathname("/#{this_resource.path}").dirname url_path = current_source_dir.join(url_path) if url_path.relative? resource = app.sitemap.by_path(url_path.to_s) if resource @@ -202,7 +204,7 @@ module Middleman else # Try to find a resource relative to destination paths url_path = Pathname(uri.path) - current_source_dir = Pathname('/' + this_resource.destination_path).dirname + current_source_dir = Pathname("/#{this_resource.destination_path}").dirname url_path = current_source_dir.join(url_path) if url_path.relative? resource = app.sitemap.by_destination_path(url_path.to_s) resource_url = resource.url if resource @@ -257,9 +259,9 @@ module Middleman end if resource - '/' + resource.destination_path + "/#{resource.destination_path}" else - '/' + normalize_path(path) + "/#{normalize_path(path)}" end end @@ -275,11 +277,11 @@ module Middleman # if we've been asked to. if relative # Output urls relative to the destination path, not the source path - current_dir = Pathname('/' + curr_resource.destination_path).dirname + current_dir = Pathname("/#{curr_resource.destination_path}").dirname relative_path = Pathname(resource_url).relative_path_from(current_dir).to_s # Put back the trailing slash to avoid unnecessary Apache redirects - relative_path << '/' if resource_url.end_with?('/') && !relative_path.end_with?('/') + relative_path = "#{relative_path}/" if resource_url.end_with?('/') && !relative_path.end_with?('/') relative_path else diff --git a/middleman-core/lib/middleman-core/util/rack.rb b/middleman-core/lib/middleman-core/util/rack.rb index 1f771a31..69538f60 100644 --- a/middleman-core/lib/middleman-core/util/rack.rb +++ b/middleman-core/lib/middleman-core/util/rack.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/contracts' module Middleman @@ -13,11 +15,11 @@ module Middleman Contract RespondTo[:each] => String def extract_response_text(response) # The rack spec states all response bodies must respond to each - result = '' + result = [] response.each do |part, _| result << part end - result + result.join end Contract String, String, SetOf[String], IsA['::Middleman::Application'], Proc => String @@ -32,7 +34,7 @@ module Middleman asset_path = Regexp.last_match(2) if asset_path.start_with?(url_fn_prefix) - opening_character << url_fn_prefix + opening_character = "#{opening_character}#{url_fn_prefix}" asset_path = asset_path[url_fn_prefix.length..-1] end diff --git a/middleman-core/lib/middleman-core/util/uri_templates.rb b/middleman-core/lib/middleman-core/util/uri_templates.rb index 1d8f04d6..db0cd43f 100644 --- a/middleman-core/lib/middleman-core/util/uri_templates.rb +++ b/middleman-core/lib/middleman-core/util/uri_templates.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # For URI templating require 'addressable/uri' require 'addressable/template' @@ -46,6 +48,7 @@ module Middleman # Reimplementation of http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-parameterize that preserves un-transliterate-able multibyte chars. parameterized_string = ::ActiveSupport::Inflector.transliterate(str.to_s).downcase + parameterized_string = parameterized_string.dup if parameterized_string.frozen? parameterized_string.gsub!(/[^a-z0-9\-_\?]+/, sep) parameterized_string.chars.to_a.each_with_index do |char, i| diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index dc0b4402..b4f3b4b8 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,5 +1,7 @@ +# frozen_string_literal: true + module Middleman # Current Version # @return [String] - VERSION = '5.0.0.rc.1'.freeze unless const_defined?(:VERSION) + VERSION = '5.0.0.rc.1' unless const_defined?(:VERSION) end diff --git a/middleman-core/lib/middleman/rack.rb b/middleman-core/lib/middleman/rack.rb index a47490d9..109fe055 100644 --- a/middleman-core/lib/middleman/rack.rb +++ b/middleman-core/lib/middleman/rack.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core/load_paths' ::Middleman.setup_load_paths diff --git a/middleman-core/spec/middleman-core/callbacks_spec.rb b/middleman-core/spec/middleman-core/callbacks_spec.rb index b0aad5e9..585806c6 100644 --- a/middleman-core/spec/middleman-core/callbacks_spec.rb +++ b/middleman-core/spec/middleman-core/callbacks_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + # require 'spec_helper' require 'middleman-core/callback_manager' diff --git a/middleman-core/spec/middleman-core/core_extensions/data_spec.rb b/middleman-core/spec/middleman-core/core_extensions/data_spec.rb index f122e16a..366c6ba7 100644 --- a/middleman-core/spec/middleman-core/core_extensions/data_spec.rb +++ b/middleman-core/spec/middleman-core/core_extensions/data_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'middleman-core/core_extensions' require 'middleman-core/core_extensions/data' diff --git a/middleman-core/spec/middleman-core/data_proxy_spec.rb b/middleman-core/spec/middleman-core/data_proxy_spec.rb index 2aea1aa7..39cf3501 100644 --- a/middleman-core/spec/middleman-core/data_proxy_spec.rb +++ b/middleman-core/spec/middleman-core/data_proxy_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'middleman-core/core_extensions/data/proxies/hash' require 'middleman-core/util/data' diff --git a/middleman-core/spec/middleman-core/dependencies_spec.rb b/middleman-core/spec/middleman-core/dependencies_spec.rb index 43010eab..321ab156 100644 --- a/middleman-core/spec/middleman-core/dependencies_spec.rb +++ b/middleman-core/spec/middleman-core/dependencies_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'middleman-core/dependencies' diff --git a/middleman-core/spec/middleman-core/dns_resolver_spec.rb b/middleman-core/spec/middleman-core/dns_resolver_spec.rb index 5c5f8c89..c520f767 100644 --- a/middleman-core/spec/middleman-core/dns_resolver_spec.rb +++ b/middleman-core/spec/middleman-core/dns_resolver_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'middleman-core/dns_resolver' diff --git a/middleman-core/spec/middleman-core/preview_server/server_hostname_spec.rb b/middleman-core/spec/middleman-core/preview_server/server_hostname_spec.rb index b0dc6a07..cf6c6ed4 100644 --- a/middleman-core/spec/middleman-core/preview_server/server_hostname_spec.rb +++ b/middleman-core/spec/middleman-core/preview_server/server_hostname_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'middleman-core/preview_server/server_hostname' diff --git a/middleman-core/spec/middleman-core/preview_server/server_ip_address_spec.rb b/middleman-core/spec/middleman-core/preview_server/server_ip_address_spec.rb index a82fec63..5aedd85a 100644 --- a/middleman-core/spec/middleman-core/preview_server/server_ip_address_spec.rb +++ b/middleman-core/spec/middleman-core/preview_server/server_ip_address_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'middleman-core/preview_server/server_ip_address' diff --git a/middleman-core/spec/middleman-core/util_spec.rb b/middleman-core/spec/middleman-core/util_spec.rb index e4383463..4afe1e2b 100644 --- a/middleman-core/spec/middleman-core/util_spec.rb +++ b/middleman-core/spec/middleman-core/util_spec.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'spec_helper' require 'middleman-core' @@ -63,7 +65,7 @@ describe Middleman::Util do it 'returns Array with strings, or IndifferentHash, true, false' do indifferent_hash = { test: 'subject' } regular_hash = { regular: 'hash' } - input = [indifferent_hash, regular_hash, true, false] + input = [indifferent_hash, regular_hash, true, false] subject = Middleman::Util.recursively_enhance input expect(subject[1].regular).to eq 'hash' diff --git a/middleman-core/spec/spec_helper.rb b/middleman-core/spec/spec_helper.rb index d91c492e..619bdba7 100644 --- a/middleman-core/spec/spec_helper.rb +++ b/middleman-core/spec/spec_helper.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'active_support/all' require 'simplecov' diff --git a/middleman-core/spec/support/given.rb b/middleman-core/spec/support/given.rb index 8e0fe5f2..547cc52c 100644 --- a/middleman-core/spec/support/given.rb +++ b/middleman-core/spec/support/given.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + module Given ROOT = File.expand_path('../..', __dir__) TMP = File.join(ROOT, 'tmp') diff --git a/middleman/Rakefile b/middleman/Rakefile index 74d040b1..7bb8554d 100644 --- a/middleman/Rakefile +++ b/middleman/Rakefile @@ -1,3 +1,5 @@ -RAKE_ROOT = __FILE__.freeze -GEM_NAME = 'middleman'.freeze +# frozen_string_literal: true + +RAKE_ROOT = __FILE__ +GEM_NAME = 'middleman' require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper') diff --git a/middleman/lib/middleman.rb b/middleman/lib/middleman.rb index 878b9c59..ced27435 100644 --- a/middleman/lib/middleman.rb +++ b/middleman/lib/middleman.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require 'middleman-core' # Make the VERSION string available