tworingtools 2.1.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/bumpr +4 -12
- data/bin/changetag +10 -12
- data/bin/clean-rc-tags +1 -1
- data/bin/migrate-changelog +3 -3
- data/bin/prerelease-podspec +7 -0
- data/bin/release-podspec +9 -6
- data/lib/errors.rb +8 -0
- data/lib/git_check.rb +10 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9b1c737a275e5641827ae194527d442e3b66193aa207f04986fde49baf4347b
|
4
|
+
data.tar.gz: 9fa221d0138418902b99203f7ad06929c8b87e7d2b270fcce6a09996659c7c47
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52ca1d901b65ddac44e48ca3232104f7473be210bce899d919432e6debc6d9b23c77e2e0406dfc3d8ac8180f3eed7dca6f5ca45d5371cf8d723b62d606eaac5e
|
7
|
+
data.tar.gz: 5fc053973986ad6b0ea4139be05dc8f062e328604ddcc59a62f4518bdf2b6c6335120263c864b1b0b3c9c9f6bc31974a6dbe56b5948f44ad761d734263659774
|
data/bin/bumpr
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'open3'
|
4
3
|
require 'optparse'
|
5
4
|
require_relative '../lib/echoexec'
|
5
|
+
require_relative '../lib/errors'
|
6
|
+
require_relative '../lib/git_check'
|
6
7
|
|
7
8
|
options = {}
|
8
9
|
parser = OptionParser.new do |opts|
|
@@ -24,12 +25,7 @@ parser = OptionParser.new do |opts|
|
|
24
25
|
end
|
25
26
|
parser.parse!
|
26
27
|
|
27
|
-
unless options[:no_commit]
|
28
|
-
modified_file_count, stderr, status = Open3.capture3("git status --porcelain | egrep '^(M| M)' | wc -l")
|
29
|
-
if modified_file_count.to_i > 0 then
|
30
|
-
echo_and_exec 'git stash'
|
31
|
-
end
|
32
|
-
end
|
28
|
+
git_check unless options[:no_commit]
|
33
29
|
|
34
30
|
component = ARGV[0]
|
35
31
|
version_file = ARGV[1]
|
@@ -44,7 +40,7 @@ argument = {
|
|
44
40
|
|
45
41
|
if argument == nil then
|
46
42
|
puts 'Unrecognized version component.'
|
47
|
-
exit
|
43
|
+
exit TwoRingToolError::INVALID_SEMVER_COMPONENT
|
48
44
|
end
|
49
45
|
|
50
46
|
command = "vrsn #{argument} --file #{version_file}"
|
@@ -54,8 +50,4 @@ stdout, stderr, status = Open3.capture3(command)
|
|
54
50
|
unless options[:no_commit] then
|
55
51
|
echo_and_exec "git add #{version_file}"
|
56
52
|
echo_and_exec "git commit --message \"#{stdout}\""
|
57
|
-
|
58
|
-
if modified_file_count.to_i > 0 then
|
59
|
-
echo_and_exec "git stash pop"
|
60
|
-
end
|
61
53
|
end
|
data/bin/changetag
CHANGED
@@ -2,12 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require_relative '../lib/echoexec'
|
5
|
-
|
6
|
-
|
7
|
-
ILLEGAL_COMMENT_CHAR = 65
|
8
|
-
INVALID_CHANGELOG_PATH = 66
|
9
|
-
UNFORCED_ANNOTATION_OVERWRITE_ATTEMPT = 67
|
10
|
-
CHANGELOG_ENTRY_NOT_FOUND = 68
|
5
|
+
require_relative '../lib/errors'
|
6
|
+
require_relative '../lib/git_check'
|
11
7
|
|
12
8
|
options = {}
|
13
9
|
parser = OptionParser.new do |opts|
|
@@ -19,7 +15,7 @@ parser = OptionParser.new do |opts|
|
|
19
15
|
|
20
16
|
For normal usage, provide the path to the changelog from which to extract release notes, and the git tag name for which you'd like to extract release notes. This pulls the relevant section from your changelog, as long as you adhere to the format described at http://keepachangelog.com/en/1.0.0/.
|
21
17
|
|
22
|
-
Note that the specification requires using the '#' character for hierarchical organization. Conveniently, this also renders different header styles with markdown. Unfortunately, that character is used to denote comments in git tag annotations (similar to git commit messages). So, before using changetag, you must change this to a different character:
|
18
|
+
Note that the specification requires using the '#' character for hierarchical organization. Conveniently, this also renders different header styles with markdown. Unfortunately, that character is used to denote comments in git tag annotations (similar to git commit messages). So, before using changetag, you must change this to a different character:
|
23
19
|
|
24
20
|
$> git config core.commentchar "@"
|
25
21
|
|
@@ -41,6 +37,8 @@ parser = OptionParser.new do |opts|
|
|
41
37
|
end
|
42
38
|
parser.parse!
|
43
39
|
|
40
|
+
git_check unless options[:no_commit]
|
41
|
+
|
44
42
|
# set valid git message comment character
|
45
43
|
|
46
44
|
echo_and_exec "git config core.commentchar '@'"
|
@@ -50,7 +48,7 @@ echo_and_exec "git config core.commentchar '@'"
|
|
50
48
|
changelog_path = ARGV[0]
|
51
49
|
unless File.file?(changelog_path) then
|
52
50
|
puts "The path '#{changelog_path}' does not point to a valid file."
|
53
|
-
exit INVALID_CHANGELOG_PATH
|
51
|
+
exit TwoRingToolError::INVALID_CHANGELOG_PATH
|
54
52
|
end
|
55
53
|
|
56
54
|
git_tag = ARGV[1]
|
@@ -58,7 +56,7 @@ current_git_tag_annotation = `git tag -n #{git_tag}`.strip
|
|
58
56
|
git_tag_exists = current_git_tag_annotation != ''
|
59
57
|
if git_tag_exists and current_git_tag_annotation != git_tag and options[:force] != true then
|
60
58
|
puts "The tag #{git_tag} already has an annotation. To overwrite it, call changetag with the -f/--force option."
|
61
|
-
exit UNFORCED_ANNOTATION_OVERWRITE_ATTEMPT
|
59
|
+
exit TwoRingToolError::UNFORCED_ANNOTATION_OVERWRITE_ATTEMPT
|
62
60
|
end
|
63
61
|
|
64
62
|
# Extract the relevant section from the changelog, which should have the following format: (square brackets should be present, chevrons are to denote content descriptions)
|
@@ -75,9 +73,9 @@ end
|
|
75
73
|
=end
|
76
74
|
|
77
75
|
changelog_contents = File.open(changelog_path).readlines
|
78
|
-
if options[:name] != nil then
|
76
|
+
if options[:name] != nil then
|
79
77
|
entry_name = options[:name]
|
80
|
-
else
|
78
|
+
else
|
81
79
|
entry_name = git_tag
|
82
80
|
end
|
83
81
|
|
@@ -92,7 +90,7 @@ end
|
|
92
90
|
|
93
91
|
if entry_start_idx == -1 then
|
94
92
|
puts "Could not find an entry in the changelog named '#{entry_name}'."
|
95
|
-
exit CHANGELOG_ENTRY_NOT_FOUND
|
93
|
+
exit TwoRingToolError::CHANGELOG_ENTRY_NOT_FOUND
|
96
94
|
end
|
97
95
|
|
98
96
|
entry_end_idx = -1
|
data/bin/clean-rc-tags
CHANGED
@@ -2,4 +2,4 @@
|
|
2
2
|
#
|
3
3
|
# Deletes any release candidate tags leftover after prerelease testing.
|
4
4
|
|
5
|
-
`git tag --list | grep '
|
5
|
+
`git tag --list | grep '\\\-RC[0-9]\\\+' | xargs -tI @ bash -c \"git tag --delete @ && git push --delete origin @\"`
|
data/bin/migrate-changelog
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'optparse'
|
4
4
|
require_relative '../lib/echoexec'
|
5
|
+
require_relative '../lib/git_check'
|
5
6
|
|
6
7
|
options = {}
|
7
8
|
parser = OptionParser.new do |opts|
|
@@ -19,13 +20,13 @@ parser = OptionParser.new do |opts|
|
|
19
20
|
end
|
20
21
|
parser.parse!
|
21
22
|
|
23
|
+
git_check unless options[:no_commit]
|
24
|
+
|
22
25
|
changelog_path = ARGV[0]
|
23
26
|
version = ARGV[1]
|
24
27
|
|
25
28
|
new_entry = "\n\#\# [#{version}] #{Time.now.strftime("%Y-%m-%d")}\n"
|
26
29
|
|
27
|
-
`git stash`
|
28
|
-
|
29
30
|
# read in the changelog file contents
|
30
31
|
changelog_contents = File.open(changelog_path).readlines
|
31
32
|
|
@@ -40,4 +41,3 @@ end
|
|
40
41
|
|
41
42
|
`git add #{changelog_path}`
|
42
43
|
`git commit --message "chore(changelog): moved Unreleased entries to #{version}"`
|
43
|
-
`git stash pop`
|
data/bin/prerelease-podspec
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'open3'
|
4
4
|
require 'optparse'
|
5
|
+
require_relative '../lib/git_check'
|
5
6
|
require_relative '../lib/echoexec'
|
6
7
|
|
7
8
|
podspec = ARGV[0]
|
@@ -22,6 +23,7 @@ parser = OptionParser.new do |opts|
|
|
22
23
|
BANNER
|
23
24
|
opts.on('-w', '--allow-warnings', 'Pass \'--allow-warnings\' to \'cocoapods spec lint\'.') do |force| options[:allow_warnings] = true end
|
24
25
|
opts.on('-v', '--verbose', 'Pass \'--verbose\' to \'cocoapods spec lint\'.') do |name| options[:verbose] = true end
|
26
|
+
opts.on('-s', '--skip-tests', 'Pass \'--skip-tests\' to \'cocoapods spec lint\'.') do |skip_tests| options[:skip_tests] = true end
|
25
27
|
opts.on('-n', '--podspec-name-in-tag', 'When forming the tag name for a release candidate, prefix the podspec‘s name to the version string. Helps when you have multiple podspecs in a repository and tag versions for each.') do |podspec_name_in_tag| options[:podspec_name_in_tag] = true end
|
26
28
|
opts.on('-n', '--no-branch', 'Make any changes on the current branch instead of creating a temporary new branch.') do |no_branch| options[:no_branch] = true end
|
27
29
|
opts.on('-cCHANGELOG', '--changelog=CHANGELOG', 'Location of a CHANGELOG document adhering to https://keepachangelog.com/en/1.0.0/ whose version entry should be extracted into an annotated tag for this release candidate.') do |changelog| options[:changelog] = changelog end
|
@@ -32,6 +34,8 @@ parser = OptionParser.new do |opts|
|
|
32
34
|
end
|
33
35
|
parser.parse!
|
34
36
|
|
37
|
+
git_check unless options[:no_commit]
|
38
|
+
|
35
39
|
version_file = "#{podspec}.podspec"
|
36
40
|
|
37
41
|
current_version = `vrsn --read --file #{version_file}`.strip
|
@@ -72,6 +76,9 @@ end
|
|
72
76
|
if options[:verbose] != nil then
|
73
77
|
spec_lint_flags << '--verbose'
|
74
78
|
end
|
79
|
+
if options[:skip_tests] != nil then
|
80
|
+
spec_lint_flags << '--skip-tests'
|
81
|
+
end
|
75
82
|
stdout, stderr, status = Open3.capture3 "rbenv exec bundle exec pod spec lint #{podspec}.podspec #{spec_lint_flags.join ' '}"
|
76
83
|
|
77
84
|
puts "stdout: #{stdout}"
|
data/bin/release-podspec
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'open3'
|
4
4
|
require 'optparse'
|
5
5
|
require_relative '../lib/echoexec'
|
6
|
+
require_relative '../lib/errors'
|
7
|
+
require_relative '../lib/git_check'
|
6
8
|
|
7
9
|
podspec = ARGV[0]
|
8
10
|
|
@@ -23,19 +25,21 @@ parser = OptionParser.new do |opts|
|
|
23
25
|
opts.on('-v', '--verbose', 'Pass \'--verbose\' to \'cocoapods spec lint\'.') do |name| options[:verbose] = true end
|
24
26
|
opts.on('-rREPO', '--repo=REPO', 'By default, release-podspec pushes the podspec to CocoaPods trunk. By supplying this argument, instead of \`pod trunk push\`, \`pod repo push\` is used instead.') do |repo| options[:repo] = repo end
|
25
27
|
opts.on('-cCHANGELOG_PATH', '--changelog-path=CHANGELOG_PATH', 'By default, release-podspec looks for //CHANGELOG.md. You can specify another location with this option.') do |changelog_path| options[:changelog_path] = changelog_path end
|
26
|
-
opts.on('--e', '--changelog-entry=CHANGELOG_ENTRY', 'The name of the changelog entry, if it differs from the tag name.') do |changelog_entry_name_override| options[:changelog_entry_name_override] =
|
27
|
-
opts.on('-h', '--help', 'Print this help message.') do
|
28
|
+
opts.on('--e', '--changelog-entry=CHANGELOG_ENTRY', 'The name of the changelog entry, if it differs from the tag name.') do |changelog_entry_name_override| options[:changelog_entry_name_override] = changelog_entry_name_override end
|
29
|
+
opts.on('-h', '--help', 'Print this help message.') do
|
28
30
|
puts opts
|
29
31
|
exit
|
30
32
|
end
|
31
33
|
end
|
32
34
|
parser.parse!
|
33
35
|
|
36
|
+
git_check unless options[:no_commit]
|
37
|
+
|
34
38
|
changelog_path = 'CHANGELOG.md'
|
35
39
|
if options[:changelog_path] != nil then
|
36
40
|
changelog_path = options[:changelog_path]
|
37
41
|
end
|
38
|
-
version = `vrsn --read --file #{podspec}.podspec
|
42
|
+
version = `vrsn --read --file #{podspec}.podspec`.strip
|
39
43
|
name_prefix = String.new
|
40
44
|
if options[:podspec_name_in_tag] then
|
41
45
|
name_prefix = podspec + '-'
|
@@ -47,7 +51,7 @@ end
|
|
47
51
|
echo_and_exec "rbenv exec bundle exec changetag #{changelog_path} #{name_prefix}#{version} #{changelog_entry_name}"
|
48
52
|
echo_and_exec 'git push --tags'
|
49
53
|
|
50
|
-
spec_lint_flags = Array.new
|
54
|
+
spec_lint_flags = Array.new
|
51
55
|
if options[:allow_warnings] != nil then
|
52
56
|
spec_lint_flags << '--allow-warnings'
|
53
57
|
end
|
@@ -72,8 +76,7 @@ puts stdout
|
|
72
76
|
|
73
77
|
if status != 0 then
|
74
78
|
puts "Podspec push failed:\nstderr: #{stderr}"
|
75
|
-
exit
|
79
|
+
exit TwoRingToolError::PODSPEC_PUSH_FAILED
|
76
80
|
else
|
77
81
|
puts "Podspec pushed successfully!"
|
78
82
|
end
|
79
|
-
|
data/lib/errors.rb
ADDED
data/lib/git_check.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'open3'
|
2
|
+
require_relative 'errors'
|
3
|
+
|
4
|
+
def git_check
|
5
|
+
modified_file_count, stderr, status = Open3.capture3("git status --porcelain | egrep '^(M| M)' | wc -l")
|
6
|
+
if modified_file_count.to_i > 0 then
|
7
|
+
puts 'Please commit all changes to working index before proceeding.'
|
8
|
+
exit TwoRingToolError::GIT_DIRTY_INDEX
|
9
|
+
end
|
10
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tworingtools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew McKnight
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-04-
|
11
|
+
date: 2020-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: github_api
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.19'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.19'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,6 +72,8 @@ files:
|
|
72
72
|
- bin/sync-forks
|
73
73
|
- bin/xcsims
|
74
74
|
- lib/echoexec.rb
|
75
|
+
- lib/errors.rb
|
76
|
+
- lib/git_check.rb
|
75
77
|
homepage: https://github.com/TwoRingSoft/tools
|
76
78
|
licenses:
|
77
79
|
- MIT
|