switches.rb 0.10.3 → 0.10.4

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: f5b9c36e31d7118656c21aabaf9ba11bbce49bf412c8162bc846b498e2df4436
4
- data.tar.gz: 9e80ffa19bdba18e233a545823feda717cc929d894520c25e6c4c47727725a79
3
+ metadata.gz: ea74840ee7d4c44d9a22e7e6c4464eb0417fd4ac0d65e0683465600188e2d903
4
+ data.tar.gz: 7f68a8a35001b0ff0445d605f276b3205c0651e3ab5a582e970fe5d4a771ea0a
5
5
  SHA512:
6
- metadata.gz: 17a0546157353bbbd9de4a0139097cff70d4551c528e1203749c7bafe0195c4553ead66fd229082e6bc9b02eb43d9cacaaed3927279640608dca6bdfcb178c13
7
- data.tar.gz: 07cd0a479fe6e0ec7887e01e5b96652d1ba80d3062fc76d43e3433990751b806236ce9902531c7b8dc750560fb320c96ba39445d02c6a8fcf7fe03afef9e04f2
6
+ metadata.gz: 284df213837788db6c63752a357d763e16a84ea37331eb405365a6754335e8372a70a7dc880caddd3f6220d4530ccf901a4bfff12e3e9482ebbc7b22433e0bf2
7
+ data.tar.gz: 2b067b99909da06acaa0e366dae1ac41307f5347cd44383a3a036bac06e21eac521b6d670ac2ff07b6eac6f3332f9b07ddcee590c51e1466f039823569465f94
data/CHANGELOG CHANGED
@@ -1,5 +1,17 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 20260816
4
+
5
+ 0.10.4: Declare ostruct as a runtime dependency, in place of installing it at require time.
6
+
7
+ 1. ~ lib/Switches.rb: require 'ostruct', in place of the require_gem 'ostruct' introduced in 0.10.0. require_gem rescues the LoadError and shells out to gem install, so the dependency went unannounced and was satisfied silently into whatever GEM_HOME was set — which, under a Homebrew formula's wrapper, means the program installing a gem into its own keg. A library should announce what it needs and fail loudly without it.
8
+ 2. ~ switches.rb.gemspec: + s.dependencies = ['ostruct'], declared as data via a dependencies= setter added to the local Gem::Specification reopening, alongside the development_dependencies= setter added in 0.10.3.
9
+ 3. - lib/Kernel/require_gem.rb and - lib/Thoran/Kernel/RequireGem/require_gem.rb, vendored in 0.10.0 for the require above and with no remaining user.
10
+ 4. ~ Gemfile: - gem 'ostruct', which the gemspec now supplies.
11
+ 5. ~ spec/all.rb: the gemspec spec asserted that no runtime dependencies were declared, and now asserts that ostruct is the only one.
12
+ 6. ~ lib/Switches.rb: the header's Dependencies section names ostruct, since the Standard Ruby Library no longer covers it.
13
+ 7. ~ .gitignore: + a header, + .claude, ~ /tmp/ to tmp/, and - /test/tmp/, which tmp/ now covers.
14
+
3
15
  ## 20260812
4
16
 
5
17
  0.10.3: Move the version into a constant, and add the standard version and gemspec tests.
data/Gemfile CHANGED
@@ -1,7 +1,3 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
-
5
- # ostruct is no longer a default gem as of Ruby 4.0, so it must be provided
6
- # explicitly under bundler.
7
- gem 'ostruct'
@@ -2,5 +2,5 @@
2
2
  # Switches::VERSION
3
3
 
4
4
  class Switches
5
- VERSION = '0.10.3'
5
+ VERSION = '0.10.4'
6
6
  end
data/lib/Switches.rb CHANGED
@@ -12,13 +12,12 @@
12
12
  # 2. Do away with optional arguments entirely. Since when does anyone want to specify a non-boolean switch and then supply no arguments anyway?... OK, maybe sometimes, but this is pretty obscure IMO. OK, bad idea. These can be used as action oriented sub-commands.
13
13
  # 3. Allow for any one of the switches OpenStruct methods to assign values for any of the other associated methods, so as it is more than a read once switch and can be used for storage through out the application; although this might be stepping on Attributes.rb's toes?...
14
14
 
15
- # Dependencies:
16
- # 1. Standard Ruby Library.
15
+ # Dependencies:
16
+ # 1. Standard Ruby Library.
17
+ # 2. ostruct, which ceased to be a default gem as of Ruby 4.0 and so is declared in the gemspec.
17
18
 
18
19
  require 'optparse'
19
- require 'Kernel/require_gem'
20
-
21
- require_gem 'ostruct'
20
+ require 'ostruct'
22
21
 
23
22
  require_relative './Switches/VERSION'
24
23
 
data/spec/all.rb CHANGED
@@ -257,8 +257,8 @@ describe 'switches.rb.gemspec' do
257
257
  expect(spec.version.to_s).to eq(Switches::VERSION)
258
258
  end
259
259
 
260
- it "declares no runtime dependencies" do
261
- expect(spec.runtime_dependencies.map(&:name).sort).to eq([])
260
+ it "declares ostruct as its only runtime dependency" do
261
+ expect(spec.runtime_dependencies.map(&:name).sort).to eq(%w{ostruct})
262
262
  end
263
263
 
264
264
  it "declares its development dependencies" do
data/switches.rb.gemspec CHANGED
@@ -1,13 +1,17 @@
1
1
  require_relative './lib/Switches/VERSION'
2
2
 
3
3
  class Gem::Specification
4
+ def dependencies=(gems)
5
+ gems.each{|gem| add_dependency(*gem)}
6
+ end
7
+
4
8
  def development_dependencies=(gems)
5
9
  gems.each{|gem| add_development_dependency(*gem)}
6
10
  end
7
11
  end
8
12
 
9
13
  Gem::Specification.new do |s|
10
- s.name = 'switches.rb' # I would have preferred 'switches', but there's a gem with the name of switches.
14
+ s.name = 'switches.rb'
11
15
  s.version = Switches::VERSION
12
16
 
13
17
  s.summary = "The easiest way to provide switches to a Ruby program."
@@ -19,11 +23,7 @@ Gem::Specification.new do |s|
19
23
  s.license = 'MIT'
20
24
 
21
25
  s.required_ruby_version = ">= 2.7.0"
22
-
23
- s.development_dependencies = [
24
- 'rake',
25
- 'rspec'
26
- ]
26
+ s.require_paths = ['lib']
27
27
 
28
28
  s.files = [
29
29
  'CHANGELOG',
@@ -36,7 +36,14 @@ Gem::Specification.new do |s|
36
36
  Dir['spec/**/*.rb'],
37
37
  ].flatten
38
38
 
39
- s.require_paths = ['lib']
39
+ s.dependencies = [
40
+ 'ostruct'
41
+ ]
42
+
43
+ s.development_dependencies = [
44
+ 'rake',
45
+ 'rspec'
46
+ ]
40
47
 
41
48
  s.metadata = {
42
49
  "bug_tracker_uri" => "https://github.com/thoran/switches/issues",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switches.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.3
4
+ version: 0.10.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
@@ -9,6 +9,20 @@ bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: ostruct
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '0'
12
26
  - !ruby/object:Gem::Dependency
13
27
  name: rake
14
28
  requirement: !ruby/object:Gem::Requirement
@@ -49,10 +63,8 @@ files:
49
63
  - LICENSE.txt
50
64
  - README.md
51
65
  - Rakefile
52
- - lib/Kernel/require_gem.rb
53
66
  - lib/Switches.rb
54
67
  - lib/Switches/VERSION.rb
55
- - lib/Thoran/Kernel/RequireGem/require_gem.rb
56
68
  - spec/all.rb
57
69
  - switches.rb.gemspec
58
70
  homepage: https://github.com/thoran/switches
@@ -1,7 +0,0 @@
1
- # Kernel/require_gem.rb
2
- # Kernel#require_gem
3
-
4
- # 20240613
5
- # 0.0.0
6
-
7
- require 'Thoran/Kernel/RequireGem/require_gem'
@@ -1,27 +0,0 @@
1
- # Thoran/Kernel/RequireGem/require_gem.rb
2
- # Thoran::Kernel::RequireGem#require_gem.rb
3
-
4
- # 20240613
5
- # 0.0.0
6
-
7
- module Thoran
8
- module Kernel
9
- module RequireGem
10
-
11
- def require_gem(load_string, gem_name: nil)
12
- require load_string
13
- rescue LoadError
14
- if gem_name
15
- system("gem install #{gem_name}")
16
- else
17
- system("gem install #{load_string}")
18
- end
19
- Gem.clear_paths
20
- require load_string
21
- end
22
-
23
- end
24
- end
25
- end
26
-
27
- Kernel.include(Thoran::Kernel::RequireGem)