version_info 1.8.2 → 1.8.5
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/.travis.yml +0 -1
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +94 -63
- data/lib/version_info.rb +1 -7
- data/lib/version_info/data.rb +30 -11
- data/lib/version_info/text_storage.rb +2 -2
- data/lib/version_info/version.rb +1 -1
- data/spec/version_info/text_format_spec.rb +14 -5
- data/spec/version_info/version_info_spec.rb +14 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ea10020b18eabf4d326bcd99f2c108088948549
|
4
|
+
data.tar.gz: 9596273410ac0636b8c95f20a9dd4e7b6caf7472
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ce5e6d2d260950c64fdf5360a89a59b0fffc8516f5989e157945dd7d3079c251e2728c64d05e22ae64cf13f5d36362f5651188e37a17398f0ac10eaa35e5366
|
7
|
+
data.tar.gz: 8c4c67402bb4bba9cffa0c7389934ff710ee807930e0fabb02118c49912451f698afa5bdf0d5d4d7c0cbe45f1b16d0992b68f7af283209fbebb716117dd3bc38
|
data/.travis.yml
CHANGED
data/coverage/.last_run.json
CHANGED
data/coverage/.resultset.json
CHANGED
@@ -9,26 +9,20 @@
|
|
9
9
|
null,
|
10
10
|
null,
|
11
11
|
1,
|
12
|
-
|
13
|
-
null,
|
14
|
-
null,
|
15
|
-
1,
|
16
|
-
19,
|
17
|
-
21,
|
18
|
-
19,
|
12
|
+
32,
|
19
13
|
null,
|
20
14
|
null,
|
21
15
|
null,
|
22
16
|
1,
|
23
|
-
|
17
|
+
27,
|
24
18
|
null,
|
25
19
|
null,
|
26
20
|
1,
|
27
|
-
|
21
|
+
30,
|
28
22
|
null,
|
29
23
|
null,
|
30
24
|
1,
|
31
|
-
|
25
|
+
21,
|
32
26
|
null,
|
33
27
|
null,
|
34
28
|
1,
|
@@ -42,25 +36,25 @@
|
|
42
36
|
null,
|
43
37
|
null,
|
44
38
|
1,
|
45
|
-
|
39
|
+
32,
|
46
40
|
null,
|
47
41
|
null,
|
48
42
|
1,
|
49
|
-
|
43
|
+
32,
|
50
44
|
0,
|
51
45
|
0,
|
52
46
|
null,
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
47
|
+
32,
|
48
|
+
32,
|
49
|
+
32,
|
50
|
+
32,
|
57
51
|
10,
|
58
52
|
null,
|
59
|
-
|
53
|
+
32,
|
60
54
|
1,
|
61
55
|
null,
|
62
56
|
null,
|
63
|
-
|
57
|
+
32,
|
64
58
|
null,
|
65
59
|
null,
|
66
60
|
null,
|
@@ -73,17 +67,17 @@
|
|
73
67
|
1,
|
74
68
|
null,
|
75
69
|
1,
|
76
|
-
|
77
|
-
|
78
|
-
|
70
|
+
30,
|
71
|
+
30,
|
72
|
+
30,
|
79
73
|
null,
|
80
74
|
null,
|
81
75
|
1,
|
82
|
-
|
76
|
+
75,
|
83
77
|
null,
|
84
78
|
null,
|
85
79
|
1,
|
86
|
-
|
80
|
+
30,
|
87
81
|
null,
|
88
82
|
null,
|
89
83
|
1,
|
@@ -92,8 +86,8 @@
|
|
92
86
|
null,
|
93
87
|
null,
|
94
88
|
1,
|
95
|
-
|
96
|
-
|
89
|
+
10,
|
90
|
+
5,
|
97
91
|
null,
|
98
92
|
null,
|
99
93
|
null,
|
@@ -116,7 +110,7 @@
|
|
116
110
|
1,
|
117
111
|
null,
|
118
112
|
1,
|
119
|
-
|
113
|
+
26,
|
120
114
|
null,
|
121
115
|
null,
|
122
116
|
1,
|
@@ -129,9 +123,9 @@
|
|
129
123
|
null,
|
130
124
|
null,
|
131
125
|
1,
|
132
|
-
|
133
|
-
|
134
|
-
|
126
|
+
3,
|
127
|
+
16,
|
128
|
+
3,
|
135
129
|
null,
|
136
130
|
null,
|
137
131
|
null
|
@@ -211,12 +205,13 @@
|
|
211
205
|
1,
|
212
206
|
1,
|
213
207
|
1,
|
214
|
-
|
215
|
-
|
208
|
+
32,
|
209
|
+
32,
|
210
|
+
32,
|
216
211
|
null,
|
217
212
|
null,
|
218
213
|
1,
|
219
|
-
|
214
|
+
45,
|
220
215
|
null,
|
221
216
|
null,
|
222
217
|
1,
|
@@ -224,8 +219,8 @@
|
|
224
219
|
null,
|
225
220
|
null,
|
226
221
|
1,
|
227
|
-
|
228
|
-
|
222
|
+
30,
|
223
|
+
30,
|
229
224
|
null,
|
230
225
|
null,
|
231
226
|
1,
|
@@ -234,25 +229,26 @@
|
|
234
229
|
null,
|
235
230
|
null,
|
236
231
|
1,
|
237
|
-
|
238
|
-
|
232
|
+
5,
|
233
|
+
5,
|
239
234
|
null,
|
240
235
|
null,
|
241
236
|
1,
|
242
|
-
|
237
|
+
32,
|
238
|
+
32,
|
243
239
|
null,
|
244
240
|
null,
|
245
241
|
1,
|
246
|
-
|
242
|
+
34,
|
247
243
|
null,
|
248
244
|
null,
|
249
245
|
1,
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
246
|
+
10,
|
247
|
+
10,
|
248
|
+
10,
|
249
|
+
7,
|
254
250
|
null,
|
255
|
-
|
251
|
+
10,
|
256
252
|
null,
|
257
253
|
null,
|
258
254
|
1,
|
@@ -260,39 +256,56 @@
|
|
260
256
|
null,
|
261
257
|
null,
|
262
258
|
1,
|
263
|
-
|
259
|
+
30,
|
264
260
|
null,
|
265
261
|
null,
|
266
262
|
1,
|
267
|
-
|
263
|
+
10,
|
264
|
+
null,
|
265
|
+
null,
|
266
|
+
1,
|
267
|
+
12,
|
268
|
+
46,
|
269
|
+
46,
|
270
|
+
10,
|
271
|
+
10,
|
272
|
+
10,
|
273
|
+
null,
|
274
|
+
12,
|
275
|
+
null,
|
276
|
+
null,
|
277
|
+
1,
|
278
|
+
1,
|
268
279
|
null,
|
269
280
|
null,
|
270
281
|
1,
|
271
282
|
8,
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
283
|
+
8,
|
284
|
+
8,
|
285
|
+
35,
|
286
|
+
35,
|
287
|
+
35,
|
277
288
|
null,
|
278
289
|
8,
|
279
290
|
null,
|
280
291
|
null,
|
281
292
|
1,
|
282
|
-
|
293
|
+
35,
|
294
|
+
40,
|
295
|
+
35,
|
283
296
|
null,
|
284
297
|
null,
|
285
298
|
1,
|
286
|
-
|
287
|
-
|
288
|
-
19,
|
289
|
-
19,
|
290
|
-
19,
|
299
|
+
116,
|
300
|
+
null,
|
291
301
|
null,
|
302
|
+
1,
|
303
|
+
160,
|
304
|
+
40,
|
292
305
|
null,
|
293
306
|
null,
|
294
307
|
1,
|
295
|
-
|
308
|
+
128,
|
296
309
|
null,
|
297
310
|
null,
|
298
311
|
null,
|
@@ -303,11 +316,11 @@
|
|
303
316
|
null,
|
304
317
|
1,
|
305
318
|
1,
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
319
|
+
9,
|
320
|
+
9,
|
321
|
+
9,
|
322
|
+
9,
|
323
|
+
9,
|
311
324
|
null,
|
312
325
|
null,
|
313
326
|
1,
|
@@ -363,12 +376,21 @@
|
|
363
376
|
null,
|
364
377
|
null,
|
365
378
|
1,
|
379
|
+
null,
|
380
|
+
null,
|
381
|
+
1,
|
366
382
|
1,
|
367
383
|
1,
|
368
384
|
1,
|
369
385
|
1,
|
370
386
|
null,
|
371
387
|
null,
|
388
|
+
1,
|
389
|
+
1,
|
390
|
+
1,
|
391
|
+
1,
|
392
|
+
1,
|
393
|
+
null,
|
372
394
|
null
|
373
395
|
],
|
374
396
|
"Z:/Projects/github/version_info/spec/version_info/version_info_spec.rb": [
|
@@ -384,9 +406,14 @@
|
|
384
406
|
null,
|
385
407
|
8,
|
386
408
|
null,
|
409
|
+
1,
|
410
|
+
8,
|
411
|
+
null,
|
387
412
|
null,
|
388
413
|
1,
|
389
414
|
1,
|
415
|
+
1,
|
416
|
+
1,
|
390
417
|
null,
|
391
418
|
null,
|
392
419
|
1,
|
@@ -404,23 +431,27 @@
|
|
404
431
|
null,
|
405
432
|
1,
|
406
433
|
1,
|
434
|
+
1,
|
407
435
|
null,
|
408
436
|
null,
|
409
437
|
1,
|
410
438
|
1,
|
411
439
|
1,
|
412
440
|
1,
|
441
|
+
1,
|
413
442
|
null,
|
414
443
|
null,
|
415
444
|
1,
|
416
445
|
1,
|
417
446
|
1,
|
447
|
+
1,
|
418
448
|
null,
|
419
449
|
null,
|
420
450
|
1,
|
421
451
|
1,
|
422
452
|
1,
|
423
453
|
1,
|
454
|
+
1,
|
424
455
|
null,
|
425
456
|
null,
|
426
457
|
null,
|
@@ -509,6 +540,6 @@
|
|
509
540
|
null
|
510
541
|
]
|
511
542
|
},
|
512
|
-
"timestamp":
|
543
|
+
"timestamp": 1386012568
|
513
544
|
}
|
514
545
|
}
|
data/lib/version_info.rb
CHANGED
@@ -8,12 +8,6 @@ module VersionInfo
|
|
8
8
|
@segments ||= [:major, :minor, :patch]
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.segment_at(idx)
|
12
|
-
segments << :build if (segments.size == 3) && (idx>=3)
|
13
|
-
(segments.size..idx).each{|n| segments << "vinfo#{n}".to_sym}
|
14
|
-
@segments[idx]
|
15
|
-
end
|
16
|
-
|
17
11
|
# define segments
|
18
12
|
def self.segments=(values)
|
19
13
|
@segments = values
|
@@ -46,7 +40,7 @@ module VersionInfo
|
|
46
40
|
old_const = other.const_get(:VERSION, false)
|
47
41
|
other.send(:remove_const, :VERSION) rescue true
|
48
42
|
end
|
49
|
-
other.const_set(:VERSION, Data.new)
|
43
|
+
other.const_set(:VERSION, Data.new(VersionInfo.segments))
|
50
44
|
singleton = other.singleton_class
|
51
45
|
singleton.class_eval do
|
52
46
|
define_method :VERSION do
|
data/lib/version_info/data.rb
CHANGED
@@ -3,8 +3,9 @@ require 'ostruct'
|
|
3
3
|
module VersionInfo
|
4
4
|
STORAGE_CLASS = {text: TextStorage, yaml: YamlStorage, module: ModuleStorage}
|
5
5
|
class Data < OpenStruct
|
6
|
-
def initialize
|
7
|
-
super
|
6
|
+
def initialize(segments)
|
7
|
+
super()
|
8
|
+
@segments = segments.dup
|
8
9
|
reset
|
9
10
|
end
|
10
11
|
|
@@ -32,6 +33,7 @@ module VersionInfo
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def reset
|
36
|
+
clear
|
35
37
|
assign(get_defaults)
|
36
38
|
end
|
37
39
|
|
@@ -40,9 +42,9 @@ module VersionInfo
|
|
40
42
|
end
|
41
43
|
|
42
44
|
def bump(key)
|
43
|
-
idx =
|
45
|
+
idx = segments.index(key.to_sym) + 1
|
44
46
|
return unless idx
|
45
|
-
|
47
|
+
segments[idx..2].each do |sgm|
|
46
48
|
send("#{sgm}=", 0) if send(sgm)
|
47
49
|
end
|
48
50
|
send("#{key}=", 1 + send(key).to_i)
|
@@ -61,11 +63,11 @@ module VersionInfo
|
|
61
63
|
end
|
62
64
|
|
63
65
|
def tag_format
|
64
|
-
|
65
|
-
fmts =
|
66
|
-
fmt_join =
|
67
|
-
fmt_join[2] = '+' #build uses '+'. See semver.org
|
68
|
-
fmt_join[-1] = '' #remove last char
|
66
|
+
unless @tag_format
|
67
|
+
fmts = segments.map { |k| "%<#{k}>s"}
|
68
|
+
fmt_join = fmts.map { |k| "." }
|
69
|
+
fmt_join[2] = '+' if fmts.size > 2 #build uses '+'. See semver.org
|
70
|
+
fmt_join[-1] = '' if fmt_join.size > 0 #remove last char
|
69
71
|
@tag_format = fmts.zip(fmt_join).flatten.join
|
70
72
|
end
|
71
73
|
@tag_format
|
@@ -76,16 +78,33 @@ module VersionInfo
|
|
76
78
|
end
|
77
79
|
|
78
80
|
def set_version_info(tag_str)
|
81
|
+
clear
|
79
82
|
values = tag_str.to_s.split(/\.|\+|\-/)
|
80
83
|
values.each_with_index do |val, idx|
|
81
84
|
val = val.to_s.chomp
|
82
85
|
val = val.match(/(^\d+)$/) ? val.to_i : val
|
83
|
-
self.send("#{
|
86
|
+
self.send("#{segment_at(idx)}=", val )
|
84
87
|
end
|
88
|
+
self
|
89
|
+
end
|
90
|
+
|
91
|
+
def segment_at(idx)
|
92
|
+
@segments << :build if (@segments.size == 3) && (idx>=3)
|
93
|
+
(@segments.size..idx).each{|n| @segments << "vinfo#{n}".to_sym}
|
94
|
+
@segments[idx]
|
95
|
+
end
|
96
|
+
|
97
|
+
def segments
|
98
|
+
@segments
|
99
|
+
end
|
100
|
+
|
101
|
+
def clear
|
102
|
+
segments.each{|key| delete_field(key) if @table.has_key?(key)}
|
103
|
+
@tag_format = nil
|
85
104
|
end
|
86
105
|
|
87
106
|
def get_defaults
|
88
|
-
|
107
|
+
segments.inject({}){|h, k| h[k] = 0; h}
|
89
108
|
end
|
90
109
|
end
|
91
110
|
end
|
@@ -23,8 +23,8 @@ module VersionInfo
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def save_to(io)
|
26
|
-
io.puts VersionInfo.segments.map{|sgm| data.send(sgm)}.join('.')
|
27
|
-
data.to_hash.each {|k, v| io.puts "#{k}: #{v}" unless
|
26
|
+
io.puts data.tag #VersionInfo.segments.map{|sgm| data.send(sgm)}.join('.')
|
27
|
+
data.to_hash.each {|k, v| io.puts "#{k}: #{v}" unless data.segments.include?(k) }
|
28
28
|
self
|
29
29
|
end
|
30
30
|
end
|
data/lib/version_info/version.rb
CHANGED
@@ -47,14 +47,24 @@ END
|
|
47
47
|
@test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3}
|
48
48
|
end
|
49
49
|
|
50
|
-
it "auto
|
50
|
+
it "auto add segments on load" do
|
51
51
|
io = StringIO.new("1.2.3.B4.5")
|
52
52
|
File.should_receive(:open).and_yield(io)
|
53
53
|
@test_module::VERSION.load
|
54
54
|
@test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3, :build => 'B4', :vinfo4 => 5 }
|
55
55
|
end
|
56
56
|
|
57
|
-
it "
|
57
|
+
it "can save custom tag format" do
|
58
|
+
@test_module::VERSION.set_version_info("1.2.3+B4.5")
|
59
|
+
io = StringIO.new
|
60
|
+
File.should_receive(:open).and_yield(io)
|
61
|
+
@test_module::VERSION.save
|
62
|
+
io.string.should == <<END
|
63
|
+
1.2.3+B4.5
|
64
|
+
END
|
65
|
+
end
|
66
|
+
|
67
|
+
it "auto add build segment uses semvar.org tag format " do
|
58
68
|
io = StringIO.new("1.2.3.B4.5")
|
59
69
|
File.should_receive(:open).and_yield(io)
|
60
70
|
@test_module::VERSION.load
|
@@ -62,10 +72,9 @@ END
|
|
62
72
|
end
|
63
73
|
|
64
74
|
it "can load custom data " do
|
65
|
-
io = StringIO.new("1.2.3\nauthor: jcangas\n")
|
75
|
+
io = StringIO.new("1.2.3+B4.5\nauthor: jcangas\n")
|
66
76
|
File.should_receive(:open).and_yield(io)
|
67
77
|
@test_module::VERSION.load
|
68
|
-
@test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3, :author => 'jcangas' }
|
78
|
+
@test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3, :build => 'B4', :vinfo4 => 5, :author => 'jcangas' }
|
69
79
|
end
|
70
|
-
|
71
80
|
end
|
@@ -10,9 +10,14 @@ describe "VersionInfo defaults" do
|
|
10
10
|
|
11
11
|
@test_module::VERSION.file_name = nil
|
12
12
|
end
|
13
|
+
after :each do
|
14
|
+
@test_module = nil
|
15
|
+
end
|
13
16
|
|
14
17
|
it "is initalized" do
|
18
|
+
@test_module::VERSION.segments.should == [:major, :minor, :patch]
|
15
19
|
@test_module::VERSION.to_hash.should == {:major => 0, :minor => 0, :patch => 0 }
|
20
|
+
@test_module::VERSION.tag_format.should == "%<major>s.%<minor>s.%<patch>s"
|
16
21
|
end
|
17
22
|
|
18
23
|
it "can assign filename" do
|
@@ -30,23 +35,27 @@ describe "VersionInfo defaults" do
|
|
30
35
|
|
31
36
|
it "tag has format" do
|
32
37
|
@test_module::VERSION.tag.should == '0.0.0'
|
38
|
+
@test_module::VERSION.tag_format.should == "%<major>s.%<minor>s.%<patch>s"
|
33
39
|
end
|
34
40
|
|
35
41
|
it "tag format can be changed" do
|
42
|
+
@test_module::VERSION.set_version_info('0.0.0.0')
|
36
43
|
@test_module::VERSION.build_flag = 'pre'
|
37
|
-
@test_module::VERSION.tag_format =
|
38
|
-
@test_module::VERSION.tag.should == '0.0.0
|
44
|
+
@test_module::VERSION.tag_format = "%<major>d.%<minor>d.%<patch>d-%<build_flag>s%<build>d"
|
45
|
+
@test_module::VERSION.tag.should == '0.0.0-pre0'
|
39
46
|
end
|
40
47
|
|
41
48
|
it "can bump a segment" do
|
49
|
+
@test_module::VERSION.bump(:minor)
|
42
50
|
@test_module::VERSION.bump(:patch)
|
43
|
-
@test_module::VERSION.tag.should == '0.
|
51
|
+
@test_module::VERSION.tag.should == '0.1.1'
|
44
52
|
end
|
45
53
|
|
46
|
-
it "bump a segment reset sublevels " do
|
54
|
+
it "bump a segment reset semver sublevels " do
|
55
|
+
@test_module::VERSION.set_version_info("1.2.3+B4.5")
|
47
56
|
@test_module::VERSION.bump(:patch)
|
48
57
|
@test_module::VERSION.bump(:minor)
|
49
|
-
@test_module::VERSION.tag.should ==
|
58
|
+
@test_module::VERSION.tag.should == "1.3.0+B4.5"
|
50
59
|
end
|
51
60
|
|
52
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: version_info
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jorge L. Cangas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|