Skip to content

Commit

Permalink
(maint) Rename @puppetfile to @puppetfile_path for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
mwaggett committed Aug 13, 2021
1 parent b94bf2a commit 7880c0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions lib/r10k/module_loader/puppetfile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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


Expand Down
6 changes: 3 additions & 3 deletions spec/unit/module_loader/puppetfile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down

0 comments on commit 7880c0c

Please sign in to comment.