switches.rb 0.10.2 → 0.10.3

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: 3522ecf029cdd554e02bb72d5620de851dfeb091421cfa2efea8c9d115f8d935
4
- data.tar.gz: 75a81b0ca90c8d6125e4bbac37cc5840291b17bbaef5598050db2c97d27a2742
3
+ metadata.gz: f5b9c36e31d7118656c21aabaf9ba11bbce49bf412c8162bc846b498e2df4436
4
+ data.tar.gz: 9e80ffa19bdba18e233a545823feda717cc929d894520c25e6c4c47727725a79
5
5
  SHA512:
6
- metadata.gz: 852da32c748e8b771122eb84e54fb4aaba785a0a973c5b377cfa0c89fd36e6095812dfa96bb466ecd47a637fbd994b14fb6868a1db6a1a0c870e97570a389fc6
7
- data.tar.gz: c6ffc907d26d8219cee5e6b011a1f0746574139867b7ae4249c7589262394be5b13022d28a04cad9cffc6429f62b88a4acb67c4b5c121c12f0af4405a16bc0c5
6
+ metadata.gz: 17a0546157353bbbd9de4a0139097cff70d4551c528e1203749c7bafe0195c4553ead66fd229082e6bc9b02eb43d9cacaaed3927279640608dca6bdfcb178c13
7
+ data.tar.gz: 07cd0a479fe6e0ec7887e01e5b96652d1ba80d3062fc76d43e3433990751b806236ce9902531c7b8dc750560fb320c96ba39445d02c6a8fcf7fe03afef9e04f2
data/CHANGELOG CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  ## 20260812
4
4
 
5
+ 0.10.3: Move the version into a constant, and add the standard version and gemspec tests.
6
+
7
+ 1. + lib/Switches/VERSION.rb: Switches::VERSION, required from lib/Switches.rb. The version now lives in a constant the gemspec reads, in place of the '0.10.2' literal it declared.
8
+ 2. ~ switches.rb.gemspec: s.version from Switches::VERSION; development_dependencies declared as data — s.development_dependencies = [...], via a setter added in a local Gem::Specification reopening — in place of the add_development_dependency calls; - s.date, which was a stale literal, letting RubyGems' default stand.
9
+ 3. + spec/all.rb: the standard version and gemspec specs — VERSION is a string, an anchored X.Y.Z, and matches the newest CHANGELOG entry; the gemspec loads and validates, pins no date, takes its version from Switches::VERSION, declares no runtime dependencies, and declares rake and rspec for development.
10
+ 4. - lib/Switches.rb: the "# 20260809 / # 0.10.1" date-and-version stamp in the header, now redundant since VERSION.rb carries the version.
11
+
5
12
  0.10.2: Recover the in-source change log into the CHANGELOG, and move the Notes to the README.
6
13
 
7
14
  1. + CHANGELOG: the 0.9.0 to 0.9.13 series, recovered from the "Changes since 0.8:" log that lived in the lib/Switches.rb header. The items are reproduced as written; the versions carry no reliable dates and are left undated.
@@ -0,0 +1,6 @@
1
+ # lib/Switches/VERSION.rb
2
+ # Switches::VERSION
3
+
4
+ class Switches
5
+ VERSION = '0.10.3'
6
+ end
data/lib/Switches.rb CHANGED
@@ -1,9 +1,6 @@
1
1
  # Switches.rb
2
2
  # Switches
3
3
 
4
- # 20260809
5
- # 0.10.1
6
-
7
4
  # Description: Switches provides for a nice wrapper to OptionParser to also act as a store for switches supplied.
8
5
 
9
6
  # Todo:
@@ -23,6 +20,8 @@ require 'Kernel/require_gem'
23
20
 
24
21
  require_gem 'ostruct'
25
22
 
23
+ require_relative './Switches/VERSION'
24
+
26
25
  class OpenStruct
27
26
 
28
27
  def to_h
data/spec/all.rb CHANGED
@@ -224,3 +224,44 @@ describe Switches do
224
224
  end
225
225
  end
226
226
  end
227
+
228
+ describe Switches do
229
+ describe "VERSION" do
230
+ it "is a string" do
231
+ expect(Switches::VERSION).to be_a(String)
232
+ end
233
+
234
+ it "is three numbers separated by dots" do
235
+ expect(Switches::VERSION).to match(/\A\d+\.\d+\.\d+\z/)
236
+ end
237
+
238
+ it "matches the newest entry in the CHANGELOG" do
239
+ changelog = File.read(File.expand_path('../CHANGELOG', __dir__))
240
+ expect(changelog[/^(\d+\.\d+\.\d+):/, 1]).to eq(Switches::VERSION)
241
+ end
242
+ end
243
+ end
244
+
245
+ describe 'switches.rb.gemspec' do
246
+ let(:spec){Gem::Specification.load(File.expand_path('../switches.rb.gemspec', __dir__))}
247
+
248
+ it "is a valid specification" do
249
+ expect(spec.validate).to eq(true)
250
+ end
251
+
252
+ it "does not pin a date" do
253
+ expect(spec.date).to eq(Gem::Specification.new.date)
254
+ end
255
+
256
+ it "takes its version from Switches::VERSION" do
257
+ expect(spec.version.to_s).to eq(Switches::VERSION)
258
+ end
259
+
260
+ it "declares no runtime dependencies" do
261
+ expect(spec.runtime_dependencies.map(&:name).sort).to eq([])
262
+ end
263
+
264
+ it "declares its development dependencies" do
265
+ expect(spec.development_dependencies.map(&:name).sort).to eq(%w{rake rspec})
266
+ end
267
+ end
data/switches.rb.gemspec CHANGED
@@ -1,19 +1,29 @@
1
+ require_relative './lib/Switches/VERSION'
2
+
3
+ class Gem::Specification
4
+ def development_dependencies=(gems)
5
+ gems.each{|gem| add_development_dependency(*gem)}
6
+ end
7
+ end
8
+
1
9
  Gem::Specification.new do |s|
2
10
  s.name = 'switches.rb' # I would have preferred 'switches', but there's a gem with the name of switches.
3
-
4
- s.version = '0.10.2'
5
- s.date = '2026-08-09'
11
+ s.version = Switches::VERSION
6
12
 
7
13
  s.summary = "The easiest way to provide switches to a Ruby program."
8
14
  s.description = "Switches provides for a nice wrapper to OptionParser to also act as a store for switches supplied."
15
+
9
16
  s.author = 'thoran'
10
17
  s.email = 'code@thoran.com'
11
18
  s.homepage = "https://github.com/thoran/switches"
12
19
  s.license = 'MIT'
20
+
13
21
  s.required_ruby_version = ">= 2.7.0"
14
22
 
15
- s.add_development_dependency('rake')
16
- s.add_development_dependency('rspec')
23
+ s.development_dependencies = [
24
+ 'rake',
25
+ 'rspec'
26
+ ]
17
27
 
18
28
  s.files = [
19
29
  'CHANGELOG',
@@ -23,7 +33,7 @@ Gem::Specification.new do |s|
23
33
  'README.md',
24
34
  'switches.rb.gemspec',
25
35
  Dir['lib/**/*.rb'],
26
- Dir['spec/**/*.rb']
36
+ Dir['spec/**/*.rb'],
27
37
  ].flatten
28
38
 
29
39
  s.require_paths = ['lib']
@@ -32,6 +42,6 @@ Gem::Specification.new do |s|
32
42
  "bug_tracker_uri" => "https://github.com/thoran/switches/issues",
33
43
  "changelog_uri" => "https://github.com/thoran/switches/blob/master/CHANGELOG",
34
44
  "source_code_uri" => "https://github.com/thoran/switches",
35
- "documentation_uri" => "https://github.com/thoran/switches/blob/master/README.md"
45
+ "documentation_uri" => "https://github.com/thoran/switches/blob/master/README.md",
36
46
  }
37
47
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switches.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - thoran
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2026-08-09 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rake
@@ -51,6 +51,7 @@ files:
51
51
  - Rakefile
52
52
  - lib/Kernel/require_gem.rb
53
53
  - lib/Switches.rb
54
+ - lib/Switches/VERSION.rb
54
55
  - lib/Thoran/Kernel/RequireGem/require_gem.rb
55
56
  - spec/all.rb
56
57
  - switches.rb.gemspec