releasetool 0.3.0 → 0.5.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 +4 -4
- data/.rubocop.yml +117 -0
- data/.rubocop_todo.yml +139 -0
- data/Gemfile +2 -0
- data/README.md +12 -0
- data/Rakefile +2 -0
- data/bin/release +2 -0
- data/lib/releasetool/base_hooks.rb +20 -0
- data/lib/releasetool/configuration.rb +76 -0
- data/lib/releasetool/release.rb +19 -20
- data/lib/releasetool/util.rb +24 -2
- data/lib/releasetool/version.rb +9 -3
- data/lib/releasetool.rb +3 -1
- data/lib/tasks/release_thor.rb +38 -18
- data/release_notes/v0.4.0.md +7 -0
- data/release_notes/v0.5.0.md +5 -0
- data/releasetool.gemspec +6 -3
- data/spec/fixtures/empty_file.rb +3 -0
- data/spec/fixtures/hooks_example.rb +18 -0
- data/spec/releasetool_spec.rb +109 -27
- data/spec/spec_helper.rb +11 -11
- data/spec/version_spec.rb +12 -13
- metadata +29 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b46e141b87c5f056ab3af71cdf6a5157e6b559e51743a07383bc225676c9866
|
4
|
+
data.tar.gz: e9d0a785e91132404eee8aef1a96705834569d5933210dbae5e3a6cbe89f2360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f0e80727a056d71917c33fb270685e16f7ec50e50a9aad75d0ae15c09380b993aec681fa340e45ecc126bda12a4a0778e807443dabba0e9f269b586f22cdc046
|
7
|
+
data.tar.gz: ad2a984cb079825de22f0efa986f6f4695e3df5f711c4eb8da5075ad726a2356eea050dff44d24efb48a78bf2d6069077a1126c4854a353b2ce2efa6d8cb4326
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
3
|
+
#require:
|
4
|
+
# - rubocop-performance
|
5
|
+
# - rubocop-rspec
|
6
|
+
|
7
|
+
AllCops:
|
8
|
+
TargetRubyVersion: 2.7
|
9
|
+
DefaultFormatter: fuubar
|
10
|
+
Exclude:
|
11
|
+
- 'tmp/**/*'
|
12
|
+
DisplayCopNames: true
|
13
|
+
NewCops: enable
|
14
|
+
CacheRootDirectory: tmp # ie. tmp/rubocop_cache
|
15
|
+
UseCache: true
|
16
|
+
|
17
|
+
Gemspec/DevelopmentDependencies:
|
18
|
+
EnforcedStyle: gemspec
|
19
|
+
|
20
|
+
# Don't like this, it's too annoying
|
21
|
+
Layout/LineLength:
|
22
|
+
Max: 120
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Layout/ParameterAlignment:
|
26
|
+
EnforcedStyle: with_fixed_indentation
|
27
|
+
|
28
|
+
Lint/AmbiguousBlockAssociation:
|
29
|
+
Enabled: true
|
30
|
+
Exclude:
|
31
|
+
- "spec/**/*" # https://github.com/rubocop/rubocop/issues/4222
|
32
|
+
|
33
|
+
Lint/AssignmentInCondition:
|
34
|
+
AutoCorrect: false
|
35
|
+
|
36
|
+
Lint/UnusedBlockArgument:
|
37
|
+
AutoCorrect: false
|
38
|
+
|
39
|
+
Lint/UnusedMethodArgument:
|
40
|
+
AutoCorrect: false
|
41
|
+
|
42
|
+
Metrics/AbcSize:
|
43
|
+
Enabled: false
|
44
|
+
# I don't think this is something we want to enforce (yet?)
|
45
|
+
|
46
|
+
Metrics/BlockLength:
|
47
|
+
AllowedMethods:
|
48
|
+
- "no_commands" # thor
|
49
|
+
Exclude:
|
50
|
+
- "spec/**/*.rb"
|
51
|
+
|
52
|
+
Metrics/ClassLength:
|
53
|
+
Enabled: false
|
54
|
+
|
55
|
+
Metrics/CyclomaticComplexity:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
Metrics/MethodLength:
|
59
|
+
Enabled: false
|
60
|
+
# No (not yet)
|
61
|
+
|
62
|
+
Metrics/PerceivedComplexity:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
Naming/AccessorMethodName:
|
66
|
+
Enabled: false
|
67
|
+
# In theory this is good. In practice lots of false errors
|
68
|
+
|
69
|
+
## I'm not very keen on this one
|
70
|
+
#Performance/TimesMap:
|
71
|
+
# Enabled: false
|
72
|
+
|
73
|
+
## I can't see the value of this
|
74
|
+
#RSpec/DescribeClass:
|
75
|
+
# Enabled: false
|
76
|
+
|
77
|
+
#RSpec/EmptyExampleGroup:
|
78
|
+
# # we need to fix manually - e.g. fill it in or delete it
|
79
|
+
# AutoCorrect: false
|
80
|
+
#
|
81
|
+
## prefer this
|
82
|
+
#RSpec/ExpectChange:
|
83
|
+
# EnforcedStyle: block
|
84
|
+
#
|
85
|
+
## I can't see the value of this
|
86
|
+
#RSpec/MultipleMemoizedHelpers:
|
87
|
+
# Enabled: false
|
88
|
+
#
|
89
|
+
## This is actually wrong and a mistake (`expect ... to receive ... and return ...` is good practice)
|
90
|
+
#RSpec/StubbedMock:
|
91
|
+
# Enabled: false
|
92
|
+
|
93
|
+
|
94
|
+
Style/BlockDelimiters:
|
95
|
+
Exclude:
|
96
|
+
- 'spec/**/*'
|
97
|
+
|
98
|
+
Style/Documentation:
|
99
|
+
Enabled: false
|
100
|
+
# Sounds good, but really?
|
101
|
+
|
102
|
+
Style/DoubleNegation:
|
103
|
+
Enabled: false
|
104
|
+
# double negation is an ok way to enforce true / false when assigning
|
105
|
+
|
106
|
+
Style/NumericLiterals:
|
107
|
+
Enabled: false
|
108
|
+
# This is a pain, most long numeric literals are things like ids or times as numbers
|
109
|
+
|
110
|
+
Style/StringLiterals:
|
111
|
+
Enabled: true
|
112
|
+
EnforcedStyle: double_quotes
|
113
|
+
|
114
|
+
Style/SymbolProc:
|
115
|
+
Enabled: true
|
116
|
+
AllowMethodsWithArguments: true
|
117
|
+
AllowComments: true
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config --exclude-limit 100`
|
3
|
+
# on 2023-09-11 13:28:02 UTC using RuboCop version 1.56.3.
|
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
|
+
# Configuration parameters: ExpectMatchingDefinition, CheckDefinitionPathHierarchy, CheckDefinitionPathHierarchyRoots, Regex, IgnoreExecutableScripts, AllowedAcronyms.
|
11
|
+
# CheckDefinitionPathHierarchyRoots: lib, spec, test, src
|
12
|
+
# AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
|
13
|
+
Naming/FileName:
|
14
|
+
Exclude:
|
15
|
+
- 'spec/fixtures/example_with_releases/config/initializers/00-version.rb'
|
16
|
+
|
17
|
+
# Offense count: 8
|
18
|
+
# Configuration parameters: ForbiddenDelimiters.
|
19
|
+
# ForbiddenDelimiters: (?i-mx:(^|\s)(EO[A-Z]{1}|END)(\s|$))
|
20
|
+
Naming/HeredocDelimiterNaming:
|
21
|
+
Exclude:
|
22
|
+
- 'lib/tasks/release_thor.rb'
|
23
|
+
|
24
|
+
# Offense count: 15
|
25
|
+
# Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
|
26
|
+
# SupportedStyles: snake_case, normalcase, non_integer
|
27
|
+
# AllowedIdentifiers: capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
|
28
|
+
Naming/VariableNumber:
|
29
|
+
Exclude:
|
30
|
+
- 'spec/releasetool_spec.rb'
|
31
|
+
- 'spec/version_spec.rb'
|
32
|
+
|
33
|
+
# Offense count: 1
|
34
|
+
# This cop supports safe autocorrection (--autocorrect).
|
35
|
+
# Configuration parameters: EnforcedStyle, EnforcedShorthandSyntax, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
36
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
37
|
+
# SupportedShorthandSyntax: always, never, either, consistent
|
38
|
+
Style/HashSyntax:
|
39
|
+
Exclude:
|
40
|
+
- 'Rakefile'
|
41
|
+
|
42
|
+
# Offense count: 6
|
43
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
44
|
+
# Configuration parameters: EnforcedStyle.
|
45
|
+
# SupportedStyles: literals, strict
|
46
|
+
Style/MutableConstant:
|
47
|
+
Exclude:
|
48
|
+
- 'lib/releasetool.rb'
|
49
|
+
- 'lib/releasetool/util.rb'
|
50
|
+
- 'lib/tasks/release_thor.rb'
|
51
|
+
- 'spec/fixtures/example_with_releases/config/initializers/00-version.rb'
|
52
|
+
|
53
|
+
# Offense count: 1
|
54
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
55
|
+
# Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
|
56
|
+
# SupportedStyles: predicate, comparison
|
57
|
+
Style/NumericPredicate:
|
58
|
+
Exclude:
|
59
|
+
- 'spec/**/*'
|
60
|
+
- 'lib/tasks/release_thor.rb'
|
61
|
+
|
62
|
+
# Offense count: 2
|
63
|
+
# This cop supports safe autocorrection (--autocorrect).
|
64
|
+
# Configuration parameters: PreferredDelimiters.
|
65
|
+
Style/PercentLiteralDelimiters:
|
66
|
+
Exclude:
|
67
|
+
- 'releasetool.gemspec'
|
68
|
+
|
69
|
+
# Offense count: 3
|
70
|
+
# This cop supports safe autocorrection (--autocorrect).
|
71
|
+
# Configuration parameters: AllowedCompactTypes.
|
72
|
+
# SupportedStyles: compact, exploded
|
73
|
+
Style/RaiseArgs:
|
74
|
+
EnforcedStyle: compact
|
75
|
+
|
76
|
+
# Offense count: 2
|
77
|
+
# This cop supports safe autocorrection (--autocorrect).
|
78
|
+
Style/RedundantPercentQ:
|
79
|
+
Exclude:
|
80
|
+
- 'releasetool.gemspec'
|
81
|
+
|
82
|
+
# Offense count: 1
|
83
|
+
# This cop supports safe autocorrection (--autocorrect).
|
84
|
+
# Configuration parameters: EnforcedStyle.
|
85
|
+
# SupportedStyles: only_raise, only_fail, semantic
|
86
|
+
Style/SignalException:
|
87
|
+
Exclude:
|
88
|
+
- 'lib/releasetool/util.rb'
|
89
|
+
|
90
|
+
# Offense count: 1
|
91
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
92
|
+
Style/SlicingWithRange:
|
93
|
+
Exclude:
|
94
|
+
- 'lib/releasetool/version.rb'
|
95
|
+
|
96
|
+
# Offense count: 1
|
97
|
+
# This cop supports safe autocorrection (--autocorrect).
|
98
|
+
# Configuration parameters: AllowModifier.
|
99
|
+
Style/SoleNestedConditional:
|
100
|
+
Exclude:
|
101
|
+
- 'lib/releasetool/release.rb'
|
102
|
+
|
103
|
+
# Offense count: 1
|
104
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
105
|
+
# Configuration parameters: RequireEnglish, EnforcedStyle.
|
106
|
+
# SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
|
107
|
+
Style/SpecialGlobalVars:
|
108
|
+
Exclude:
|
109
|
+
- 'releasetool.gemspec'
|
110
|
+
|
111
|
+
# Offense count: 34
|
112
|
+
# This cop supports safe autocorrection (--autocorrect).
|
113
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
114
|
+
# SupportedStyles: single_quotes, double_quotes
|
115
|
+
Style/StringLiterals:
|
116
|
+
Exclude:
|
117
|
+
- 'Gemfile'
|
118
|
+
- 'bin/release'
|
119
|
+
- 'lib/releasetool/release.rb'
|
120
|
+
- 'lib/releasetool/util.rb'
|
121
|
+
- 'lib/tasks/release_thor.rb'
|
122
|
+
- 'releasetool.gemspec'
|
123
|
+
- 'spec/releasetool_spec.rb'
|
124
|
+
- 'spec/spec_helper.rb'
|
125
|
+
- 'spec/version_spec.rb'
|
126
|
+
|
127
|
+
# Offense count: 1
|
128
|
+
# This cop supports safe autocorrection (--autocorrect).
|
129
|
+
# Configuration parameters: EnforcedStyle.
|
130
|
+
# SupportedStyles: single_quotes, double_quotes
|
131
|
+
Style/StringLiteralsInInterpolation:
|
132
|
+
Exclude:
|
133
|
+
- 'lib/tasks/release_thor.rb'
|
134
|
+
|
135
|
+
# Offense count: 1
|
136
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
137
|
+
Style/ZeroLengthPredicate:
|
138
|
+
Exclude:
|
139
|
+
- 'lib/tasks/release_thor.rb'
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -22,6 +22,8 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
+
```release help```
|
26
|
+
|
25
27
|
### List existing tags
|
26
28
|
|
27
29
|
```release list```
|
@@ -67,6 +69,7 @@ It will ask for a one-line summary of the release (full details are in the relea
|
|
67
69
|
|
68
70
|
The tests work on a known-good repo stored in `spec/fixtures/example_with_releases.tar`. To recreate this:
|
69
71
|
```
|
72
|
+
mkdir -p spec/fixtures/example_with_releases
|
70
73
|
cd spec/fixtures/example_with_releases && tar -xvf ../example_with_releases.tar && cd -
|
71
74
|
```
|
72
75
|
|
@@ -75,11 +78,20 @@ then you can tweak it and save it back with:
|
|
75
78
|
cd spec/fixtures/example_with_releases && tar -cvf ../example_with_releases.tar . && cd -
|
76
79
|
```
|
77
80
|
|
81
|
+
ditto for other one with config
|
82
|
+
|
83
|
+
cd spec/fixtures/example_with_releases && tar -cvf ../example_with_releases.tar . && cd -
|
84
|
+
|
78
85
|
## Configuration
|
79
86
|
|
80
87
|
If you want it to automatically update the version number in a string then set the environment variable
|
81
88
|
`RELEASETOOL_VERSION_FILE`, eg. `export RELEASETOOL_VERSION_FILE=./lib/releasetool.rb`. By default this is configured to config/initializers/00-version.rb (useful for rails projects).
|
82
89
|
|
90
|
+
If you want to run something after `release start` or after `release commit` then generate a hooks file:
|
91
|
+
|
92
|
+
release init
|
93
|
+
|
94
|
+
which will generate a file at `config/releasetool/hooks.rb` which you can adjust.
|
83
95
|
|
84
96
|
## Contributing
|
85
97
|
|
data/Rakefile
CHANGED
data/bin/release
CHANGED
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "releasetool/util"
|
4
|
+
|
5
|
+
module Releasetool
|
6
|
+
class BaseHooks
|
7
|
+
# @param config [Releasetool::Configuration]
|
8
|
+
def initialize(config)
|
9
|
+
@config = config
|
10
|
+
end
|
11
|
+
|
12
|
+
def after_prepare(version)
|
13
|
+
# noop
|
14
|
+
end
|
15
|
+
|
16
|
+
def after_commit(version)
|
17
|
+
# noop
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "releasetool/util"
|
4
|
+
require "pathname"
|
5
|
+
|
6
|
+
module Releasetool
|
7
|
+
class Configuration
|
8
|
+
def after_start_hook(version)
|
9
|
+
return nil unless hooks.respond_to?(:after_start)
|
10
|
+
|
11
|
+
hooks.after_start(version)
|
12
|
+
end
|
13
|
+
|
14
|
+
def after_commit_hook(version)
|
15
|
+
return nil unless hooks.respond_to?(:after_commit)
|
16
|
+
|
17
|
+
hooks.after_commit(version)
|
18
|
+
end
|
19
|
+
|
20
|
+
def generate
|
21
|
+
FileUtils.mkdir_p(config_dir)
|
22
|
+
if File.exist?(hooks_file)
|
23
|
+
say "File #{hooks_file.inspect} already exists"
|
24
|
+
return
|
25
|
+
end
|
26
|
+
|
27
|
+
File.write(hooks_file, default_hooks)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def config_dir
|
33
|
+
Pathname.new("./config/releasetool")
|
34
|
+
end
|
35
|
+
|
36
|
+
def hooks
|
37
|
+
@hooks ||= new_hooks
|
38
|
+
end
|
39
|
+
|
40
|
+
def new_hooks
|
41
|
+
return nil unless File.exist?(hooks_file)
|
42
|
+
|
43
|
+
load hooks_file # we use load so we can test it 🙁
|
44
|
+
return nil unless defined?(Releasetool::Hooks)
|
45
|
+
|
46
|
+
Releasetool::Hooks.new(self)
|
47
|
+
end
|
48
|
+
|
49
|
+
def hooks_file
|
50
|
+
config_dir / "hooks.rb"
|
51
|
+
end
|
52
|
+
|
53
|
+
def default_hooks
|
54
|
+
<<~HOOKS
|
55
|
+
# frozen_string_literal: true
|
56
|
+
|
57
|
+
require "releasetool/util"
|
58
|
+
require "releasetool/base_hooks"
|
59
|
+
|
60
|
+
module Releasetool
|
61
|
+
class Hooks < Releasetool::BaseHooks
|
62
|
+
include Releasetool::Util
|
63
|
+
|
64
|
+
# def after_start(version)
|
65
|
+
# puts "after_start has been called"
|
66
|
+
# end
|
67
|
+
|
68
|
+
# def after_commit(version)
|
69
|
+
# puts "after_commit has been called"
|
70
|
+
# end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
HOOKS
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
data/lib/releasetool/release.rb
CHANGED
@@ -1,4 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "releasetool/util"
|
4
|
+
require "fileutils"
|
2
5
|
|
3
6
|
module Releasetool
|
4
7
|
class Release
|
@@ -6,6 +9,7 @@ module Releasetool
|
|
6
9
|
|
7
10
|
def initialize(version, previous:)
|
8
11
|
raise "Version must be a Releasetool::Version" unless version.is_a?(Releasetool::Version)
|
12
|
+
|
9
13
|
if previous
|
10
14
|
raise "Previous must be nil or a Releasetool::Version" unless version.is_a?(Releasetool::Version)
|
11
15
|
end
|
@@ -18,10 +22,10 @@ module Releasetool
|
|
18
22
|
commits = `git log #{@previous}..HEAD --pretty=format:"- %B"`
|
19
23
|
notes = commits.gsub("\n\n", "\n")
|
20
24
|
notes_file = "#{DIR}/#{@version}.md"
|
21
|
-
if File.
|
22
|
-
puts "-"*80
|
25
|
+
if File.exist?(notes_file)
|
26
|
+
puts "-" * 80
|
23
27
|
puts " File '#{notes_file}' already exists (appending)"
|
24
|
-
puts "-"*80
|
28
|
+
puts "-" * 80
|
25
29
|
File.open(notes_file, 'a') do |f|
|
26
30
|
f.puts("\n\nAPPENDED:\n\n")
|
27
31
|
f.puts(notes)
|
@@ -33,22 +37,20 @@ module Releasetool
|
|
33
37
|
f.puts(notes)
|
34
38
|
end
|
35
39
|
puts "written to #{notes_file}"
|
36
|
-
if edit
|
37
|
-
system("open #{notes_file}")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
if File.exists?(VERSION_FILE)
|
41
|
-
from_version = @previous.to_s_without_v
|
42
|
-
to_version = @version.to_s_without_v
|
43
|
-
guarded_system("cat #{VERSION_FILE} | sed s/#{from_version}/#{to_version.gsub('.', '\.')}/ > #{VERSION_FILE}.tmp")
|
44
|
-
guarded_system("mv #{VERSION_FILE}.tmp #{VERSION_FILE}")
|
40
|
+
system("open #{notes_file}") if edit
|
45
41
|
end
|
42
|
+
return unless File.exist?(Releasetool::Util.version_file)
|
43
|
+
|
44
|
+
from_version = @previous.to_s_without_v
|
45
|
+
to_version = @version.to_s_without_v
|
46
|
+
guarded_system("cat #{Releasetool::Util.version_file} | sed s/#{from_version}/#{to_version.gsub('.', '\.')}/ > #{Releasetool::Util.version_file}.tmp")
|
47
|
+
guarded_system("mv #{Releasetool::Util.version_file}.tmp #{Releasetool::Util.version_file}")
|
46
48
|
end
|
47
49
|
|
48
50
|
private
|
49
51
|
|
50
52
|
def ensure_dir
|
51
|
-
|
53
|
+
FileUtils.mkdir_p(DIR)
|
52
54
|
end
|
53
55
|
|
54
56
|
def headers
|
@@ -62,20 +64,17 @@ module Releasetool
|
|
62
64
|
def ensured_template_file
|
63
65
|
ensure_dir
|
64
66
|
template_file = "#{DIR}/#{TEMPLATE_FILE}"
|
65
|
-
create_template_file(template_file) unless File.
|
67
|
+
create_template_file(template_file) unless File.exist?(template_file)
|
66
68
|
template_file
|
67
69
|
end
|
68
70
|
|
69
71
|
def create_template_file(template_file)
|
70
|
-
File.
|
71
|
-
f.write <<~FILEEND
|
72
|
+
File.write(template_file, <<~FILEEND)
|
72
73
|
$VERSION Release Notes
|
73
|
-
|
74
|
+
|
74
75
|
*Changes since $PREVIOUS*
|
75
76
|
|
76
|
-
|
77
|
-
end
|
77
|
+
FILEEND
|
78
78
|
end
|
79
|
-
|
80
79
|
end
|
81
80
|
end
|
data/lib/releasetool/util.rb
CHANGED
@@ -1,13 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'English'
|
4
|
+
require "releasetool/configuration"
|
5
|
+
|
1
6
|
module Releasetool
|
2
7
|
module Util
|
3
|
-
|
4
8
|
DIR = "release_notes"
|
5
|
-
VERSION_FILE = ENV['RELEASETOOL_VERSION_FILE'] || "config/initializers/00-version.rb" #rails out of box
|
6
9
|
TEMPLATE_FILE = "__TEMPLATE__.md" # relative to DIR
|
7
10
|
RELEASE_MARKER_FILE = ".RELEASE_NEW_VERSION" # should be a config var
|
8
11
|
|
12
|
+
def self.version_file
|
13
|
+
# rails out of box
|
14
|
+
ENV['RELEASETOOL_VERSION_FILE'] || "config/initializers/00-version.rb"
|
15
|
+
end
|
16
|
+
|
9
17
|
def stored_version
|
10
18
|
fail Thor::Error.new("No stored version... did you forget to do release start?") unless File.exist?(RELEASE_MARKER_FILE)
|
19
|
+
|
11
20
|
File.read(RELEASE_MARKER_FILE).strip
|
12
21
|
end
|
13
22
|
|
@@ -19,5 +28,18 @@ module Releasetool
|
|
19
28
|
puts command
|
20
29
|
system(command) or raise Thor::Error.new("Couldn't '#{command}'")
|
21
30
|
end
|
31
|
+
|
32
|
+
def guarded_capture(command)
|
33
|
+
puts command
|
34
|
+
output = `#{command}`
|
35
|
+
raise Thor::Error.new("Couldn't '#{command}'") unless $CHILD_STATUS
|
36
|
+
|
37
|
+
output
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [Releasetool::Configuration]
|
41
|
+
def config
|
42
|
+
@config ||= Releasetool::Configuration.new
|
43
|
+
end
|
22
44
|
end
|
23
45
|
end
|
data/lib/releasetool/version.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Releasetool
|
2
4
|
class Version
|
3
5
|
attr_reader :ident
|
6
|
+
|
4
7
|
def initialize(ident)
|
5
8
|
raise "Not a valid version identifier: #{ident.inspect}" unless ident.is_a?(String)
|
9
|
+
|
6
10
|
@ident = ident
|
7
11
|
end
|
8
12
|
|
@@ -43,9 +47,11 @@ module Releasetool
|
|
43
47
|
end
|
44
48
|
|
45
49
|
private
|
46
|
-
|
47
|
-
|
48
|
-
|
50
|
+
|
51
|
+
def incremented(number)
|
52
|
+
raise "Can't work out next version from #{self}" unless number.to_i.to_s == number
|
53
|
+
|
54
|
+
number.to_i + 1
|
49
55
|
end
|
50
56
|
|
51
57
|
def segments
|
data/lib/releasetool.rb
CHANGED
data/lib/tasks/release_thor.rb
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'thor'
|
4
|
+
require "releasetool"
|
2
5
|
require "releasetool/release"
|
3
6
|
require "releasetool/util"
|
4
7
|
require "releasetool/version"
|
5
8
|
|
6
9
|
class Release < Thor
|
7
|
-
|
8
10
|
include Releasetool::Util
|
11
|
+
desc "init", <<-END
|
12
|
+
generate optional config directory and optional hooks file
|
13
|
+
END
|
14
|
+
|
15
|
+
def init
|
16
|
+
config.generate
|
17
|
+
end
|
18
|
+
|
19
|
+
# ========================
|
20
|
+
|
9
21
|
desc "list", <<-END
|
10
22
|
show a list of tags ordered by date (just a git listing).
|
11
23
|
END
|
@@ -38,7 +50,7 @@ class Release < Thor
|
|
38
50
|
# ========================
|
39
51
|
|
40
52
|
method_option :since, type: :string, desc: "since commit_ref (or will use most recent tag)", required: false,
|
41
|
-
|
53
|
+
aliases: 's'
|
42
54
|
method_option :edit, type: :boolean, desc: "edit", required: false, aliases: 'e'
|
43
55
|
method_option :minor, type: :boolean, desc: "minor version", required: false, default: false
|
44
56
|
|
@@ -46,15 +58,13 @@ class Release < Thor
|
|
46
58
|
Start a release by doing a prepare, and storing the target release in #{RELEASE_MARKER_FILE}.
|
47
59
|
END
|
48
60
|
|
49
|
-
def start(specified_version=nil)
|
50
|
-
if File.
|
51
|
-
|
52
|
-
|
53
|
-
version
|
54
|
-
File.open(RELEASE_MARKER_FILE, 'w') do |f|
|
55
|
-
f.write(version)
|
56
|
-
end
|
61
|
+
def start(specified_version = nil)
|
62
|
+
raise Thor::Error.new("Can't start when already started on a version. release abort or release finish") if File.exist?(RELEASE_MARKER_FILE)
|
63
|
+
|
64
|
+
version = specified_version ? Releasetool::Version.new(specified_version) : next_version
|
65
|
+
File.write(RELEASE_MARKER_FILE, version)
|
57
66
|
Releasetool::Release.new(version, previous: previous_version).prepare(edit: options[:edit])
|
67
|
+
config.after_start_hook(version)
|
58
68
|
end
|
59
69
|
|
60
70
|
DEFAULT_COMMIT_MESSAGE = 'preparing for release [CI SKIP]'
|
@@ -63,11 +73,14 @@ class Release < Thor
|
|
63
73
|
If no version given, it will use the version stored by release start
|
64
74
|
END
|
65
75
|
|
66
|
-
|
76
|
+
# should take release commit --edit which allows you to edit, or --no-edit (default) which allows you to just skip
|
77
|
+
method_option :edit, type: :boolean, desc: "edit", aliases: 'e', default: false
|
78
|
+
def commit(version = nil)
|
67
79
|
version ||= stored_version
|
68
80
|
guarded_system("git add #{DIR}")
|
69
|
-
guarded_system("git add #{
|
70
|
-
guarded_system("git commit #{DIR} #{File.
|
81
|
+
guarded_system("git add #{Releasetool::Util.version_file}") if File.exist?(Releasetool::Util.version_file)
|
82
|
+
guarded_system("git commit #{DIR} #{File.exist?(Releasetool::Util.version_file) ? Releasetool::Util.version_file : ''} #{options[:edit] ? '-e' : nil} -m\"#{DEFAULT_COMMIT_MESSAGE}\"")
|
83
|
+
config.after_commit_hook(version)
|
71
84
|
end
|
72
85
|
|
73
86
|
desc "tag (NEW_VERSION)", <<-END
|
@@ -75,9 +88,10 @@ class Release < Thor
|
|
75
88
|
If no version given, it will use the version stored by release start
|
76
89
|
END
|
77
90
|
|
78
|
-
def tag(version=nil)
|
91
|
+
def tag(version = nil)
|
79
92
|
version ||= stored_version
|
80
|
-
|
93
|
+
last_useful_commit = guarded_capture("git log head^^..head^ --pretty=format:%s").strip.split("\n").first.strip
|
94
|
+
guarded_system("git tag -a #{version} -e -m \"#{last_useful_commit}\"")
|
81
95
|
end
|
82
96
|
|
83
97
|
desc "push (NEW_VERSION)", <<-END
|
@@ -85,7 +99,7 @@ class Release < Thor
|
|
85
99
|
If no version given, it will use the version stored by release start.
|
86
100
|
END
|
87
101
|
|
88
|
-
def push(version=nil)
|
102
|
+
def push(version = nil)
|
89
103
|
version ||= stored_version
|
90
104
|
guarded_system("git push")
|
91
105
|
guarded_system("git push origin #{version}")
|
@@ -100,10 +114,16 @@ class Release < Thor
|
|
100
114
|
remove_stored_version
|
101
115
|
end
|
102
116
|
|
117
|
+
map %w[--version -v] => :__print_version
|
118
|
+
|
119
|
+
desc "--version, -v", "print the version"
|
120
|
+
def __print_version
|
121
|
+
say "Releasetool v#{Releasetool::VERSION}"
|
122
|
+
end
|
123
|
+
|
103
124
|
protected
|
104
125
|
|
105
|
-
def next_version
|
106
|
-
return Releasetool::Version.new(specified) if specified
|
126
|
+
def next_version
|
107
127
|
if options[:major]
|
108
128
|
previous_version.next_major
|
109
129
|
elsif options[:minor]
|
@@ -0,0 +1,7 @@
|
|
1
|
+
v0.4.0 Release Notes
|
2
|
+
|
3
|
+
*Changes since v0.3.0*
|
4
|
+
|
5
|
+
* `release commit` now doesn't require you to edit message by default. If you want to edit use `release commit --edit`
|
6
|
+
* `release tag` now gives you the previous log message as the default tag message (useful in case of release a single-issue/commit)
|
7
|
+
* `release --version` to print version
|
data/releasetool.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
lib = File.expand_path('lib', __dir__)
|
3
4
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
5
|
require 'releasetool'
|
5
6
|
|
@@ -15,12 +16,14 @@ Gem::Specification.new do |spec|
|
|
15
16
|
|
16
17
|
spec.files = `git ls-files`.split($/)
|
17
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
|
+
spec.required_ruby_version = '>= 2.7.0'
|
20
21
|
|
21
22
|
spec.add_dependency 'thor', '>= 0.18'
|
22
23
|
|
23
24
|
spec.add_development_dependency "bundler", "~> 2.1"
|
24
25
|
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "rspec"
|
27
|
+
spec.add_development_dependency "rubocop", "1.56.3"
|
28
|
+
spec.metadata['rubygems_mfa_required'] = 'true'
|
26
29
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "releasetool/util"
|
4
|
+
require "releasetool/base_hooks"
|
5
|
+
|
6
|
+
module Releasetool
|
7
|
+
class Hooks < Releasetool::BaseHooks
|
8
|
+
include Releasetool::Util
|
9
|
+
|
10
|
+
def after_start(version)
|
11
|
+
puts "after_start(#{version}) has been called"
|
12
|
+
end
|
13
|
+
|
14
|
+
def after_commit(version)
|
15
|
+
puts "after_commit(#{version}) has been called"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/releasetool_spec.rb
CHANGED
@@ -1,40 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
require 'fileutils'
|
3
|
-
require File.expand_path('
|
5
|
+
require File.expand_path('../lib/tasks/release_thor', __dir__)
|
4
6
|
|
5
|
-
describe Releasetool do
|
7
|
+
RSpec.describe Releasetool do
|
6
8
|
it 'should have a version number' do
|
7
9
|
expect(Releasetool::VERSION).not_to be_nil
|
8
10
|
end
|
9
11
|
end
|
10
12
|
|
11
|
-
describe Release, quietly:
|
13
|
+
RSpec.describe Release, quietly: false do
|
12
14
|
subject { Release.new }
|
13
|
-
|
14
|
-
|
15
|
+
|
16
|
+
let(:tmpdir) { File.expand_path('../tmp/testing', __dir__) }
|
17
|
+
let(:root_dir) { File.expand_path('..', __dir__) }
|
18
|
+
let(:hooks_example_rb) { File.expand_path('./fixtures/hooks_example.rb', __dir__) }
|
19
|
+
let(:empty_file) { File.expand_path('./fixtures/empty_file.rb', __dir__) }
|
15
20
|
before {
|
16
|
-
|
17
|
-
FileUtils.
|
18
|
-
FileUtils.
|
21
|
+
Releasetool.send(:remove_const, :Hooks) if defined?(Releasetool::Hooks)
|
22
|
+
FileUtils.rmtree(tmpdir)
|
23
|
+
FileUtils.mkdir_p(tmpdir)
|
24
|
+
FileUtils.chdir(tmpdir)
|
19
25
|
system('tar -xf ../../spec/fixtures/example_with_releases.tar')
|
20
26
|
}
|
21
27
|
after {
|
22
|
-
FileUtils.chdir(
|
28
|
+
FileUtils.chdir(root_dir)
|
23
29
|
}
|
24
30
|
it "should respond to list" do
|
25
31
|
subject.list
|
26
32
|
end
|
27
33
|
|
28
|
-
let(:mock_target){ instance_double(Releasetool::Release)}
|
29
|
-
let(:v_0_0_1) {Releasetool::Version.new("v0.0.1")}
|
30
|
-
let(:v_0_0_2) {Releasetool::Version.new("v0.0.2")}
|
31
|
-
let(:v_0_0_3) {Releasetool::Version.new("v0.0.3")}
|
32
|
-
let(:v_0_1_0) {Releasetool::Version.new("v0.1.0")}
|
33
|
-
let(:v_1_0_0) {Releasetool::Version.new("v1.0.0")}
|
34
|
+
let(:mock_target) { instance_double(Releasetool::Release) }
|
35
|
+
let(:v_0_0_1) { Releasetool::Version.new("v0.0.1") }
|
36
|
+
let(:v_0_0_2) { Releasetool::Version.new("v0.0.2") }
|
37
|
+
let(:v_0_0_3) { Releasetool::Version.new("v0.0.3") }
|
38
|
+
let(:v_0_1_0) { Releasetool::Version.new("v0.1.0") }
|
39
|
+
let(:v_1_0_0) { Releasetool::Version.new("v1.0.0") }
|
34
40
|
|
35
|
-
|
41
|
+
describe "start" do
|
36
42
|
context "with a since" do
|
37
|
-
subject { Release.new([], {since: 'v0.0.2'}, {}) }
|
43
|
+
subject { Release.new([], { since: 'v0.0.2' }, {}) }
|
38
44
|
it "it should do a prepare and store a file" do
|
39
45
|
expect(Releasetool::Release).to receive(:new).with(v_0_0_3, previous: v_0_0_2).and_return(mock_target)
|
40
46
|
expect(mock_target).to receive(:prepare)
|
@@ -44,14 +50,14 @@ describe Release, quietly: true do
|
|
44
50
|
allow(Releasetool::Release).to receive(:new).with(v_0_0_3, previous: v_0_0_2).and_return(mock_target)
|
45
51
|
allow(mock_target).to receive(:prepare)
|
46
52
|
expect { subject.start('v0.0.3') }.to change {
|
47
|
-
|
48
|
-
|
49
|
-
expect(File.read(File.join(
|
53
|
+
File.exist?(File.join(tmpdir, '.RELEASE_NEW_VERSION'))
|
54
|
+
}
|
55
|
+
expect(File.read(File.join(tmpdir, '.RELEASE_NEW_VERSION')).to_s).to eq('v0.0.3')
|
50
56
|
end
|
51
57
|
|
52
58
|
it "with existing release-version file, it should freak out" do
|
53
|
-
FileUtils.touch(File.join(
|
54
|
-
expect { subject.start('v0.0.3') }.to raise_error
|
59
|
+
FileUtils.touch(File.join(tmpdir, '.RELEASE_NEW_VERSION'))
|
60
|
+
expect { subject.start('v0.0.3') }.to raise_error(/Can't start when already started on a version/)
|
55
61
|
end
|
56
62
|
end
|
57
63
|
|
@@ -72,7 +78,7 @@ describe Release, quietly: true do
|
|
72
78
|
end
|
73
79
|
|
74
80
|
context "without a new version but with --minor modifier" do
|
75
|
-
subject { Release.new([], {minor: true}, {}) }
|
81
|
+
subject { Release.new([], { minor: true }, {}) }
|
76
82
|
|
77
83
|
it "it should use next minor level" do
|
78
84
|
expect(Releasetool::Release).to receive(:new).with(v_0_1_0, previous: v_0_0_1).and_return(mock_target)
|
@@ -82,7 +88,7 @@ describe Release, quietly: true do
|
|
82
88
|
end
|
83
89
|
|
84
90
|
context "without a new version but with --major modifier" do
|
85
|
-
subject { Release.new([], {major: true}, {}) }
|
91
|
+
subject { Release.new([], { major: true }, {}) }
|
86
92
|
|
87
93
|
it "it should use next minor level" do
|
88
94
|
expect(Releasetool::Release).to receive(:new).with(v_1_0_0, previous: v_0_0_1).and_return(mock_target)
|
@@ -90,11 +96,89 @@ describe Release, quietly: true do
|
|
90
96
|
subject.start
|
91
97
|
end
|
92
98
|
end
|
99
|
+
|
100
|
+
context "with config and..." do
|
101
|
+
context "with empty hooks" do
|
102
|
+
before do
|
103
|
+
FileUtils.mkdir_p("#{tmpdir}/config/releasetool")
|
104
|
+
FileUtils.cp(empty_file, "#{tmpdir}/config/releasetool/hooks.rb")
|
105
|
+
end
|
106
|
+
it "should still work" do
|
107
|
+
expect(Releasetool::Release).to receive(:new).with(v_0_0_2, previous: v_0_0_1).and_return(mock_target)
|
108
|
+
expect(mock_target).to receive(:prepare)
|
109
|
+
expected = "after_start(v0.0.2) has been called"
|
110
|
+
expect { subject.start }.not_to output(/#{Regexp.escape(expected)}/).to_stdout
|
111
|
+
end
|
112
|
+
end
|
113
|
+
context "with hook" do
|
114
|
+
before do
|
115
|
+
FileUtils.mkdir_p("#{tmpdir}/config/releasetool")
|
116
|
+
FileUtils.cp(hooks_example_rb, "#{tmpdir}/config/releasetool/hooks.rb")
|
117
|
+
end
|
118
|
+
it "should output hook" do
|
119
|
+
expected = "after_start(v0.0.2) has been called"
|
120
|
+
expect { subject.start }.to output(/#{Regexp.escape(expected)}/).to_stdout
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
describe "commit" do
|
127
|
+
before {
|
128
|
+
allow(ENV).to receive(:[]).with('RELEASETOOL_VERSION_FILE').and_return(nil) # in case it is defined...
|
129
|
+
expect(subject).to receive(:guarded_system).with("git add release_notes")
|
130
|
+
expect(subject).to receive(:guarded_system).with("git add config/initializers/00-version.rb")
|
131
|
+
}
|
132
|
+
context "with no args" do
|
133
|
+
it "outputs without -e" do
|
134
|
+
expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
|
135
|
+
subject.commit('v0.0.3')
|
136
|
+
end
|
137
|
+
end
|
138
|
+
|
139
|
+
context "with --edit" do
|
140
|
+
subject { Release.new([], { edit: true }, {}) }
|
141
|
+
it "outputs with e" do
|
142
|
+
expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -e -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
|
143
|
+
subject.commit('v0.0.3')
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
context "with generated config and hook" do
|
148
|
+
it "should generate and still work" do
|
149
|
+
subject.init
|
150
|
+
expected = "after_commit(v0.0.3) has been called"
|
151
|
+
expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
|
152
|
+
expect { subject.commit('v0.0.3') }.not_to output(/#{Regexp.escape(expected)}/).to_stdout
|
153
|
+
end
|
154
|
+
end
|
155
|
+
|
156
|
+
context "with config and hook" do
|
157
|
+
before do
|
158
|
+
FileUtils.mkdir_p("#{tmpdir}/config/releasetool")
|
159
|
+
FileUtils.cp(hooks_example_rb, "#{tmpdir}/config/releasetool/hooks.rb")
|
160
|
+
end
|
161
|
+
it "should output hook" do
|
162
|
+
expect(subject).to receive(:guarded_system).with("git commit release_notes config/initializers/00-version.rb -m\"#{Release::DEFAULT_COMMIT_MESSAGE}\"")
|
163
|
+
expected = "after_commit(v0.0.3) has been called"
|
164
|
+
expect { subject.commit('v0.0.3') }.to output(/#{Regexp.escape(expected)}/).to_stdout
|
165
|
+
end
|
166
|
+
end
|
167
|
+
end
|
168
|
+
|
169
|
+
describe "init" do
|
170
|
+
it "should generate " do
|
171
|
+
expect(Dir.exist?("#{tmpdir}/config/releasetool")).to be_falsey
|
172
|
+
expect(File.exist?("#{tmpdir}/config/releasetool/hooks.rb")).to be_falsey
|
173
|
+
subject.init
|
174
|
+
expect(Dir.exist?("#{tmpdir}/config/releasetool")).to be_truthy
|
175
|
+
expect(File.exist?("#{tmpdir}/config/releasetool/hooks.rb")).to be_truthy
|
176
|
+
end
|
93
177
|
end
|
94
178
|
|
95
179
|
describe "latest" do
|
96
180
|
it "outputs latest version" do
|
97
|
-
expect{subject.latest}.to output("v0.0.1\n").to_stdout
|
181
|
+
expect { subject.latest }.to output("v0.0.1\n").to_stdout
|
98
182
|
end
|
99
183
|
end
|
100
184
|
|
@@ -110,7 +194,6 @@ describe Release, quietly: true do
|
|
110
194
|
end
|
111
195
|
end
|
112
196
|
|
113
|
-
|
114
197
|
# describe 'CLI' do
|
115
198
|
# it "should work with source and no target" do
|
116
199
|
# puts "CLI"
|
@@ -137,5 +220,4 @@ describe Release, quietly: true do
|
|
137
220
|
# }.strip).not_to eq('')
|
138
221
|
# end
|
139
222
|
# end
|
140
|
-
|
141
223
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.expand_path('../lib', __dir__)
|
2
4
|
require 'releasetool'
|
3
5
|
|
4
6
|
RSpec.configure do |config|
|
5
7
|
config.around quietly: true do |example|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
$stdout = original_stdout
|
15
|
-
end
|
8
|
+
original_stderr = $stderr
|
9
|
+
original_stdout = $stdout
|
10
|
+
# Redirect stderr and stdout
|
11
|
+
$stderr = File.open(File::NULL, "w")
|
12
|
+
$stdout = File.open(File::NULL, "w")
|
13
|
+
example.run
|
14
|
+
$stderr = original_stderr
|
15
|
+
$stdout = original_stdout
|
16
16
|
end
|
17
17
|
end
|
data/spec/version_spec.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
require "releasetool/version"
|
@@ -21,9 +23,9 @@ describe Releasetool::Version do
|
|
21
23
|
end
|
22
24
|
|
23
25
|
describe "next_patch" do
|
24
|
-
let(:v_0_0_1) {Releasetool::Version.new("v0.0.1")}
|
25
|
-
let(:v_0_0_2) {Releasetool::Version.new("v0.0.2")}
|
26
|
-
let(:v_0_0_3) {Releasetool::Version.new("v0.0.3")}
|
26
|
+
let(:v_0_0_1) { Releasetool::Version.new("v0.0.1") }
|
27
|
+
let(:v_0_0_2) { Releasetool::Version.new("v0.0.2") }
|
28
|
+
let(:v_0_0_3) { Releasetool::Version.new("v0.0.3") }
|
27
29
|
|
28
30
|
it "is next" do
|
29
31
|
expect(v_0_0_1.next_patch).to eq(v_0_0_2)
|
@@ -34,9 +36,9 @@ describe Releasetool::Version do
|
|
34
36
|
end
|
35
37
|
|
36
38
|
describe "next_minor" do
|
37
|
-
let(:v_0_0_1) {Releasetool::Version.new("v0.0.1")}
|
38
|
-
let(:v_0_1_0) {Releasetool::Version.new("v0.1.0")}
|
39
|
-
let(:v_0_2_0) {Releasetool::Version.new("v0.2.0")}
|
39
|
+
let(:v_0_0_1) { Releasetool::Version.new("v0.0.1") }
|
40
|
+
let(:v_0_1_0) { Releasetool::Version.new("v0.1.0") }
|
41
|
+
let(:v_0_2_0) { Releasetool::Version.new("v0.2.0") }
|
40
42
|
|
41
43
|
it "is next" do
|
42
44
|
expect(v_0_0_1.next_minor).to eq(v_0_1_0)
|
@@ -47,9 +49,9 @@ describe Releasetool::Version do
|
|
47
49
|
end
|
48
50
|
|
49
51
|
describe "next_major" do
|
50
|
-
let(:v_0_1_1) {Releasetool::Version.new("v0.1.1")}
|
51
|
-
let(:v_1_0_0) {Releasetool::Version.new("v1.0.0")}
|
52
|
-
let(:v_2_0_0) {Releasetool::Version.new("v2.0.0")}
|
52
|
+
let(:v_0_1_1) { Releasetool::Version.new("v0.1.1") }
|
53
|
+
let(:v_1_0_0) { Releasetool::Version.new("v1.0.0") }
|
54
|
+
let(:v_2_0_0) { Releasetool::Version.new("v2.0.0") }
|
53
55
|
|
54
56
|
it "is next" do
|
55
57
|
expect(v_0_1_1.next_major).to eq(v_1_0_0)
|
@@ -60,11 +62,8 @@ describe Releasetool::Version do
|
|
60
62
|
end
|
61
63
|
|
62
64
|
describe "==" do
|
63
|
-
let(:v_0_0_2) {Releasetool::Version.new("v0.0.2")}
|
65
|
+
let(:v_0_0_2) { Releasetool::Version.new("v0.0.2") }
|
64
66
|
|
65
|
-
it "is self same" do
|
66
|
-
expect(v_0_0_2 == v_0_0_2).to be_truthy
|
67
|
-
end
|
68
67
|
it "is same if other is a version of same" do
|
69
68
|
expect(v_0_0_2 == Releasetool::Version.new("v0.0.2")).to be_truthy
|
70
69
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: releasetool
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Diggins
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.56.3
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.56.3
|
69
83
|
description: Some release-related functions, initially just release notes management
|
70
84
|
and creation
|
71
85
|
email:
|
@@ -76,12 +90,16 @@ extensions: []
|
|
76
90
|
extra_rdoc_files: []
|
77
91
|
files:
|
78
92
|
- ".gitignore"
|
93
|
+
- ".rubocop.yml"
|
94
|
+
- ".rubocop_todo.yml"
|
79
95
|
- Gemfile
|
80
96
|
- LICENSE.txt
|
81
97
|
- README.md
|
82
98
|
- Rakefile
|
83
99
|
- bin/release
|
84
100
|
- lib/releasetool.rb
|
101
|
+
- lib/releasetool/base_hooks.rb
|
102
|
+
- lib/releasetool/configuration.rb
|
85
103
|
- lib/releasetool/release.rb
|
86
104
|
- lib/releasetool/util.rb
|
87
105
|
- lib/releasetool/version.rb
|
@@ -94,15 +112,20 @@ files:
|
|
94
112
|
- release_notes/v0.1.1.md
|
95
113
|
- release_notes/v0.2.0.md
|
96
114
|
- release_notes/v0.3.0.md
|
115
|
+
- release_notes/v0.4.0.md
|
116
|
+
- release_notes/v0.5.0.md
|
97
117
|
- releasetool.gemspec
|
118
|
+
- spec/fixtures/empty_file.rb
|
98
119
|
- spec/fixtures/example_with_releases.tar
|
120
|
+
- spec/fixtures/hooks_example.rb
|
99
121
|
- spec/releasetool_spec.rb
|
100
122
|
- spec/spec_helper.rb
|
101
123
|
- spec/version_spec.rb
|
102
124
|
homepage: ''
|
103
125
|
licenses:
|
104
126
|
- MIT
|
105
|
-
metadata:
|
127
|
+
metadata:
|
128
|
+
rubygems_mfa_required: 'true'
|
106
129
|
post_install_message:
|
107
130
|
rdoc_options: []
|
108
131
|
require_paths:
|
@@ -111,19 +134,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
111
134
|
requirements:
|
112
135
|
- - ">="
|
113
136
|
- !ruby/object:Gem::Version
|
114
|
-
version:
|
137
|
+
version: 2.7.0
|
115
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
139
|
requirements:
|
117
140
|
- - ">="
|
118
141
|
- !ruby/object:Gem::Version
|
119
142
|
version: '0'
|
120
143
|
requirements: []
|
121
|
-
rubygems_version: 3.2.
|
144
|
+
rubygems_version: 3.2.33
|
122
145
|
signing_key:
|
123
146
|
specification_version: 4
|
124
147
|
summary: Release management tools
|
125
|
-
test_files:
|
126
|
-
- spec/fixtures/example_with_releases.tar
|
127
|
-
- spec/releasetool_spec.rb
|
128
|
-
- spec/spec_helper.rb
|
129
|
-
- spec/version_spec.rb
|
148
|
+
test_files: []
|