version_info 1.8.5 → 1.8.7

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
  SHA1:
3
- metadata.gz: 3ea10020b18eabf4d326bcd99f2c108088948549
4
- data.tar.gz: 9596273410ac0636b8c95f20a9dd4e7b6caf7472
3
+ metadata.gz: 5cc474b5ba4526551647b702c320e8858cea87ad
4
+ data.tar.gz: 2a2d7e241bcdccf599ea4d57fad32c7da1076480
5
5
  SHA512:
6
- metadata.gz: 1ce5e6d2d260950c64fdf5360a89a59b0fffc8516f5989e157945dd7d3079c251e2728c64d05e22ae64cf13f5d36362f5651188e37a17398f0ac10eaa35e5366
7
- data.tar.gz: 8c4c67402bb4bba9cffa0c7389934ff710ee807930e0fabb02118c49912451f698afa5bdf0d5d4d7c0cbe45f1b16d0992b68f7af283209fbebb716117dd3bc38
6
+ metadata.gz: e7a5d7cebb105b914073d8c10817754d5283c4ca7bda24872ced8da5aec464945fb8bdfe944b4c64b604af45eab9da22d7262934242c990e1555b89a1d6cd6d4
7
+ data.tar.gz: cfa49cea4f74ff30f59aa762cc0e0665c26f133966aafe737731db1839d02052287f4afb267e014f471e64d6f0a178006d621c8c19c9427c88e93bb895bb511b
data/.travis.yml CHANGED
@@ -1,3 +1,3 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.0.0
3
+ - ruby-head
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- version_info (1.8.0)
4
+ version_info (1.8.7)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -1,5 +1,5 @@
1
- {
2
- "result": {
3
- "covered_percent": 95.29
4
- }
5
- }
1
+ {
2
+ "result": {
3
+ "covered_percent": 100.0
4
+ }
5
+ }
@@ -1,545 +1,331 @@
1
- {
2
- "RSpec": {
3
- "coverage": {
4
- "Z:/Projects/github/version_info/lib/version_info.rb": [
5
- 1,
6
- 1,
7
- null,
8
- 1,
9
- null,
10
- null,
11
- 1,
12
- 32,
13
- null,
14
- null,
15
- null,
16
- 1,
17
- 27,
18
- null,
19
- null,
20
- 1,
21
- 30,
22
- null,
23
- null,
24
- 1,
25
- 21,
26
- null,
27
- null,
28
- 1,
29
- 0,
30
- 0,
31
- 0,
32
- 0,
33
- 0,
34
- 0,
35
- null,
36
- null,
37
- null,
38
- 1,
39
- 32,
40
- null,
41
- null,
42
- 1,
43
- 32,
44
- 0,
45
- 0,
46
- null,
47
- 32,
48
- 32,
49
- 32,
50
- 32,
51
- 10,
52
- null,
53
- 32,
54
- 1,
55
- null,
56
- null,
57
- 32,
58
- null,
59
- null,
60
- null,
61
- null,
62
- null
63
- ],
64
- "Z:/Projects/github/version_info/lib/version_info/storage.rb": [
65
- 1,
66
- 1,
67
- 1,
68
- null,
69
- 1,
70
- 30,
71
- 30,
72
- 30,
73
- null,
74
- null,
75
- 1,
76
- 75,
77
- null,
78
- null,
79
- 1,
80
- 30,
81
- null,
82
- null,
83
- 1,
84
- 12,
85
- 6,
86
- null,
87
- null,
88
- 1,
89
- 10,
90
- 5,
91
- null,
92
- null,
93
- null,
94
- null,
95
- 1,
96
- 1,
97
- 1,
98
- null
99
- ],
100
- "Z:/Projects/github/version_info/lib/version_info/text_storage.rb": [
101
- null,
102
- 1,
103
- null,
104
- null,
105
- null,
106
- null,
107
- null,
108
- null,
109
- null,
110
- 1,
111
- null,
112
- 1,
113
- 26,
114
- null,
115
- null,
116
- 1,
117
- 4,
118
- 4,
119
- 5,
120
- 4,
121
- 4,
122
- 4,
123
- null,
124
- null,
125
- 1,
126
- 3,
127
- 16,
128
- 3,
129
- null,
130
- null,
131
- null
132
- ],
133
- "Z:/Projects/github/version_info/lib/version_info/yaml_storage.rb": [
134
- 1,
135
- null,
136
- 1,
137
- null,
138
- null,
139
- null,
140
- null,
141
- null,
142
- null,
143
- null,
144
- null,
145
- 1,
146
- 1,
147
- 11,
148
- null,
149
- null,
150
- 1,
151
- 2,
152
- null,
153
- 9,
154
- 2,
155
- 2,
156
- null,
157
- null,
158
- 1,
159
- 9,
160
- 2,
161
- 2,
162
- null,
163
- null,
164
- null
165
- ],
166
- "Z:/Projects/github/version_info/lib/version_info/module_storage.rb": [
167
- null,
168
- 1,
169
- null,
170
- null,
171
- null,
172
- null,
173
- null,
174
- null,
175
- null,
176
- null,
177
- null,
178
- null,
179
- 1,
180
- null,
181
- 1,
182
- 7,
183
- null,
184
- null,
185
- 1,
186
- 0,
187
- null,
188
- null,
189
- 1,
190
- 0,
191
- 0,
192
- 0,
193
- 0,
194
- null,
195
- null,
196
- null,
197
- null,
198
- null,
199
- null
200
- ],
201
- "Z:/Projects/github/version_info/lib/version_info/data.rb": [
202
- 1,
203
- null,
204
- 1,
205
- 1,
206
- 1,
207
- 1,
208
- 32,
209
- 32,
210
- 32,
211
- null,
212
- null,
213
- 1,
214
- 45,
215
- null,
216
- null,
217
- 1,
218
- 4,
219
- null,
220
- null,
221
- 1,
222
- 30,
223
- 30,
224
- null,
225
- null,
226
- 1,
227
- 6,
228
- 6,
229
- null,
230
- null,
231
- 1,
232
- 5,
233
- 5,
234
- null,
235
- null,
236
- 1,
237
- 32,
238
- 32,
239
- null,
240
- null,
241
- 1,
242
- 34,
243
- null,
244
- null,
245
- 1,
246
- 10,
247
- 10,
248
- 10,
249
- 7,
250
- null,
251
- 10,
252
- null,
253
- null,
254
- 1,
255
- 0,
256
- null,
257
- null,
258
- 1,
259
- 30,
260
- null,
261
- null,
262
- 1,
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,
279
- null,
280
- null,
281
- 1,
282
- 8,
283
- 8,
284
- 8,
285
- 35,
286
- 35,
287
- 35,
288
- null,
289
- 8,
290
- null,
291
- null,
292
- 1,
293
- 35,
294
- 40,
295
- 35,
296
- null,
297
- null,
298
- 1,
299
- 116,
300
- null,
301
- null,
302
- 1,
303
- 160,
304
- 40,
305
- null,
306
- null,
307
- 1,
308
- 128,
309
- null,
310
- null,
311
- null,
312
- null
313
- ],
314
- "Z:/Projects/github/version_info/spec/version_info/text_format_spec.rb": [
315
- 1,
316
- null,
317
- 1,
318
- 1,
319
- 9,
320
- 9,
321
- 9,
322
- 9,
323
- 9,
324
- null,
325
- null,
326
- 1,
327
- 1,
328
- null,
329
- null,
330
- 1,
331
- 1,
332
- null,
333
- null,
334
- 1,
335
- 1,
336
- 1,
337
- 1,
338
- 1,
339
- 1,
340
- null,
341
- null,
342
- 1,
343
- 1,
344
- 1,
345
- 1,
346
- 1,
347
- 1,
348
- 1,
349
- null,
350
- null,
351
- null,
352
- null,
353
- 1,
354
- null,
355
- null,
356
- null,
357
- 1,
358
- 1,
359
- 1,
360
- 1,
361
- 1,
362
- null,
363
- null,
364
- 1,
365
- 1,
366
- 1,
367
- 1,
368
- 1,
369
- null,
370
- null,
371
- 1,
372
- 1,
373
- 1,
374
- 1,
375
- 1,
376
- null,
377
- null,
378
- 1,
379
- null,
380
- null,
381
- 1,
382
- 1,
383
- 1,
384
- 1,
385
- 1,
386
- null,
387
- null,
388
- 1,
389
- 1,
390
- 1,
391
- 1,
392
- 1,
393
- null,
394
- null
395
- ],
396
- "Z:/Projects/github/version_info/spec/version_info/version_info_spec.rb": [
397
- 1,
398
- null,
399
- null,
400
- null,
401
- 1,
402
- null,
403
- 1,
404
- 8,
405
- 8,
406
- null,
407
- 8,
408
- null,
409
- 1,
410
- 8,
411
- null,
412
- null,
413
- 1,
414
- 1,
415
- 1,
416
- 1,
417
- null,
418
- null,
419
- 1,
420
- 1,
421
- 1,
422
- null,
423
- null,
424
- 1,
425
- 2,
426
- null,
427
- null,
428
- 1,
429
- 2,
430
- null,
431
- null,
432
- 1,
433
- 1,
434
- 1,
435
- null,
436
- null,
437
- 1,
438
- 1,
439
- 1,
440
- 1,
441
- 1,
442
- null,
443
- null,
444
- 1,
445
- 1,
446
- 1,
447
- 1,
448
- null,
449
- null,
450
- 1,
451
- 1,
452
- 1,
453
- 1,
454
- 1,
455
- null,
456
- null,
457
- null,
458
- null,
459
- 1,
460
- 1,
461
- 3,
462
- 3,
463
- 3,
464
- null,
465
- null,
466
- 1,
467
- 3,
468
- null,
469
- null,
470
- 1,
471
- 1,
472
- null,
473
- null,
474
- 1,
475
- 2,
476
- null,
477
- null,
478
- 1,
479
- 1,
480
- 1,
481
- 1,
482
- null,
483
- null,
484
- null,
485
- null
486
- ],
487
- "Z:/Projects/github/version_info/spec/version_info/yaml_format_spec.rb": [
488
- 1,
489
- null,
490
- 1,
491
- 1,
492
- 6,
493
- 6,
494
- 6,
495
- 6,
496
- 6,
497
- null,
498
- null,
499
- 1,
500
- 1,
501
- null,
502
- null,
503
- 1,
504
- 1,
505
- null,
506
- null,
507
- 1,
508
- 1,
509
- 1,
510
- 1,
511
- 1,
512
- null,
513
- 1,
514
- null,
515
- null,
516
- 1,
517
- 1,
518
- 1,
519
- 1,
520
- 1,
521
- 1,
522
- 1,
523
- null,
524
- null,
525
- 1,
526
- 1,
527
- 1,
528
- 1,
529
- 1,
530
- null,
531
- null,
532
- 1,
533
- 1,
534
- 1,
535
- 1,
536
- 1,
537
- null,
538
- null,
539
- null,
540
- null
541
- ]
542
- },
543
- "timestamp": 1386012568
544
- }
545
- }
1
+ {
2
+ "RSpec": {
3
+ "coverage": {
4
+ "/Users/jcangas/Projects/github/version_info/spec/version_info/module_format_spec.rb": [
5
+ 1,
6
+ null,
7
+ 1,
8
+ 1,
9
+ 9,
10
+ 9,
11
+ 9,
12
+ 9,
13
+ 9,
14
+ null,
15
+ null,
16
+ 1,
17
+ 1,
18
+ null,
19
+ null,
20
+ 1,
21
+ 1,
22
+ null,
23
+ null,
24
+ 1,
25
+ 1,
26
+ null,
27
+ null,
28
+ 1,
29
+ 1,
30
+ null,
31
+ null,
32
+ 1,
33
+ 1,
34
+ null,
35
+ null,
36
+ 1,
37
+ 1,
38
+ 1,
39
+ 1,
40
+ 1,
41
+ 1,
42
+ null,
43
+ null,
44
+ 1,
45
+ 1,
46
+ 1,
47
+ null,
48
+ null,
49
+ 1,
50
+ 1,
51
+ null,
52
+ null,
53
+ null,
54
+ null,
55
+ null,
56
+ null,
57
+ 1,
58
+ 1,
59
+ 1,
60
+ 1,
61
+ 1,
62
+ 1,
63
+ null,
64
+ null,
65
+ null,
66
+ null,
67
+ null,
68
+ null,
69
+ 1,
70
+ null,
71
+ null,
72
+ 1,
73
+ 1,
74
+ null,
75
+ null,
76
+ null,
77
+ null,
78
+ null,
79
+ null,
80
+ 1,
81
+ 1,
82
+ 1,
83
+ 1,
84
+ 1,
85
+ 1,
86
+ 1,
87
+ 1,
88
+ 1,
89
+ null,
90
+ null,
91
+ null,
92
+ null,
93
+ null,
94
+ null,
95
+ 1,
96
+ null,
97
+ null,
98
+ null
99
+ ],
100
+ "/Users/jcangas/Projects/github/version_info/spec/version_info/text_format_spec.rb": [
101
+ 1,
102
+ null,
103
+ 1,
104
+ 1,
105
+ 9,
106
+ 9,
107
+ 9,
108
+ 9,
109
+ 9,
110
+ null,
111
+ null,
112
+ 1,
113
+ 1,
114
+ null,
115
+ null,
116
+ 1,
117
+ 1,
118
+ null,
119
+ null,
120
+ 1,
121
+ 1,
122
+ 1,
123
+ 1,
124
+ 1,
125
+ 1,
126
+ null,
127
+ null,
128
+ 1,
129
+ 1,
130
+ 1,
131
+ 1,
132
+ 1,
133
+ 1,
134
+ 1,
135
+ null,
136
+ null,
137
+ null,
138
+ null,
139
+ 1,
140
+ null,
141
+ null,
142
+ null,
143
+ 1,
144
+ 1,
145
+ 1,
146
+ 1,
147
+ 1,
148
+ null,
149
+ null,
150
+ 1,
151
+ 1,
152
+ 1,
153
+ 1,
154
+ 1,
155
+ null,
156
+ null,
157
+ 1,
158
+ 1,
159
+ 1,
160
+ 1,
161
+ 1,
162
+ null,
163
+ null,
164
+ 1,
165
+ null,
166
+ null,
167
+ 1,
168
+ 1,
169
+ 1,
170
+ 1,
171
+ 1,
172
+ null,
173
+ null,
174
+ 1,
175
+ 1,
176
+ 1,
177
+ 1,
178
+ 1,
179
+ null,
180
+ null
181
+ ],
182
+ "/Users/jcangas/Projects/github/version_info/spec/version_info/version_info_spec.rb": [
183
+ 1,
184
+ null,
185
+ null,
186
+ null,
187
+ 1,
188
+ null,
189
+ 1,
190
+ 8,
191
+ 8,
192
+ null,
193
+ 8,
194
+ null,
195
+ 1,
196
+ 8,
197
+ null,
198
+ null,
199
+ 1,
200
+ 1,
201
+ 1,
202
+ 1,
203
+ null,
204
+ null,
205
+ 1,
206
+ 1,
207
+ 1,
208
+ null,
209
+ null,
210
+ 1,
211
+ 2,
212
+ null,
213
+ null,
214
+ 1,
215
+ 2,
216
+ null,
217
+ null,
218
+ 1,
219
+ 1,
220
+ 1,
221
+ null,
222
+ null,
223
+ 1,
224
+ 1,
225
+ 1,
226
+ 1,
227
+ 1,
228
+ null,
229
+ null,
230
+ 1,
231
+ 1,
232
+ 1,
233
+ 1,
234
+ null,
235
+ null,
236
+ 1,
237
+ 1,
238
+ 1,
239
+ 1,
240
+ 1,
241
+ null,
242
+ null,
243
+ null,
244
+ null,
245
+ 1,
246
+ 1,
247
+ 3,
248
+ 3,
249
+ 3,
250
+ null,
251
+ null,
252
+ 1,
253
+ 3,
254
+ null,
255
+ null,
256
+ 1,
257
+ 1,
258
+ null,
259
+ null,
260
+ 1,
261
+ 2,
262
+ null,
263
+ null,
264
+ 1,
265
+ 1,
266
+ 1,
267
+ 1,
268
+ null,
269
+ null,
270
+ null,
271
+ null
272
+ ],
273
+ "/Users/jcangas/Projects/github/version_info/spec/version_info/yaml_format_spec.rb": [
274
+ 1,
275
+ null,
276
+ 1,
277
+ 1,
278
+ 6,
279
+ 6,
280
+ 6,
281
+ 6,
282
+ 6,
283
+ null,
284
+ null,
285
+ 1,
286
+ 1,
287
+ null,
288
+ null,
289
+ 1,
290
+ 1,
291
+ null,
292
+ null,
293
+ 1,
294
+ 1,
295
+ 1,
296
+ 1,
297
+ 1,
298
+ null,
299
+ 1,
300
+ null,
301
+ null,
302
+ 1,
303
+ 1,
304
+ 1,
305
+ 1,
306
+ 1,
307
+ 1,
308
+ 1,
309
+ null,
310
+ null,
311
+ 1,
312
+ 1,
313
+ 1,
314
+ 1,
315
+ 1,
316
+ null,
317
+ null,
318
+ 1,
319
+ 1,
320
+ 1,
321
+ 1,
322
+ 1,
323
+ null,
324
+ null,
325
+ null,
326
+ null
327
+ ]
328
+ },
329
+ "timestamp": 1392487607
330
+ }
331
+ }
@@ -16,15 +16,29 @@ module VersionInfo
16
16
  'version.rb'
17
17
  end
18
18
 
19
- def load_from(io)
19
+ def load_content
20
+ File.readlines(file_name)
21
+ end
22
+
23
+ def load
24
+ content = load_content
25
+ parse_from(content)
26
+ self
27
+ end
28
+
29
+ def parse_from(content)
30
+ match = content.join.match /(\s*VERSION\s*=\s*)('|")(.*)('|")/
31
+ str = match[3]
32
+ data.set_version_info(str)
20
33
  self
21
34
  end
22
35
 
23
36
  def save
24
- content = File.read(file_name)
37
+ content = load_content.join
25
38
  content.gsub!(/(\s*VERSION\s*=\s*)('|").*('|")/, "\\1\\2#{data.tag}\\3")
26
39
  File.open(file_name, 'w' ) {|out| out.print content}
27
40
  self
41
+ content
28
42
  end
29
43
 
30
44
  end
@@ -12,9 +12,13 @@ module VersionInfo
12
12
  def default_file_name
13
13
  'VERSION'
14
14
  end
15
-
15
+
16
+ def load_content(io)
17
+ io.readlines
18
+ end
19
+
16
20
  def load_from(io)
17
- content = io.readlines
21
+ content = load_content(io)
18
22
  str = content.shift
19
23
  custom = content.inject({}) {|result, line| k, v = line.chomp.split(':'); result[k.strip.to_sym] = v.strip; result}
20
24
  data.set_version_info(str)
@@ -1,6 +1,6 @@
1
1
 
2
2
  module VersionInfo
3
- VERSION = "1.8.5"
3
+ VERSION = "1.8.7"
4
4
  versionable(self)
5
5
  VERSION.file_name = __FILE__
6
6
  end
data/lib/version_info.rb CHANGED
@@ -46,11 +46,11 @@ module VersionInfo
46
46
  define_method :VERSION do
47
47
  @data ||= self::VERSION
48
48
  end
49
- define_method :"VERSION=" do |value_str|
49
+ define_method :"VERSION=" do |value_str|
50
50
  self.VERSION.set_version_info(value_str)
51
51
  end
52
52
  end
53
- other.VERSION= old_const if old_const
53
+ other.VERSION= old_const.to_s if old_const
54
54
  end
55
55
 
56
56
  end
@@ -26,9 +26,7 @@ describe "Module file format" do
26
26
  end
27
27
 
28
28
  it "has segmentes" do
29
- @test_module.VERSION.major.should == 0
30
- @test_module.VERSION.minor.should == 0
31
- @test_module.VERSION.patch.should == 0
29
+ @test_module.VERSION.segments.should == [:major, :minor, :patch]
32
30
  end
33
31
 
34
32
  it "can assign VERSION" do
@@ -39,4 +37,58 @@ describe "Module file format" do
39
37
  @test_module.VERSION.to_hash.should == {major: 1, minor: 2, patch: 4, author: 'jcangas', email: 'jcangas@example.com' }
40
38
  end
41
39
 
40
+ it "can use tag" do
41
+ @test_module.VERSION = "1.2.4"
42
+ @test_module.VERSION.tag.should == "1.2.4"
43
+ end
44
+
45
+ it "can save " do
46
+ content = <<END
47
+ module Test
48
+ include VersionInfo
49
+ self.VERSION = "#{@test_module.VERSION.tag}"
50
+ self.VERSION.file_name = __FILE__
51
+ end
52
+ END
53
+ @test_module::VERSION.storage.should_receive(:load_content).and_return(content.lines)
54
+ io = StringIO.new
55
+ File.should_receive(:open).and_yield(io)
56
+ @test_module::VERSION.bump(:minor)
57
+ @test_module::VERSION.storage.data.tag.should == "0.1.0"
58
+ @test_module::VERSION.save
59
+ io.string.should == <<END
60
+ module Test
61
+ include VersionInfo
62
+ self.VERSION = "#{@test_module.VERSION.tag}"
63
+ self.VERSION.file_name = __FILE__
64
+ end
65
+ END
66
+ end
67
+
68
+ it "can save as delphi" do
69
+ content = <<END
70
+ TVersionInfo = class
71
+ public
72
+ const
73
+ VERSION = '0.2.0';
74
+ end
75
+ END
76
+ @test_module::VERSION.storage.should_receive(:load_content).and_return(content.lines)
77
+ @test_module::VERSION.load
78
+ @test_module::VERSION.storage.data.tag.should == "0.2.0"
79
+ @test_module::VERSION.bump(:minor)
80
+ @test_module::VERSION.storage.data.tag.should == "0.3.0"
81
+ io = StringIO.new
82
+ File.should_receive(:open).and_yield(io)
83
+ @test_module::VERSION.storage.should_receive(:load_content).and_return(content.lines)
84
+ @test_module::VERSION.save
85
+ io.string.should == <<END
86
+ TVersionInfo = class
87
+ public
88
+ const
89
+ VERSION = '0.3.0';
90
+ end
91
+ END
92
+ end
93
+
42
94
  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.5
4
+ version: 1.8.7
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-12-02 00:00:00.000000000 Z
11
+ date: 2014-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler