tworingtools 2.0.3 → 3.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 06fe6502106dcae958559b6fce2dd724c2ecbd6e77d2b95e2b0f6cb67a1de286
4
- data.tar.gz: 738ef45f9b00cb2c59f69078b69166c8c0ea6522eb738178570ef88607e16e17
3
+ metadata.gz: c09250511b87bb9ed4e1f1da967f5c5712b45c343e7213451dcab4fd1c7586ab
4
+ data.tar.gz: ac6720085431eb198ac48b69b8823b20aa616346abf79f2446f81b4b3a24339b
5
5
  SHA512:
6
- metadata.gz: ba6a34c3e5db422f727ab9ca63e17d8a88d7e92a15313356fb33e94d16a1c856bc92213ed03e474985ad4b73153e520cfc60c31dcdcf782433697d3b4c8546f5
7
- data.tar.gz: ff8920bab3dcf610d9e0044a21f9f4f3d098f2f3d04d704e64ce13fd3b450054797827a58be3ce8d02ca3e73904f43c84c4d2c047225c2530094aac33a5c5b31
6
+ metadata.gz: a6eff7ef2d44889e7114bcd90e865fc10ad469771c4fc2a25511f581655f6718a3358fed338e81f86cb5f71e47d403c2996ca633dbc9ed2146c6d4771e757b67
7
+ data.tar.gz: 4b24b67f638695591f6fa109e6dae3684e7002bd47bb70692445ff02d85c7a416c5da2a2f50c4d357259f38ea70a07104a3f19e81f5473f318c91502b3944553
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] then
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 1
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
@@ -2,12 +2,8 @@
2
2
 
3
3
  require 'optparse'
4
4
  require_relative '../lib/echoexec'
5
-
6
- # failure modes
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
@@ -2,4 +2,4 @@
2
2
  #
3
3
  # Deletes any release candidate tags leftover after prerelease testing.
4
4
 
5
- `git tag --list | grep '\-RC[0-9]\+' | xargs -tI @ bash -c "git tag --delete @ && git push --delete origin @"`
5
+ `git tag --list | grep '\\\-RC[0-9]\\\+' | xargs -tI @ bash -c \"git tag --delete @ && git push --delete origin @\"`
@@ -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`
@@ -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]
@@ -32,6 +33,8 @@ parser = OptionParser.new do |opts|
32
33
  end
33
34
  parser.parse!
34
35
 
36
+ git_check unless options[:no_commit]
37
+
35
38
  version_file = "#{podspec}.podspec"
36
39
 
37
40
  current_version = `vrsn --read --file #{version_file}`.strip
@@ -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,26 +25,33 @@ 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('-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
27
30
  puts opts
28
31
  exit
29
32
  end
30
33
  end
31
34
  parser.parse!
32
35
 
36
+ git_check unless options[:no_commit]
37
+
33
38
  changelog_path = 'CHANGELOG.md'
34
39
  if options[:changelog_path] != nil then
35
40
  changelog_path = options[:changelog_path]
36
41
  end
37
- version = `vrsn --read --file #{podspec}.podspec`
42
+ version = `vrsn --read --file #{podspec}.podspec`.strip
38
43
  name_prefix = String.new
39
44
  if options[:podspec_name_in_tag] then
40
45
  name_prefix = podspec + '-'
41
46
  end
42
- echo_and_exec "rbenv exec bundle exec changetag #{changelog_path} #{name_prefix}#{version} "
47
+ changelog_entry_name = String.new
48
+ if options[:changelog_entry_name_override] != nil then
49
+ changelog_entry_name = "--name " + options[:changelog_entry_name_override]
50
+ end
51
+ echo_and_exec "rbenv exec bundle exec changetag #{changelog_path} #{name_prefix}#{version} #{changelog_entry_name}"
43
52
  echo_and_exec 'git push --tags'
44
53
 
45
- spec_lint_flags = Array.new
54
+ spec_lint_flags = Array.new
46
55
  if options[:allow_warnings] != nil then
47
56
  spec_lint_flags << '--allow-warnings'
48
57
  end
@@ -67,8 +76,7 @@ puts stdout
67
76
 
68
77
  if status != 0 then
69
78
  puts "Podspec push failed:\nstderr: #{stderr}"
70
- exit 1
79
+ exit TwoRingToolError::PODSPEC_PUSH_FAILED
71
80
  else
72
81
  puts "Podspec pushed successfully!"
73
82
  end
74
-
@@ -0,0 +1,8 @@
1
+ module TwoRingToolError
2
+ INVALID_CHANGELOG_PATH = 65
3
+ UNFORCED_ANNOTATION_OVERWRITE_ATTEMPT = 66
4
+ CHANGELOG_ENTRY_NOT_FOUND = 67
5
+ GIT_DIRTY_INDEX = 68
6
+ PODSPEC_PUSH_FAILED = 69
7
+ INVALID_SEMVER_COMPONENT = 70
8
+ end
@@ -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: 2.0.3
4
+ version: 3.0.2
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-04 00:00:00.000000000 Z
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.18'
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.18'
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