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 +4 -4
- data/CHANGELOG +12 -0
- data/Gemfile +0 -4
- data/lib/Switches/VERSION.rb +1 -1
- data/lib/Switches.rb +4 -5
- data/spec/all.rb +2 -2
- data/switches.rb.gemspec +14 -7
- metadata +15 -3
- data/lib/Kernel/require_gem.rb +0 -7
- data/lib/Thoran/Kernel/RequireGem/require_gem.rb +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea74840ee7d4c44d9a22e7e6c4464eb0417fd4ac0d65e0683465600188e2d903
|
|
4
|
+
data.tar.gz: 7f68a8a35001b0ff0445d605f276b3205c0651e3ab5a582e970fe5d4a771ea0a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
data/lib/Switches/VERSION.rb
CHANGED
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 '
|
|
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
|
|
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'
|
|
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.
|
|
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.
|
|
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
|
data/lib/Kernel/require_gem.rb
DELETED
|
@@ -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)
|