gem_hadar 2.27.1 → 2.28.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a8debbdd2155f6f325ac0ac4df0f290e93d31fb291833c29e34f33b21346cf0
4
- data.tar.gz: 2ea5037b6ec777c0963177b1b49e21544fd9339925eb482b78d15569c9c6b7fa
3
+ metadata.gz: daf6ae6f7b363c60218f4fc5407f01726c9e75ff6c0f6240ed8e81a814d1ed9c
4
+ data.tar.gz: afb6124dfc553533641be6e09bdbce21f248e1c440d4b60659b45a18f7ea6e22
5
5
  SHA512:
6
- metadata.gz: 5b98cfe029c0dc80efe2d8b355439ad2beb620b4195707a58a76d460a358dd630f725d7bc01bb6c8a0f262f75ba14924eeb229c9eb2d41e628ac369e3bb73bb0
7
- data.tar.gz: 233b4b9bfdc72fdc80796e13d8c8ecfa6f78428c5af51dfc3a602be0f9301009165fb169dff8717d9e3f196d1f9b1a44a704d39c8f54ba6ddb4ee32a5e6ac896
6
+ metadata.gz: c75aa02f6e94f706e68a69832ae842ade115b0de6461a89d625e6d68157f9a6903ea89d85186dddccce17abbf67ce4c9c6d268f755d637d9a63c8eb98056d189
7
+ data.tar.gz: 90f13cda7914f55a2e13813efa50684c885b78a62651aed42371dc43a7af44752af91383902a7ddb351704c3400877fa53293315ed4b7b6413ce0a24b46c8165
data/gem_hadar.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: gem_hadar 2.27.1 ruby lib
2
+ # stub: gem_hadar 2.28.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "gem_hadar".freeze
6
- s.version = "2.27.1".freeze
6
+ s.version = "2.28.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]
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.homepage = "https://github.com/flori/gem_hadar".freeze
18
18
  s.licenses = ["MIT".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "GemHadar - Library for the development of Ruby Gems".freeze, "--main".freeze, "README.md".freeze]
20
- s.rubygems_version = "4.1.0".freeze
20
+ s.rubygems_version = "4.1.1".freeze
21
21
  s.summary = "Library for the development of Ruby Gems".freeze
22
22
  s.test_files = ["spec/gem_hadar_spec.rb".freeze, "spec/spec_helper.rb".freeze]
23
23
 
@@ -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.1'
8
+ VERSION = '2.28.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
@@ -1,10 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'rbconfig'
3
- if defined?(::RbConfig)
4
- include ::RbConfig
5
- else
6
- include ::Config
7
- end
3
+ include ::RbConfig
8
4
  require 'rake'
9
5
  require 'net/http'
10
6
  require 'uri'
@@ -18,7 +14,6 @@ require 'term/ansicolor'
18
14
  require_maybe 'yard'
19
15
  require_maybe 'simplecov'
20
16
  require_maybe 'rubygems/package_task'
21
- require_maybe 'rcov/rcovtask'
22
17
  require_maybe 'rspec/core/rake_task'
23
18
 
24
19
  # The GemHadar class serves as the primary configuration and task management
@@ -75,12 +70,7 @@ class GemHadar
75
70
  include GemHadar::Warn
76
71
  include GemHadar::OllamaSupport
77
72
  include GemHadar::Editor
78
-
79
- if defined?(::RbConfig)
80
- include ::RbConfig
81
- else
82
- include ::Config
83
- end
73
+ include ::RbConfig
84
74
  include Rake::DSL
85
75
  extend DSLKit::DSLAccessor
86
76
  include Tins::SecureWrite
@@ -661,7 +651,12 @@ class GemHadar
661
651
  #
662
652
  # @return [ Array<Symbol, String> ] an array of task names that are required
663
653
  # as dependencies for the default task execution
664
- dsl_accessor :default_task_dependencies, [ :gemspec, :test ]
654
+ dsl_accessor :default_task_dependencies do
655
+ deps = [ :gemspec ]
656
+ deps << :test if test_dir
657
+ deps << :spec if spec_dir
658
+ deps
659
+ end
665
660
 
666
661
  # The default_task method defines the default Rake task for the gem project.
667
662
  #
@@ -1054,6 +1049,10 @@ class GemHadar
1054
1049
  # options, test pattern, and verbose output. The task also conditionally
1055
1050
  # depends on the :compile task if project extensions are present.
1056
1051
  def spec_task
1052
+ if spec_dir && !defined?(::RSpec::Core::RakeTask)
1053
+ fail 'spec_dir is set but RSpec is not loaded. ' \
1054
+ "Add 'rspec-core' to your development dependencies."
1055
+ end
1057
1056
  defined? ::RSpec::Core::RakeTask or return
1058
1057
  st = RSpec::Core::RakeTask.new(:run_specs) do |t|
1059
1058
  t.ruby_opts ||= ''
@@ -1064,36 +1063,6 @@ class GemHadar
1064
1063
  task :spec => [ (:compile if extensions.full?), st.name ].compact
1065
1064
  end
1066
1065
 
1067
- # The rcov_task method sets up a Rake task for executing code coverage tests
1068
- # using RCov.
1069
- #
1070
- # This method configures a :rcov task that runs the project's test suite with
1071
- # RCov to generate code coverage reports. It includes the test directory and
1072
- # required paths in the load path, specifies the test files to run, and
1073
- # enables verbose output. The task also conditionally depends on the :compile
1074
- # task if project extensions are present. If RCov is not available, it
1075
- # displays a warning message suggesting to install RCov.
1076
- def rcov_task
1077
- if defined?(::Rcov)
1078
- rt = ::Rcov::RcovTask.new(:run_rcov) do |t|
1079
- t.libs << test_dir
1080
- t.libs.concat require_paths.to_a
1081
- t.libs.uniq!
1082
- t.test_files = test_files
1083
- t.verbose = true
1084
- t.rcov_opts = %W[-x '\\b#{test_dir}\/' -x '\\bgems\/']
1085
- end
1086
- desc 'Run the rcov code coverage tests'
1087
- task :rcov => [ (:compile if extensions.full?), rt.name ].compact
1088
- clobber 'coverage'
1089
- else
1090
- desc 'Run the rcov code coverage tests'
1091
- task :rcov do
1092
- warn "rcov doesn't work for some reason, have you tried 'gem install rcov'?"
1093
- end
1094
- end
1095
- end
1096
-
1097
1066
  # The version_bump_task method defines Rake tasks for incrementing the gem's
1098
1067
  # version number.
1099
1068
  #
@@ -1912,11 +1881,8 @@ class GemHadar
1912
1881
  gem_hadar_update_task
1913
1882
  gemspec_task
1914
1883
  gems_install_task
1915
- if test_dir
1916
- test_task
1917
- rcov_task
1918
- end
1919
- spec_task
1884
+ test_task if test_dir
1885
+ spec_task if spec_dir
1920
1886
  package_task
1921
1887
  yard_task
1922
1888
  install_library_task
@@ -2164,22 +2130,25 @@ class GemHadar
2164
2130
  # from the local Git configuration.
2165
2131
  #
2166
2132
  # 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.
2133
+ # push URLs, and processes them to construct valid URIs. The remote named by
2134
+ # GIT_REMOTE (default: "origin") is preferred; if that remote is not on
2135
+ # GitHub.com, it falls back to scanning all remotes.
2169
2136
  #
2170
2137
  # @return [URI, nil] The parsed GitHub remote URI or nil if not found.
2171
2138
  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)
2139
+ remotes = `git remote -v`
2140
+ return if remotes.empty?
2141
+ remotes_urls = remotes.scan(/^(\S+)\s+(\S+)\s+\(push\)/)
2142
+ remotes_uris = remotes_urls.map do |name, url|
2143
+ if %r(\A(?<scheme>[^@]+)@(?<hostname>[A-Za-z0-9.]+):(?:\d*)(?<path>.*)) =~ url
2144
+ path = ?/ + path unless path.start_with? ?/
2145
+ url = 'ssh://%s@%s%s' % [ scheme, hostname, path ]
2180
2146
  end
2181
- remotes_uris.find { |uri| uri.hostname == 'github.com' }
2147
+ [name, URI.parse(url)]
2182
2148
  end
2149
+ preferred = remotes_uris.find { |n, _| n == git_remote }
2150
+ return preferred&.last if preferred&.last&.hostname == 'github.com'
2151
+ remotes_uris.map(&:last).find { |uri| uri.hostname == 'github.com' }
2183
2152
  end
2184
2153
 
2185
2154
  # The github_workflows attribute accessor for configuring GitHub Actions
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.1
4
+ version: 2.28.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -338,7 +338,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
338
338
  - !ruby/object:Gem::Version
339
339
  version: "0"
340
340
  requirements: []
341
- rubygems_version: 4.1.0
341
+ rubygems_version: 4.1.1
342
342
  specification_version: 4
343
343
  summary: Library for the development of Ruby Gems
344
344
  test_files: