app_version_tasks 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/.codeclimate.yml +32 -0
- data/.gitignore +12 -0
- data/.rspec +2 -0
- data/.rubocop.yml +1 -0
- data/.rubocop_todo.yml +43 -0
- data/.todo.reek +17 -0
- data/.travis.yml +10 -0
- data/Gemfile +4 -0
- data/LICENSE +13 -0
- data/README.md +121 -0
- data/Rakefile +6 -0
- data/app_version_tasks.gemspec +42 -0
- data/config/.keep +0 -0
- data/lib/app_version_tasks/configuration.rb +46 -0
- data/lib/app_version_tasks/semantic_version.rb +118 -0
- data/lib/app_version_tasks/semantic_version_file.rb +58 -0
- data/lib/app_version_tasks/version.rb +3 -0
- data/lib/app_version_tasks.rb +23 -0
- data/lib/tasks/app_version_tasks.rake +34 -0
- metadata +292 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0b3242a986b7518363aa51e7ce4e69ac5a0bfc16
|
4
|
+
data.tar.gz: 5a650c4939439f11a1da7e804c5a671016b1f88e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 16d7f23c235f4e8351d7c3ae3958efe1b8af19436bb0be705da165a7d258a09a4e177432958d1d591b5fabb9ecfe08b217cb2fb9af26617dd6548592c853161e
|
7
|
+
data.tar.gz: 38adfc8012d670761b9687ef40047e8474e8b1257628eed5291fdf492e7d406802c1d27bf6fe3992793c64fdbf522dbb49bd893a5933993756fa3a0437ee1be8
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
engines:
|
2
|
+
brakeman:
|
3
|
+
enabled: false
|
4
|
+
bundler-audit:
|
5
|
+
enabled: true
|
6
|
+
csslint:
|
7
|
+
enabled: false
|
8
|
+
duplication:
|
9
|
+
enabled: true
|
10
|
+
config:
|
11
|
+
languages:
|
12
|
+
- ruby
|
13
|
+
fixme:
|
14
|
+
enabled: true
|
15
|
+
reek:
|
16
|
+
enabled: true
|
17
|
+
rubocop:
|
18
|
+
enabled: true
|
19
|
+
ratings:
|
20
|
+
paths:
|
21
|
+
- Gemfile.lock
|
22
|
+
- "**.rb"
|
23
|
+
- "**.rake"
|
24
|
+
exclude_paths:
|
25
|
+
- .binstubs/
|
26
|
+
- .bundle/
|
27
|
+
- .gems/
|
28
|
+
- .git/
|
29
|
+
- bin/
|
30
|
+
- coverage/
|
31
|
+
- pkg/
|
32
|
+
- spec/
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-09-20 11:58:49 -0700 using RuboCop version 0.42.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
Metrics/AbcSize:
|
11
|
+
Max: 20
|
12
|
+
|
13
|
+
# Offense count: 3
|
14
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
15
|
+
# URISchemes: http, https
|
16
|
+
Metrics/LineLength:
|
17
|
+
Max: 96
|
18
|
+
|
19
|
+
# Offense count: 1
|
20
|
+
Style/AccessorMethodName:
|
21
|
+
Exclude:
|
22
|
+
- 'lib/app_version_tasks/configuration.rb'
|
23
|
+
|
24
|
+
# Offense count: 5
|
25
|
+
# Cop supports --auto-correct.
|
26
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
27
|
+
# SupportedStyles: normal, rails
|
28
|
+
Style/IndentationConsistency:
|
29
|
+
Exclude:
|
30
|
+
- 'lib/app_version_tasks/configuration.rb'
|
31
|
+
- 'lib/app_version_tasks/semantic_version_file.rb'
|
32
|
+
|
33
|
+
# Offense count: 1
|
34
|
+
# Cop supports --auto-correct.
|
35
|
+
Style/MutableConstant:
|
36
|
+
Exclude:
|
37
|
+
- 'lib/app_version_tasks/version.rb'
|
38
|
+
|
39
|
+
# Offense count: 1
|
40
|
+
# Cop supports --auto-correct.
|
41
|
+
Style/RescueModifier:
|
42
|
+
Exclude:
|
43
|
+
- 'lib/app_version_tasks/configuration.rb'
|
data/.todo.reek
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
---
|
2
|
+
ControlParameter:
|
3
|
+
exclude:
|
4
|
+
- AppVersionTasks::Configuration#application_name=
|
5
|
+
- AppVersionTasks::Configuration#git_working_directory=
|
6
|
+
- AppVersionTasks::Configuration#version_file_path=
|
7
|
+
UtilityFunction:
|
8
|
+
exclude:
|
9
|
+
- AppVersionTasks::Configuration#default_root_path
|
10
|
+
- AppVersionTasks::SemanticVersionFile#path
|
11
|
+
- AppVersionTasks::SemanticVersionFile#version_template
|
12
|
+
NilCheck:
|
13
|
+
exclude:
|
14
|
+
- AppVersionTasks::SemanticVersion#git_release_branch?
|
15
|
+
TooManyMethods:
|
16
|
+
exclude:
|
17
|
+
- AppVersionTasks::SemanticVersion
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright 2016 The Board of Trustees of the Leland Stanford Junior University.
|
2
|
+
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
|
+
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
|
2
|
+
[](https://travis-ci.org/sul-dlss/app_version_tasks) [](https://codeclimate.com/github/sul-dlss/app_version_tasks) [](https://codeclimate.com/github/sul-dlss/app_version_tasks/coverage) [](https://codeclimate.com/github/sul-dlss/app_version_tasks) [](http://inch-ci.org/github/sul-dlss/app_version_tasks)
|
3
|
+
|
4
|
+
# AppVersionTasks
|
5
|
+
|
6
|
+
Rake tasks for application semantic version and release management. Inspired by:
|
7
|
+
|
8
|
+
- https://github.com/nilbus/rails-app-versioning
|
9
|
+
- http://stackoverflow.com/questions/11199553/where-to-define-rails-apps-version-number
|
10
|
+
|
11
|
+
## Installation
|
12
|
+
|
13
|
+
Add this line to your application's Gemfile:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'app_version_tasks'
|
17
|
+
```
|
18
|
+
|
19
|
+
And then execute:
|
20
|
+
|
21
|
+
$ bundle
|
22
|
+
|
23
|
+
Or install it yourself as:
|
24
|
+
|
25
|
+
$ gem install app_version_tasks
|
26
|
+
|
27
|
+
## Configuration
|
28
|
+
|
29
|
+
In the `Rakefile` for the project, load and configure with this snippet:
|
30
|
+
|
31
|
+
spec = Gem::Specification.find_by_name 'app_version_tasks'
|
32
|
+
load "#{spec.gem_dir}/lib/tasks/app_version_tasks.rake"
|
33
|
+
|
34
|
+
require 'app_version_tasks'
|
35
|
+
AppVersionTasks.configure do |config|
|
36
|
+
# the following settings are the defaults
|
37
|
+
config.application_name = Rails.application.class.parent_name
|
38
|
+
config.version_file_path = File.join(Rails.root, 'config', 'version.rb')
|
39
|
+
config.git_working_directory = Rails.root.to_s
|
40
|
+
end
|
41
|
+
|
42
|
+
Each of the rake tasks that bump the semantic version will modify an
|
43
|
+
application version file; by default, the template for that file looks
|
44
|
+
like this:
|
45
|
+
|
46
|
+
# Rails.root/config/version.rb
|
47
|
+
module #{Rails.application.class.parent_name}
|
48
|
+
class Application
|
49
|
+
VERSION = '0.0.0'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
If the version file does not exist, it will be created automatically from
|
54
|
+
that template. If it exists already, it is assumed that it contains a
|
55
|
+
single quoted string matching the regex pattern: /'\d+\.\d+\.\d+'/
|
56
|
+
|
57
|
+
The default version_file_path is `Rails.root/config/version.rb`, but that can
|
58
|
+
be configured (see above). When the default location is used, the version file
|
59
|
+
can be included in the `config/application.rb` using:
|
60
|
+
|
61
|
+
# Rails.root/config/application.rb
|
62
|
+
require_relative 'version'
|
63
|
+
|
64
|
+
If a different version file is used and it does not contain the structure above,
|
65
|
+
it might work with this gem. The code in this gem simply assumes the version file
|
66
|
+
contains a semantic version surrounded by single quotes, e.g. `'x.y.z'`, where
|
67
|
+
the single quotes around the version string are an important assumption.
|
68
|
+
|
69
|
+
## Usage
|
70
|
+
|
71
|
+
`rake -T` should include these version tasks:
|
72
|
+
|
73
|
+
version:bump:major - bump and commit the major version (x in x.0.0)
|
74
|
+
- resets the minor and patch versions to zero
|
75
|
+
- does not push the local workspace to 'origin'
|
76
|
+
version:bump:minor - bump and commit the minor version (y in x.y.0)
|
77
|
+
- resets the patch version to zero
|
78
|
+
- does not push the local workspace to 'origin'
|
79
|
+
version:bump:patch - bump and commit the patch version (z in x.y.z)
|
80
|
+
- does not push the local workspace to 'origin'
|
81
|
+
version:current - the current version
|
82
|
+
version:release - tag and push the current version
|
83
|
+
- pushes to 'origin/{current_branch}'
|
84
|
+
|
85
|
+
#### Report the current version
|
86
|
+
|
87
|
+
bundle exec rake version:current
|
88
|
+
|
89
|
+
#### Bump and commit a patch version
|
90
|
+
|
91
|
+
# Example: 0.0.0 moves to 0.0.1
|
92
|
+
# Example: 1.1.1 moves to 1.1.2
|
93
|
+
bundle exec rake version:bump:patch
|
94
|
+
|
95
|
+
#### Bump and commit a minor version
|
96
|
+
|
97
|
+
# Example: 0.0.1 moves to 0.1.0
|
98
|
+
# Example: 1.1.2 moves to 1.2.0
|
99
|
+
bundle exec rake version:bump:minor
|
100
|
+
|
101
|
+
#### Bump and commit a major version
|
102
|
+
|
103
|
+
# Example: 0.1.0 moves to 1.0.0
|
104
|
+
# Example: 1.2.0 moves to 2.0.0
|
105
|
+
bundle exec rake version:bump:major
|
106
|
+
|
107
|
+
#### Tag and push the current version
|
108
|
+
|
109
|
+
# Example: tag 'v2.0.0' and push to origin
|
110
|
+
bundle exec rake version:release
|
111
|
+
|
112
|
+
## Development
|
113
|
+
|
114
|
+
After checking out the repo, run `./bin/setup` to install dependencies. Then, run `rake` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
115
|
+
|
116
|
+
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).
|
117
|
+
|
118
|
+
## Contributing
|
119
|
+
|
120
|
+
Bug reports and pull requests are welcome on GitHub at
|
121
|
+
https://github.com/sul-dlss/app_version_tasks
|
data/Rakefile
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'app_version_tasks/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'app_version_tasks'
|
8
|
+
spec.version = AppVersionTasks::VERSION
|
9
|
+
spec.authors = ['Darren L. Weber, Ph.D.']
|
10
|
+
spec.email = ['dweber.consulting@gmail.com']
|
11
|
+
|
12
|
+
spec.summary = 'Application version tasks.'
|
13
|
+
spec.description = 'Rake tasks to manage application semantic version.'
|
14
|
+
spec.homepage = 'https://github.com/sul-dlss/app_version_tasks'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |file|
|
17
|
+
file.match(/^(bin|config.ru|Gemfile.lock|spec)/)
|
18
|
+
end
|
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_dependency 'git', '~> 1.3'
|
24
|
+
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.12'
|
26
|
+
spec.add_development_dependency 'pry'
|
27
|
+
spec.add_development_dependency 'pry-doc'
|
28
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'rubocop'
|
31
|
+
spec.add_development_dependency 'rubocop-rspec'
|
32
|
+
spec.add_development_dependency 'yard'
|
33
|
+
|
34
|
+
spec.add_development_dependency 'combustion', '~> 0.5.5'
|
35
|
+
spec.add_development_dependency 'rails', '~> 4.2'
|
36
|
+
spec.add_development_dependency 'rspec-rails', '~> 3.4', '>= 3.4.2'
|
37
|
+
spec.add_development_dependency 'sqlite3'
|
38
|
+
|
39
|
+
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.6'
|
40
|
+
spec.add_development_dependency 'simplecov', '~> 0.12'
|
41
|
+
spec.add_development_dependency 'single_cov', '~> 0.5'
|
42
|
+
end
|
data/config/.keep
ADDED
File without changes
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module AppVersionTasks
|
2
|
+
##
|
3
|
+
# Configuration parameters
|
4
|
+
class Configuration
|
5
|
+
attr_reader :application_name
|
6
|
+
attr_reader :version_file_path
|
7
|
+
attr_reader :git_working_directory
|
8
|
+
|
9
|
+
def initialize(opts = {})
|
10
|
+
self.application_name = opts[:application_name]
|
11
|
+
self.git_working_directory = opts[:git_working_directory]
|
12
|
+
self.version_file_path = opts[:version_file_path]
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param [String] application_name
|
16
|
+
def application_name=(value)
|
17
|
+
@application_name = begin
|
18
|
+
value || Rails.application.class.parent_name
|
19
|
+
rescue
|
20
|
+
'App'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# @param [String] value for the git working directory
|
25
|
+
def git_working_directory=(value)
|
26
|
+
@git_working_directory = value || default_root_path
|
27
|
+
end
|
28
|
+
|
29
|
+
# @param [String] value for the version file path
|
30
|
+
def version_file_path=(value)
|
31
|
+
@version_file_path = value || default_version_path
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# @return [String] path
|
37
|
+
def default_root_path
|
38
|
+
Rails.root.to_s rescue Dir.pwd
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String] path
|
42
|
+
def default_version_path
|
43
|
+
File.join(default_root_path, 'config', 'version.rb')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,118 @@
|
|
1
|
+
require 'git'
|
2
|
+
require_relative 'semantic_version_file'
|
3
|
+
|
4
|
+
module AppVersionTasks
|
5
|
+
# Manage application semantic version
|
6
|
+
class SemanticVersion
|
7
|
+
# Semantic version attributes
|
8
|
+
attr_reader :major, :minor, :patch
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
@version_file = SemanticVersionFile.new
|
12
|
+
@major, @minor, @patch = version_file.version_parts
|
13
|
+
end
|
14
|
+
|
15
|
+
# Bump semantic version category
|
16
|
+
# @param [String|Symbol] category (:major, :minor, :patch)
|
17
|
+
def bump(category)
|
18
|
+
case category.to_sym
|
19
|
+
when :major
|
20
|
+
bump_major
|
21
|
+
when :minor
|
22
|
+
bump_minor
|
23
|
+
when :patch
|
24
|
+
bump_patch
|
25
|
+
end
|
26
|
+
bump_version
|
27
|
+
end
|
28
|
+
|
29
|
+
def release
|
30
|
+
return 'Aborting - checkout correct branch and try again.' unless git_release_branch?
|
31
|
+
git_release
|
32
|
+
end
|
33
|
+
|
34
|
+
def version
|
35
|
+
[major, minor, patch].join('.')
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
attr_accessor :version_file
|
41
|
+
|
42
|
+
# Bump major version
|
43
|
+
def bump_major
|
44
|
+
@major += 1
|
45
|
+
@minor = 0
|
46
|
+
@patch = 0
|
47
|
+
end
|
48
|
+
|
49
|
+
# Bump minor version
|
50
|
+
def bump_minor
|
51
|
+
@minor += 1
|
52
|
+
@patch = 0
|
53
|
+
end
|
54
|
+
|
55
|
+
# Bump patch version
|
56
|
+
def bump_patch
|
57
|
+
@patch += 1
|
58
|
+
end
|
59
|
+
|
60
|
+
# Save bumped version to file and commit
|
61
|
+
def bump_version
|
62
|
+
version_file.write(version)
|
63
|
+
git_commit_version
|
64
|
+
end
|
65
|
+
|
66
|
+
def git
|
67
|
+
@git ||= Git.open(AppVersionTasks.configuration.git_working_directory)
|
68
|
+
end
|
69
|
+
|
70
|
+
def git_commit_version
|
71
|
+
version_file_path = version_file.path
|
72
|
+
return unless git.diff(version_file_path).any?
|
73
|
+
git.add(version_file_path)
|
74
|
+
git.commit("Bump version: #{version}")
|
75
|
+
end
|
76
|
+
|
77
|
+
def git_current_branch
|
78
|
+
git.lib.branch_current
|
79
|
+
end
|
80
|
+
|
81
|
+
def git_release_branch?
|
82
|
+
current_branch = git_current_branch
|
83
|
+
return true if current_branch == 'master'
|
84
|
+
print "Working with current branch [#{current_branch}]. Continue? [y]: "
|
85
|
+
response = $stdin.gets.chomp
|
86
|
+
!response.match(/y/i).nil?
|
87
|
+
end
|
88
|
+
|
89
|
+
def git_release
|
90
|
+
git_pull
|
91
|
+
git_tag_version
|
92
|
+
git_push
|
93
|
+
end
|
94
|
+
|
95
|
+
def git_pull
|
96
|
+
current_branch = git_current_branch
|
97
|
+
puts "Pulling from origin/#{current_branch}"
|
98
|
+
puts git.pull('origin', current_branch)
|
99
|
+
end
|
100
|
+
|
101
|
+
def git_push
|
102
|
+
current_branch = git_current_branch
|
103
|
+
git.push('origin', current_branch)
|
104
|
+
puts "Pushed to origin/#{current_branch}"
|
105
|
+
end
|
106
|
+
|
107
|
+
def git_tag_version
|
108
|
+
git_commit_version
|
109
|
+
tag_msg = "Release #{release_tag}"
|
110
|
+
tag = git.add_tag(release_tag, a: true, m: tag_msg, f: true)
|
111
|
+
puts "Added tag #{tag.name} on commit #{tag.sha}"
|
112
|
+
end
|
113
|
+
|
114
|
+
def release_tag
|
115
|
+
"v#{version}"
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
module AppVersionTasks
|
3
|
+
# Manage application semantic version
|
4
|
+
class SemanticVersionFile
|
5
|
+
def initialize
|
6
|
+
return if File.exist? path
|
7
|
+
File.write(path, version_template)
|
8
|
+
puts "AppVersionTasks: version file created: #{path}"
|
9
|
+
end
|
10
|
+
|
11
|
+
# @see AppVersionTasks.configuration.version_file_path
|
12
|
+
# @return [String] path to version file
|
13
|
+
def path
|
14
|
+
AppVersionTasks.configuration.version_file_path
|
15
|
+
end
|
16
|
+
|
17
|
+
# Rewind and read version file
|
18
|
+
# @return [String] content of version file
|
19
|
+
def read
|
20
|
+
File.read path
|
21
|
+
end
|
22
|
+
|
23
|
+
# Write semantic version to version file, by replacing an existing
|
24
|
+
# 'x.y.z' in the version file with the 'i.j.k' in version parameter
|
25
|
+
# @param [String] version - 'i.j.k'
|
26
|
+
# @return [Integer] string length written to version file
|
27
|
+
def write(version = '0.0.0')
|
28
|
+
ver_data = read.gsub(/'.*'/, "'#{version}'")
|
29
|
+
File.write(path, ver_data)
|
30
|
+
end
|
31
|
+
|
32
|
+
# @return [String] version in version file
|
33
|
+
def version
|
34
|
+
retries ||= 0
|
35
|
+
read.match(/'(.*)'/)[1]
|
36
|
+
rescue
|
37
|
+
retry if (retries += 1) < 3
|
38
|
+
raise 'failed to read and parse version file'
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Array<Integer>] version components [major, minor, patch]
|
42
|
+
def version_parts
|
43
|
+
version.split('.').map(&:to_i)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def version_template
|
49
|
+
<<VERSION_TEMPLATE
|
50
|
+
module #{AppVersionTasks.configuration.application_name}
|
51
|
+
class Application
|
52
|
+
VERSION = '0.0.0'.freeze
|
53
|
+
end
|
54
|
+
end
|
55
|
+
VERSION_TEMPLATE
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'app_version_tasks/version'
|
2
|
+
require 'app_version_tasks/configuration'
|
3
|
+
require 'app_version_tasks/semantic_version'
|
4
|
+
|
5
|
+
# Manage and release application semantic versions
|
6
|
+
module AppVersionTasks
|
7
|
+
# Configuration at the module level
|
8
|
+
class << self
|
9
|
+
attr_reader :configuration
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.configuration
|
13
|
+
@configuration ||= Configuration.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.reset
|
17
|
+
@configuration = Configuration.new
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.configure
|
21
|
+
yield(configuration)
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
|
2
|
+
namespace :version do
|
3
|
+
desc 'report the current version'
|
4
|
+
task current: :environment do
|
5
|
+
ver = AppVersionTasks::SemanticVersion.new
|
6
|
+
puts ver.version
|
7
|
+
end
|
8
|
+
|
9
|
+
desc 'add and push a release tag for the current version'
|
10
|
+
task release: :environment do
|
11
|
+
ver = AppVersionTasks::SemanticVersion.new
|
12
|
+
puts ver.release
|
13
|
+
end
|
14
|
+
|
15
|
+
namespace :bump do
|
16
|
+
desc 'bump and push the major version (x.0.0)'
|
17
|
+
task major: :environment do
|
18
|
+
ver = AppVersionTasks::SemanticVersion.new
|
19
|
+
puts ver.bump(:major)
|
20
|
+
end
|
21
|
+
|
22
|
+
desc 'bump and push the minor version (0.x.0)'
|
23
|
+
task minor: :environment do
|
24
|
+
ver = AppVersionTasks::SemanticVersion.new
|
25
|
+
puts ver.bump(:minor)
|
26
|
+
end
|
27
|
+
|
28
|
+
desc 'bump and push the patch version (0.0.x)'
|
29
|
+
task patch: :environment do
|
30
|
+
ver = AppVersionTasks::SemanticVersion.new
|
31
|
+
puts ver.bump(:patch)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,292 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: app_version_tasks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Darren L. Weber, Ph.D.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-09-27 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: git
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.12'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.12'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-doc
|
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
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: yard
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: combustion
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.5.5
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.5.5
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: rails
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '4.2'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '4.2'
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: rspec-rails
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '3.4'
|
174
|
+
- - ">="
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: 3.4.2
|
177
|
+
type: :development
|
178
|
+
prerelease: false
|
179
|
+
version_requirements: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '3.4'
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: 3.4.2
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
name: sqlite3
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: codeclimate-test-reporter
|
203
|
+
requirement: !ruby/object:Gem::Requirement
|
204
|
+
requirements:
|
205
|
+
- - "~>"
|
206
|
+
- !ruby/object:Gem::Version
|
207
|
+
version: '0.6'
|
208
|
+
type: :development
|
209
|
+
prerelease: false
|
210
|
+
version_requirements: !ruby/object:Gem::Requirement
|
211
|
+
requirements:
|
212
|
+
- - "~>"
|
213
|
+
- !ruby/object:Gem::Version
|
214
|
+
version: '0.6'
|
215
|
+
- !ruby/object:Gem::Dependency
|
216
|
+
name: simplecov
|
217
|
+
requirement: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - "~>"
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0.12'
|
222
|
+
type: :development
|
223
|
+
prerelease: false
|
224
|
+
version_requirements: !ruby/object:Gem::Requirement
|
225
|
+
requirements:
|
226
|
+
- - "~>"
|
227
|
+
- !ruby/object:Gem::Version
|
228
|
+
version: '0.12'
|
229
|
+
- !ruby/object:Gem::Dependency
|
230
|
+
name: single_cov
|
231
|
+
requirement: !ruby/object:Gem::Requirement
|
232
|
+
requirements:
|
233
|
+
- - "~>"
|
234
|
+
- !ruby/object:Gem::Version
|
235
|
+
version: '0.5'
|
236
|
+
type: :development
|
237
|
+
prerelease: false
|
238
|
+
version_requirements: !ruby/object:Gem::Requirement
|
239
|
+
requirements:
|
240
|
+
- - "~>"
|
241
|
+
- !ruby/object:Gem::Version
|
242
|
+
version: '0.5'
|
243
|
+
description: Rake tasks to manage application semantic version.
|
244
|
+
email:
|
245
|
+
- dweber.consulting@gmail.com
|
246
|
+
executables: []
|
247
|
+
extensions: []
|
248
|
+
extra_rdoc_files: []
|
249
|
+
files:
|
250
|
+
- ".codeclimate.yml"
|
251
|
+
- ".gitignore"
|
252
|
+
- ".rspec"
|
253
|
+
- ".rubocop.yml"
|
254
|
+
- ".rubocop_todo.yml"
|
255
|
+
- ".todo.reek"
|
256
|
+
- ".travis.yml"
|
257
|
+
- Gemfile
|
258
|
+
- LICENSE
|
259
|
+
- README.md
|
260
|
+
- Rakefile
|
261
|
+
- app_version_tasks.gemspec
|
262
|
+
- config/.keep
|
263
|
+
- lib/app_version_tasks.rb
|
264
|
+
- lib/app_version_tasks/configuration.rb
|
265
|
+
- lib/app_version_tasks/semantic_version.rb
|
266
|
+
- lib/app_version_tasks/semantic_version_file.rb
|
267
|
+
- lib/app_version_tasks/version.rb
|
268
|
+
- lib/tasks/app_version_tasks.rake
|
269
|
+
homepage: https://github.com/sul-dlss/app_version_tasks
|
270
|
+
licenses: []
|
271
|
+
metadata: {}
|
272
|
+
post_install_message:
|
273
|
+
rdoc_options: []
|
274
|
+
require_paths:
|
275
|
+
- lib
|
276
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
277
|
+
requirements:
|
278
|
+
- - ">="
|
279
|
+
- !ruby/object:Gem::Version
|
280
|
+
version: '0'
|
281
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
282
|
+
requirements:
|
283
|
+
- - ">="
|
284
|
+
- !ruby/object:Gem::Version
|
285
|
+
version: '0'
|
286
|
+
requirements: []
|
287
|
+
rubyforge_project:
|
288
|
+
rubygems_version: 2.5.1
|
289
|
+
signing_key:
|
290
|
+
specification_version: 4
|
291
|
+
summary: Application version tasks.
|
292
|
+
test_files: []
|