version_info 1.8.0 → 1.8.2

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: f6fed5fde16f2c17fdb40b6bd1c7dcd6942f1fe7
4
- data.tar.gz: 89817de707b2b79da5249e3a76ba3bc3d5161987
3
+ metadata.gz: 718e8eee0dc06dd98dcc2757f024485ec4802bf4
4
+ data.tar.gz: 6bd0a11d3bd55e7ea7e25cc2b11d491bdbfbc8e6
5
5
  SHA512:
6
- metadata.gz: 7e1f0d5fd0c14f8f160ddf24a861b6a04dacf8fa6555955cb5d099325e865cd4418713e9a1175f207981ecd1f29668dbf74a0957f5feea3dc4d9f41ed2ed3888
7
- data.tar.gz: d713981e8668924181289b47e43853a2c847dccd227022e3ca6a5182648c94d399bb422ccf458c6ea3939aa0be040669ebeca7f3f229a378473dfa63490adf99
6
+ metadata.gz: e29144dd0136a49db899fc186f6563558ea9de0ca91cf2272bd352d7d5052a938b7003c96733387aaefcfc39fe99a667433fca9c6bfc6a2aa70398014586bcb4
7
+ data.tar.gz: 738ee136e707c8224ca6ce92df398d049db90301eea74cb74f49552fc4db4f31d4cc6c0a8873cfd0f657f55c1a09e4170813facb87083dc98b3f2d51e5bec186
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 1.9.3
4
- - 2.0.0
3
+ - 1.9.3
4
+ - 2.0.0
data/Gemfile.lock CHANGED
@@ -12,9 +12,10 @@ GEM
12
12
  simplecov (>= 0.7)
13
13
  term-ansicolor
14
14
  thor
15
- diff-lcs (1.2.4)
16
- mime-types (1.19)
17
- multi_json (1.7.2)
15
+ diff-lcs (1.2.5)
16
+ docile (1.1.1)
17
+ mime-types (2.0)
18
+ multi_json (1.8.2)
18
19
  notifier (0.4.1)
19
20
  rake (10.1.0)
20
21
  rest-client (1.6.7)
@@ -23,20 +24,21 @@ GEM
23
24
  rspec-core (~> 2.14.0)
24
25
  rspec-expectations (~> 2.14.0)
25
26
  rspec-mocks (~> 2.14.0)
26
- rspec-core (2.14.5)
27
- rspec-expectations (2.14.2)
27
+ rspec-core (2.14.7)
28
+ rspec-expectations (2.14.4)
28
29
  diff-lcs (>= 1.1.3, < 2.0)
29
- rspec-mocks (2.14.3)
30
- simplecov (0.7.1)
31
- multi_json (~> 1.0)
32
- simplecov-html (~> 0.7.1)
33
- simplecov-html (0.7.1)
30
+ rspec-mocks (2.14.4)
31
+ simplecov (0.8.2)
32
+ docile (~> 1.1.0)
33
+ multi_json
34
+ simplecov-html (~> 0.8.0)
35
+ simplecov-html (0.8.0)
34
36
  term-ansicolor (1.2.2)
35
37
  tins (~> 0.8)
36
38
  test_notifier (1.0.1)
37
39
  notifier
38
- thor (0.16.0)
39
- tins (0.10.0)
40
+ thor (0.18.1)
41
+ tins (0.13.1)
40
42
 
41
43
  PLATFORMS
42
44
  ruby
data/README.md CHANGED
@@ -1,8 +1,9 @@
1
1
  ## VersionInfo
2
2
 
3
- ### Travis CI status
3
+ ### Current status
4
4
 
5
5
  [![Build Status](https://secure.travis-ci.org/jcangas/version_info.png)](http://travis-ci.org/jcangas/version_info)
6
+ [![Gem Version](https://badge.fury.io/rb/version_info.png)](http://badge.fury.io/rb/version_info)
6
7
 
7
8
  ### Install
8
9
 
@@ -9,20 +9,26 @@
9
9
  null,
10
10
  null,
11
11
  1,
12
- 66,
12
+ 115,
13
+ null,
14
+ null,
15
+ 1,
16
+ 19,
17
+ 21,
18
+ 19,
13
19
  null,
14
20
  null,
15
21
  null,
16
22
  1,
17
- 6,
23
+ 26,
18
24
  null,
19
25
  null,
20
26
  1,
21
- 27,
27
+ 29,
22
28
  null,
23
29
  null,
24
30
  1,
25
- 18,
31
+ 20,
26
32
  null,
27
33
  null,
28
34
  1,
@@ -36,25 +42,25 @@
36
42
  null,
37
43
  null,
38
44
  1,
39
- 29,
45
+ 31,
40
46
  null,
41
47
  null,
42
48
  1,
43
- 29,
49
+ 31,
44
50
  0,
45
51
  0,
46
52
  null,
47
- 29,
48
- 29,
49
- 29,
50
- 29,
53
+ 31,
54
+ 31,
55
+ 31,
56
+ 31,
51
57
  10,
52
58
  null,
53
- 29,
59
+ 31,
54
60
  1,
55
61
  null,
56
62
  null,
57
- 29,
63
+ 31,
58
64
  null,
59
65
  null,
60
66
  null,
@@ -67,22 +73,22 @@
67
73
  1,
68
74
  null,
69
75
  1,
70
- 27,
71
- 27,
72
- 27,
76
+ 29,
77
+ 29,
78
+ 29,
73
79
  null,
74
80
  null,
75
81
  1,
76
- 66,
82
+ 72,
77
83
  null,
78
84
  null,
79
85
  1,
80
- 27,
86
+ 29,
81
87
  null,
82
88
  null,
83
89
  1,
84
- 8,
85
- 4,
90
+ 12,
91
+ 6,
86
92
  null,
87
93
  null,
88
94
  1,
@@ -110,17 +116,16 @@
110
116
  1,
111
117
  null,
112
118
  1,
113
- 20,
119
+ 24,
114
120
  null,
115
121
  null,
116
122
  1,
117
- null,
118
- 2,
119
- 2,
120
- 3,
121
- 2,
122
- 2,
123
- 2,
123
+ 4,
124
+ 4,
125
+ 5,
126
+ 4,
127
+ 4,
128
+ 4,
124
129
  null,
125
130
  null,
126
131
  1,
@@ -206,12 +211,12 @@
206
211
  1,
207
212
  1,
208
213
  1,
209
- 29,
210
- 29,
214
+ 31,
215
+ 31,
211
216
  null,
212
217
  null,
213
218
  1,
214
- 39,
219
+ 43,
215
220
  null,
216
221
  null,
217
222
  1,
@@ -219,13 +224,13 @@
219
224
  null,
220
225
  null,
221
226
  1,
222
- 27,
223
- 27,
227
+ 29,
228
+ 29,
224
229
  null,
225
230
  null,
226
231
  1,
227
- 4,
228
- 4,
232
+ 6,
233
+ 6,
229
234
  null,
230
235
  null,
231
236
  1,
@@ -234,11 +239,11 @@
234
239
  null,
235
240
  null,
236
241
  1,
237
- 29,
242
+ 31,
238
243
  null,
239
244
  null,
240
245
  1,
241
- 31,
246
+ 33,
242
247
  null,
243
248
  null,
244
249
  1,
@@ -255,15 +260,22 @@
255
260
  null,
256
261
  null,
257
262
  1,
258
- 22,
263
+ 26,
259
264
  null,
260
265
  null,
261
266
  1,
262
- 6,
267
+ 7,
263
268
  null,
264
269
  null,
265
270
  1,
266
- 25,
271
+ 8,
272
+ 30,
273
+ 30,
274
+ 7,
275
+ 7,
276
+ 7,
277
+ null,
278
+ 8,
267
279
  null,
268
280
  null,
269
281
  1,
@@ -271,27 +283,31 @@
271
283
  null,
272
284
  null,
273
285
  1,
274
- 3,
275
- 12,
286
+ 5,
287
+ 5,
288
+ 19,
289
+ 19,
290
+ 19,
291
+ null,
276
292
  null,
277
293
  null,
278
294
  1,
279
- 116,
295
+ 124,
280
296
  null,
281
297
  null,
282
298
  null,
283
299
  null
284
300
  ],
285
- "Z:/Projects/github/version_info/spec/version_info/module_format_spec.rb": [
301
+ "Z:/Projects/github/version_info/spec/version_info/text_format_spec.rb": [
286
302
  1,
287
303
  null,
288
304
  1,
289
305
  1,
290
- 6,
291
- null,
292
- 6,
293
- 6,
294
- 6,
306
+ 8,
307
+ 8,
308
+ 8,
309
+ 8,
310
+ 8,
295
311
  null,
296
312
  null,
297
313
  1,
@@ -304,12 +320,6 @@
304
320
  null,
305
321
  1,
306
322
  1,
307
- null,
308
- null,
309
- 1,
310
- 1,
311
- null,
312
- null,
313
323
  1,
314
324
  1,
315
325
  1,
@@ -322,30 +332,15 @@
322
332
  1,
323
333
  1,
324
334
  1,
325
- null,
326
- null,
327
- null
328
- ],
329
- "Z:/Projects/github/version_info/spec/version_info/text_format_spec.rb": [
330
335
  1,
331
336
  null,
332
- 1,
333
- 1,
334
- 6,
335
- 6,
336
- 6,
337
- 6,
338
337
  null,
339
338
  null,
340
- 1,
341
- 1,
342
339
  null,
343
- null,
344
- 1,
345
340
  1,
346
341
  null,
347
342
  null,
348
- 1,
343
+ null,
349
344
  1,
350
345
  1,
351
346
  1,
@@ -358,14 +353,6 @@
358
353
  1,
359
354
  1,
360
355
  1,
361
- 1,
362
- 1,
363
- null,
364
- null,
365
- null,
366
- null,
367
- 1,
368
- null,
369
356
  null,
370
357
  null,
371
358
  1,
@@ -475,6 +462,7 @@
475
462
  6,
476
463
  6,
477
464
  6,
465
+ 6,
478
466
  null,
479
467
  null,
480
468
  1,
@@ -521,6 +509,6 @@
521
509
  null
522
510
  ]
523
511
  },
524
- "timestamp": 1379663599
512
+ "timestamp": 1385730622
525
513
  }
526
514
  }
@@ -61,7 +61,14 @@ module VersionInfo
61
61
  end
62
62
 
63
63
  def tag_format
64
- @tag_format ||= VersionInfo.segments.map { |k| "%<#{k}>d"}.join('.')
64
+ unless @tag_format
65
+ fmts = VersionInfo.segments.map { |k| "%<#{k}>s"}
66
+ fmt_join = VersionInfo.segments.map { |k| "." }
67
+ fmt_join[2] = '+' #build uses '+'. See semver.org
68
+ fmt_join[-1] = '' #remove last char
69
+ @tag_format = fmts.zip(fmt_join).flatten.join
70
+ end
71
+ @tag_format
65
72
  end
66
73
 
67
74
  def tag_format=(value)
@@ -69,12 +76,16 @@ module VersionInfo
69
76
  end
70
77
 
71
78
  def set_version_info(tag_str)
72
- values = tag_str.to_s.split('.')
73
- VersionInfo.segments.each{|sgm| self.send("#{sgm}=", values.shift.match(/(\d+)/).to_s.to_i) }
79
+ values = tag_str.to_s.split(/\.|\+|\-/)
80
+ values.each_with_index do |val, idx|
81
+ val = val.to_s.chomp
82
+ val = val.match(/(^\d+)$/) ? val.to_i : val
83
+ self.send("#{VersionInfo.segment_at(idx)}=", val )
84
+ end
74
85
  end
75
86
 
76
87
  def get_defaults
77
- VersionInfo.segments[0..2].inject({}){|h, k| h[k] = 0; h}
88
+ VersionInfo.segments.inject({}){|h, k| h[k] = 0; h}
78
89
  end
79
90
  end
80
91
  end
@@ -14,7 +14,6 @@ module VersionInfo
14
14
  end
15
15
 
16
16
  def load_from(io)
17
- #content = io.string.split("\n") unless io.is_a? Array
18
17
  content = io.readlines
19
18
  str = content.shift
20
19
  custom = content.inject({}) {|result, line| k, v = line.chomp.split(':'); result[k.strip.to_sym] = v.strip; result}
@@ -1,6 +1,6 @@
1
1
 
2
2
  module VersionInfo
3
- VERSION = "1.8.0"
3
+ VERSION = "1.8.2"
4
4
  versionable(self)
5
5
  VERSION.file_name = __FILE__
6
6
  end
data/lib/version_info.rb CHANGED
@@ -8,6 +8,12 @@ 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
+
11
17
  # define segments
12
18
  def self.segments=(values)
13
19
  @segments = values
data/spec/spec_helper.rb CHANGED
@@ -29,3 +29,5 @@ if Notifier.os?(/mingw32/)
29
29
  end
30
30
  end
31
31
  end
32
+
33
+ TestNotifier.default_notifier = :growl
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  describe "Module file format" do
4
4
  before :each do
5
5
  VersionInfo.file_format = :module
6
-
6
+ VersionInfo.segments = nil
7
7
  @test_module = Module.new
8
8
  @test_module.send :include, VersionInfo # force new VERSION value
9
9
  @test_module::VERSION.file_name = nil
@@ -34,9 +34,9 @@ describe "Module file format" do
34
34
  it "can assign VERSION" do
35
35
  @test_module.VERSION = '1.2.4'
36
36
  @test_module.VERSION.author = 'jcangas'
37
- @test_module.VERSION.email = 'jorge.cangas@gmail.com'
37
+ @test_module.VERSION.email = 'jcangas@example.com'
38
38
  @test_module.VERSION.class.name.should == 'VersionInfo::Data'
39
- @test_module.VERSION.to_hash.should == {major: 1, minor: 2, patch: 4, author: 'jcangas', email: 'jorge.cangas@gmail.com' }
39
+ @test_module.VERSION.to_hash.should == {major: 1, minor: 2, patch: 4, author: 'jcangas', email: 'jcangas@example.com' }
40
40
  end
41
41
 
42
42
  end
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe "Text file format" do
4
4
  before :each do
5
5
  VersionInfo.file_format = :text
6
+ VersionInfo.segments = nil
6
7
  @test_module = Module.new
7
8
  @test_module.send :include, VersionInfo
8
9
  @test_module::VERSION.file_name = nil
@@ -29,12 +30,12 @@ describe "Text file format" do
29
30
  File.should_receive(:open).and_yield(io)
30
31
  @test_module::VERSION.bump(:minor)
31
32
  @test_module::VERSION.author = 'jcangas'
32
- @test_module::VERSION.email = 'jorge.cangas@gmail.com'
33
+ @test_module::VERSION.email = 'jcangas@example.com'
33
34
  @test_module::VERSION.save
34
35
  io.string.should == <<END
35
36
  0.1.0
36
37
  author: jcangas
37
- email: jorge.cangas@gmail.com
38
+ email: jcangas@example.com
38
39
  END
39
40
 
40
41
  end
@@ -43,7 +44,21 @@ END
43
44
  io = StringIO.new("1.2.3")
44
45
  File.should_receive(:open).and_yield(io)
45
46
  @test_module::VERSION.load
46
- @test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3 }
47
+ @test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3}
48
+ end
49
+
50
+ it "auto expand segments " do
51
+ io = StringIO.new("1.2.3.B4.5")
52
+ File.should_receive(:open).and_yield(io)
53
+ @test_module::VERSION.load
54
+ @test_module::VERSION.to_hash.should == {:major => 1, :minor => 2, :patch => 3, :build => 'B4', :vinfo4 => 5 }
55
+ end
56
+
57
+ it "auto expand for build uses semvar.org tag format " do
58
+ io = StringIO.new("1.2.3.B4.5")
59
+ File.should_receive(:open).and_yield(io)
60
+ @test_module::VERSION.load
61
+ @test_module::VERSION.tag.should == "1.2.3+B4.5"
47
62
  end
48
63
 
49
64
  it "can load custom data " do
@@ -3,6 +3,7 @@ require 'spec_helper'
3
3
  describe "Yaml file format" do
4
4
  before :each do
5
5
  VersionInfo.file_format = :yaml
6
+ VersionInfo.segments = nil
6
7
  @test_module = Module.new
7
8
  @test_module.send :include, VersionInfo
8
9
  @test_module::VERSION.file_name = nil
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.0
4
+ version: 1.8.2
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-09-30 00:00:00.000000000 Z
11
+ date: 2013-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -149,14 +149,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
149
149
  version: '0'
150
150
  requirements: []
151
151
  rubyforge_project: version_info
152
- rubygems_version: 2.1.4
152
+ rubygems_version: 2.0.3
153
153
  signing_key:
154
154
  specification_version: 4
155
155
  summary: A Ruby gem to manage your project version data. Rake tasks included!
156
- test_files:
157
- - spec/spec_helper.rb
158
- - spec/version_info/module_format_spec.rb
159
- - spec/version_info/test_file.rb
160
- - spec/version_info/text_format_spec.rb
161
- - spec/version_info/version_info_spec.rb
162
- - spec/version_info/yaml_format_spec.rb
156
+ test_files: []