build_integer 0.1.0
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 +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +56 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/build_integer.gemspec +27 -0
- data/lib/build_integer.rb +53 -0
- data/lib/build_integer/version.rb +3 -0
- metadata +114 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c2ba20e6990c81cffc54c19552670a9a6fe78e06
|
4
|
+
data.tar.gz: 1e514f3da375ab9792d2b64f99b17fcf16cd72b5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9a7974b5049c0c384e032fb1c91f86321f95b19b6d9cc8bb1a2cfc1565598005e90bc939fcb7164fee7108e57ce3957cbc3e2ee8a805185b3cde7242ccc73cbc
|
7
|
+
data.tar.gz: 12f37dd29e9434bc9388adc39b0d0bea8d536fb3a918d0c4bb3a8c4a5a48b445daec6354a00d7cbdfce328f1983e8b3dec3e90cf9f2cbec5d053cb1187be3a60
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 David Hooper
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
[](https://travis-ci.org/ModHub/build_integer)
|
2
|
+
# BuildInteger
|
3
|
+
|
4
|
+
Tracks the current build count with a .build-number file.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'build_integer'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install build_integer
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
# start
|
26
|
+
BuildInteger.find # finds or creates a .build-number file and returns the current build number
|
27
|
+
# > 10
|
28
|
+
BuildInteger.increment # increases the number by 1
|
29
|
+
# > 11
|
30
|
+
BuildInteger.decrement # decreases the number by 1
|
31
|
+
# > 10
|
32
|
+
BuildInteger.set 5 # set the build number to 5
|
33
|
+
# > 5
|
34
|
+
BuildInteger.current # returns the current build number
|
35
|
+
# > 5
|
36
|
+
BuildInteger.reset # sets the build number to 10
|
37
|
+
# > 0
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
## Development
|
42
|
+
|
43
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
44
|
+
|
45
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork repository
|
50
|
+
2. Make your changes
|
51
|
+
3. write some tests
|
52
|
+
4. Send a PR
|
53
|
+
|
54
|
+
## License
|
55
|
+
|
56
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "build_integer"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'build_integer/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "build_integer"
|
8
|
+
spec.version = BuildInteger::VERSION
|
9
|
+
spec.authors = ["David Hooper"]
|
10
|
+
spec.email = ["davidhooper94@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = "Tracks a build number in a .build-number file in your repository"
|
13
|
+
spec.description = "Helps you keep track of the current build number by
|
14
|
+
keeping a .build-number file in your repository."
|
15
|
+
spec.homepage = "https://github.com/ModHub/build_integer"
|
16
|
+
spec.license = "MIT"
|
17
|
+
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "exe"
|
20
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
|
23
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
24
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
26
|
+
spec.add_development_dependency "fakefs"
|
27
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
require "build_integer/version"
|
2
|
+
|
3
|
+
module BuildInteger
|
4
|
+
BUILD_NUMBER_FILE_NAME = ".build-number"
|
5
|
+
@@current_build_number = 0
|
6
|
+
|
7
|
+
def self.find
|
8
|
+
read_or_create
|
9
|
+
@@current_build_number
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.current
|
13
|
+
@@current_build_number
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.increment
|
17
|
+
@@current_build_number += 1
|
18
|
+
write_file
|
19
|
+
@@current_build_number
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.decrement
|
23
|
+
@@current_build_number -= 1
|
24
|
+
write_file
|
25
|
+
@@current_build_number
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.set_build_number(build_number)
|
29
|
+
@@current_build_number = build_number
|
30
|
+
write_file
|
31
|
+
@@current_build_number
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.reset
|
35
|
+
@@current_build_number = 0
|
36
|
+
write_file
|
37
|
+
@@current_build_number
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def self.read_or_create
|
42
|
+
if File.exists?(BUILD_NUMBER_FILE_NAME)
|
43
|
+
@@current_build_number = File.read(BUILD_NUMBER_FILE_NAME).to_i
|
44
|
+
else
|
45
|
+
write_file
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.write_file
|
50
|
+
File.write BUILD_NUMBER_FILE_NAME, @@current_build_number.to_s
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
metadata
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: build_integer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Hooper
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-05-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: fakefs
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: |-
|
70
|
+
Helps you keep track of the current build number by
|
71
|
+
keeping a .build-number file in your repository.
|
72
|
+
email:
|
73
|
+
- davidhooper94@gmail.com
|
74
|
+
executables: []
|
75
|
+
extensions: []
|
76
|
+
extra_rdoc_files: []
|
77
|
+
files:
|
78
|
+
- ".gitignore"
|
79
|
+
- ".rspec"
|
80
|
+
- ".travis.yml"
|
81
|
+
- Gemfile
|
82
|
+
- LICENSE.txt
|
83
|
+
- README.md
|
84
|
+
- Rakefile
|
85
|
+
- bin/console
|
86
|
+
- bin/setup
|
87
|
+
- build_integer.gemspec
|
88
|
+
- lib/build_integer.rb
|
89
|
+
- lib/build_integer/version.rb
|
90
|
+
homepage: https://github.com/ModHub/build_integer
|
91
|
+
licenses:
|
92
|
+
- MIT
|
93
|
+
metadata: {}
|
94
|
+
post_install_message:
|
95
|
+
rdoc_options: []
|
96
|
+
require_paths:
|
97
|
+
- lib
|
98
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ">="
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
requirements: []
|
109
|
+
rubyforge_project:
|
110
|
+
rubygems_version: 2.4.5.1
|
111
|
+
signing_key:
|
112
|
+
specification_version: 4
|
113
|
+
summary: Tracks a build number in a .build-number file in your repository
|
114
|
+
test_files: []
|