Applied Rubocop feedback.
This commit is contained in:
parent
c11a9e6f39
commit
dcc52d967c
|
@ -35,13 +35,13 @@ module Middleman::Cli
|
||||||
# Output a .gitignore file
|
# Output a .gitignore file
|
||||||
class_option :git, type: :boolean, default: true
|
class_option :git, type: :boolean, default: true
|
||||||
|
|
||||||
no_tasks {
|
no_tasks do
|
||||||
# Write a .gitignore file for project
|
# Write a .gitignore file for project
|
||||||
# @return [void]
|
# @return [void]
|
||||||
def generate_gitignore!
|
def generate_gitignore!
|
||||||
return unless options[:git]
|
return unless options[:git]
|
||||||
copy_file 'gitignore', File.join(name, '.gitignore')
|
copy_file 'gitignore', File.join(name, '.gitignore')
|
||||||
end
|
end
|
||||||
}
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -118,7 +118,6 @@ module Middleman
|
||||||
# Set the value of a setting by key. Creates the setting if it doesn't exist.
|
# Set the value of a setting by key. Creates the setting if it doesn't exist.
|
||||||
# @param [Symbol] key
|
# @param [Symbol] key
|
||||||
# @param [Object] val
|
# @param [Object] val
|
||||||
# rubocop:disable UselessSetterCall
|
|
||||||
def []=(key, val)
|
def []=(key, val)
|
||||||
setting_obj = setting(key) || define_setting(key)
|
setting_obj = setting(key) || define_setting(key)
|
||||||
setting_obj.value = val
|
setting_obj.value = val
|
||||||
|
@ -228,7 +227,6 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
# Whether or not there has been a value set beyond the default
|
# Whether or not there has been a value set beyond the default
|
||||||
# rubocop:disable TrivialAccessors
|
|
||||||
def value_set?
|
def value_set?
|
||||||
@value_set
|
@value_set
|
||||||
end
|
end
|
||||||
|
|
|
@ -428,7 +428,7 @@ module Middleman
|
||||||
|
|
||||||
layout_path = locate_layout(layout_name, current_engine)
|
layout_path = locate_layout(layout_name, current_engine)
|
||||||
|
|
||||||
if !layout_path
|
unless layout_path
|
||||||
raise ::Middleman::CoreExtensions::Rendering::TemplateNotFound, "Could not locate layout: #{layout_name}"
|
raise ::Middleman::CoreExtensions::Rendering::TemplateNotFound, "Could not locate layout: #{layout_name}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -462,7 +462,6 @@ module Middleman
|
||||||
end
|
end
|
||||||
|
|
||||||
# The currently rendering engine
|
# The currently rendering engine
|
||||||
# rubocop:disable TrivialAccessors
|
|
||||||
# @return [Symbol, nil]
|
# @return [Symbol, nil]
|
||||||
def current_engine=(v)
|
def current_engine=(v)
|
||||||
@_current_engine = v
|
@_current_engine = v
|
||||||
|
|
|
@ -130,7 +130,6 @@ module Middleman
|
||||||
@klass.after_configuration do
|
@klass.after_configuration do
|
||||||
ext.after_configuration if ext.respond_to?(:after_configuration)
|
ext.after_configuration if ext.respond_to?(:after_configuration)
|
||||||
|
|
||||||
# rubocop:disable IfUnlessModifier
|
|
||||||
if ext.respond_to?(:manipulate_resource_list)
|
if ext.respond_to?(:manipulate_resource_list)
|
||||||
ext.app.sitemap.register_resource_list_manipulator(ext.class.extension_name, ext)
|
ext.app.sitemap.register_resource_list_manipulator(ext.class.extension_name, ext)
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,6 @@ module Middleman
|
||||||
|
|
||||||
module ResourceInstanceMethods
|
module ResourceInstanceMethods
|
||||||
# Whether this page is a proxy
|
# Whether this page is a proxy
|
||||||
# rubocop:disable TrivialAccessors
|
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def proxy?
|
def proxy?
|
||||||
@proxied_to
|
@proxied_to
|
||||||
|
|
|
@ -102,13 +102,13 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
|
||||||
# Override helper to add `relative` opt-out.
|
# Override helper to add `relative` opt-out.
|
||||||
def stylesheet_link_tag(*sources)
|
def stylesheet_link_tag(*sources)
|
||||||
options = {
|
options = {
|
||||||
:rel => 'stylesheet'
|
rel: 'stylesheet'
|
||||||
}.update(sources.extract_options!.symbolize_keys)
|
}.update(sources.extract_options!.symbolize_keys)
|
||||||
|
|
||||||
path_options = {}
|
path_options = {}
|
||||||
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
|
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
|
||||||
|
|
||||||
sources.flatten.inject(ActiveSupport::SafeBuffer.new) do |all,source|
|
sources.flatten.inject(ActiveSupport::SafeBuffer.new) do |all, source|
|
||||||
all << tag(:link, {
|
all << tag(:link, {
|
||||||
href: asset_path(:css, source, path_options)
|
href: asset_path(:css, source, path_options)
|
||||||
}.update(options))
|
}.update(options))
|
||||||
|
@ -122,7 +122,7 @@ class Middleman::CoreExtensions::DefaultHelpers < ::Middleman::Extension
|
||||||
path_options = {}
|
path_options = {}
|
||||||
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
|
path_options[:relative] = options.delete(:relative) if options.key?(:relative)
|
||||||
|
|
||||||
sources.flatten.inject(::ActiveSupport::SafeBuffer.new) do |all,source|
|
sources.flatten.inject(::ActiveSupport::SafeBuffer.new) do |all, source|
|
||||||
all << content_tag(:script, nil, {
|
all << content_tag(:script, nil, {
|
||||||
src: asset_path(:js, source, path_options)
|
src: asset_path(:js, source, path_options)
|
||||||
}.update(options))
|
}.update(options))
|
||||||
|
|
|
@ -245,10 +245,10 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
|
||||||
::I18n.locale = lang
|
::I18n.locale = lang
|
||||||
localized_page_id = ::I18n.t("paths.#{page_id}", default: page_id, fallback: [])
|
localized_page_id = ::I18n.t("paths.#{page_id}", default: page_id, fallback: [])
|
||||||
|
|
||||||
partially_localized_path = ""
|
partially_localized_path = ''
|
||||||
|
|
||||||
File.dirname(path).split('/').each do |path_sub|
|
File.dirname(path).split('/').each do |path_sub|
|
||||||
next if path_sub == ""
|
next if path_sub == ''
|
||||||
partially_localized_path = "#{partially_localized_path}/#{(::I18n.t("paths.#{path_sub}", default: path_sub).to_s)}"
|
partially_localized_path = "#{partially_localized_path}/#{(::I18n.t("paths.#{path_sub}", default: path_sub).to_s)}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -152,8 +152,8 @@ class Middleman::Extensions::Lorem < ::Middleman::Extension
|
||||||
color = options[:color]
|
color = options[:color]
|
||||||
|
|
||||||
if options[:random_color]
|
if options[:random_color]
|
||||||
background_color = hex.shuffle[0...6].join
|
background_color = hex.sample(6).join
|
||||||
color = hex.shuffle[0...6].join
|
color = hex.sample(6).join
|
||||||
end
|
end
|
||||||
|
|
||||||
src << "/#{background_color.sub(/^#/, '')}" if background_color
|
src << "/#{background_color.sub(/^#/, '')}" if background_color
|
||||||
|
|
|
@ -18,7 +18,7 @@ class Middleman::Extensions::RelativeAssets < ::Middleman::Extension
|
||||||
def asset_url(path, prefix='', options={})
|
def asset_url(path, prefix='', options={})
|
||||||
options[:relative] = true unless options.key?(:relative)
|
options[:relative] = true unless options.key?(:relative)
|
||||||
|
|
||||||
path = super(path, prefix, options)
|
super(path, prefix, options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue