gem_hadar 2.27.0 → 2.27.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7df19269ddadb71d9fa946f34e19478663c755af8b213b0716273f51aecac9f3
4
- data.tar.gz: fe177de62c32da9ccfd4758bd290f8769ce50c189c28115dc54ef05cb3cefd31
3
+ metadata.gz: 39a15677843a01f5117384dadd4a93cb2615f6cd9c40f0b0e74071c186bc708b
4
+ data.tar.gz: a0f3f6a23f7ff61338ee9f0af28098128f9aa9b39b8e8bcbbd6414d13d6d4e03
5
5
  SHA512:
6
- metadata.gz: e9f0af878df583ab9f754b64d1589d6db7b20452953539fd2d527e14b46e8f2eb0e41785783745e6885000e5fb4e299e7fd323aad45823a26513307279774446
7
- data.tar.gz: fae1ae8769df8eb20ecbd828478121a0cd29d18c9fd2203c3ec0f7687347d245252b71b9053a8c142604d823007b1bba64e95451000544350704b3efc2c824da
6
+ metadata.gz: 5ef82f8141f9188643ec8cc3e5aacfdfe925ffb5b08e93da618265bd98623a0d8ad0009f867bcc423b63d7d920f1af64eb495140b0246824a7f7b10b993f03cb
7
+ data.tar.gz: 86ee05fa57cfd7e39a594fc4359d27d1f8f0ef3406e4299a88df036a8ec6a0e48420314f3e152d3bb16330ca094d85a42bb884566195f217729ee362752e93a0
data/gem_hadar.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: gem_hadar 2.27.0 ruby lib
2
+ # stub: gem_hadar 2.27.2 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gem_hadar".freeze
6
- s.version = "2.27.0".freeze
6
+ s.version = "2.27.2".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -5,7 +5,7 @@
5
5
  # by hand; it is rewritten on every `rake version` invocation.
6
6
  class GemHadar
7
7
  # The current version of the GemHadar gem as a String.
8
- VERSION = '2.27.0'
8
+ VERSION = '2.27.2'
9
9
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
10
10
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
11
11
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/lib/gem_hadar.rb CHANGED
@@ -2164,22 +2164,25 @@ class GemHadar
2164
2164
  # from the local Git configuration.
2165
2165
  #
2166
2166
  # It executes `git remote -v` to get all remote configurations, extracts the
2167
- # push URLs, processes them to construct valid URIs, and returns the first
2168
- # URI pointing to GitHub.com.
2167
+ # push URLs, and processes them to construct valid URIs. The remote named by
2168
+ # GIT_REMOTE (default: "origin") is preferred; if that remote is not on
2169
+ # GitHub.com, it falls back to scanning all remotes.
2169
2170
  #
2170
2171
  # @return [URI, nil] The parsed GitHub remote URI or nil if not found.
2171
2172
  def github_remote_url
2172
- if remotes = `git remote -v`
2173
- remotes_urls = remotes.scan(/^(\S+)\s+(\S+)\s+\(push\)/)
2174
- remotes_uris = remotes_urls.map do |name, url|
2175
- if %r(\A(?<scheme>[^@]+)@(?<hostname>[A-Za-z0-9.]+):(?:\d*)(?<path>.*)) =~ url
2176
- path = ?/ + path unless path.start_with? ?/
2177
- url = 'ssh://%s@%s%s' % [ scheme, hostname, path ] # approximate correct URIs
2178
- end
2179
- URI.parse(url)
2173
+ remotes = `git remote -v`
2174
+ return if remotes.empty?
2175
+ remotes_urls = remotes.scan(/^(\S+)\s+(\S+)\s+\(push\)/)
2176
+ remotes_uris = remotes_urls.map do |name, url|
2177
+ if %r(\A(?<scheme>[^@]+)@(?<hostname>[A-Za-z0-9.]+):(?:\d*)(?<path>.*)) =~ url
2178
+ path = ?/ + path unless path.start_with? ?/
2179
+ url = 'ssh://%s@%s%s' % [ scheme, hostname, path ]
2180
2180
  end
2181
- remotes_uris.find { |uri| uri.hostname == 'github.com' }
2181
+ [name, URI.parse(url)]
2182
2182
  end
2183
+ preferred = remotes_uris.find { |n, _| n == git_remote }
2184
+ return preferred&.last if preferred&.last&.hostname == 'github.com'
2185
+ remotes_uris.map(&:last).find { |uri| uri.hostname == 'github.com' }
2183
2186
  end
2184
2187
 
2185
2188
  # The github_workflows attribute accessor for configuring GitHub Actions
@@ -2289,9 +2292,13 @@ class GemHadar
2289
2292
  diff = `diff -u --color=always #{dst.to_path} #{new.path}`
2290
2293
  puts diff unless diff.strip.empty?
2291
2294
  end
2292
- if ask?("Update #{dst}? (y/N) ", /\Ay/i)
2293
- secure_write(dst) { |f| f.write rendered }
2294
- puts "Updated #{dst}."
2295
+ if STDIN.tty?
2296
+ if ask?("Update #{dst}? (y/N) ", /\Ay/i)
2297
+ secure_write(dst) { |f| f.write rendered }
2298
+ puts "Updated #{dst}."
2299
+ end
2300
+ else
2301
+ warn "Workflow #{dst} differs from template. Run interactively to update."
2295
2302
  end
2296
2303
  end
2297
2304
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gem_hadar
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.27.0
4
+ version: 2.27.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank