Skip to content

Commit

Permalink
r10k::module::git: expose remote as getter
Browse files Browse the repository at this point in the history
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 22da06b from puppetlabs#1379
  • Loading branch information
bastelfreak committed Apr 9, 2024
1 parent 9725e26 commit df8a068
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
Unreleased
----------

- r10k::module::git: expose remote as getter [#1379](https://github.com/puppetlabs/r10k/pull/1379)

3.16.1
------
Expand Down
5 changes: 5 additions & 0 deletions lib/r10k/module/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit df8a068

Please sign in to comment.