howzit 2.0.22 → 2.0.25
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/CHANGELOG.md +24 -0
- data/lib/howzit/buildnote.rb +21 -14
- data/lib/howzit/version.rb +1 -1
- data/lib/howzit.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29f72dd5e915f1fbec378cc4210902fb6e3b9ce376de4f4e962c08b40dc5bbca
|
4
|
+
data.tar.gz: bdc554ae8533b3a86360c82a41d4ea55677a5a271fab218db5b1057814aac490
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b49e67762ea36e7e792decb239a8d35f100f28be2992f70a2fb9b2d6ed13ba809db11aa4ea075244be6b263c1c464430b0e57db73ecf444a61f79fcdad812a91
|
7
|
+
data.tar.gz: 7d2d9b973f4798dc4ce0082ccdaad308748a4a39fe505f384f928cdf1fe73a23f751928907e2418a602e26f0de46bafb874d9f0917017d39a0c6feedcfb99990
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,27 @@
|
|
1
|
+
### 2.0.25
|
2
|
+
|
3
|
+
2022-08-09 12:46
|
4
|
+
|
5
|
+
#### FIXED
|
6
|
+
|
7
|
+
- Template metadata inheritence
|
8
|
+
|
9
|
+
### 2.0.24
|
10
|
+
|
11
|
+
2022-08-09 09:04
|
12
|
+
|
13
|
+
#### FIXED
|
14
|
+
|
15
|
+
- Avoid reading upstream files multiple times
|
16
|
+
|
17
|
+
### 2.0.23
|
18
|
+
|
19
|
+
2022-08-09 05:51
|
20
|
+
|
21
|
+
#### FIXED
|
22
|
+
|
23
|
+
- --grep function regression
|
24
|
+
|
1
25
|
### 2.0.22
|
2
26
|
|
3
27
|
2022-08-08 13:49
|
data/lib/howzit/buildnote.rb
CHANGED
@@ -12,7 +12,7 @@ module Howzit
|
|
12
12
|
##
|
13
13
|
## @param file [String] The path to the build note file
|
14
14
|
##
|
15
|
-
def initialize(file: nil)
|
15
|
+
def initialize(file: nil, meta: nil)
|
16
16
|
file ||= note_file
|
17
17
|
|
18
18
|
@topics = []
|
@@ -21,7 +21,9 @@ module Howzit
|
|
21
21
|
content = Util.read_file(file)
|
22
22
|
raise "{br}No content found in build note (#{file}){x}".c if content.nil? || content.empty?
|
23
23
|
|
24
|
-
|
24
|
+
this_meta = content.split(/^#/)[0].strip.get_metadata
|
25
|
+
|
26
|
+
@metadata = meta.nil? ? this_meta : meta.merge(this_meta)
|
25
27
|
|
26
28
|
read_help(file)
|
27
29
|
end
|
@@ -32,7 +34,7 @@ module Howzit
|
|
32
34
|
## @return description
|
33
35
|
##
|
34
36
|
def inspect
|
35
|
-
|
37
|
+
"#<Howzit::BuildNote @topics=[#{@topics.count}]>"
|
36
38
|
end
|
37
39
|
|
38
40
|
##
|
@@ -205,14 +207,14 @@ module Howzit
|
|
205
207
|
if File.exist?(file) && !default
|
206
208
|
file = "{by}#{file}".c
|
207
209
|
unless Prompt.yn("Are you sure you want to overwrite #{file}", default: false)
|
208
|
-
|
210
|
+
Howzit.console.info('Cancelled')
|
209
211
|
Process.exit 0
|
210
212
|
end
|
211
213
|
end
|
212
214
|
|
213
215
|
File.open(file, 'w') do |f|
|
214
216
|
f.puts note
|
215
|
-
|
217
|
+
Howzit.console.info("{by}Template {bw}#{title}{by} written to {bw}#{file}{x}".c)
|
216
218
|
end
|
217
219
|
|
218
220
|
if File.exist?(file) && !default && Prompt.yn("{bg}Do you want to open {bw}#{file} {bg}for editing?{x}".c,
|
@@ -298,14 +300,14 @@ module Howzit
|
|
298
300
|
if File.exist?(fname) && !default
|
299
301
|
file = "{by}#{fname}".c
|
300
302
|
unless Prompt.yn("Are you absolutely sure you want to overwrite #{file}", default: false)
|
301
|
-
|
303
|
+
Howzit.console.info('Canceled')
|
302
304
|
Process.exit 0
|
303
305
|
end
|
304
306
|
end
|
305
307
|
|
306
308
|
File.open(fname, 'w') do |f|
|
307
309
|
f.puts note
|
308
|
-
|
310
|
+
Howzit.console.info("{by}Build notes for {bw}#{title}{by} written to {bw}#{fname}{x}".c)
|
309
311
|
end
|
310
312
|
|
311
313
|
if File.exist?(fname) && !default && Prompt.yn("{bg}Do you want to open {bw}#{fname} {bg}for editing?{x}".c,
|
@@ -451,11 +453,12 @@ module Howzit
|
|
451
453
|
## @return [Array] extracted topics
|
452
454
|
##
|
453
455
|
def read_template(template, file, subtopics = nil)
|
454
|
-
note = BuildNote.new(file: file)
|
456
|
+
note = BuildNote.new(file: file, meta: @metadata)
|
455
457
|
|
456
458
|
template_topics = subtopics.nil? ? note.topics : extract_subtopics(note, subtopics)
|
457
459
|
template_topics.map do |topic|
|
458
460
|
topic.parent = template
|
461
|
+
topic.content = topic.content.render_template(@metadata)
|
459
462
|
topic
|
460
463
|
end
|
461
464
|
end
|
@@ -532,7 +535,6 @@ module Howzit
|
|
532
535
|
##
|
533
536
|
def read_upstream
|
534
537
|
buildnotes = glob_upstream
|
535
|
-
|
536
538
|
topics_dict = []
|
537
539
|
buildnotes.each do |path|
|
538
540
|
topics_dict.concat(read_help_file(path))
|
@@ -608,6 +610,7 @@ module Howzit
|
|
608
610
|
end
|
609
611
|
title = "#{short_path}:#{title}"
|
610
612
|
end
|
613
|
+
|
611
614
|
topic = Topic.new(title, prefix + lines.join("\n").strip.render_template(@metadata))
|
612
615
|
|
613
616
|
topics.push(topic)
|
@@ -627,12 +630,15 @@ module Howzit
|
|
627
630
|
##
|
628
631
|
def read_help(path = nil)
|
629
632
|
@topics = read_help_file(path)
|
630
|
-
return unless
|
633
|
+
return unless Howzit.options[:include_upstream]
|
631
634
|
|
632
|
-
|
635
|
+
unless Howzit.has_read_upstream
|
636
|
+
upstream_topics = read_upstream
|
633
637
|
|
634
|
-
|
635
|
-
|
638
|
+
upstream_topics.each do |topic|
|
639
|
+
@topics.push(topic) unless find_topic(topic.title.sub(/^.+:/, '')).count.positive?
|
640
|
+
end
|
641
|
+
Howzit.has_read_upstream = true
|
636
642
|
end
|
637
643
|
|
638
644
|
if note_file && @topics.empty?
|
@@ -691,7 +697,7 @@ module Howzit
|
|
691
697
|
## single topic
|
692
698
|
##
|
693
699
|
def process_topic(topic, run, single: false)
|
694
|
-
new_topic = topic.dup
|
700
|
+
new_topic = topic.is_a?(String) ? find_topic(topic)[0] : topic.dup
|
695
701
|
|
696
702
|
# Handle variable replacement
|
697
703
|
new_topic.content = new_topic.content.render_arguments
|
@@ -793,6 +799,7 @@ module Howzit
|
|
793
799
|
|
794
800
|
if !topic_matches.empty?
|
795
801
|
# If we found a match
|
802
|
+
topic_matches.map! { |topic| topic.is_a?(String) ? find_topic(topic)[0] : topic }
|
796
803
|
topic_matches.each { |topic_match| output.push(process_topic(topic_match, Howzit.options[:run], single: true)) }
|
797
804
|
else
|
798
805
|
# If there's no argument or no match found, output all
|
data/lib/howzit/version.rb
CHANGED
data/lib/howzit.rb
CHANGED
@@ -82,5 +82,13 @@ module Howzit
|
|
82
82
|
def console
|
83
83
|
@console ||= Howzit::ConsoleLogger.new(options[:log_level])
|
84
84
|
end
|
85
|
+
|
86
|
+
def has_read_upstream
|
87
|
+
@has_read_upstream ||= false
|
88
|
+
end
|
89
|
+
|
90
|
+
def has_read_upstream=(has_read)
|
91
|
+
@has_read_upstream = has_read
|
92
|
+
end
|
85
93
|
end
|
86
94
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: howzit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.25
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brett Terpstra
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-08-
|
11
|
+
date: 2022-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|