diff --git a/Rules b/Rules index 8d91a27..a54613c 100644 --- a/Rules +++ b/Rules @@ -12,7 +12,7 @@ require "nanoc-tidy" ## # Extensions -[Nanoc::RuleDSL::CompilationRuleContext, Nanoc::RuleDSL::CompilerDSL].each { _1.prepend(Mixin) } +[Nanoc::RuleDSL::CompilationRuleContext, Nanoc::RuleDSL::CompilerDSL].each { _1.prepend(Utils) } Nanoc::RuleDSL::CompilationRuleContext.prepend(Nanoc::Extension::AnonymousFilter) Nanoc::RuleDSL::CompilerDSL.prepend(Nanoc::Extension::RequireRules) diff --git a/nanoc/lib/mixin.rb b/nanoc/lib/utils.rb similarity index 83% rename from nanoc/lib/mixin.rb rename to nanoc/lib/utils.rb index 5fde7b8..2a9ae9d 100644 --- a/nanoc/lib/mixin.rb +++ b/nanoc/lib/utils.rb @@ -1,11 +1,15 @@ # frozen_string_literal: true -module Mixin +## +# The {Utils Utils} module provides methods that are +# available at build time. Both ERB templates and the +# Rules file have access to the methods of this module. +module Utils require "test-cmd" - require_relative "mixin/t" - require_relative "mixin/inline" - require_relative "mixin/erb" - require_relative "mixin/opengraph" + require_relative "utils/t" + require_relative "utils/inline" + require_relative "utils/erb" + require_relative "utils/opengraph" ## # @return [Ryo::Object] @@ -74,4 +78,4 @@ module Mixin include ERB include OpenGraph end -use_helper Mixin +use_helper Utils diff --git a/nanoc/lib/mixin/erb.rb b/nanoc/lib/utils/erb.rb similarity index 85% rename from nanoc/lib/mixin/erb.rb rename to nanoc/lib/utils/erb.rb index f39b4e4..28f688a 100644 --- a/nanoc/lib/mixin/erb.rb +++ b/nanoc/lib/utils/erb.rb @@ -1,9 +1,9 @@ # frozen_string_literal: true ## -# The {Mixin::ERB Mixin::ERB} module provides a method +# The {Utils::ERB Utils::ERB} module provides a method # that can render an ERB template -module Mixin::ERB +module Utils::ERB ## # @param [String] file # The path to an ERB template diff --git a/nanoc/lib/mixin/inline.rb b/nanoc/lib/utils/inline.rb similarity index 95% rename from nanoc/lib/mixin/inline.rb rename to nanoc/lib/utils/inline.rb index 9cd63a8..8cad7a7 100644 --- a/nanoc/lib/mixin/inline.rb +++ b/nanoc/lib/utils/inline.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Mixin::Inline +module Utils::Inline def inline_json(path, class_name: File.basename(path, File.extname(path))) %|