app_version 0.1.16 → 0.2.00

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f878612bbaafcf0f701d81d5569c57e74206f81
4
- data.tar.gz: 7d122158ffd812c837cc61691b6d99e233efee51
3
+ metadata.gz: 8274a73f4258a9ec0e34b69cf723f78878ae4b83
4
+ data.tar.gz: c25c195c0d0cc8a52907836bc6f9b65e9118ccba
5
5
  SHA512:
6
- metadata.gz: 3246346ade23713c0523396d32bf296cb64ad50d714dca645df90cf6acaf1d3537244b5783f54ab6bdb7b89b21527acca428c824b3b17bf516a9b8a9d5599357
7
- data.tar.gz: a2f238894c3d7dd5d9f2118fd3656dca6adee8d5c6197e8347c5d8cc345241e160e97a9e8e7c5caa38eafaf1f66ee9826ea902d2daae396413609409530fd899
6
+ metadata.gz: f027e97544deef0b98c0a14e3b7e424a290445f2ad4baacdfb75e88b9d22810af0b187dac3e798a67c0bd5ee288c68e56dc3a40aa2617e5af6a433157bbf8c5d
7
+ data.tar.gz: 66dda170bbe21edd69ed7232d1bbc73060644ca981edce0d7f328b297f1d7a95075fe156c62a321ebc4a64500faae8b24e1675c60ef9b67bd2b95c58d20ead7b
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## App Version
2
2
 
3
- [![Build Status](https://travis-ci.org/mort666/app_version.png?branch=master)](https://travis-ci.org/mort666/app_version)
3
+ [![CircleCI](https://circleci.com/gh/mort666/app_version.svg?style=svg)](https://circleci.com/gh/mort666/app_version)
4
4
 
5
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
 
@@ -63,6 +63,9 @@ The plugin creates a constant `APP_VERSION` that contains the version number of
63
63
 
64
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.
65
65
 
66
+ There is a default format and a "semantic versioning" format to use. The semantic versioning format follows: http://semver.org/ as guidelines.
67
+
68
+
66
69
  ### Capistrano Usage
67
70
 
68
71
  When the app_version plugin is installed, it copies a templated edition of the version.yml file into /lib/templates/version.yml.erb, the initial file shows a tag for retrieving the revision count with git. It also shows displaying the branch as specified with "set :branch" in your capistrano deploy.rb, see the comments in the erb file for more nifty tricks.
@@ -32,6 +32,7 @@ module App
32
32
  end
33
33
  end
34
34
 
35
+
35
36
  # Creates a new instance of the Version class using information in the passed
36
37
  # Hash to construct the version number.
37
38
  #
@@ -135,13 +136,21 @@ module App
135
136
  0
136
137
  end
137
138
 
139
+ def sem_ver_format
140
+ @@sem_ver_format = "#{major}.#{minor}"
141
+ @@sem_ver_format << ".#{patch}" unless patch.blank?
142
+ @@sem_ver_format << "-#{meta}" unless meta.blank?
143
+ @@sem_ver_format << "+#{build}" unless build.blank?
144
+ @@sem_ver_format
145
+ end
146
+
138
147
  #
139
148
  # Generate version string
140
149
  #
141
150
  # @return [String] Returns App Version string
142
151
  #
143
152
  def to_s
144
- if @format
153
+ if defined? @format
145
154
  str = eval(@format.to_s.inspect)
146
155
  else
147
156
  str = "#{major}.#{minor}"
@@ -281,4 +281,52 @@ class AppVersionTest < MiniTest::Test
281
281
  assert_equal '4a', version.minor
282
282
  assert_equal '2010.4a', version.to_s
283
283
  end
284
+
285
+ # see http://semver.org/ for specification
286
+
287
+ def test_semver_format
288
+ App::Version.respond_to? :sem_ver_format
289
+ end
290
+
291
+ # see http://semver.org/#spec-item-2
292
+ def test_to_s_with_semver_format_with_no_build_or_milestone_or_meta
293
+ @version.milestone = nil
294
+ @version.build = nil
295
+ @version.meta = nil
296
+ @version.format = @version.sem_ver_format
297
+ assert(@version.major.to_i >= 0)
298
+ assert(@version.minor.to_i >= 0)
299
+ assert(@version.patch.to_i >= 0) if defined? @version.patch
300
+
301
+ assert_equal '1.2.3', @version.to_s
302
+ end
303
+
304
+ # see http://semver.org/#spec-item-9
305
+ def test_to_s_with_semver_format_with_no_build_or_milestone
306
+ @version.milestone = nil
307
+ @version.build = nil
308
+ @version.meta = 'rc.1'
309
+ @version.format = @version.sem_ver_format
310
+ assert(@version.major.to_i >= 0)
311
+ assert(@version.minor.to_i >= 0)
312
+ assert(@version.patch.to_i >= 0) if defined? @version.patch
313
+ assert(/[[:alnum:]\-.]*/ =~ @version.meta) if defined? @version.meta
314
+
315
+ assert_equal '1.2.3-rc.1', @version.to_s
316
+ end
317
+
318
+ # see http://semver.org/#spec-item-10
319
+ def test_to_s_with_semver_format_with_no_milestone_or_meta
320
+ @version.milestone = nil
321
+ @version.build = '20161231'
322
+ @version.format = @version.sem_ver_format
323
+ assert(@version.major.to_i >= 0)
324
+ assert(@version.minor.to_i >= 0)
325
+ assert(@version.patch.to_i >= 0) if defined? @version.patch
326
+ assert(/[[:alnum:]\-.]*/ =~ @version.build) if defined? @version.build
327
+
328
+ assert_equal '1.2.3-rc.1+20161231', @version.to_s
329
+ end
330
+
331
+
284
332
  end
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_version
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.16
4
+ version: 0.2.00
5
5
  platform: ruby
6
6
  authors:
7
+ - Scott Curry
7
8
  - Stephen Kapp
8
9
  - Phillip Toland
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2016-08-17 00:00:00.000000000 Z
13
+ date: 2016-12-27 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: rails
@@ -26,8 +27,10 @@ dependencies:
26
27
  - !ruby/object:Gem::Version
27
28
  version: '4.2'
28
29
  description: App Version Gem originally App Version Rails Plugin from https://github.com/toland/app_version,
29
- updated to run with later rails versions as a gem, currently supports Rails 4.2.x.
30
+ updated to run in CI server and with later rails versions as a gem, currently supports
31
+ Rails 4.2.x.
30
32
  email:
33
+ - coder.scottcurry.com
31
34
  - mort666@virus.org
32
35
  - phil.toland@gmail.com
33
36
  executables: []
@@ -47,7 +50,7 @@ files:
47
50
  - test/app_version_test.rb
48
51
  - test/test_helper.rb
49
52
  - test/version.yml
50
- homepage: https://github.com/mort666/app_version
53
+ homepage: https://github.com/scurry/app_version
51
54
  licenses: []
52
55
  metadata: {}
53
56
  post_install_message:
@@ -74,3 +77,4 @@ test_files:
74
77
  - test/app_version_test.rb
75
78
  - test/test_helper.rb
76
79
  - test/version.yml
80
+ has_rdoc: