From df8a06834b3c9ae93a7e53bb8a983bd06e6fb473 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> ``` cherry-picked 22da06bd1411bc9bed339ecc5a1b6262f6093a8b from https://github.com/puppetlabs/r10k/pull/1379 --- CHANGELOG.mkd | 1 + lib/r10k/module/git.rb | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/CHANGELOG.mkd b/CHANGELOG.mkd index 5cf179a60..17a9375ba 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) 3.16.1 ------ diff --git a/lib/r10k/module/git.rb b/lib/r10k/module/git.rb index 1cec41333..84fcb409f 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)