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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzI4MTY2MTg1OGJmNDZkZjZjZjk0YjYxZTA3YTc2NDE3ZDQzOGFiOQ==
4
+ ODFmM2Y1NmZlNzU5NzI4YmI4OTgwMmJjODg2OWY0OWFhOGYyOGU1MQ==
5
5
  data.tar.gz: !binary |-
6
- NTAwOGU4MTdiNzg3OTdiMTVhMjU3NDg0ZDYyMTVkMzFmM2ZkOGRmYg==
6
+ NmYyZDhhNjEyZDc1ZTQ3NDAxNmNhNWVkZDc1YmMwNGEyYTYzZjkwZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MWI1YzVlZDUzZjI4OTFjMjZmMWZiYjQ3YWU3MmRhYzk4ZGU5M2VmMTc2NWZi
10
- NTNkYTdhMTMyZDFmODI2NDgxOThlM2ZlN2U2NjdiNTRjZDI3MDZhNDA5ZDM1
11
- NWY4MmYwOWNlZjE5ZDY1MWQ1MTNjZTc2M2M0NzZiZjhkNzdjZDM=
9
+ YmIxODY2MzEzN2ZjYTc1MzNiYTg0ZWEzMjFiMTg1ZGFiMDc2YTI3YjAxN2Ni
10
+ MjQ0ODhkMTA1ZGM5MTM3YTMwMWYxMjZlMTRiMmYyYWNjZGNkNmNkM2E0MjBk
11
+ N2E1MzIyN2VmOTI0ZjU0ZGZjODJjM2Q0NGE0ZDNkMDRlOGE0YjY=
12
12
  data.tar.gz: !binary |-
13
- NTFjOWYzYmRmYzRlYzljOTI5NWY0NmM5ZjI0N2U1M2RiMmVkMTU5MDI3YTZh
14
- Mzc2MjY4YTlhMjBhNDZjNDBhY2U1MjFkOWRlMzkxZGY0NjM2ZTA3ZWFlYzJl
15
- MzI5MDRlYWQyMGVjMmYyOTRlMDg0ZWZhNjBmMjViZGVlM2NkZDg=
13
+ Y2NhNmNkYjIwMmMwNmQ1YWQxMjI2NDI4ODBiY2IyODczYjE4YTgyZTZkYzA2
14
+ YTEzODU0NDI1OTUyOWZkMTQ3ODI5ZjJkODQ3NjNkYmM1YTFmYmUxNTRlMDM4
15
+ ODg3M2U2NDQ4YTE5MTFhZmExY2IwNDU3NTAxOGZhODc4MjRlOGQ=
data/.semver CHANGED
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 1
4
- :patch: 2
4
+ :patch: 3
5
5
  :special: ''
6
6
  :metadata: ''
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)
@@ -1,3 +1,3 @@
1
1
  module BuildNumber
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -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.2
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-09-25 00:00:00.000000000 Z
11
+ date: 2014-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler