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 +4 -4
- data/gem_hadar.gemspec +2 -2
- data/lib/gem_hadar/version.rb +1 -1
- data/lib/gem_hadar.rb +21 -14
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 39a15677843a01f5117384dadd4a93cb2615f6cd9c40f0b0e74071c186bc708b
|
|
4
|
+
data.tar.gz: a0f3f6a23f7ff61338ee9f0af28098128f9aa9b39b8e8bcbbd6414d13d6d4e03
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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.
|
|
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.
|
|
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]
|
data/lib/gem_hadar/version.rb
CHANGED
|
@@ -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.
|
|
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
|
|
2168
|
-
#
|
|
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
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
|
|
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
|
-
|
|
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
|
|
2293
|
-
|
|
2294
|
-
|
|
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
|