build_number 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.semver +1 -1
- data/lib/build_number.rb +6 -0
- data/lib/build_number/version.rb +1 -1
- data/spec/build_number_spec.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ODFmM2Y1NmZlNzU5NzI4YmI4OTgwMmJjODg2OWY0OWFhOGYyOGU1MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NmYyZDhhNjEyZDc1ZTQ3NDAxNmNhNWVkZDc1YmMwNGEyYTYzZjkwZg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmIxODY2MzEzN2ZjYTc1MzNiYTg0ZWEzMjFiMTg1ZGFiMDc2YTI3YjAxN2Ni
|
10
|
+
MjQ0ODhkMTA1ZGM5MTM3YTMwMWYxMjZlMTRiMmYyYWNjZGNkNmNkM2E0MjBk
|
11
|
+
N2E1MzIyN2VmOTI0ZjU0ZGZjODJjM2Q0NGE0ZDNkMDRlOGE0YjY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
Y2NhNmNkYjIwMmMwNmQ1YWQxMjI2NDI4ODBiY2IyODczYjE4YTgyZTZkYzA2
|
14
|
+
YTEzODU0NDI1OTUyOWZkMTQ3ODI5ZjJkODQ3NjNkYmM1YTFmYmUxNTRlMDM4
|
15
|
+
ODg3M2U2NDQ4YTE5MTFhZmExY2IwNDU3NTAxOGZhODc4MjRlOGQ=
|
data/.semver
CHANGED
data/lib/build_number.rb
CHANGED
@@ -15,6 +15,12 @@ module BuildNumber
|
|
15
15
|
ENV[env_var_name]
|
16
16
|
end
|
17
17
|
|
18
|
+
# Returns the next build number without incrementing it.
|
19
|
+
def self.next(dir=nil)
|
20
|
+
file = find_or_create_file dir
|
21
|
+
@next ||= read(file)
|
22
|
+
end
|
23
|
+
|
18
24
|
# Reads and increments the value in the storage file. Returns the
|
19
25
|
# current build number.
|
20
26
|
def self.increment(dir=nil)
|
data/lib/build_number/version.rb
CHANGED
data/spec/build_number_spec.rb
CHANGED
@@ -65,6 +65,12 @@ describe BuildNumber do
|
|
65
65
|
BuildNumber.current(tmp_dir).should eq(build_number.to_s)
|
66
66
|
BuildNumber.read(path).should eq(build_number + 1)
|
67
67
|
end
|
68
|
+
|
69
|
+
it 'should read but not increment the number when calling next' do
|
70
|
+
next_build_number = BuildNumber.next tmp_dir
|
71
|
+
build_number.should eq(next_build_number)
|
72
|
+
BuildNumber.read(path).should eq(next_build_number)
|
73
|
+
end
|
68
74
|
end
|
69
75
|
|
70
76
|
describe 'when using a custom env var name' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: build_number
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Scaduto
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|