app_version_tasks 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/.rubocop_todo.yml +16 -28
- data/.travis.yml +16 -5
- data/README.md +43 -24
- data/Rakefile +8 -1
- data/app_version_tasks.gemspec +3 -5
- data/lib/app_version_tasks/configuration.rb +4 -2
- data/lib/app_version_tasks/semantic_version.rb +64 -64
- data/lib/app_version_tasks/semantic_version_file.rb +1 -1
- data/lib/app_version_tasks/version.rb +1 -1
- metadata +8 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9e39627a77d8da4ac660fe3d1bc5b9aee2e56a54
|
4
|
+
data.tar.gz: 6caa4e574bd11225b5087719cd6d0950293c09a3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 877c4257c9c12435eafbd56c2ed68c591a0434cc843b8e810eedd92cf88e5f01e2b5340eec43c4600f3833829113cdb3e133bc5e469e1fd7fdcef76c99fe4f20
|
7
|
+
data.tar.gz: cc30e9c5215685327b1fc6e675b14b093677c6e8db584779aca9ddbe77cb5776cfbe9331b807a5bf9009374fa8cdc6c7dc2292d3c4333a8a4ee5346720c799bd
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
CHANGED
@@ -1,43 +1,31 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on
|
3
|
+
# on 2017-12-21 10:42:10 -0800 using RuboCop version 0.52.0.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
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
10
|
# Cop supports --auto-correct.
|
26
|
-
# Configuration parameters: EnforcedStyle
|
27
|
-
# SupportedStyles:
|
28
|
-
|
11
|
+
# Configuration parameters: EnforcedStyle.
|
12
|
+
# SupportedStyles: auto_detection, squiggly, active_support, powerpack, unindent
|
13
|
+
Layout/IndentHeredoc:
|
29
14
|
Exclude:
|
30
|
-
- 'lib/app_version_tasks/configuration.rb'
|
31
15
|
- 'lib/app_version_tasks/semantic_version_file.rb'
|
32
16
|
|
33
17
|
# Offense count: 1
|
34
|
-
|
35
|
-
Style/MutableConstant:
|
18
|
+
Lint/DuplicateMethods:
|
36
19
|
Exclude:
|
37
|
-
- 'lib/app_version_tasks
|
20
|
+
- 'lib/app_version_tasks.rb'
|
38
21
|
|
39
|
-
# Offense count:
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
|
22
|
+
# Offense count: 7
|
23
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
24
|
+
Metrics/BlockLength:
|
25
|
+
Max: 101
|
26
|
+
|
27
|
+
# Offense count: 4
|
28
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
29
|
+
# URISchemes: http, https
|
30
|
+
Metrics/LineLength:
|
31
|
+
Max: 91
|
data/.travis.yml
CHANGED
@@ -1,10 +1,21 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
|
-
- 2.
|
5
|
-
|
4
|
+
- 2.4.2
|
5
|
+
|
6
|
+
env:
|
7
|
+
global:
|
8
|
+
- CC_TEST_REPORTER_ID=488c417d6ba946ef7cea3101be8bbd46f2bf6092c52f8907d321c63b69c69085
|
9
|
+
|
10
|
+
before_install: gem install bundler -v 1.16.0
|
6
11
|
install: ./bin/setup
|
7
12
|
|
8
|
-
|
9
|
-
|
10
|
-
|
13
|
+
before_script:
|
14
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
15
|
+
- chmod +x ./cc-test-reporter
|
16
|
+
- ./cc-test-reporter before-build
|
17
|
+
script:
|
18
|
+
- bundle exec rspec
|
19
|
+
after_script:
|
20
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
21
|
+
|
data/README.md
CHANGED
@@ -10,45 +10,64 @@ Rake tasks for application semantic version and release management. Inspired by
|
|
10
10
|
|
11
11
|
## Installation
|
12
12
|
|
13
|
-
|
13
|
+
$ gem install app_version_tasks
|
14
|
+
|
15
|
+
## Configuration for a ruby gem
|
16
|
+
|
17
|
+
Add this gem and then `bundle install`:
|
14
18
|
|
15
19
|
```ruby
|
16
|
-
|
20
|
+
Gem::Specification.new do |spec|
|
21
|
+
spec.add_development_dependency 'app_version_tasks'
|
22
|
+
end
|
17
23
|
```
|
18
24
|
|
19
|
-
|
25
|
+
In the `Rakefile`, try this snippet and customize as required.
|
20
26
|
|
21
|
-
|
22
|
-
|
23
|
-
|
27
|
+
```ruby
|
28
|
+
require 'app_version_tasks'
|
29
|
+
spec = Gem::Specification.find_by_name 'app_version_tasks'
|
30
|
+
load "#{spec.gem_dir}/lib/tasks/app_version_tasks.rake"
|
31
|
+
AppVersionTasks.configure do |config|
|
32
|
+
config.application_name = 'GreatGem'
|
33
|
+
config.version_file_path = File.join('lib', 'great_gem', 'version.rb')
|
34
|
+
end
|
35
|
+
```
|
24
36
|
|
25
|
-
|
37
|
+
## Configuration for a rails application
|
26
38
|
|
27
|
-
|
39
|
+
Add this gem and `bundle install`:
|
28
40
|
|
29
|
-
|
41
|
+
```ruby
|
42
|
+
gem 'app_version_tasks'
|
43
|
+
```
|
30
44
|
|
31
|
-
|
32
|
-
load "#{spec.gem_dir}/lib/tasks/app_version_tasks.rake"
|
45
|
+
In the `Rakefile`, load and configure with this snippet:
|
33
46
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
47
|
+
```ruby
|
48
|
+
require 'app_version_tasks'
|
49
|
+
spec = Gem::Specification.find_by_name 'app_version_tasks'
|
50
|
+
load "#{spec.gem_dir}/lib/tasks/app_version_tasks.rake"
|
51
|
+
AppVersionTasks.configure do |config|
|
52
|
+
# the following settings are the defaults
|
53
|
+
config.application_name = Rails.application.class.parent_name
|
54
|
+
config.version_file_path = File.join(Rails.root, 'config', 'version.rb')
|
55
|
+
config.git_working_directory = Rails.root.to_s
|
56
|
+
end
|
57
|
+
```
|
41
58
|
|
42
59
|
Each of the rake tasks that bump the semantic version will modify an
|
43
60
|
application version file; by default, the template for that file looks
|
44
61
|
like this:
|
45
62
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
63
|
+
```ruby
|
64
|
+
# Rails.root/config/version.rb
|
65
|
+
module #{Rails.application.class.parent_name}
|
66
|
+
class Application
|
67
|
+
VERSION = '0.0.0'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
```
|
52
71
|
|
53
72
|
If the version file does not exist, it will be created automatically from
|
54
73
|
that template. If it exists already, it is assumed that it contains a
|
data/Rakefile
CHANGED
@@ -1,6 +1,13 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rspec/core/rake_task'
|
3
3
|
|
4
|
-
|
4
|
+
require 'app_version_tasks'
|
5
|
+
AppVersionTasks.configure do |config|
|
6
|
+
config.application_name = 'AppVersionTasks'
|
7
|
+
config.version_file_path = File.join('lib', 'app_version_tasks', 'version.rb')
|
8
|
+
end
|
9
|
+
|
10
|
+
Dir.glob('lib/tasks/*.rake').each { |r| load r }
|
5
11
|
|
12
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
13
|
task default: :spec
|
data/app_version_tasks.gemspec
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
# coding: utf-8
|
2
1
|
lib = File.expand_path('../lib', __FILE__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'app_version_tasks/version'
|
@@ -22,21 +21,20 @@ Gem::Specification.new do |spec|
|
|
22
21
|
|
23
22
|
spec.add_dependency 'git', '~> 1.3'
|
24
23
|
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.16'
|
26
25
|
spec.add_development_dependency 'pry'
|
27
26
|
spec.add_development_dependency 'pry-doc'
|
28
|
-
spec.add_development_dependency 'rake', '~>
|
27
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
29
28
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
29
|
spec.add_development_dependency 'rubocop'
|
31
30
|
spec.add_development_dependency 'rubocop-rspec'
|
32
31
|
spec.add_development_dependency 'yard'
|
33
32
|
|
34
|
-
spec.add_development_dependency 'combustion', '~> 0.
|
33
|
+
spec.add_development_dependency 'combustion', '~> 0.7.0'
|
35
34
|
spec.add_development_dependency 'rails', '~> 4.2'
|
36
35
|
spec.add_development_dependency 'rspec-rails', '~> 3.4', '>= 3.4.2'
|
37
36
|
spec.add_development_dependency 'sqlite3'
|
38
37
|
|
39
|
-
spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.6'
|
40
38
|
spec.add_development_dependency 'simplecov', '~> 0.12'
|
41
39
|
spec.add_development_dependency 'single_cov', '~> 0.5'
|
42
40
|
end
|
@@ -16,7 +16,7 @@ module AppVersionTasks
|
|
16
16
|
def application_name=(value)
|
17
17
|
@application_name = begin
|
18
18
|
value || Rails.application.class.parent_name
|
19
|
-
rescue
|
19
|
+
rescue StandardError
|
20
20
|
'App'
|
21
21
|
end
|
22
22
|
end
|
@@ -35,7 +35,9 @@ module AppVersionTasks
|
|
35
35
|
|
36
36
|
# @return [String] path
|
37
37
|
def default_root_path
|
38
|
-
Rails.root.to_s
|
38
|
+
Rails.root.to_s
|
39
|
+
rescue StandardError
|
40
|
+
Dir.pwd
|
39
41
|
end
|
40
42
|
|
41
43
|
# @return [String] path
|
@@ -37,82 +37,82 @@ module AppVersionTasks
|
|
37
37
|
|
38
38
|
private
|
39
39
|
|
40
|
-
|
40
|
+
attr_accessor :version_file
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
42
|
+
# Bump major version
|
43
|
+
def bump_major
|
44
|
+
@major += 1
|
45
|
+
@minor = 0
|
46
|
+
@patch = 0
|
47
|
+
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
# Bump minor version
|
50
|
+
def bump_minor
|
51
|
+
@minor += 1
|
52
|
+
@patch = 0
|
53
|
+
end
|
54
54
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
# Bump patch version
|
56
|
+
def bump_patch
|
57
|
+
@patch += 1
|
58
|
+
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
60
|
+
# Save bumped version to file and commit
|
61
|
+
def bump_version
|
62
|
+
version_file.write(version)
|
63
|
+
git_commit_version
|
64
|
+
end
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
66
|
+
def git
|
67
|
+
@git ||= Git.open(AppVersionTasks.configuration.git_working_directory)
|
68
|
+
end
|
69
69
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
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
76
|
|
77
|
-
|
78
|
-
|
79
|
-
|
77
|
+
def git_current_branch
|
78
|
+
git.lib.branch_current
|
79
|
+
end
|
80
80
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
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
88
|
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
89
|
+
def git_release
|
90
|
+
git_pull
|
91
|
+
git_tag_version
|
92
|
+
git_push
|
93
|
+
end
|
94
94
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
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
100
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
101
|
+
def git_push
|
102
|
+
current_branch = git_current_branch
|
103
|
+
git.push('origin', current_branch, tags: true)
|
104
|
+
puts "Pushed to origin/#{current_branch}"
|
105
|
+
end
|
106
106
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
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
113
|
|
114
|
-
|
115
|
-
|
116
|
-
|
114
|
+
def release_tag
|
115
|
+
"v#{version}"
|
116
|
+
end
|
117
117
|
end
|
118
118
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_version_tasks
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Darren L. Weber, Ph.D.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-12-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '1.
|
33
|
+
version: '1.16'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '1.
|
40
|
+
version: '1.16'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: pry
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '12.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '12.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: rspec
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -142,14 +142,14 @@ dependencies:
|
|
142
142
|
requirements:
|
143
143
|
- - "~>"
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: 0.
|
145
|
+
version: 0.7.0
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
150
|
- - "~>"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: 0.
|
152
|
+
version: 0.7.0
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: rails
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -198,20 +198,6 @@ dependencies:
|
|
198
198
|
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
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
201
|
- !ruby/object:Gem::Dependency
|
216
202
|
name: simplecov
|
217
203
|
requirement: !ruby/object:Gem::Requirement
|