gem_hadar 2.26.0 → 2.27.0
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/.github/workflows/static.yml +1 -1
- data/gem_hadar.gemspec +2 -2
- data/lib/gem_hadar/github_workflows/static.yml.erb +1 -1
- data/lib/gem_hadar/version.rb +1 -1
- data/lib/gem_hadar.rb +51 -7
- 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: 7df19269ddadb71d9fa946f34e19478663c755af8b213b0716273f51aecac9f3
|
|
4
|
+
data.tar.gz: fe177de62c32da9ccfd4758bd290f8769ce50c189c28115dc54ef05cb3cefd31
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9f0af878df583ab9f754b64d1589d6db7b20452953539fd2d527e14b46e8f2eb0e41785783745e6885000e5fb4e299e7fd323aad45823a26513307279774446
|
|
7
|
+
data.tar.gz: fae1ae8769df8eb20ecbd828478121a0cd29d18c9fd2203c3ec0f7687347d245252b71b9053a8c142604d823007b1bba64e95451000544350704b3efc2c824da
|
data/gem_hadar.gemspec
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
|
2
|
-
# stub: gem_hadar 2.
|
|
2
|
+
# stub: gem_hadar 2.27.0 ruby lib
|
|
3
3
|
|
|
4
4
|
Gem::Specification.new do |s|
|
|
5
5
|
s.name = "gem_hadar".freeze
|
|
6
|
-
s.version = "2.
|
|
6
|
+
s.version = "2.27.0".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.
|
|
8
|
+
VERSION = '2.27.0'
|
|
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
|
@@ -13,6 +13,7 @@ require 'rake/clean'
|
|
|
13
13
|
require 'rake/testtask'
|
|
14
14
|
require 'set'
|
|
15
15
|
require 'pathname'
|
|
16
|
+
require 'tempfile'
|
|
16
17
|
require 'term/ansicolor'
|
|
17
18
|
require_maybe 'yard'
|
|
18
19
|
require_maybe 'simplecov'
|
|
@@ -1370,24 +1371,32 @@ class GemHadar
|
|
|
1370
1371
|
#
|
|
1371
1372
|
# @param path [ String ] the file path to the gem package to be pushed
|
|
1372
1373
|
def gem_push(path)
|
|
1374
|
+
@push_cancelled = false
|
|
1373
1375
|
if File.exist?(path)
|
|
1374
1376
|
if ask?("Do you really want to push #{path.inspect} to rubygems? "\
|
|
1375
1377
|
"(yes/NO) ", /\Ayes\z/i)
|
|
1376
1378
|
then
|
|
1377
1379
|
key = ENV['GEM_HOST_API_KEY'].full? { |k| "--key #{k} " }
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
if ask?("Delete #{tag} from #{@version_tag_pushed.to_a.join(', ')}? (y/N) ", /\Ay/i)
|
|
1383
|
-
@version_tag_pushed.each { |gr| sh "git push #{gr} --delete #{tag}" }
|
|
1384
|
-
end
|
|
1380
|
+
begin
|
|
1381
|
+
sh "gem push #{key}#{path}"
|
|
1382
|
+
rescue RuntimeError
|
|
1383
|
+
@push_cancelled = true
|
|
1385
1384
|
end
|
|
1385
|
+
else
|
|
1386
|
+
@push_cancelled = true
|
|
1386
1387
|
exit 1
|
|
1387
1388
|
end
|
|
1388
1389
|
else
|
|
1390
|
+
@push_cancelled = true
|
|
1389
1391
|
abort "Cannot push gem to rubygems: #{path.inspect} doesn't exist."
|
|
1390
1392
|
end
|
|
1393
|
+
ensure
|
|
1394
|
+
if @push_cancelled && @version_tag_pushed&.any?
|
|
1395
|
+
tag = GemHadar::VersionSpec[version].tag
|
|
1396
|
+
if ask?("Delete #{tag} from #{@version_tag_pushed.to_a.join(', ')}? (y/N) ", /\Ay/i)
|
|
1397
|
+
@version_tag_pushed.each { |gr| sh "git push #{gr} --delete #{tag}" }
|
|
1398
|
+
end
|
|
1399
|
+
end
|
|
1391
1400
|
end
|
|
1392
1401
|
|
|
1393
1402
|
# The git_remotes_task method defines a Rake task that displays all Git
|
|
@@ -1448,6 +1457,7 @@ class GemHadar
|
|
|
1448
1457
|
end
|
|
1449
1458
|
desc "Create a new GitHub release for the current version with a AI-generated changelog"
|
|
1450
1459
|
task :release do
|
|
1460
|
+
@push_cancelled and next
|
|
1451
1461
|
yes = ask?(
|
|
1452
1462
|
"Do you want to publish a release message on github? (y/n%{default}) ",
|
|
1453
1463
|
/\Ay/i, default: ENV['GITHUB_RELEASE_ENABLED']
|
|
@@ -1915,6 +1925,7 @@ class GemHadar
|
|
|
1915
1925
|
push_task
|
|
1916
1926
|
release_task
|
|
1917
1927
|
github_workflows_task
|
|
1928
|
+
check_workflow_drift
|
|
1918
1929
|
write_ignore_file
|
|
1919
1930
|
strip_modeline 'Gemfile'
|
|
1920
1931
|
strip_modeline 'Rakefile'
|
|
@@ -2252,6 +2263,39 @@ class GemHadar
|
|
|
2252
2263
|
end
|
|
2253
2264
|
end
|
|
2254
2265
|
end
|
|
2266
|
+
|
|
2267
|
+
# The check_workflow_drift method compares rendered workflow templates
|
|
2268
|
+
# against the files on disk and offers to update them if they differ.
|
|
2269
|
+
#
|
|
2270
|
+
# This runs on every rake invocation (like write_gemfile / strip_modeline)
|
|
2271
|
+
# so that template changes shipped in a new gem_hadar release are surfaced
|
|
2272
|
+
# to the user without silently overwriting local edits.
|
|
2273
|
+
def check_workflow_drift
|
|
2274
|
+
return unless github_workflows.any?
|
|
2275
|
+
src_dir = Pathname.new(__dir__).join('gem_hadar', 'github_workflows')
|
|
2276
|
+
dst_dir = Pathname.pwd.join('.github', 'workflows')
|
|
2277
|
+
github_workflows.each do |workflow, variables|
|
|
2278
|
+
src = src_dir.join(workflow + '.erb')
|
|
2279
|
+
dst = dst_dir.join(workflow)
|
|
2280
|
+
next unless src.exist? && dst.exist?
|
|
2281
|
+
@github_workflows_variables = variables
|
|
2282
|
+
erb = ERB.new(File.read(src), trim_mode: ?-)
|
|
2283
|
+
erb.filename = src.to_s
|
|
2284
|
+
rendered = erb.result(binding)
|
|
2285
|
+
if rendered != dst.read
|
|
2286
|
+
Tempfile.create(%w[wf_cur wf_new]) do |new|
|
|
2287
|
+
new.write rendered
|
|
2288
|
+
new.flush
|
|
2289
|
+
diff = `diff -u --color=always #{dst.to_path} #{new.path}`
|
|
2290
|
+
puts diff unless diff.strip.empty?
|
|
2291
|
+
end
|
|
2292
|
+
if ask?("Update #{dst}? (y/N) ", /\Ay/i)
|
|
2293
|
+
secure_write(dst) { |f| f.write rendered }
|
|
2294
|
+
puts "Updated #{dst}."
|
|
2295
|
+
end
|
|
2296
|
+
end
|
|
2297
|
+
end
|
|
2298
|
+
end
|
|
2255
2299
|
end
|
|
2256
2300
|
|
|
2257
2301
|
# The GemHadar method serves as the primary entry point for configuring and
|