From 7880c0c3a26106bd07e0a1f66f4cda0329b5583c Mon Sep 17 00:00:00 2001 From: Molly Waggett Date: Thu, 12 Aug 2021 08:53:03 -0700 Subject: [PATCH] (maint) Rename `@puppetfile` to `@puppetfile_path` for clarity --- lib/r10k/module_loader/puppetfile.rb | 8 ++++---- spec/unit/module_loader/puppetfile_spec.rb | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/r10k/module_loader/puppetfile.rb b/lib/r10k/module_loader/puppetfile.rb index 01fe06b05..90fc9bbdc 100644 --- a/lib/r10k/module_loader/puppetfile.rb +++ b/lib/r10k/module_loader/puppetfile.rb @@ -34,7 +34,7 @@ def initialize(basedir:, @basedir = cleanpath(basedir) @moduledir = resolve_path(@basedir, moduledir) - @puppetfile = resolve_path(@basedir, puppetfile) + @puppetfile_path = resolve_path(@basedir, puppetfile) @forge = forge @overrides = overrides @environment = environment @@ -46,13 +46,13 @@ def initialize(basedir:, @desired_contents = [] @purge_exclusions = [] - logger.info _("Using Puppetfile '%{puppetfile}'") % {puppetfile: @puppetfile} + logger.info _("Using Puppetfile '%{puppetfile}'") % {puppetfile: @puppetfile_path} logger.debug _("Using moduledir '%{moduledir}'") % {moduledir: @moduledir} end def load dsl = R10K::ModuleLoader::Puppetfile::DSL.new(self) - dsl.instance_eval(puppetfile_content(@puppetfile), @puppetfile) + dsl.instance_eval(puppetfile_content(@puppetfile_path), @puppetfile_path) validate_no_duplicate_names(@modules) @modules @@ -71,7 +71,7 @@ def load } rescue SyntaxError, LoadError, ArgumentError, NameError => e - raise R10K::Error.wrap(e, _("Failed to evaluate %{path}") % {path: @puppetfile}) + raise R10K::Error.wrap(e, _("Failed to evaluate %{path}") % {path: @puppetfile_path}) end diff --git a/spec/unit/module_loader/puppetfile_spec.rb b/spec/unit/module_loader/puppetfile_spec.rb index 071a798a0..c620407b4 100644 --- a/spec/unit/module_loader/puppetfile_spec.rb +++ b/spec/unit/module_loader/puppetfile_spec.rb @@ -37,13 +37,13 @@ it 'respects absolute paths' do absolute_options = options.merge({puppetfile: '/opt/puppetlabs/special/Puppetfile'}) puppetfile = R10K::ModuleLoader::Puppetfile.new(**absolute_options) - expect(puppetfile.instance_variable_get(:@puppetfile)).to eq('/opt/puppetlabs/special/Puppetfile') + expect(puppetfile.instance_variable_get(:@puppetfile_path)).to eq('/opt/puppetlabs/special/Puppetfile') end it 'roots the Puppetfile in the basepath if a relative path is specified' do relative_options = options.merge({puppetfile: 'Puppetfile.global'}) puppetfile = R10K::ModuleLoader::Puppetfile.new(**relative_options) - expect(puppetfile.instance_variable_get(:@puppetfile)).to eq('/test/basedir/env/Puppetfile.global') + expect(puppetfile.instance_variable_get(:@puppetfile_path)).to eq('/test/basedir/env/Puppetfile.global') end end @@ -68,7 +68,7 @@ end it 'has a Puppetfile rooted in the basedir' do - expect(subject.instance_variable_get(:@puppetfile)).to eq('/test/basedir/Puppetfile') + expect(subject.instance_variable_get(:@puppetfile_path)).to eq('/test/basedir/Puppetfile') end it 'uses the public forge' do