tworingtools 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/changetag +19 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90a1bc7d807d2796539d05469cbfc08267d44cd893a8329ae9e4bb8136cfdde4
|
4
|
+
data.tar.gz: dcc34f89bcfb21cfa384ce6f47ea523187894fae6f115befff262a66ca189c0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fe5fc725dabcfc11dd59f8d74138610a25d5f417f6e8c891eb25682c6e86f02dc0fd9d5bfdcc6dbbe0ea6ec192775ec9c973b6835352ff2941d75df518fb21bc
|
7
|
+
data.tar.gz: f9ab4e4f9df84926094333840543b8aa5aa48eb14ae9cf4362edf7d2f2f955f9ebf211fdf6f16742cd4e32e868011783214f2436ecdf0a5512b5ddbc6aa5af5c
|
data/bin/changetag
CHANGED
@@ -55,7 +55,6 @@ end
|
|
55
55
|
# get the changelog entry contents
|
56
56
|
|
57
57
|
changelog_path = ARGV[0]
|
58
|
-
|
59
58
|
unless File.file?(changelog_path) then
|
60
59
|
puts "The path '#{changelog_path}' does not point to a valid file."
|
61
60
|
exit INVALID_CHANGELOG_PATH
|
@@ -69,9 +68,8 @@ if git_tag_exists and current_git_tag_annotation != git_tag and options[:force]
|
|
69
68
|
exit UNFORCED_ANNOTATION_OVERWRITE_ATTEMPT
|
70
69
|
end
|
71
70
|
|
71
|
+
# Extract the relevant section from the changelog, which should have the following format: (square brackets should be present, chevrons are to denote content descriptions)
|
72
72
|
=begin
|
73
|
-
Extract the relevant section from the changelog, which should have the following format: (square brackets should be present, chevrons are to denote content descriptions)
|
74
|
-
|
75
73
|
## [<entry-name>] <entry-date>
|
76
74
|
|
77
75
|
<contents>
|
@@ -82,6 +80,7 @@ Extract the relevant section from the changelog, which should have the following
|
|
82
80
|
|
83
81
|
... etc ...
|
84
82
|
=end
|
83
|
+
|
85
84
|
changelog_contents = File.open(changelog_path).readlines
|
86
85
|
if options[:name] != nil then
|
87
86
|
entry_name = options[:name]
|
@@ -112,10 +111,25 @@ changelog_contents.each_with_index do |line, i|
|
|
112
111
|
end
|
113
112
|
end
|
114
113
|
|
115
|
-
|
114
|
+
# get the changelog entry lines
|
115
|
+
entry_contents = changelog_contents[entry_start_idx..entry_end_idx].select{|x| x != "\n"}
|
116
116
|
|
117
|
-
#
|
117
|
+
# clean up the entry name by just setting it to the name of the tag
|
118
|
+
entry_contents[0] = entry_name
|
119
|
+
|
120
|
+
# combine the lines and escape any quotes that will mess with the command executed in shell
|
121
|
+
entry_contents = entry_contents.join("\n").gsub('`', '\\\`').gsub("'", '\\\'').gsub('"', '\\\"').split("\n")
|
118
122
|
|
123
|
+
# shorten any markdown headings. The entry name should be at level two ("##"), so remove two from each string of hashes that begins a line
|
124
|
+
entry_contents.map! do |line|
|
125
|
+
line unless line[0] == '#'
|
126
|
+
line.gsub(/^\#\#/, '')
|
127
|
+
end
|
128
|
+
|
129
|
+
# join the final result into a string
|
130
|
+
entry_contents = entry_contents.join("\n")
|
131
|
+
|
132
|
+
# create or edit a git tag with the changelog contents
|
119
133
|
if git_tag_exists then
|
120
134
|
echo_and_exec "git tag #{git_tag} #{git_tag} -f -m \"#{entry_contents}\""
|
121
135
|
else
|