howzit 2.1.14 → 2.1.15

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: 1fa016c0fa681b1f07238f643dcdffd1fe9679a0362dd18a99ad5c9280282a66
4
- data.tar.gz: 2e171f199e644a56046121b4a2b7bc803196bee9b026f619939c51f70828ec13
3
+ metadata.gz: 801a2edf83210d0abd3cf17ab9c9259469429478c48b8245df7475bde19c6676
4
+ data.tar.gz: c47dd24e16f255fcbbd0ac5acadb3c57f423bda0237bbbb85b43f8c82e08b0db
5
5
  SHA512:
6
- metadata.gz: 5178be93f700a6d51ddee37f1ea239d65eab8c79f60773d4a8faa9f6dc191a195d43e725cb9980532b2ab177a332c86fe0b914d64051c1eb67c80df0f1c61104
7
- data.tar.gz: 58490e3f05c46aba51248dc857f1835b8146f9bfcd7b76fa0640175140046676825a4d1e25f1824bac5415875857da0078a95d2f4dbc783e0bf69d90e42c3c05
6
+ metadata.gz: f8ea4385da70cb5cf7e8d66b5352f164d7cee71b050cf47a544539bf61d0ffd95b4c46f77347b8cf016fd50bd9edf6f7fe1b088fb4f8d324af9343c833334204
7
+ data.tar.gz: 7bc8190df842331c74ab4dc0146262b886c1174d3fcf2faef35dc536d0622fe29c2868c4db6e2067e1198c801116d8b67bb0272214cfe8a75dd210a86ec8db66
data/.gitignore CHANGED
@@ -42,3 +42,4 @@ Gemfile.lock
42
42
  # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
43
43
  .rvmrc
44
44
  results.log
45
+ html
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ### 2.1.15
2
+
3
+ 2024-08-07 13:10
4
+
5
+ #### FIXED
6
+
7
+ - Prompt for editor when $EDITOR is not defined
8
+ - Use exec for CLI editors provide a separate process
9
+ - Remove tests for editor in main executable
10
+
1
11
  ### 2.1.14
2
12
 
3
13
  2024-08-06 16:36
data/README.rdoc ADDED
@@ -0,0 +1,6 @@
1
+ = Howzit
2
+
3
+ A command-line reference tool for tracking project build systems
4
+
5
+
6
+
data/Rakefile CHANGED
@@ -6,6 +6,13 @@ require 'rspec/core/rake_task'
6
6
  require 'rubocop/rake_task'
7
7
  require 'yard'
8
8
  require 'tty-spinner'
9
+ require 'rdoc/task'
10
+
11
+ Rake::RDocTask.new do |rd|
12
+ rd.main = 'README.rdoc'
13
+ rd.rdoc_files.include('README.rdoc', 'lib/**/*.rb', 'bin/**/*')
14
+ rd.title = 'Howzit'
15
+ end
9
16
 
10
17
  task default: %i[test yard]
11
18
 
@@ -41,17 +48,20 @@ task :dockertest, :version, :login do |_, args|
41
48
  args.with_defaults(version: 'all', login: false)
42
49
  case args[:version]
43
50
  when /^a/
44
- %w[6 7 3].each do |v|
51
+ %w[2 3 32].each do |v|
45
52
  Rake::Task['dockertest'].reenable
46
53
  Rake::Task['dockertest'].invoke(v, false)
47
54
  end
48
55
  Process.exit 0
56
+ when /^32/
57
+ img = 'howzittest32'
58
+ file = 'docker/Dockerfile-3.2'
49
59
  when /^3/
50
60
  img = 'howzittest3'
51
61
  file = 'docker/Dockerfile-3.0'
52
- when /6$/
53
- img = 'howzittest26'
54
- file = 'docker/Dockerfile-2.6'
62
+ # when /6$/
63
+ # img = 'howzittest26'
64
+ # file = 'docker/Dockerfile-2.6'
55
65
  when /(^2|7$)/
56
66
  img = 'howzittest27'
57
67
  file = 'docker/Dockerfile-2.7'
@@ -64,7 +74,7 @@ task :dockertest, :version, :login do |_, args|
64
74
 
65
75
  exec "docker run -v #{File.dirname(__FILE__)}:/howzit -it #{img} /bin/bash -l" if args[:login]
66
76
 
67
- spinner = TTY::Spinner.new('[:spinner] Running tests ...', hide_cursor: true)
77
+ spinner = TTY::Spinner.new("[:spinner] Running tests #{img}", hide_cursor: true)
68
78
 
69
79
  spinner.auto_spin
70
80
  res = `docker run --rm -v #{File.dirname(__FILE__)}:/howzit -it #{img}`
data/bin/howzit CHANGED
@@ -159,15 +159,13 @@ OptionParser.new do |opts|
159
159
  Process.exit 0
160
160
  end
161
161
 
162
- editor = File.basename(Howzit.options[:editor])
163
- desc = %(Edit buildnotes file in current working directory using editor (#{editor}))
162
+ desc = %(Edit buildnotes file in current working directory using default editor)
164
163
  opts.on('-e', '--edit', desc) do
165
164
  Howzit.buildnote.edit
166
165
  Process.exit 0
167
166
  end
168
167
 
169
- config_editor = File.basename(Howzit.options[:config_editor])
170
- opts.on('--edit-config', "Edit configuration file using editor (#{config_editor})") do
168
+ opts.on('--edit-config', "Edit configuration file using default editor") do
171
169
  Howzit.config.editor
172
170
  Process.exit 0
173
171
  end
@@ -3,7 +3,7 @@ FROM ruby:2.6
3
3
  RUN mkdir /howzit
4
4
  WORKDIR /howzit
5
5
  # COPY ./ /howzit/
6
- RUN gem install bundler:2.2.17
6
+ RUN gem install bundler:2.2.29
7
7
  RUN apt-get update -y
8
8
  RUN apt-get install -y less vim
9
9
  COPY ./docker/inputrc /root/.inputrc
@@ -3,7 +3,7 @@ FROM ruby:2.7
3
3
  RUN mkdir /howzit
4
4
  WORKDIR /howzit
5
5
  # COPY ./ /howzit/
6
- RUN gem install bundler:2.2.17
6
+ RUN gem install bundler:2.2.29
7
7
  RUN apt-get update -y
8
8
  RUN apt-get install -y less vim
9
9
  COPY ./docker/inputrc /root/.inputrc
@@ -3,7 +3,7 @@ FROM ruby:3.0.0
3
3
  RUN mkdir /howzit
4
4
  WORKDIR /howzit
5
5
  # COPY ./ /howzit/
6
- RUN gem install bundler:2.2.17
6
+ RUN gem install bundler:2.2.29
7
7
  RUN apt-get update -y
8
8
  RUN apt-get install -y less vim
9
9
  COPY ./docker/inputrc /root/.inputrc
@@ -0,0 +1,11 @@
1
+ FROM ruby:3.2.0
2
+ # RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
3
+ RUN mkdir /howzit
4
+ WORKDIR /howzit
5
+ # COPY ./ /howzit/
6
+ RUN gem install bundler:2.2.29
7
+ RUN apt-get update -y
8
+ RUN apt-get install -y less vim
9
+ COPY ./docker/inputrc /root/.inputrc
10
+ COPY ./docker/bash_profile /root/.bash_profile
11
+ CMD ["scripts/runtests.sh"]
data/docker/bash_profile CHANGED
@@ -1,6 +1,7 @@
1
1
  #!/bin/bash
2
2
  export GLI_DEBUG=true
3
3
  export EDITOR="/usr/bin/vim"
4
+ export PATH=$PATH:$GEM_HOME/bin
4
5
  alias b="bundle exec bin/howzit"
5
6
 
6
7
  shopt -s nocaseglob
@@ -499,7 +499,7 @@ module Howzit
499
499
  ## @return [String] file path
500
500
  ##
501
501
  def glob_note
502
- Dir.glob('*.{txt,md,markdown}').select(&:build_note?)[0]
502
+ Dir.glob('*.{txt,md,markdown}').select(&:build_note?).sort[0]
503
503
  end
504
504
 
505
505
  ##
@@ -655,12 +655,14 @@ module Howzit
655
655
  def edit_note
656
656
  editor = Howzit.options.fetch(:editor, ENV['EDITOR'])
657
657
 
658
+ editor = Howzit.config.update_editor if editor.nil?
659
+
658
660
  raise 'No editor defined' if editor.nil?
659
661
 
660
662
  raise "Invalid editor (#{editor})" unless Util.valid_command?(editor)
661
663
 
662
664
  create_note(prompt: true) if note_file.nil?
663
- `#{editor} "#{note_file}"`
665
+ exec %(#{editor} "#{note_file}")
664
666
  end
665
667
 
666
668
  ##
@@ -680,6 +682,8 @@ module Howzit
680
682
  def edit_template_file(file)
681
683
  editor = Howzit.options.fetch(:editor, ENV['EDITOR'])
682
684
 
685
+ editor = Howzit.config.update_editor if editor.nil?
686
+
683
687
  raise 'No editor defined' if editor.nil?
684
688
 
685
689
  raise "Invalid editor (#{editor})" unless Util.valid_command?(editor)
data/lib/howzit/config.rb CHANGED
@@ -127,6 +127,31 @@ module Howzit
127
127
  edit_config
128
128
  end
129
129
 
130
+ ## Update editor config
131
+ def update_editor
132
+ puts 'No $EDITOR defined, no value in config'
133
+ editor = Prompt.read_editor
134
+ if editor.nil?
135
+ 'Cancelled, no editor stored.'
136
+ Process.exit 1
137
+ end
138
+ update_config_option({ config_editor: editor, editor: editor })
139
+ puts "Default editor set to #{editor}, modify in config file"
140
+ editor
141
+ end
142
+
143
+ ##
144
+ ## Update a config option and resave config file
145
+ ##
146
+ ## @param options [Hash] key value pairs
147
+ ##
148
+ def update_config_option(options)
149
+ options.each do |key, value|
150
+ Howzit.options[key] = value
151
+ end
152
+ write_config(Howzit.options)
153
+ end
154
+
130
155
  private
131
156
 
132
157
  ##
@@ -263,13 +288,15 @@ module Howzit
263
288
  def edit_config
264
289
  editor = Howzit.options.fetch(:config_editor, ENV['EDITOR'])
265
290
 
291
+ editor = update_editor if editor.nil?
292
+
266
293
  raise 'No config_editor defined' if editor.nil?
267
294
 
268
295
  # raise "Invalid editor (#{editor})" unless Util.valid_command?(editor)
269
296
 
270
297
  load_config
271
298
  if Util.valid_command?(editor.split(/ /).first)
272
- system %(#{editor} "#{config_file}")
299
+ exec %(#{editor} "#{config_file}")
273
300
  else
274
301
  `open -a "#{editor}" "#{config_file}"`
275
302
  end
data/lib/howzit/prompt.rb CHANGED
@@ -159,6 +159,22 @@ module Howzit
159
159
  system('stty', @stty_save)
160
160
  end
161
161
 
162
+ ##
163
+ ## Request editor
164
+ ##
165
+ def read_editor(default = nil)
166
+ @stty_save = `stty -g`.chomp
167
+
168
+ default ||= 'vim'
169
+ prompt = "Define a default editor command (default #{default}): "
170
+ res = Readline.readline(prompt, true).squeeze(' ').strip
171
+ res = default if res.empty?
172
+
173
+ Util.valid_command?(res) ? res : default
174
+ ensure
175
+ system('stty', @stty_save)
176
+ end
177
+
162
178
  ##
163
179
  ## Convert a response to an Integer
164
180
  ##
@@ -3,5 +3,5 @@
3
3
  # Primary module for this gem.
4
4
  module Howzit
5
5
  # Current Howzit version.
6
- VERSION = '2.1.14'
6
+ VERSION = '2.1.15'
7
7
  end
data/lib/howzit.rb CHANGED
@@ -77,8 +77,8 @@ module Howzit
77
77
  ##
78
78
  ## Module storage for buildnote
79
79
  ##
80
- def buildnote
81
- @buildnote ||= BuildNote.new
80
+ def buildnote(file = nil)
81
+ @buildnote ||= BuildNote.new(file: file)
82
82
  end
83
83
 
84
84
  ##
data/scripts/runtests.sh CHANGED
@@ -1,4 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
3
  bundle install
4
- rake test
4
+ export EDITOR="/usr/bin/vim"
5
+ export PATH=$PATH:$GEM_HOME/bin
6
+ rake spec
@@ -3,7 +3,7 @@
3
3
  require 'spec_helper'
4
4
 
5
5
  describe Howzit::BuildNote do
6
- subject(:how) { @hz }
6
+ subject(:how) { Howzit.buildnote('builda.md') }
7
7
 
8
8
  describe ".note_file" do
9
9
  it "locates a build note file" do
data/spec/spec_helper.rb CHANGED
@@ -69,6 +69,7 @@ def save_buildnote
69
69
  This one is just to throw things off
70
70
  EONOTE
71
71
  File.open('builda.md', 'w') { |f| f.puts note }
72
+ # puts "Saved to builda.md: #{File.exist?('builda.md')}"
72
73
  end
73
74
 
74
75
  def delete_buildnote
data/spec/topic_spec.rb CHANGED
@@ -21,7 +21,10 @@ describe Howzit::Topic do
21
21
  end
22
22
 
23
23
  describe Howzit::Topic do
24
- subject(:topic) { @hz.find_topic('Topic Balogna')[0] }
24
+ subject(:topic) {
25
+ bn = Howzit.buildnote
26
+ bn.find_topic('Topic Balogna')[0]
27
+ }
25
28
 
26
29
  describe '.title' do
27
30
  it 'has the correct title' do
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.1.14
4
+ version: 2.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -304,12 +304,14 @@ files:
304
304
  - Guardfile
305
305
  - LICENSE.txt
306
306
  - README.md
307
+ - README.rdoc
307
308
  - Rakefile
308
309
  - bin/howzit
309
310
  - docker/Dockerfile
310
311
  - docker/Dockerfile-2.6
311
312
  - docker/Dockerfile-2.7
312
313
  - docker/Dockerfile-3.0
314
+ - docker/Dockerfile-3.2
313
315
  - docker/bash_profile
314
316
  - docker/inputrc
315
317
  - fish/completions/bld.fish