tworingtools 1.3.0 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/bin/changetag +19 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 92b3d2b2119f4550caa1bea34457c623f70f406947393765b46f60b7e55cb9ae
4
- data.tar.gz: 6abbde855a4bb79818e6833b464724583cef15acfe1b80180953697dad420d99
3
+ metadata.gz: 90a1bc7d807d2796539d05469cbfc08267d44cd893a8329ae9e4bb8136cfdde4
4
+ data.tar.gz: dcc34f89bcfb21cfa384ce6f47ea523187894fae6f115befff262a66ca189c0d
5
5
  SHA512:
6
- metadata.gz: 8044bfc8f56b663876098c1b696f203112494917fde9c42ded6d2f9578f636d2bbb8f478c9f5683407659edf7fd30c27121a93162edf68d4ab48cb06e0b27dcf
7
- data.tar.gz: b957e3e536cf096da7c1bd0ce70a0f48076c3491baaaa98a2322dbd99280254010fe811e17e482ebb3343967d9cd3d8b7162ccd8806ba76fb501e2f618bbe0f8
6
+ metadata.gz: fe5fc725dabcfc11dd59f8d74138610a25d5f417f6e8c891eb25682c6e86f02dc0fd9d5bfdcc6dbbe0ea6ec192775ec9c973b6835352ff2941d75df518fb21bc
7
+ data.tar.gz: f9ab4e4f9df84926094333840543b8aa5aa48eb14ae9cf4362edf7d2f2f955f9ebf211fdf6f16742cd4e32e868011783214f2436ecdf0a5512b5ddbc6aa5af5c
@@ -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
- entry_contents = changelog_contents[entry_start_idx..entry_end_idx].select{|x| x != "\n"}.join("\n").gsub('`', '\\\`').gsub("'", '\\\'').gsub('"', '\\\"').split("\n").join("\n")
114
+ # get the changelog entry lines
115
+ entry_contents = changelog_contents[entry_start_idx..entry_end_idx].select{|x| x != "\n"}
116
116
 
117
- # create or edit a git tag with the changelog contents
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tworingtools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew McKnight