howzit 1.2.12 → 1.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Rakefile +5 -0
- data/lib/howzit/buildnotes.rb +35 -20
- data/lib/howzit/prompt.rb +3 -0
- data/lib/howzit/version.rb +1 -1
- data/spec/ruby_gem_spec.rb +3 -7
- 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: 36a27d1566deff8857d39035c0e40f696a29d78b7ae24274a73ceacc54541321
|
4
|
+
data.tar.gz: 7b13d6644bf397e10f629689b159102a33dd5aa2c3610f368819de3dc8736007
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9da1ea212df950e75a34006a44b0ade09c02fd4fe7c02ea0fddfffcf2936e6ca5db0d7f0c9e6cc44aac3d65eb4544aa9d4c03c156487f9311f39f08ee12199d4
|
7
|
+
data.tar.gz: 99f9be58ff9184a2f96e7db6fed83e3fc19f0945e31c9d58daa32db022b175a8c99a329a9c023528af52100f46583ac892091eb04ed5d9e9e791087fe8f8c82d
|
data/CHANGELOG.md
CHANGED
data/Rakefile
CHANGED
data/lib/howzit/buildnotes.rb
CHANGED
@@ -160,30 +160,40 @@ module Howzit
|
|
160
160
|
warn "\nCanceled"
|
161
161
|
exit!
|
162
162
|
end
|
163
|
+
default = !$stdout.isatty || @options[:default]
|
163
164
|
# First make sure there isn't already a buildnotes file
|
164
165
|
if note_file
|
165
166
|
fname = Color.template("{by}#{note_file}{bw}")
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
167
|
+
unless default
|
168
|
+
res = yn("#{fname} exists and appears to be a build note, continue anyway?", false)
|
169
|
+
unless res
|
170
|
+
puts 'Canceled'
|
171
|
+
Process.exit 0
|
172
|
+
end
|
170
173
|
end
|
171
174
|
end
|
172
175
|
|
173
176
|
title = File.basename(Dir.pwd)
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
177
|
+
if default
|
178
|
+
input = title
|
179
|
+
else
|
180
|
+
printf Color.template("{bw}Project name {xg}[#{title}]{bw}: {x}")
|
181
|
+
input = $stdin.gets.chomp
|
182
|
+
title = input unless input.empty?
|
183
|
+
end
|
178
184
|
summary = ''
|
179
|
-
|
180
|
-
|
181
|
-
|
185
|
+
unless default
|
186
|
+
printf Color.template('{bw}Project summary: {x}')
|
187
|
+
input = $stdin.gets.chomp
|
188
|
+
summary = input unless input.empty?
|
189
|
+
end
|
182
190
|
|
183
191
|
fname = 'buildnotes.md'
|
184
|
-
|
185
|
-
|
186
|
-
|
192
|
+
unless default
|
193
|
+
printf Color.template("{bw}Build notes filename (must begin with 'howzit' or 'build')\n{xg}[#{fname}]{bw}: {x}")
|
194
|
+
input = $stdin.gets.chomp
|
195
|
+
fname = input unless input.empty?
|
196
|
+
end
|
187
197
|
|
188
198
|
note = <<~EOBUILDNOTES
|
189
199
|
# #{title}
|
@@ -210,7 +220,7 @@ module Howzit
|
|
210
220
|
|
211
221
|
EOBUILDNOTES
|
212
222
|
|
213
|
-
if File.exist?(fname)
|
223
|
+
if File.exist?(fname) && !default
|
214
224
|
file = Color.template("{by}#{fname}")
|
215
225
|
res = yn("Are you absolutely sure you want to overwrite #{file}", false)
|
216
226
|
|
@@ -689,7 +699,8 @@ module Howzit
|
|
689
699
|
title_only: false,
|
690
700
|
choose: false,
|
691
701
|
quiet: false,
|
692
|
-
verbose: false
|
702
|
+
verbose: false,
|
703
|
+
default: false
|
693
704
|
}
|
694
705
|
|
695
706
|
defaults = {
|
@@ -733,7 +744,7 @@ module Howzit
|
|
733
744
|
end
|
734
745
|
|
735
746
|
opts.on('-e', '--edit', "Edit buildnotes file in current working directory
|
736
|
-
using
|
747
|
+
using $EDITOR") do
|
737
748
|
edit_note
|
738
749
|
Process.exit 0
|
739
750
|
end
|
@@ -797,7 +808,7 @@ module Howzit
|
|
797
808
|
@options[:wrap] = w.to_i
|
798
809
|
end
|
799
810
|
|
800
|
-
opts.on('--edit-config', "Edit configuration file using
|
811
|
+
opts.on('--edit-config', "Edit configuration file using default $EDITOR") do
|
801
812
|
edit_config(defaults)
|
802
813
|
Process.exit 0
|
803
814
|
end
|
@@ -852,6 +863,10 @@ module Howzit
|
|
852
863
|
puts "Howzit v#{VERSION}"
|
853
864
|
Process.exit 0
|
854
865
|
end
|
866
|
+
|
867
|
+
opts.on('--default', 'Answer all prompts with default response') do
|
868
|
+
@options[:default] = true
|
869
|
+
end
|
855
870
|
end.parse!(args)
|
856
871
|
|
857
872
|
@cli_args = args
|
@@ -1040,7 +1055,7 @@ module Howzit
|
|
1040
1055
|
File.join(config_dir, 'templates')
|
1041
1056
|
end
|
1042
1057
|
|
1043
|
-
def create_config
|
1058
|
+
def create_config(defaults)
|
1044
1059
|
dir, file = [config_dir, config_file]
|
1045
1060
|
unless File.directory?(dir)
|
1046
1061
|
warn "Creating config directory at #{dir}"
|
@@ -1055,7 +1070,7 @@ module Howzit
|
|
1055
1070
|
end
|
1056
1071
|
|
1057
1072
|
def load_config(defaults)
|
1058
|
-
file = create_config
|
1073
|
+
file = create_config(defaults)
|
1059
1074
|
config = YAML.load(IO.read(file))
|
1060
1075
|
newconfig = config ? defaults.merge(config) : defaults
|
1061
1076
|
write_config(newconfig)
|
data/lib/howzit/prompt.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Howzit
|
4
|
+
# Command line prompt utils
|
4
5
|
module Prompt
|
5
6
|
def yn(prompt, default = true)
|
7
|
+
return default if !$stdout.isatty
|
8
|
+
|
6
9
|
system 'stty cbreak'
|
7
10
|
yn = color_single_options(default ? %w[Y n] : %w[y N])
|
8
11
|
$stdout.syswrite "\e[1;37m#{prompt} #{yn}\e[1;37m? \e[0m"
|
data/lib/howzit/version.rb
CHANGED
data/spec/ruby_gem_spec.rb
CHANGED
@@ -12,7 +12,9 @@ end
|
|
12
12
|
|
13
13
|
describe Howzit::BuildNotes do
|
14
14
|
Dir.chdir('spec')
|
15
|
-
|
15
|
+
how = Howzit::BuildNotes.new(['--no-upstream', '--default'])
|
16
|
+
how.create_note
|
17
|
+
subject { how }
|
16
18
|
|
17
19
|
describe ".note_file" do
|
18
20
|
it "locates a build note file" do
|
@@ -20,12 +22,6 @@ describe Howzit::BuildNotes do
|
|
20
22
|
end
|
21
23
|
end
|
22
24
|
|
23
|
-
describe ".get_note_title" do
|
24
|
-
it "is named howzit test" do
|
25
|
-
expect(subject.get_note_title).to match(/howzit test/)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
25
|
describe ".grep_topics" do
|
30
26
|
it "found editable" do
|
31
27
|
expect(subject.grep_topics('editable')).to include('File Structure')
|
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: 1.2.
|
4
|
+
version: 1.2.13
|
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-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|