version_info 1.8.8 → 1.9.0

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: 8faed425d19abf274ee245d50f63c35ab49f6ac3
4
- data.tar.gz: bcb30f9e127ce124b4a68f235a47d13759a6feff
3
+ metadata.gz: 6631429538dbd8b3cc32768357a3fa332ee82b3e
4
+ data.tar.gz: f6e2355cb2d0af05745727b21d4749898cb243ba
5
5
  SHA512:
6
- metadata.gz: 8c11d70dd3fcfa4e0cf0c6b1c12aeeb04b4f42c905e0987edadf293926e0aa3aa3080347bfb5aee4e746988e0e5fe73a5153e8bb54973681d464bf39d53e4d38
7
- data.tar.gz: 4c4803ba8ee25fa43a79781560ce00d0e67d7bffa1f4edc0634c0b13705d24c22ba6e7d03b53ada1afc7e016a8437a8490ce1004ef5e232e76907548ce4bb28c
6
+ metadata.gz: 44b3ed302d485ddc12352502541b956bc400a4f20e98f7f5e2866b22b3199dfad0a7e7d8b4b6d05bea314c318041bbaac1a49a20ca40c505b8b0d67b9b8fd3c1
7
+ data.tar.gz: 62a4c716f397f07651932a13811516d40f00367eaf961516b751b8d3991ff372b090a3009301cd033f661da6d2d1cc456b9b4bbb995ae67ec69749a6b5034e25
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 96.97
3
+ "covered_percent": 96.99
4
4
  }
5
5
  }
@@ -9,20 +9,20 @@
9
9
  null,
10
10
  null,
11
11
  1,
12
- 35,
12
+ 37,
13
13
  null,
14
14
  null,
15
15
  null,
16
16
  1,
17
- 30,
17
+ 32,
18
18
  null,
19
19
  null,
20
20
  1,
21
- 33,
21
+ 17,
22
22
  null,
23
23
  null,
24
24
  1,
25
- 24,
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
- 35,
39
+ 37,
40
40
  null,
41
41
  null,
42
42
  1,
43
- 35,
43
+ 37,
44
44
  0,
45
45
  0,
46
46
  null,
47
- 35,
48
- 35,
49
- 35,
50
- 35,
47
+ 37,
48
+ 37,
49
+ 37,
50
+ 37,
51
51
  12,
52
52
  null,
53
- 35,
53
+ 37,
54
54
  2,
55
55
  null,
56
56
  null,
57
- 35,
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
- 33,
71
- 33,
72
- 33,
69
+ 17,
70
+ 17,
73
71
  null,
74
72
  null,
75
73
  1,
76
- 113,
74
+ 47,
77
75
  null,
78
76
  null,
79
77
  1,
80
- 33,
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
- 2,
89
- 2,
90
- 2,
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
- 22,
116
+ 4,
119
117
  null,
120
118
  null,
121
119
  1,
122
- 18,
120
+ 0,
123
121
  null,
124
122
  null,
125
123
  1,
126
- 22,
127
- 22,
128
- 22,
124
+ 4,
125
+ 4,
126
+ 4,
129
127
  null,
130
128
  null,
131
129
  1,
132
- 22,
133
- 23,
134
- 22,
135
- 22,
136
- 22,
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
- 9,
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
- 12,
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
- 35,
237
- 35,
238
- 35,
224
+ 37,
225
+ 37,
226
+ 37,
239
227
  null,
240
228
  null,
241
229
  1,
242
- 63,
230
+ 39,
231
+ 17,
232
+ null,
233
+ 39,
243
234
  null,
244
235
  null,
245
236
  1,
246
- 4,
237
+ 11,
247
238
  null,
248
239
  null,
249
240
  1,
250
- 33,
251
- 33,
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
- 35,
266
- 35,
256
+ 37,
257
+ 37,
267
258
  null,
268
259
  null,
269
260
  1,
270
- 37,
261
+ 39,
271
262
  null,
272
263
  null,
273
264
  1,
274
- 12,
275
- 12,
276
- 12,
277
- 9,
265
+ 13,
266
+ 13,
267
+ 13,
268
+ 10,
278
269
  null,
279
- 12,
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
- 56,
278
+ 42,
288
279
  null,
289
280
  null,
290
281
  1,
291
- 18,
282
+ 20,
292
283
  null,
293
284
  null,
294
285
  1,
295
- 20,
296
- 58,
297
- 58,
298
- 13,
299
- 13,
300
- 13,
286
+ 22,
287
+ 66,
288
+ 66,
289
+ 15,
290
+ 15,
291
+ 15,
301
292
  null,
302
- 20,
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
- 28,
311
- 28,
312
- 28,
313
- 95,
314
- 95,
315
- 95,
301
+ 10,
302
+ 10,
303
+ 10,
304
+ 41,
305
+ 41,
306
+ 41,
316
307
  null,
317
- 28,
308
+ 10,
318
309
  null,
319
310
  null,
320
311
  1,
321
- 95,
322
- 100,
323
- 95,
312
+ 41,
313
+ 46,
314
+ 41,
324
315
  null,
325
316
  null,
326
317
  1,
327
- 150,
318
+ 140,
328
319
  null,
329
320
  null,
330
321
  1,
331
- 252,
332
- 63,
322
+ 188,
323
+ 47,
333
324
  null,
334
325
  null,
335
326
  1,
336
- 140,
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
- 9,
444
- 9,
445
- 9,
446
- 9,
447
- 9,
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": 1392630616
670
+ "timestamp": 1392639091
668
671
  }
669
672
  }
@@ -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
@@ -5,21 +5,24 @@ module VersionInfo
5
5
  class Data < OpenStruct
6
6
  def initialize(segments)
7
7
  super()
8
- @segments = segments.dup
8
+ @segments = segments
9
9
  reset
10
10
  end
11
11
 
12
12
  def storage
13
- @storage ||= STORAGE_CLASS[VersionInfo.file_format.to_sym].new(self)
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.file_name
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("\n").match /(\s*VERSION\s*=\s*)('|")(.*)('|")/
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
@@ -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 file_name
12
- @file_name ||= Dir.pwd + '/' + default_file_name
9
+ def data
10
+ @data
13
11
  end
14
12
 
15
- def file_name=(value)
16
- @file_name = value
13
+ def file_name
14
+ @data.file_name
17
15
  end
18
16
 
19
17
  def load_content
@@ -1,6 +1,6 @@
1
1
 
2
2
  module VersionInfo
3
- VERSION = "1.8.8"
3
+ VERSION = "1.9.0"
4
4
  versionable(self)
5
5
  VERSION.file_name = __FILE__
6
6
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: version_info
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.8
4
+ version: 1.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jorge L. Cangas