From c25b0b7a6fe3b05f5b7f39669551b32fff7beb30 Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 29 Mar 2024 23:11:26 +0100 Subject: [PATCH] r10k::module::git: expose remote as getter This allows us to access the remote property to figure out the git URI for a module: ``` $ bundle exec irb Calling `DidYouMean::SPELL_CHECKERS.merge!(error_name => spell_checker)' has been deprecated. Please call `DidYouMean.correct_error(error_name, spell_checker)' instead. irb(main):001:0> require 'json' => true irb(main):002:0> require 'r10k/module_loader/puppetfile' => true irb(main):003:0> puppetfile = R10K::ModuleLoader::Puppetfile.new(basedir: '/home/bastelfreak/code/controlrepo/').load => {:modules=> ... irb(main):004:0> mod = puppetfile[:modules].map {|mod| mod if mod.class == R10K::Module::Git}.compact.first => ... irb(main):005:0> mod.remote => "https://github.com/voxpupuli/puppet-borg" irb(main):006:0> ``` --- CHANGELOG.mkd | 1 + lib/r10k/module/git.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.mkd b/CHANGELOG.mkd index a99749d72..4bebbeb31 100644 --- a/CHANGELOG.mkd +++ b/CHANGELOG.mkd @@ -4,6 +4,7 @@ CHANGELOG Unreleased ---------- +- r10k::module::git: expose remote as getter [#1379](https://github.com/puppetlabs/r10k/pull/1379) 4.0.2 ----- diff --git a/lib/r10k/module/git.rb b/lib/r10k/module/git.rb index 8242a9c6a..f0e061fea 100644 --- a/lib/r10k/module/git.rb +++ b/lib/r10k/module/git.rb @@ -46,6 +46,11 @@ def self.statically_defined_version(name, args) # @return [String] attr_reader :default_override_ref + # @!attribute[r] remote + # @api private + # @return [String] + attr_reader :remote + include R10K::Util::Setopts def initialize(title, dirname, opts, environment=nil)