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>
```
  • Loading branch information
bastelfreak committed Mar 29, 2024
1 parent 04b594d commit 22da06b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.mkd
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ CHANGELOG
Unreleased
----------

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

4.0.2
-----

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 22da06b

Please sign in to comment.