version_info 1.8.8 → 1.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +90 -87
- data/lib/version_info.rb +1 -1
- data/lib/version_info/data.rb +7 -4
- data/lib/version_info/module_storage.rb +3 -2
- data/lib/version_info/storage.rb +4 -6
- data/lib/version_info/version.rb +1 -1
- data/spec/version_info/text_format_spec.rb +13 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6631429538dbd8b3cc32768357a3fa332ee82b3e
|
4
|
+
data.tar.gz: f6e2355cb2d0af05745727b21d4749898cb243ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 44b3ed302d485ddc12352502541b956bc400a4f20e98f7f5e2866b22b3199dfad0a7e7d8b4b6d05bea314c318041bbaac1a49a20ca40c505b8b0d67b9b8fd3c1
|
7
|
+
data.tar.gz: 62a4c716f397f07651932a13811516d40f00367eaf961516b751b8d3991ff372b090a3009301cd033f661da6d2d1cc456b9b4bbb995ae67ec69749a6b5034e25
|
data/coverage/.last_run.json
CHANGED
data/coverage/.resultset.json
CHANGED
@@ -9,20 +9,20 @@
|
|
9
9
|
null,
|
10
10
|
null,
|
11
11
|
1,
|
12
|
-
|
12
|
+
37,
|
13
13
|
null,
|
14
14
|
null,
|
15
15
|
null,
|
16
16
|
1,
|
17
|
-
|
17
|
+
32,
|
18
18
|
null,
|
19
19
|
null,
|
20
20
|
1,
|
21
|
-
|
21
|
+
17,
|
22
22
|
null,
|
23
23
|
null,
|
24
24
|
1,
|
25
|
-
|
25
|
+
26,
|
26
26
|
null,
|
27
27
|
null,
|
28
28
|
1,
|
@@ -36,25 +36,25 @@
|
|
36
36
|
null,
|
37
37
|
null,
|
38
38
|
1,
|
39
|
-
|
39
|
+
37,
|
40
40
|
null,
|
41
41
|
null,
|
42
42
|
1,
|
43
|
-
|
43
|
+
37,
|
44
44
|
0,
|
45
45
|
0,
|
46
46
|
null,
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
47
|
+
37,
|
48
|
+
37,
|
49
|
+
37,
|
50
|
+
37,
|
51
51
|
12,
|
52
52
|
null,
|
53
|
-
|
53
|
+
37,
|
54
54
|
2,
|
55
55
|
null,
|
56
56
|
null,
|
57
|
-
|
57
|
+
37,
|
58
58
|
null,
|
59
59
|
null,
|
60
60
|
null,
|
@@ -62,22 +62,20 @@
|
|
62
62
|
null
|
63
63
|
],
|
64
64
|
"Z:/Projects/github/version_info/lib/version_info/storage.rb": [
|
65
|
-
1,
|
66
65
|
1,
|
67
66
|
1,
|
68
67
|
null,
|
69
68
|
1,
|
70
|
-
|
71
|
-
|
72
|
-
33,
|
69
|
+
17,
|
70
|
+
17,
|
73
71
|
null,
|
74
72
|
null,
|
75
73
|
1,
|
76
|
-
|
74
|
+
47,
|
77
75
|
null,
|
78
76
|
null,
|
79
77
|
1,
|
80
|
-
|
78
|
+
7,
|
81
79
|
null,
|
82
80
|
null,
|
83
81
|
1,
|
@@ -85,9 +83,9 @@
|
|
85
83
|
null,
|
86
84
|
null,
|
87
85
|
1,
|
88
|
-
|
89
|
-
|
90
|
-
|
86
|
+
3,
|
87
|
+
3,
|
88
|
+
3,
|
91
89
|
null,
|
92
90
|
null,
|
93
91
|
1,
|
@@ -115,25 +113,25 @@
|
|
115
113
|
1,
|
116
114
|
null,
|
117
115
|
1,
|
118
|
-
|
116
|
+
4,
|
119
117
|
null,
|
120
118
|
null,
|
121
119
|
1,
|
122
|
-
|
120
|
+
0,
|
123
121
|
null,
|
124
122
|
null,
|
125
123
|
1,
|
126
|
-
|
127
|
-
|
128
|
-
|
124
|
+
4,
|
125
|
+
4,
|
126
|
+
4,
|
129
127
|
null,
|
130
128
|
null,
|
131
129
|
1,
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
130
|
+
4,
|
131
|
+
5,
|
132
|
+
4,
|
133
|
+
4,
|
134
|
+
4,
|
137
135
|
null,
|
138
136
|
null,
|
139
137
|
1,
|
@@ -158,7 +156,7 @@
|
|
158
156
|
null,
|
159
157
|
1,
|
160
158
|
1,
|
161
|
-
|
159
|
+
3,
|
162
160
|
null,
|
163
161
|
null,
|
164
162
|
1,
|
@@ -193,17 +191,7 @@
|
|
193
191
|
1,
|
194
192
|
null,
|
195
193
|
1,
|
196
|
-
|
197
|
-
null,
|
198
|
-
null,
|
199
|
-
1,
|
200
|
-
0,
|
201
|
-
null,
|
202
|
-
null,
|
203
|
-
1,
|
204
|
-
1,
|
205
|
-
1,
|
206
|
-
1,
|
194
|
+
3,
|
207
195
|
null,
|
208
196
|
null,
|
209
197
|
1,
|
@@ -233,22 +221,25 @@
|
|
233
221
|
1,
|
234
222
|
1,
|
235
223
|
1,
|
236
|
-
|
237
|
-
|
238
|
-
|
224
|
+
37,
|
225
|
+
37,
|
226
|
+
37,
|
239
227
|
null,
|
240
228
|
null,
|
241
229
|
1,
|
242
|
-
|
230
|
+
39,
|
231
|
+
17,
|
232
|
+
null,
|
233
|
+
39,
|
243
234
|
null,
|
244
235
|
null,
|
245
236
|
1,
|
246
|
-
|
237
|
+
11,
|
247
238
|
null,
|
248
239
|
null,
|
249
240
|
1,
|
250
|
-
|
251
|
-
|
241
|
+
35,
|
242
|
+
35,
|
252
243
|
null,
|
253
244
|
null,
|
254
245
|
1,
|
@@ -262,21 +253,21 @@
|
|
262
253
|
null,
|
263
254
|
null,
|
264
255
|
1,
|
265
|
-
|
266
|
-
|
256
|
+
37,
|
257
|
+
37,
|
267
258
|
null,
|
268
259
|
null,
|
269
260
|
1,
|
270
|
-
|
261
|
+
39,
|
271
262
|
null,
|
272
263
|
null,
|
273
264
|
1,
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
265
|
+
13,
|
266
|
+
13,
|
267
|
+
13,
|
268
|
+
10,
|
278
269
|
null,
|
279
|
-
|
270
|
+
13,
|
280
271
|
null,
|
281
272
|
null,
|
282
273
|
1,
|
@@ -284,22 +275,22 @@
|
|
284
275
|
null,
|
285
276
|
null,
|
286
277
|
1,
|
287
|
-
|
278
|
+
42,
|
288
279
|
null,
|
289
280
|
null,
|
290
281
|
1,
|
291
|
-
|
282
|
+
20,
|
292
283
|
null,
|
293
284
|
null,
|
294
285
|
1,
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
286
|
+
22,
|
287
|
+
66,
|
288
|
+
66,
|
289
|
+
15,
|
290
|
+
15,
|
291
|
+
15,
|
301
292
|
null,
|
302
|
-
|
293
|
+
22,
|
303
294
|
null,
|
304
295
|
null,
|
305
296
|
1,
|
@@ -307,33 +298,33 @@
|
|
307
298
|
null,
|
308
299
|
null,
|
309
300
|
1,
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
301
|
+
10,
|
302
|
+
10,
|
303
|
+
10,
|
304
|
+
41,
|
305
|
+
41,
|
306
|
+
41,
|
316
307
|
null,
|
317
|
-
|
308
|
+
10,
|
318
309
|
null,
|
319
310
|
null,
|
320
311
|
1,
|
321
|
-
|
322
|
-
|
323
|
-
|
312
|
+
41,
|
313
|
+
46,
|
314
|
+
41,
|
324
315
|
null,
|
325
316
|
null,
|
326
317
|
1,
|
327
|
-
|
318
|
+
140,
|
328
319
|
null,
|
329
320
|
null,
|
330
321
|
1,
|
331
|
-
|
332
|
-
|
322
|
+
188,
|
323
|
+
47,
|
333
324
|
null,
|
334
325
|
null,
|
335
326
|
1,
|
336
|
-
|
327
|
+
148,
|
337
328
|
null,
|
338
329
|
null,
|
339
330
|
null,
|
@@ -440,11 +431,19 @@
|
|
440
431
|
null,
|
441
432
|
1,
|
442
433
|
1,
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
434
|
+
11,
|
435
|
+
11,
|
436
|
+
11,
|
437
|
+
11,
|
438
|
+
11,
|
439
|
+
null,
|
440
|
+
null,
|
441
|
+
1,
|
442
|
+
1,
|
443
|
+
null,
|
444
|
+
null,
|
445
|
+
1,
|
446
|
+
1,
|
448
447
|
null,
|
449
448
|
null,
|
450
449
|
1,
|
@@ -453,6 +452,10 @@
|
|
453
452
|
null,
|
454
453
|
1,
|
455
454
|
1,
|
455
|
+
1,
|
456
|
+
1,
|
457
|
+
1,
|
458
|
+
1,
|
456
459
|
null,
|
457
460
|
null,
|
458
461
|
1,
|
@@ -664,6 +667,6 @@
|
|
664
667
|
null
|
665
668
|
]
|
666
669
|
},
|
667
|
-
"timestamp":
|
670
|
+
"timestamp": 1392639091
|
668
671
|
}
|
669
672
|
}
|
data/lib/version_info.rb
CHANGED
@@ -40,7 +40,7 @@ module VersionInfo
|
|
40
40
|
old_const = other.const_get(:VERSION, false)
|
41
41
|
other.send(:remove_const, :VERSION) rescue true
|
42
42
|
end
|
43
|
-
other.const_set(:VERSION, Data.new(VersionInfo.segments))
|
43
|
+
other.const_set(:VERSION, Data.new(VersionInfo.segments.dup))
|
44
44
|
singleton = other.singleton_class
|
45
45
|
singleton.class_eval do
|
46
46
|
define_method :VERSION do
|
data/lib/version_info/data.rb
CHANGED
@@ -5,21 +5,24 @@ module VersionInfo
|
|
5
5
|
class Data < OpenStruct
|
6
6
|
def initialize(segments)
|
7
7
|
super()
|
8
|
-
@segments = segments
|
8
|
+
@segments = segments
|
9
9
|
reset
|
10
10
|
end
|
11
11
|
|
12
12
|
def storage
|
13
|
-
@storage
|
13
|
+
unless @storage
|
14
|
+
@storage ||= STORAGE_CLASS[VersionInfo.file_format.to_sym].new(self)
|
15
|
+
end
|
16
|
+
@storage
|
14
17
|
end
|
15
18
|
|
16
19
|
def file_name
|
17
|
-
storage.
|
20
|
+
@file_name ||= Dir.pwd + '/' + storage.default_file_name
|
18
21
|
end
|
19
22
|
|
20
23
|
def file_name=(value)
|
24
|
+
@file_name = value
|
21
25
|
@storage = nil #recreate storage
|
22
|
-
storage.file_name = value
|
23
26
|
end
|
24
27
|
|
25
28
|
def load
|
@@ -17,14 +17,15 @@ module VersionInfo
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def parse_from(content)
|
20
|
-
match = content.join
|
21
|
-
str = match[3]
|
20
|
+
match = content.join.match /(\s*VERSION\s*=\s*)('|")(.*)('|")/
|
21
|
+
str = match ? match[3] : "0.0.0"
|
22
22
|
data.set_version_info(str)
|
23
23
|
self
|
24
24
|
end
|
25
25
|
|
26
26
|
def save
|
27
27
|
content = load_content.join
|
28
|
+
content = "VERSION = '#{data.tag}'" if content.empty?
|
28
29
|
content.gsub!(/(\s*VERSION\s*=\s*)('|").*('|")/, "\\1\\2#{data.tag}\\3")
|
29
30
|
File.open(file_name, 'w' ) {|out| out.print content}
|
30
31
|
self
|
data/lib/version_info/storage.rb
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
module VersionInfo
|
2
2
|
class Storage
|
3
|
-
attr :data
|
4
3
|
|
5
4
|
def initialize(data)
|
6
5
|
super()
|
7
6
|
@data = data
|
8
|
-
load if file_name && File.exist?(file_name)
|
9
7
|
end
|
10
8
|
|
11
|
-
def
|
12
|
-
@
|
9
|
+
def data
|
10
|
+
@data
|
13
11
|
end
|
14
12
|
|
15
|
-
def file_name
|
16
|
-
@file_name
|
13
|
+
def file_name
|
14
|
+
@data.file_name
|
17
15
|
end
|
18
16
|
|
19
17
|
def load_content
|
data/lib/version_info/version.rb
CHANGED
@@ -17,10 +17,22 @@ describe "Text file format" do
|
|
17
17
|
@test_module::VERSION.to_hash.should == {:major => 0, :minor => 0, :patch => 0 }
|
18
18
|
end
|
19
19
|
|
20
|
+
it "has tag str" do
|
21
|
+
@test_module::VERSION.tag.should == "0.0.0"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "can bump minor" do
|
25
|
+
@test_module::VERSION.bump(:minor)
|
26
|
+
@test_module::VERSION.storage.data.should == @test_module::VERSION
|
27
|
+
@test_module::VERSION.storage.data.to_hash.should == {:major => 0, :minor => 1, :patch => 0 }
|
28
|
+
@test_module::VERSION.storage.data.tag.should == "0.1.0"
|
29
|
+
@test_module::VERSION.to_hash.should == {:major => 0, :minor => 1, :patch => 0 }
|
30
|
+
end
|
31
|
+
|
20
32
|
it "can save " do
|
33
|
+
@test_module::VERSION.bump(:minor)
|
21
34
|
io = StringIO.new
|
22
35
|
File.should_receive(:open).and_yield(io)
|
23
|
-
@test_module::VERSION.bump(:minor)
|
24
36
|
@test_module::VERSION.save
|
25
37
|
io.string.should == "0.1.0\n"
|
26
38
|
end
|