2018 cleanup

Upgrade our deps
Drop support for Ruby 2.2 (because some deps have)
Update rubocop and lints
This commit is contained in:
Thomas Reynolds 2018-09-11 11:43:07 -07:00 committed by GitHub
parent f70bd8a2bb
commit efd1ef69d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
190 changed files with 1092 additions and 1084 deletions

View File

@ -1,71 +1,71 @@
AllCops:
TargetRubyVersion: 2.3
Include:
- '**/*.rb'
- '**/Rakefile'
- '**/Gemfile'
- '**/config.ru'
- '**/gem_rake_helper.rb'
Exclude:
- 'script/**/*'
- 'vendor/**/*'
- '**/tmp/**/*'
- '**/bin/**/*'
- 'middleman-core/lib/middleman-core/step_definitions/**/*'
- 'middleman-core/fixtures/**/*'
- 'middleman-core/features/**/*'
- 'middleman-core/spec/**/*'
- 'middleman-cli/lib/middleman-cli/templates/**/*'
- 'middleman-cli/fixtures/**/*'
- 'middleman-cli/features/**/*'
- 'middleman-cli/spec/**/*'
DoubleNegation:
Metrics/LineLength:
Enabled: false
LineLength:
Metrics/MethodLength:
Enabled: false
MethodLength:
Enabled: false
ClassLength:
Enabled: false
Documentation:
Enabled: false
HashSyntax:
EnforcedStyle: ruby19
SpaceAroundEqualsInParameterDefault:
EnforcedStyle: no_space
PerlBackrefs:
Enabled: false
ClassAndModuleChildren:
Enabled: false
AssignmentInCondition:
Enabled: false
CyclomaticComplexity:
Enabled: false
HandleExceptions:
Enabled: false
EndAlignment:
EnforcedStyleAlignWith: variable
SignalException:
Enabled: false
RegexpLiteral:
Enabled: false
FormatString:
Enabled: false
CaseIndentation:
EnforcedStyle: end
TrivialAccessors:
Enabled: false
SingleLineBlockParams:
Style/Documentation:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/CyclomaticComplexity:
Enabled: false
Metrics/BlockLength:
Enabled: false
Metrics/ModuleLength:
Enabled: false
Metrics/PerceivedComplexity:
Enabled: false
Style/ParallelAssignment:
Metrics/ClassLength:
Enabled: false
Style/BlockDelimiters:
Lint/AmbiguousRegexpLiteral:
Enabled: false
Style/MultilineBlockChain:
Lint/AmbiguousBlockAssociation:
Enabled: false
Style/SpecialGlobalVars:
Lint/UriEscapeUnescape:
Enabled: false
Lint/HandleExceptions:
Enabled: false
Lint/ShadowedException:
Enabled: false
Naming/FileName:
Enabled: false
Naming/UncommunicativeMethodParamName:
Enabled: false
Naming/MemoizedInstanceVariableName:
Enabled: false
Naming/HeredocDelimiterNaming:
Enabled: false
Security/Eval:
Enabled: false
Style/RegexpLiteral:
Enabled: false
Style/ClassAndModuleChildren:
Enabled: false
Style/MissingRespondToMissing:
Enabled: false
Style/MethodMissingSuper:
Enabled: false
Style/FrozenStringLiteralComment:
Enabled: false
Style/FormatStringToken:
Enabled: false
Style/DoubleNegation:
Enabled: false
Style/EvalWithLocation:
Enabled: false
Style/Lambda:
Enabled: false
Style/ClassVars:
Enabled: false
Style/GlobalVars:
Enabled: false

View File

@ -1,17 +1,13 @@
language: ruby
sudo: false
cache: bundler
before_script:
- bundle update
rvm:
- ruby-head
- 2.5.1
- 2.4.4
- 2.3.7
- 2.2.10
os:
- linux
# - osx
matrix:
fast_finish: true
allow_failures:
@ -20,6 +16,3 @@ env:
global:
- TEST=true
script: bundle exec rake test
notifications:
email: false
slack: middleman:JW9OvXmn1m3XrSERe8866nBR

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
source 'https://rubygems.org'
# Build and doc tools

View File

@ -10,8 +10,9 @@ PATH
middleman-core (4.3.0.rc.2)
activesupport (>= 4.2, < 5.2)
addressable (~> 2.3)
backports (~> 3.11)
bundler (~> 1.1)
contracts (~> 0.13.0)
contracts (~> 0.16.0)
dotenv
erubis
execjs (~> 2.0)
@ -73,7 +74,7 @@ GEM
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.0.5)
contracts (0.13.0)
contracts (0.16.0)
cucumber (3.1.2)
builder (>= 2.1.2)
cucumber-core (~> 3.2.0)

View File

@ -1,11 +1,13 @@
# frozen_string_literal: true
require 'rake'
require File.expand_path('../middleman-core/lib/middleman-core/version.rb', __FILE__)
require File.expand_path('middleman-core/lib/middleman-core/version.rb', __dir__)
ROOT = File.expand_path(File.dirname(__FILE__))
GEM_NAME = 'middleman'.freeze
ROOT = __dir__
GEM_NAME = 'middleman'
middleman_gems = %w(middleman-core middleman-cli middleman)
middleman_gems = %w[middleman-core middleman-cli middleman]
GEM_PATHS = middleman_gems.freeze
def sh_rake(command)
@ -58,9 +60,7 @@ end
require 'rubocop/rake_task'
desc 'Run RuboCop to check code consistency'
RuboCop::RakeTask.new(:rubocop) do |task|
task.fail_on_error = false
end
RuboCop::RakeTask.new(:rubocop)
desc 'Run tests for all middleman gems'
task default: :test

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require 'rake'
require 'yard'
@ -15,19 +17,13 @@ end
require 'cucumber/rake/task'
Cucumber::Rake::Task.new do |t|
exempt_tags = ['--tags ~@wip']
exempt_tags << '--tags ~@nojava' if RUBY_PLATFORM == 'java'
exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding)
exempt_tags << '--tags ~@nowindows' if Gem.win_platform?
exempt_tags << '--tags ~@travishatesme' if ENV['TRAVIS'] == 'true'
t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict"
exempt_tags = ["--tags 'not @wip'"]
t.cucumber_opts = "--fail-fast --require features --color #{exempt_tags.join(' ')} --strict"
end
Cucumber::Rake::Task.new(:cucumber_wip) do |t|
exempt_tags = ['--tags @wip']
exempt_tags << '--tags ~@encoding' unless Object.const_defined?(:Encoding)
exempt_tags << '--tags ~@nowindows' if Gem.win_platform?
t.cucumber_opts = "--require features --color #{exempt_tags.join(' ')} --strict"
t.cucumber_opts = "--fail-fast --require features --color #{exempt_tags.join(' ')} --strict"
end
require 'rspec/core/rake_task'
@ -38,7 +34,7 @@ RSpec::Core::RakeTask.new do |spec|
end
desc 'Run tests, both RSpec and Cucumber'
task test: [:spec, :cucumber]
task test: %i[spec cucumber]
YARD::Rake::YardocTask.new

View File

@ -1,4 +1,3 @@
# coding:utf-8
RAKE_ROOT = __FILE__.freeze
GEM_NAME = 'middleman-cli'.freeze
require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')

View File

@ -6,7 +6,7 @@ if ARGV.include? '--profile'
end
# Middleman::Profiling.start
require "middleman-core/load_paths"
require 'middleman-core/load_paths'
Middleman.setup_load_paths
require 'dotenv'
@ -35,13 +35,13 @@ module Middleman::Cli
end
end
require "middleman-cli"
require 'middleman-cli'
# Change directory to the root
Dir.chdir(ENV["MM_ROOT"]) if ENV["MM_ROOT"]
Dir.chdir(ENV['MM_ROOT']) if ENV['MM_ROOT']
# Default command is server
if ARGV[0] != 'help' && (ARGV.length < 1 || ARGV.first.include?('-'))
if ARGV[0] != 'help' && (ARGV.empty? || ARGV.first.include?('-'))
ARGV.unshift('server')
end

View File

@ -316,6 +316,7 @@ Feature: Run the preview server
Inspect your site configuration at "http://[::1]:4567/__middleman"
"""
@wip
Scenario: Start the server with https
When I run `middleman server --verbose --https` interactively
And I stop middleman if the output contains:

View File

@ -1,5 +1,6 @@
ENV["TEST"] = "true"
ENV['TEST'] = 'true'
require 'backports/latest'
require 'sassc'
require 'simplecov'

View File

@ -6,25 +6,24 @@ require 'psych'
db_file = ARGV[0]
port = ARGV[1] || 5300
db = if File.file? db_file
$stderr.puts 'Found dns db'
Psych.load_file(db_file)
else
$stderr.puts 'Found no dns db. Use default db.'
db = if File.file? db_file
warn 'Found dns db'
Psych.load_file(db_file)
else
warn 'Found no dns db. Use default db.'
{
/www\.example\.org/ => '1.1.1.1'
}
end
{
/www\.example\.org/ => '1.1.1.1'
}
end
interfaces = [
[:udp, "127.0.0.1", port],
[:tcp, "127.0.0.1", port]
[:udp, '127.0.0.1', port],
[:tcp, '127.0.0.1', port]
]
# Start the RubyDNS server
RubyDNS::run_server(listen: interfaces) do
RubyDNS.run_server(listen: interfaces) do
db.each do |matcher, result|
match(matcher, Resolv::DNS::Resource::IN::A) do |transaction|
transaction.respond!(result)

View File

@ -9,7 +9,7 @@ class MyFeature < Middleman::Extension
puts "/// #{server_information.port} ///"
puts "/// #{server_information.server_name} ///"
puts "/// #{server_information.site_addresses.first} ///"
puts "/// ### END ### ///"
puts '/// ### END ### ///'
end
end
end

View File

@ -1,7 +1,5 @@
# rubocop:disable FileName
# Setup our load paths
libdir = File.expand_path(File.dirname(__FILE__))
libdir = __dir__
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
# Require Thor since that's what the whole CLI is built around

View File

@ -44,7 +44,7 @@ module Middleman::Cli
def build
root = ENV['MM_ROOT'] || Dir.pwd
unless File.exists?(File.join(root, "config.rb"))
unless File.exist?(File.join(root, 'config.rb'))
raise Thor::Error, 'Error: Could not find a Middleman project config, perhaps you are in the wrong folder?'
end
@ -101,7 +101,7 @@ module Middleman::Cli
# @param [String] contents The event contents.
# @param [String] extra The extra information.
# @return [void]
def on_event(event_type, target, extra=nil)
def on_event(event_type, target, extra = nil)
case event_type
when :error
say_status :error, target, :red

View File

@ -39,26 +39,26 @@ module Middleman::Cli
end
repo_path, repo_branch = if shortname?(options[:template])
require 'open-uri'
require 'json'
require 'open-uri'
require 'json'
api = 'https://directory.middlemanapp.com/api'
uri = ::URI.parse("#{api}/#{options[:template]}.json")
api = 'https://directory.middlemanapp.com/api'
uri = ::URI.parse("#{api}/#{options[:template]}.json")
begin
data = ::JSON.parse(uri.read)
is_local_dir = false
data['links']['github'].split('#')
rescue ::OpenURI::HTTPError
say "Template `#{options[:template]}` not found in Middleman Directory."
say 'Did you mean to use a full `user/repo` path?'
exit 1
end
else
repo_name, repo_branch = options[:template].split('#')
repo_path, is_local_dir = repository_path(repo_name)
[repo_path, repo_branch]
end
begin
data = ::JSON.parse(uri.read)
is_local_dir = false
data['links']['github'].split('#')
rescue ::OpenURI::HTTPError
say "Template `#{options[:template]}` not found in Middleman Directory."
say 'Did you mean to use a full `user/repo` path?'
exit 1
end
else
repo_name, repo_branch = options[:template].split('#')
repo_path, is_local_dir = repository_path(repo_name)
[repo_path, repo_branch]
end
begin
dir = is_local_dir ? repo_path : clone_repository(repo_path, repo_branch)
@ -88,6 +88,7 @@ module Middleman::Cli
# Copied from Bundler
def git_present?
return @git_present if defined?(@git_present)
@git_present = which(GIT_CMD) || which('git.exe')
end
@ -126,7 +127,7 @@ module Middleman::Cli
git_path = "#{branch_cmd}#{repo_path}"
run("#{GIT_CMD} clone --depth 1 #{branch_cmd}#{repo_path} #{dir}")
unless $?.success?
unless $CHILD_STATUS.success?
say "Git clone command failed. Make sure git repository exists: #{git_path}", :red
exit 1
end

View File

@ -12,7 +12,7 @@ group :development do
end
group :test do
gem 'cucumber'
gem 'aruba'
gem 'cucumber'
gem 'rspec'
end

View File

@ -4,7 +4,7 @@ Bundler::GemHelper.install_tasks
require 'cucumber/rake/task'
Cucumber::Rake::Task.new(:cucumber, 'Run features that should pass') do |t|
t.cucumber_opts = '--color --tags ~@wip --strict'
t.cucumber_opts = '--fail-fast --color --tags 'not @wip' --strict'
end
require 'rake/clean'

View File

@ -5,7 +5,7 @@ require 'middleman-core'
class MyExtension < ::Middleman::Extension
option :my_option, 'default', 'An example option'
def initialize(app, options_hash={}, &block)
def initialize(app, options_hash = {}, &block)
# Call super to build options from the options_hash
super

View File

@ -17,7 +17,7 @@ Gem::Specification.new do |s|
s.test_files = `git ls-files -z -- {fixtures,features}/*`.split("\0")
s.executable = 'middleman'
s.require_path = 'lib'
s.required_ruby_version = '>= 2.2.0'
s.required_ruby_version = '>= 2.3.0'
# CLI
s.add_dependency('thor', ['>= 0.17.0', '< 2.0'])

View File

@ -1,4 +1,3 @@
# coding:utf-8
RAKE_ROOT = __FILE__.freeze
GEM_NAME = ENV['NAME'] || 'middleman-core'
require File.expand_path(File.dirname(__FILE__) + '/../gem_rake_helper')

View File

@ -1,2 +1,2 @@
default: --require features --tags ~@wip
wip: --require features --tags @wip
default: --fail-fast --require features --tags 'not @wip'
wip: --fail-fast --require features --tags @wip

View File

@ -111,7 +111,7 @@ Feature: Collections
"""
---
title: "Blog3 Another Article"
date: 2011-01-02
date: "2011-01-02"
tags:
- foo
---
@ -133,7 +133,7 @@ Feature: Collections
"""
---
title: "Blog2 Yet Another Article"
date: 2011-01-02
date: "2011-01-02"
tags:
- foo
---

View File

@ -6,7 +6,6 @@ Feature: Markdown support
When I go to "/index.html"
Then I should see "<p>Hello World</p>"
@encoding
Scenario: Markdown extensions (Maruku)
Given the Server is running at "markdown-app"
When I go to "/smarty_pants.html"

View File

@ -1,5 +1,6 @@
ENV["TEST"] = "true"
ENV['TEST'] = 'true'
require 'backports/latest'
require 'sassc'
require 'simplecov'

View File

@ -1,5 +1,3 @@
@encoding
Feature: Tilde directories
In order to support ~ characters in directories

View File

@ -1,4 +1,4 @@
@encoding @travishatesme @wip
@wip
Feature: Unicode filenames
In order to support non-ASCII characters in filenames

View File

@ -1,4 +1,3 @@
activate :asset_hash
activate :relative_assets

View File

@ -6,8 +6,8 @@ class Middleware
def call(env)
status, headers, response = @app.call(env)
body = ''
response.each {|part| body += part }
if (env["PATH_INFO"] =~ /css$/)
response.each { |part| body += part }
if /css$/.match?(env['PATH_INFO'])
body += "\n/* Added by Rack filter */"
status, headers, response = Rack::Response.new(body, status, headers).finish
end

View File

@ -1,6 +1,5 @@
activate :asset_hash,
prefix: "myprefix-"
prefix: 'myprefix-'
activate :relative_assets

View File

@ -6,8 +6,8 @@ class Middleware
def call(env)
status, headers, response = @app.call(env)
body = ''
response.each {|part| body += part }
if (env["PATH_INFO"] =~ /css$/)
response.each { |part| body += part }
if /css$/.match?(env['PATH_INFO'])
body += "\n/* Added by Rack filter */"
status, headers, response = Rack::Response.new(body, status, headers).finish
end

View File

@ -1,4 +1,3 @@
activate :asset_hash
activate :relative_assets

View File

@ -6,8 +6,8 @@ class Middleware
def call(env)
status, headers, response = @app.call(env)
body = ''
response.each {|part| body += part }
if (env["PATH_INFO"] =~ /css$/)
response.each { |part| body += part }
if /css$/.match?(env['PATH_INFO'])
body += "\n/* Added by Rack filter */"
status, headers, response = Rack::Response.new(body, status, headers).finish
end

View File

@ -1 +1 @@
activate :asset_host, host: "http://assets1.example.com"
activate :asset_host, host: 'http://assets1.example.com'

View File

@ -1,9 +1,9 @@
%w{
%w[
/auto-css.html
/auto-css
/auto-css/
/auto-css/auto-css.html
/auto-css/sub/auto-css.html
}.each do |path|
].each do |path|
page path, layout: false
end

View File

@ -1,9 +1,9 @@
%w{
%w[
/auto-js.html
/auto-js
/auto-js/
/auto-js/auto-js.html
/auto-js/sub/auto-js.html
}.each do |path|
].each do |path|
page path, layout: false
end

View File

@ -1 +1 @@
activate :directory_indexes
activate :directory_indexes

View File

@ -1 +1 @@
set :automatic_directory_matcher, "--"
set :automatic_directory_matcher, '--'

View File

@ -1,2 +1,2 @@
page "/data.html", layout: false
page "/data3.html", layout: false
page '/data.html', layout: false
page '/data3.html', layout: false

View File

@ -1,5 +1,5 @@
require "slim"
require 'slim'
page "/capture_html_erb.html", layout: :capture_html
page "/capture_html_haml.html", layout: :capture_html
page "/capture_html_slim.html", layout: :capture_html
page '/capture_html_erb.html', layout: :capture_html
page '/capture_html_haml.html', layout: :capture_html
page '/capture_html_slim.html', layout: :capture_html

View File

@ -1,9 +1,9 @@
proxy "/fake.html", "/real.html", layout: false
proxy '/fake.html', '/real.html', layout: false
ignore "/should_be_ignored.html"
ignore "/should_be_ignored2.html"
proxy "/target_ignore.html", "/should_be_ignored3.html", ignore: true
ignore '/should_be_ignored.html'
ignore '/should_be_ignored2.html'
proxy '/target_ignore.html', '/should_be_ignored3.html', ignore: true
%w(one two).each do |num|
proxy "/fake/#{num}.html", "/real/index.html", locals: { num: num }
%w[one two].each do |num|
proxy "/fake/#{num}.html", '/real/index.html', locals: { num: num }
end

View File

@ -1,5 +1,5 @@
set :build_dir, ".build"
set :build_dir, '.build'
ignore "/should_be_ignored.html"
ignore "/should_be_ignored2.html"
proxy "/target_ignore.html", "/should_be_ignored3.html", ignore: true
ignore '/should_be_ignored.html'
ignore '/should_be_ignored2.html'
proxy '/target_ignore.html', '/should_be_ignored3.html', ignore: true

View File

@ -1 +1 @@
set :build_dir, ".build"
set :build_dir, '.build'

View File

@ -1,9 +1,9 @@
proxy "/fake.html", "/real.html", layout: false
proxy '/fake.html', '/real.html', layout: false
ignore "/should_be_ignored.html"
ignore "/should_be_ignored2.html"
proxy "/target_ignore.html", "/should_be_ignored3.html", ignore: true
ignore '/should_be_ignored.html'
ignore '/should_be_ignored2.html'
proxy '/target_ignore.html', '/should_be_ignored3.html', ignore: true
%w(one two).each do |num|
proxy "/fake/#{num}.html", "/real/index.html", locals: { num: num }
%w[one two].each do |num|
proxy "/fake/#{num}.html", '/real/index.html', locals: { num: num }
end

View File

@ -1,2 +1 @@
activate :directory_indexes

View File

@ -1 +1 @@
set :build_dir, "sub/dir"
set :build_dir, 'sub/dir'

View File

@ -1,6 +1,6 @@
---
title: "Blog1 Newer Article"
date: 2011-01-01
date: "2011-01-01"
tags: foo, bar
---

View File

@ -1,6 +1,6 @@
---
title: "Blog1 Another Article"
date: 2011-01-02
date: "2011-01-02"
tags:
- foo
- 120

View File

@ -1,6 +1,6 @@
---
title: "Blog2 Newer Article"
date: 2011-01-01
date: "2011-01-01"
tags: foo, bar
---

View File

@ -1,6 +1,6 @@
---
title: "Blog2 Another Article"
date: 2011-01-02
date: "2011-01-02"
tags:
- foo
---

View File

@ -1,5 +1,5 @@
require "slim"
require 'slim'
page "/content_for_erb.html", layout: :content_for
page "/content_for_haml.html", layout: :content_for
page "/content_for_slim.html", layout: :content_for
page '/content_for_erb.html', layout: :content_for
page '/content_for_haml.html', layout: :content_for
page '/content_for_slim.html', layout: :content_for

View File

@ -1,34 +1,33 @@
# -*- coding: utf-8 -*-
proxy "/fake.html", "/real.html", layout: false
proxy "fake2.html", "/real.html", layout: false
proxy "fake3.html", "real.html", layout: false
proxy "/fake4.html", "real.html", layout: false
proxy '/fake.html', '/real.html', layout: false
proxy 'fake2.html', '/real.html', layout: false
proxy 'fake3.html', 'real.html', layout: false
proxy '/fake4.html', 'real.html', layout: false
ignore "/should_be_ignored.html"
ignore "/should_be_ignored2.html"
proxy "/target_ignore.html", "/should_be_ignored3.html", ignore: true
ignore '/should_be_ignored.html'
ignore '/should_be_ignored2.html'
proxy '/target_ignore.html', '/should_be_ignored3.html', ignore: true
ignore "should_be_ignored4.html"
ignore "should_be_ignored5.html"
proxy "target_ignore2.html", "/should_be_ignored6.html", ignore: true
proxy "target_ignore3.html", "should_be_ignored7.html", ignore: true
proxy "/target_ignore4.html", "should_be_ignored8.html", ignore: true
ignore 'should_be_ignored4.html'
ignore 'should_be_ignored5.html'
proxy 'target_ignore2.html', '/should_be_ignored6.html', ignore: true
proxy 'target_ignore3.html', 'should_be_ignored7.html', ignore: true
proxy '/target_ignore4.html', 'should_be_ignored8.html', ignore: true
%w(one two).each do |num|
proxy "/fake/#{num}.html", "/real/index.html", ignore: true, locals: { num: num }
proxy "fake2/#{num}.html", "/real/index.html", ignore: true, locals: { num: num }
proxy "fake3/#{num}.html", "real/index.html", ignore: true, locals: { num: num }
proxy "/fake4/#{num}.html", "real/index.html", ignore: true, locals: { num: num }
%w[one two].each do |num|
proxy "/fake/#{num}.html", '/real/index.html', ignore: true, locals: { num: num }
proxy "fake2/#{num}.html", '/real/index.html', ignore: true, locals: { num: num }
proxy "fake3/#{num}.html", 'real/index.html', ignore: true, locals: { num: num }
proxy "/fake4/#{num}.html", 'real/index.html', ignore: true, locals: { num: num }
end
proxy "明日がある.html", "/real.html", layout: false
proxy '明日がある.html', '/real.html', layout: false
page "f*/*", locals: { all_glob: "I am all glob" }
page "fake/*", locals: { glob_var: "I am one glob" }
page "fake2/*", locals: { glob_var: "I am two glob" }
page "fake3/*", locals: { glob_var: "I am three glob" }
page "fake4/*", locals: { glob_var: "I am four glob" }
page 'f*/*', locals: { all_glob: 'I am all glob' }
page 'fake/*', locals: { glob_var: 'I am one glob' }
page 'fake2/*', locals: { glob_var: 'I am two glob' }
page 'fake3/*', locals: { glob_var: 'I am three glob' }
page 'fake4/*', locals: { glob_var: 'I am four glob' }
["tom", "dick", "harry"].each do |name|
proxy "/about/#{name}.html", "/should_be_ignored9.html", locals: { person_name: name }, ignore: true
%w[tom dick harry].each do |name|
proxy "/about/#{name}.html", '/should_be_ignored9.html', locals: { person_name: name }, ignore: true
end

View File

@ -1,5 +1,5 @@
activate :external_pipeline,
name: :ember,
command: "cd test-app/ && ember #{build? ? :build : :serve} --environment #{config[:environment]}",
source: "test-app/dist",
latency: 2
name: :ember,
command: "cd test-app/ && ember #{build? ? :build : :serve} --environment #{config[:environment]}",
source: 'test-app/dist',
latency: 2

View File

@ -1 +1 @@
set :api_key, "dev1"
set :api_key, 'dev1'

View File

@ -1,2 +1,2 @@
set :api_key, "prod2"
set :api_key, 'prod2'
activate :minify_css

View File

@ -12,20 +12,20 @@ class MyFeature < Middleman::Extension
puts '/// ready ///'
end
app.before_render do |body, path, locs, template_class|
puts "/// before_render ///"
app.before_render do |_body, _path, _locs, _template_class|
puts '/// before_render ///'
end
app.after_render do |content, path, locs, template_class|
puts "/// after_render ///"
app.after_render do |_content, _path, _locs, _template_class|
puts '/// after_render ///'
end
app.before_build do |builder|
puts "/// before_build ///"
app.before_build do |_builder|
puts '/// before_build ///'
end
app.after_build do |builder|
puts "/// after_build ///"
app.after_build do |_builder|
puts '/// after_build ///'
end
end

View File

@ -1,4 +1,4 @@
require "lib/hello_helper"
require 'lib/hello_helper'
helpers HelloHelper
page "/", layout: false
page '/', layout: false

View File

@ -1,3 +1,5 @@
module Derp
def three; "Three"; end
def three
'Three'
end
end

View File

@ -1,3 +1,5 @@
module FourHelpers
def four; "Four"; end
def four
'Four'
end
end

View File

@ -1,3 +1,5 @@
module OneHelper
def one; "One"; end
def one
'One'
end
end

View File

@ -1,3 +1,5 @@
module YetAnotherThingy
def two; "Two"; end
def two
'Two'
end
end

View File

@ -1,5 +1,5 @@
module HelloHelper
def hello
"Hello World"
'Hello World'
end
end

View File

@ -1,5 +1,5 @@
activate :external_pipeline,
name: :failing,
command: "mv does-not-exist tmp/file.js",
source: "tmp",
latency: 2
name: :failing,
command: 'mv does-not-exist tmp/file.js',
source: 'tmp',
latency: 2

View File

@ -13,4 +13,4 @@ end
Middleman::Extensions.register :extension_a, ExtensionA
activate :extension_a, hello: "world", hola: "mundo"
activate :extension_a, hello: 'world', hola: 'mundo'

View File

@ -1 +1 @@
config[:frontmatter_delims][:yaml] << %w(\\--- \\---)
config[:frontmatter_delims][:yaml] << %w[\\--- \\---]

View File

@ -1 +1 @@
page "/index.html", layout: false
page '/index.html', layout: false

View File

@ -1 +1 @@
set :encoding, "ISO-8859-1"
set :encoding, 'ISO-8859-1'

View File

@ -1,11 +1,11 @@
[:en, :es].each do |locale|
proxy "/#{locale}/index.html", "index.html", ignore: true, lang: locale
%i[en es].each do |locale|
proxy "/#{locale}/index.html", 'index.html', ignore: true, lang: locale
end
proxy "/fr/index.html", "index.html", lang: :fr
proxy '/fr/index.html', 'index.html', lang: :fr
activate :i18n
# This is what breaks i18n, just because it adds a resource list manipulator that
# This is what breaks i18n, just because it adds a resource list manipulator that
# forces a rebuild of the resource list.
activate :asset_hash

View File

@ -1 +1 @@
activate :i18n, mount_at_root: :en, langs: [:en, :es]
activate :i18n, mount_at_root: :en, langs: %i[en es]

View File

@ -1,7 +1,7 @@
import_file File.expand_path("static.html", root), "/static2.html"
import_file File.expand_path('static.html', root), '/static2.html'
import_path File.expand_path("bower_components/", root)
import_path File.expand_path('bower_components/', root)
import_path File.expand_path("bower_components", root) do |target_path, original_path|
import_path File.expand_path('bower_components', root) do |target_path, _original_path|
target_path.sub('bower_components', 'bower_components2')
end

View File

@ -1,5 +1,5 @@
activate :directory_indexes
page "/leave_me_alone.html", directory_index: false
page '/leave_me_alone.html', directory_index: false
page "/wildcard*", directory_index: false
page /regex_.*/, directory_index: false
page '/wildcard*', directory_index: false
page(/regex_.*/, directory_index: false)

View File

@ -1,3 +1,3 @@
page "/spaces in file.html", layout: false
page '/spaces in file.html', layout: false
config[:port] = 5555

View File

@ -1,3 +1,3 @@
set :layout, :custom
page "/", layout: :another
page '/', layout: :another

View File

@ -1,2 +1,2 @@
ignore "danger-zone/*"
ignore "*.textile"
ignore 'danger-zone/*'
ignore '*.textile'

View File

@ -1,7 +1,7 @@
activate :directory_indexes
proxy "/sub/fake.html", "/proxied.html", ignore: true
proxy "/sub/fake2.html", "/proxied.html", ignore: true
proxy '/sub/fake.html', '/proxied.html', ignore: true
proxy '/sub/fake2.html', '/proxied.html', ignore: true
proxy "/directory-indexed/fake.html", "/proxied.html", ignore: true
proxy "/directory-indexed/fake2.html", "/proxied.html", ignore: true
proxy '/directory-indexed/fake.html', '/proxied.html', ignore: true
proxy '/directory-indexed/fake2.html', '/proxied.html', ignore: true

View File

@ -1,3 +1,3 @@
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')
files.watch :data, path: File.join(root, 'data2')

View File

@ -1,3 +1,3 @@
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')
files.watch :source, path: File.join(root, 'source2')

View File

@ -1,2 +1,2 @@
files.watch :source, path: File.join(root, 'source2'),
destination_dir: 'source2'
destination_dir: 'source2'

View File

@ -1,6 +1,6 @@
---
title: "New Article Title"
date: 2011-01-01
date: "2011-01-01"
layout: inner
---

View File

@ -1,6 +1,6 @@
---
title: "New Article Title"
date: 2011-01-01
date: "2011-01-01"
layout: inner_haml
---

View File

@ -1,6 +1,6 @@
---
title: "New Article Title"
date: 2011-01-01
date: "2011-01-01"
layout: inner_slim
---

View File

@ -1,7 +1,7 @@
helpers do
def title
content_tag :h1 do
"Title"
'Title'
end
end
end

View File

@ -1,2 +1,2 @@
page "/sub1/page-classes.html", layout: false
page "/sub1/sub2/page-classes.html", layout: false
page '/sub1/page-classes.html', layout: false
page '/sub1/sub2/page-classes.html', layout: false

View File

@ -1,4 +1,4 @@
page "/path/*", layout: "alt"
page '/path/*', layout: 'alt'
# Doesn't work, and shouldn't
# page "/path/*" do

View File

@ -1,7 +1,7 @@
%w(1 2 3).each do |n|
proxy "/#{n}.html", "/index.html", id: "page#{n}"
%w[1 2 3].each do |n|
proxy "/#{n}.html", '/index.html', id: "page#{n}"
end
page "/overwrites/*", id: :"something-else"
page '/overwrites/*', id: :"something-else"
config[:page_id_generator] = ->(path){ path + "-foo" }
config[:page_id_generator] = ->(path) { path + '-foo' }

View File

@ -1,5 +1,5 @@
%w(1 2 3).each do |n|
proxy "/#{n}.html", "/index.html", id: "page#{n}"
%w[1 2 3].each do |n|
proxy "/#{n}.html", '/index.html', id: "page#{n}"
end
page "/overwrites/*", id: :"something-else"
page '/overwrites/*', id: :"something-else"

View File

@ -1,6 +1,6 @@
---
title: "Test Article"
date: 2011-01-01
date: "2011-01-01"
tags: foo
---
Test Article Content

View File

@ -1,6 +1,6 @@
---
title: "Test Article"
date: 2011-01-02
date: "2011-01-02"
tags: foo
---
Test Article Content

View File

@ -1,6 +1,6 @@
---
title: "Test Article"
date: 2011-01-03
date: "2011-01-03"
tags: bar
---
Test Article Content

View File

@ -1,6 +1,6 @@
---
title: "Test Article"
date: 2011-01-04
date: "2011-01-04"
tags: bar
---
Test Article Content

View File

@ -1,6 +1,6 @@
---
title: "Test Article"
date: 2011-01-05
date: "2011-01-05"
tags: bar
---
Test Article Content

View File

@ -1,6 +1,6 @@
---
title: "Test Article"
date: 2011-02-01
date: "2011-02-01"
tags: bar
---
Test Article Content

View File

@ -1,6 +1,6 @@
---
title: "Test Article"
date: 2011-02-02
date: "2011-02-02"
tags: bar
---
Test Article Content

View File

@ -1,18 +1,17 @@
# -*- coding: utf-8 -*-
proxy "/fake.html", "/real.html", layout: false
proxy "fake2.html", "/real.html", layout: false
proxy "fake3.html", "real.html", layout: false
proxy "/fake4.html", "real.html", layout: false
proxy '/fake.html', '/real.html', layout: false
proxy 'fake2.html', '/real.html', layout: false
proxy 'fake3.html', 'real.html', layout: false
proxy '/fake4.html', 'real.html', layout: false
proxy "/target_ignore.html", "/should_be_ignored3.html", ignore: true
proxy "target_ignore2.html", "/should_be_ignored6.html", ignore: true
proxy "target_ignore3.html", "should_be_ignored7.html", ignore: true
proxy "/target_ignore4.html", "should_be_ignored8.html", ignore: true
proxy '/target_ignore.html', '/should_be_ignored3.html', ignore: true
proxy 'target_ignore2.html', '/should_be_ignored6.html', ignore: true
proxy 'target_ignore3.html', 'should_be_ignored7.html', ignore: true
proxy '/target_ignore4.html', 'should_be_ignored8.html', ignore: true
%w(one two).each do |num|
proxy "/fake/#{num}.html", "/real/index.html", ignore: true, locals: { num: num }
proxy "fake2/#{num}.html", "/real/index.html", ignore: true, locals: { num: num }
proxy "fake3/#{num}.html", "real/index.html", ignore: true, locals: { num: num }
%w[one two].each do |num|
proxy "/fake/#{num}.html", '/real/index.html', ignore: true, locals: { num: num }
proxy "fake2/#{num}.html", '/real/index.html', ignore: true, locals: { num: num }
proxy "fake3/#{num}.html", 'real/index.html', ignore: true, locals: { num: num }
end
proxy "明日がある.html", "/real.html", layout: false
proxy '明日がある.html', '/real.html', layout: false

View File

@ -1,4 +1,4 @@
set :sass_assets_paths, [
File.join(root, "assets", "stylesheets"),
File.join(root, "my-vendor", "stylesheets")
File.join(root, 'assets', 'stylesheets'),
File.join(root, 'my-vendor', 'stylesheets')
]

View File

@ -1,14 +1,14 @@
require "sinatra"
require 'sinatra'
class MySinatra < Sinatra::Base
get "/" do
"Hello World (Sinatra)"
get '/' do
'Hello World (Sinatra)'
end
get "/derp.html" do
"De doo"
get '/derp.html' do
'De doo'
end
end
map "/sinatra" do
map '/sinatra' do
run MySinatra
end

View File

@ -1,5 +1,5 @@
proxy "/sub/fake.html", "/proxied.html", ignore: true
proxy "/sub/fake2.html", "/proxied.html", ignore: true
proxy '/sub/fake.html', '/proxied.html', ignore: true
proxy '/sub/fake2.html', '/proxied.html', ignore: true
proxy "/directory-indexed/fake.html", "/proxied.html", ignore: true
proxy "/directory-indexed/fake2.html", "/proxied.html", ignore: true
proxy '/directory-indexed/fake.html', '/proxied.html', ignore: true
proxy '/directory-indexed/fake2.html', '/proxied.html', ignore: true

View File

@ -7,7 +7,7 @@ class ExtensionOne < ::Middleman::Extension
attr_reader :extension_two_was_activated
def initialize(app, options_hash={})
def initialize(app, options_hash = {})
super
after_extension_activated :extension_two do
@ -27,7 +27,7 @@ class ExtensionTwo < ::Middleman::Extension
attr_reader :extension_one_was_activated
def initialize(app, options_hash={})
def initialize(app, options_hash = {})
super
after_extension_activated :extension_one do

View File

@ -1 +1 @@
page "/admin/*", layout: :admin
page '/admin/*', layout: :admin

View File

@ -1,2 +1,2 @@
activate :directory_indexes
page "/admin/*", layout: :admin
page '/admin/*', layout: :admin

View File

@ -1,9 +1,9 @@
# rubocop:disable FileName
# Setup our load paths
libdir = File.expand_path(File.dirname(__FILE__))
libdir = __dir__
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)
require 'backports/latest'
# Top-level Middleman namespace
module Middleman
autoload :Application, 'middleman-core/application'

Some files were not shown because too many files have changed in this diff Show More