app_version 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 14aa690f2861de784ba49287717c9ba828889d59
4
+ data.tar.gz: ac83e1f63aedccb03e8b52770b3a56aa29a6300e
5
+ SHA512:
6
+ metadata.gz: b60b91a073efe4fbde1041415ba6a6eb0592eda2a8a5ac58fd919e566533e8a1235a975e08213a4441743b4f4b05e1bfbb7c8e7f1fc9b1dcc6cbb658c8f9574f
7
+ data.tar.gz: 11f330cda1e2889ba99e937b4bd1c9b9ecf3f7c139e7ab485ff5f41e1046f402386102274a6a89e504ac7552e88e6616c72ba2f77d0e67bad7b05ec141af09b2
data/README.md CHANGED
@@ -2,13 +2,14 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/mort666/app_version.png?branch=master)](https://travis-ci.org/mort666/app_version)
4
4
 
5
- This is a simple plugin that makes it easy to manage the version number of your Rails application. The version numbers supported by this plugin look like '2.0.1 M4 (600) of branch by coder on 2008-10-27'.
5
+ This is a simple plugin that makes it easy to manage the version number of your Rails application. The version numbers supported by this plugin look like '2.0.0-rc.1 M4 (600) of branch by coder on 2008-10-27'.
6
6
 
7
7
  The components of the version number are:
8
8
 
9
9
  2 => major
10
10
  0 => minor
11
- 1 => patch
11
+ 0 => patch
12
+ rc.1 => meta information (as defined by Semantic Versioning)
12
13
  M4 => milestone
13
14
  (600) => build number (usually Subversion revision)
14
15
  branch => the name of the branch this version is from.
@@ -45,6 +46,7 @@ following format:
45
46
  major: 2
46
47
  minor: 0
47
48
  patch: 1
49
+ meta: rc.1
48
50
  milestone: 4
49
51
  build: git-revcount
50
52
  branch: master
@@ -59,7 +61,7 @@ Using 'svn' for the build number will cause the plugin to query Subversion for t
59
61
 
60
62
  The plugin creates a constant `APP_VERSION` that contains the version number of the application. Calling the `to_s` method on APP_VERSION will result in a properly formatted version number.
61
63
 
62
- APP_VERSION also has `major`, `minor`, `patch`, `milestone`, `build`, `branch`, `committer`, and `build_date` methods to retrieve the individual components of the version number.
64
+ APP_VERSION also has `major`, `minor`, `patch`, `meta`, `milestone`, `build`,`branch`, `committer`, and `build_date` methods to retrieve the individual components of the version number.
63
65
 
64
66
  ### Capistrano Usage
65
67
 
@@ -6,9 +6,9 @@ module App
6
6
  class Version
7
7
  include Comparable
8
8
 
9
- attr_accessor :major, :minor, :patch, :milestone, :build, :branch, :committer, :build_date, :format
9
+ attr_accessor :major, :minor, :patch, :milestone, :build, :branch, :meta, :committer, :build_date, :format
10
10
 
11
- [:major, :minor, :patch, :milestone, :build, :branch, :committer, :format].each do |attr|
11
+ [:major, :minor, :patch, :milestone, :build, :branch, :committer, :meta, :format].each do |attr|
12
12
  define_method "#{attr}=".to_sym do |value|
13
13
  instance_variable_set("@#{attr}".to_sym, value.blank? ? nil : value.to_s)
14
14
  end
@@ -29,6 +29,7 @@ module App
29
29
  @major = args[:major].to_s
30
30
  @minor = args[:minor].to_s
31
31
  @patch = args[:patch].to_s unless args[:patch].blank?
32
+ @meta = args[:meta].to_s unless args[:meta].blank?
32
33
  @milestone = args[:milestone].to_s unless args[:milestone].blank?
33
34
  @build = args[:build].to_s unless args[:build].blank?
34
35
  @branch = args[:branch].to_s unless args[:branch].blank?
@@ -62,20 +63,21 @@ module App
62
63
 
63
64
  # Parses a version string to create an instance of the Version class.
64
65
  def self.parse(version)
65
- m = version.match(/(\d+)\.(\d+)(?:\.(\d+))?(?:\sM(\d+))?(?:\s\((\d+)\))?(?:\sof\s(\w+))?(?:\sby\s(\w+))?(?:\son\s(\S+))?/)
66
+ m = version.match(/(\d+)\.(\d+)(?:\.(\d+))?(?:-([\w.\d]+))?(?:\sM(\d+))?(?:\s\((\d+)\))?(?:\sof\s(\w+))?(?:\sby\s(\w+))?(?:\son\s(\S+))?/)
66
67
 
67
68
  raise ArgumentError.new("The version '#{version}' is unparsable") if m.nil?
68
69
 
69
70
  version = App::Version.new :major => m[1],
70
71
  :minor => m[2],
71
72
  :patch => m[3],
72
- :milestone => m[4],
73
- :build => m[5],
74
- :branch => m[6],
75
- :committer => m[7]
76
-
77
- if (m[8] && m[8] != '')
78
- date = Date.parse(m[8])
73
+ :meta => m[4],
74
+ :milestone => m[5],
75
+ :build => m[6],
76
+ :branch => m[7],
77
+ :committer => m[8]
78
+
79
+ if (m[9] && m[9] != '')
80
+ date = Date.parse(m[9])
79
81
  version.build_date = date
80
82
  end
81
83
 
@@ -92,7 +94,7 @@ module App
92
94
  # return self.build <=> other.build
93
95
  # end
94
96
 
95
- %w(build major minor patch milestone branch committer build_date).each do |meth|
97
+ %w(build major minor patch milestone branch meta committer build_date).each do |meth|
96
98
  rhs = self.send(meth) || -1
97
99
  lhs = other.send(meth) || -1
98
100
 
@@ -109,6 +111,7 @@ module App
109
111
  else
110
112
  str = "#{major}.#{minor}"
111
113
  str << ".#{patch}" unless patch.blank?
114
+ str << "-#{meta}" unless meta.blank?
112
115
  str << " M#{milestone}" unless milestone.blank?
113
116
  str << " (#{build})" unless build.blank?
114
117
  str << " of #{branch}" unless branch.blank?
@@ -1,14 +1,15 @@
1
- require 'test/unit'
1
+ require 'minitest/autorun'
2
2
  require 'active_support'
3
3
  require 'app_version'
4
4
 
5
- class AppVersionTest < Test::Unit::TestCase
5
+ class AppVersionTest < MiniTest::Unit::TestCase
6
6
 
7
7
  def setup
8
8
  @version = App::Version.new
9
9
  @version.major = '1'
10
10
  @version.minor = '2'
11
11
  @version.patch = '3'
12
+ @version.meta = 'rc.1'
12
13
  @version.milestone = '4'
13
14
  @version.build = '500'
14
15
  @version.branch = 'master'
@@ -22,16 +23,16 @@ class AppVersionTest < Test::Unit::TestCase
22
23
  end
23
24
 
24
25
  def test_create_from_string
25
- version = App::Version.parse '1.2.3 M4 (500) of master by coder on 2008-10-27'
26
+ version = App::Version.parse '1.2.3-rc.1 M4 (500) of master by coder on 2008-10-27'
26
27
  assert_equal @version, version
27
28
 
28
- version = App::Version.parse '1.2.3 M4 (500)'
29
+ version = App::Version.parse '1.2.3-rc.1 M4 (500)'
29
30
  @version.branch = nil
30
31
  @version.committer = nil
31
32
  @version.build_date = nil
32
33
  assert_equal @version, version
33
34
 
34
- version = App::Version.parse '1.2.3 (500)'
35
+ version = App::Version.parse '1.2.3-rc.1 (500)'
35
36
  @version.milestone = nil
36
37
  @version.branch = nil
37
38
  @version.committer = nil
@@ -40,6 +41,7 @@ class AppVersionTest < Test::Unit::TestCase
40
41
 
41
42
  version = App::Version.parse '1.2 (500)'
42
43
  @version.patch = nil
44
+ @version.meta = nil
43
45
  @version.branch = nil
44
46
  @version.committer = nil
45
47
  @version.build_date = nil
@@ -48,6 +50,7 @@ class AppVersionTest < Test::Unit::TestCase
48
50
  version = App::Version.parse '1.2'
49
51
  @version.milestone = nil
50
52
  @version.build = nil
53
+ @version.meta = nil
51
54
  @version.branch = nil
52
55
  @version.committer = nil
53
56
  @version.build_date = nil
@@ -55,6 +58,7 @@ class AppVersionTest < Test::Unit::TestCase
55
58
 
56
59
  version = App::Version.parse '1.2.1'
57
60
  @version.patch = 1
61
+ @version.meta = nil
58
62
  @version.branch = nil
59
63
  @version.committer = nil
60
64
  @version.build_date = nil
@@ -68,6 +72,7 @@ class AppVersionTest < Test::Unit::TestCase
68
72
  @version.build = 6
69
73
  @version.branch = 'branch'
70
74
  @version.committer = 'coder'
75
+ @version.meta = nil
71
76
  @version.build_date = Date.civil(2008, 10, 31)
72
77
  assert_raises(ArgumentError) { App::Version.parse 'This is not a valid version' }
73
78
  end
@@ -76,6 +81,7 @@ class AppVersionTest < Test::Unit::TestCase
76
81
  version = App::Version.new :major => 1,
77
82
  :minor => 2,
78
83
  :patch => 3,
84
+ :meta => "rc.1",
79
85
  :milestone => 4,
80
86
  :build => 500,
81
87
  :branch => 'master',
@@ -88,6 +94,7 @@ class AppVersionTest < Test::Unit::TestCase
88
94
  version = App::Version.new 'major' => 1,
89
95
  'minor' => 2,
90
96
  'patch' => 3,
97
+ 'meta' => "rc.1",
91
98
  'milestone' => 4,
92
99
  'build' => 500,
93
100
  'branch' => 'master',
@@ -100,6 +107,7 @@ class AppVersionTest < Test::Unit::TestCase
100
107
  version = App::Version.new :major => '1',
101
108
  :minor => '2',
102
109
  :patch => '3',
110
+ :meta => 'rc.1',
103
111
  :milestone => '4',
104
112
  :build => '500',
105
113
  :branch => 'master',
@@ -112,6 +120,7 @@ class AppVersionTest < Test::Unit::TestCase
112
120
  version = App::Version.new 'major' => '1',
113
121
  'minor' => '2',
114
122
  'patch' => '3',
123
+ 'meta' => 'rc.1',
115
124
  'milestone' => '4',
116
125
  'build' => '500',
117
126
  'branch' => 'master',
@@ -125,12 +134,13 @@ class AppVersionTest < Test::Unit::TestCase
125
134
  version = App::Version.new :major => '1',
126
135
  :minor => '2',
127
136
  :patch => '3',
137
+ :meta => 'rc.1',
128
138
  :milestone => '4',
129
139
  :build => '500',
130
140
  :branch => 'master',
131
141
  :committer => 'coder',
132
142
  :build_date => '12wtf34'
133
- assert_not_equal @version, version
143
+ assert @version != version
134
144
  end
135
145
 
136
146
  def test_should_raise_when_major_is_missing
@@ -152,6 +162,7 @@ class AppVersionTest < Test::Unit::TestCase
152
162
  @version.milestone = nil
153
163
  @version.build = nil
154
164
  @version.branch = nil
165
+ @version.meta = nil
155
166
  @version.committer = nil
156
167
  @version.build_date = nil
157
168
  assert_equal @version, version
@@ -203,62 +214,62 @@ class AppVersionTest < Test::Unit::TestCase
203
214
  end
204
215
 
205
216
  def test_to_s
206
- assert_equal '1.2.3 M4 (500) of master by coder on 2008-10-27', @version.to_s
217
+ assert_equal '1.2.3-rc.1 M4 (500) of master by coder on 2008-10-27', @version.to_s
207
218
  end
208
219
 
209
220
  def test_to_s_with_no_milestone
210
221
  @version.milestone = nil
211
- assert_equal '1.2.3 (500) of master by coder on 2008-10-27', @version.to_s
222
+ assert_equal '1.2.3-rc.1 (500) of master by coder on 2008-10-27', @version.to_s
212
223
  end
213
224
 
214
225
  def test_to_s_with_no_build
215
226
  @version.build = nil
216
- assert_equal '1.2.3 M4 of master by coder on 2008-10-27', @version.to_s
227
+ assert_equal '1.2.3-rc.1 M4 of master by coder on 2008-10-27', @version.to_s
217
228
  end
218
229
 
219
230
  def test_to_s_with_no_patch
220
231
  @version.patch = nil
221
- assert_equal '1.2 M4 (500) of master by coder on 2008-10-27', @version.to_s
232
+ assert_equal '1.2-rc.1 M4 (500) of master by coder on 2008-10-27', @version.to_s
222
233
  end
223
234
 
224
235
  def test_to_s_with_no_build_or_milestone
225
236
  @version.milestone = nil
226
237
  @version.build = nil
227
- assert_equal '1.2.3 of master by coder on 2008-10-27', @version.to_s
238
+ assert_equal '1.2.3-rc.1 of master by coder on 2008-10-27', @version.to_s
228
239
  end
229
240
 
230
241
  def test_to_s_with_no_branch
231
242
  @version.branch = nil
232
- assert_equal '1.2.3 M4 (500) by coder on 2008-10-27', @version.to_s
243
+ assert_equal '1.2.3-rc.1 M4 (500) by coder on 2008-10-27', @version.to_s
233
244
  end
234
245
 
235
246
  def test_to_s_with_no_committer
236
247
  @version.committer = nil
237
- assert_equal '1.2.3 M4 (500) of master on 2008-10-27', @version.to_s
248
+ assert_equal '1.2.3-rc.1 M4 (500) of master on 2008-10-27', @version.to_s
238
249
  end
239
250
 
240
251
  def test_to_s_with_no_build_date
241
252
  @version.build_date = nil
242
- assert_equal '1.2.3 M4 (500) of master by coder', @version.to_s
253
+ assert_equal '1.2.3-rc.1 M4 (500) of master by coder', @version.to_s
243
254
  end
244
255
 
245
256
  def test_to_s_with_no_branch_or_committer
246
257
  @version.branch = nil
247
258
  @version.committer = nil
248
- assert_equal '1.2.3 M4 (500) on 2008-10-27', @version.to_s
259
+ assert_equal '1.2.3-rc.1 M4 (500) on 2008-10-27', @version.to_s
249
260
  end
250
261
 
251
262
  def test_to_s_with_no_committer_or_build_date
252
263
  @version.committer = nil
253
264
  @version.build_date = nil
254
- assert_equal '1.2.3 M4 (500) of master', @version.to_s
265
+ assert_equal '1.2.3-rc.1 M4 (500) of master', @version.to_s
255
266
  end
256
267
 
257
268
  def test_to_s_with_no_build_date_or_committer_or_build_date
258
269
  @version.branch = nil
259
270
  @version.committer = nil
260
271
  @version.build_date = nil
261
- assert_equal '1.2.3 M4 (500)', @version.to_s
272
+ assert_equal '1.2.3-rc.1 M4 (500)', @version.to_s
262
273
  end
263
274
 
264
275
  def test_version_with_leading_zeros
data/test/version.yml CHANGED
@@ -2,6 +2,7 @@
2
2
  major: 1
3
3
  minor: 2
4
4
  patch: 3
5
+ meta: 'rc.1'
5
6
  milestone: 4
6
7
  build: 500
7
8
  branch: master
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
5
- prerelease:
4
+ version: 0.1.8
6
5
  platform: ruby
7
6
  authors:
8
7
  - Stephen Kapp
@@ -10,22 +9,20 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2014-01-23 00:00:00.000000000 Z
12
+ date: 2015-06-05 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rails
17
16
  requirement: !ruby/object:Gem::Requirement
18
- none: false
19
17
  requirements:
20
- - - ! '>='
18
+ - - ">="
21
19
  - !ruby/object:Gem::Version
22
20
  version: 3.2.8
23
21
  type: :runtime
24
22
  prerelease: false
25
23
  version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
24
  requirements:
28
- - - ! '>='
25
+ - - ">="
29
26
  - !ruby/object:Gem::Version
30
27
  version: 3.2.8
31
28
  description: App Version Gem originally App Version Rails Plugin from https://github.com/toland/app_version,
@@ -37,41 +34,40 @@ executables: []
37
34
  extensions: []
38
35
  extra_rdoc_files: []
39
36
  files:
37
+ - README.md
38
+ - Rakefile
39
+ - lib/app_version.rb
40
40
  - lib/app_version/app_version.rb
41
41
  - lib/app_version/railtie.rb
42
42
  - lib/app_version/templates/version.yml
43
43
  - lib/app_version/templates/version.yml.erb
44
- - lib/app_version.rb
45
44
  - lib/install.rb
46
45
  - lib/tasks/app_version_tasks.rake
47
46
  - lib/uninstall.rb
48
- - Rakefile
49
- - README.md
50
47
  - test/app_version_test.rb
51
48
  - test/version.yml
52
49
  homepage: https://github.com/mort666/app_version
53
50
  licenses: []
51
+ metadata: {}
54
52
  post_install_message:
55
53
  rdoc_options: []
56
54
  require_paths:
57
55
  - lib
58
56
  required_ruby_version: !ruby/object:Gem::Requirement
59
- none: false
60
57
  requirements:
61
- - - ! '>='
58
+ - - ">="
62
59
  - !ruby/object:Gem::Version
63
60
  version: '0'
64
61
  required_rubygems_version: !ruby/object:Gem::Requirement
65
- none: false
66
62
  requirements:
67
- - - ! '>='
63
+ - - ">="
68
64
  - !ruby/object:Gem::Version
69
65
  version: '0'
70
66
  requirements: []
71
67
  rubyforge_project:
72
- rubygems_version: 1.8.25
68
+ rubygems_version: 2.2.2
73
69
  signing_key:
74
- specification_version: 3
70
+ specification_version: 4
75
71
  summary: Rails App Version Gem
76
72
  test_files:
77
73
  - test/app_version_test.rb