howzit 1.2.8 → 1.2.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4b746b36bbf197ee183372cf3fbfd111a0314912820b814b587ed1a186821ce6
4
- data.tar.gz: e93e32a4ddb60e786c5b8e4428589571309089498df718f4f6f1c931e1d863c3
3
+ metadata.gz: 24b630c81dbd81b43b8572bbc91baabe96063a17c3cb6295a8026e6a3176dd39
4
+ data.tar.gz: 04c98ab9c7a9c57e8c7536e7709b57d51b965a76cc315c846c46dca3a0a2105e
5
5
  SHA512:
6
- metadata.gz: aad98d851e6a6e712743da60a0cceaaee32ef23aecf029ec460fc15b6c3ff65ca3e95a25c93be9c2694decbd692101801fa98f32e7d0814818ab8584912efbaa
7
- data.tar.gz: 4e92229bc8f27ce3aabe11c267fd2c8cde31c189028f1970ccb6e2690f1f2a8f87004df56e2510e31646641493aa1334769fd78cd3ac843ba348729b2e08edce
6
+ metadata.gz: 3ce4d9a3cd8cd8970cd37e5b90c7154c0b66de06827780c4e38bb4f358d517b8c81d720383cbaa8fa84ff74f56a9f1f60e554f92614cf12e4f1f563092d9d651
7
+ data.tar.gz: 5187fbd097d9171ddd3756f9df92e62b0df5309d7e1d2e0aef26551f6641340d65ade5f49f1c9b0a47852e6913c64d5914d334732e15a1ac71f2277edde38fe7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### 1.2.11
2
+
3
+ 2022-08-01 08:23
4
+
5
+ #### IMPROVED
6
+
7
+ - Code cleanup and refactoring
8
+
9
+ ### 1.2.10
10
+
11
+ 2022-08-01 07:45
12
+
13
+ #### FIXED
14
+
15
+ - Headline formatting when iTerm markers are inserted
16
+
1
17
  ### 1.2.8
2
18
 
3
19
  2022-08-01 07:01
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'https://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in howzit.gemspec.
data/Guardfile CHANGED
@@ -1,4 +1,6 @@
1
- scope groups: [:doc, :lint, :unit]
1
+ # frozen_string_literal: true
2
+
3
+ scope groups: %i[doc lint unit]
2
4
 
3
5
  group :doc do
4
6
  guard :yard do
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  # Howzit
2
2
 
3
3
  [![Gem](https://img.shields.io/gem/v/howzit.svg)](https://rubygems.org/gems/howzit)
4
+ [![Travis](https://img.shields.io/travis/makenew/ruby-gem.svg)](https://travis-ci.org/makenew/ruby-gem)
4
5
  [![GitHub license](https://img.shields.io/github/license/ttscoff/howzit.svg)](./LICENSE.txt)
5
6
 
6
7
  A command-line reference tool for tracking project build systems
data/Rakefile CHANGED
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bump/tasks'
2
4
  require 'bundler/gem_tasks'
3
5
  require 'rspec/core/rake_task'
4
6
  require 'rubocop/rake_task'
5
7
  require 'yard'
6
8
 
7
- task default: [:test, :yard]
9
+ task default: %i[test yard]
8
10
 
9
11
  desc 'Run test suite'
10
- task test: [:rubocop, :spec]
12
+ task test: %i[rubocop spec]
11
13
 
12
14
  RSpec::Core::RakeTask.new
13
15
 
data/bin/howzit CHANGED
@@ -1,6 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
+
3
4
  $LOAD_PATH.unshift File.join(__dir__, '..', 'lib')
4
5
  require 'howzit'
5
6
 
6
- Howzit::BuildNotes.new(ARGV)
7
+ how = Howzit::BuildNotes.new(ARGV)
8
+ how.process
9
+
data/howzit.gemspec CHANGED
@@ -31,7 +31,7 @@ Gem::Specification.new do |spec|
31
31
  spec.add_development_dependency 'rubocop', '~> 0.28'
32
32
  spec.add_development_dependency 'rspec', '~> 3.1'
33
33
  spec.add_development_dependency 'simplecov', '~> 0.9'
34
- spec.add_development_dependency 'codecov', '~> 0.1'
34
+ # spec.add_development_dependency 'codecov', '~> 0.1'
35
35
  spec.add_development_dependency 'fuubar', '~> 2.0'
36
36
 
37
37
  spec.add_development_dependency 'yard', '~> 0.9.5'
@@ -3,7 +3,7 @@ module Howzit
3
3
  class BuildNotes
4
4
  include Prompt
5
5
 
6
- attr_accessor :arguments, :metadata
6
+ attr_accessor :cli_args, :arguments, :metadata
7
7
 
8
8
  def topics
9
9
  @topics ||= read_help
@@ -132,8 +132,12 @@ module Howzit
132
132
  end
133
133
  end
134
134
 
135
+ def should_mark_iterm?
136
+ ENV['TERM_PROGRAM'] =~ /^iTerm/ && !@options[:run] && !@options[:paginate]
137
+ end
138
+
135
139
  def iterm_marker
136
- "\e]1337;SetMark\a\n" if ENV['TERM_PROGRAM'] =~ /^iTerm/ && !@options[:run] && !@options[:paginate]
140
+ "\e]1337;SetMark\a" if should_mark_iterm?
137
141
  end
138
142
 
139
143
  def color_single_options(choices = %w[y n])
@@ -226,16 +230,23 @@ module Howzit
226
230
  options = {
227
231
  hr: "\u{254C}",
228
232
  color: '1;32',
229
- border: '0'
233
+ border: '0',
234
+ mark: false
230
235
  }
231
236
 
232
237
  options.merge!(opts)
233
238
 
234
239
  cols = TTY::Screen.columns
240
+
235
241
  cols = @options[:wrap] if (@options[:wrap]).positive? && cols > @options[:wrap]
236
- title = "\e[#{options[:border]}m#{options[:hr]}#{options[:hr]}( \e[#{options[:color]}m#{title}\e[#{options[:border]}m )"
237
- tail = options[:hr] * (cols - title.uncolor.length)
238
- options[:hr] =~ /╌/ ? "#{iterm_marker}#{title}#{tail}\e[0m" : "#{title}#{tail}\e[0m"
242
+ title = "\e[#{options[:border]}m#{options[:hr] * 2}( \e[#{options[:color]}m#{title}\e[#{options[:border]}m )"
243
+
244
+ tail = if should_mark_iterm?
245
+ "#{options[:hr] * (cols - title.uncolor.length - 15)}#{options[:mark] ? iterm_marker : ''}"
246
+ else
247
+ options[:hr] * (cols - title.uncolor.length)
248
+ end
249
+ "#{title}#{tail}\e[0m"
239
250
  end
240
251
 
241
252
  def os_open(command)
@@ -344,7 +355,7 @@ module Howzit
344
355
 
345
356
  output = []
346
357
  if opt[:header]
347
- output.push(format_header(key))
358
+ output.push(format_header(key, { mark: should_mark_iterm? }))
348
359
  output.push('')
349
360
  end
350
361
  topic = topics[key].strip
@@ -662,7 +673,7 @@ module Howzit
662
673
  matches
663
674
  end
664
675
 
665
- def initialize(args)
676
+ def initialize(args = [])
666
677
  flags = {
667
678
  run: false,
668
679
  list_topics: false,
@@ -705,7 +716,8 @@ module Howzit
705
716
  OptionParser.new do |opts|
706
717
  opts.banner = "Usage: #{__FILE__} [OPTIONS] [TOPIC]"
707
718
  opts.separator ''
708
- opts.separator 'Show build notes for the current project (buildnotes.md). Include a topic name to see just that topic, or no argument to display all.'
719
+ opts.separator 'Show build notes for the current project (buildnotes.md).
720
+ Include a topic name to see just that topic, or no argument to display all.'
709
721
  opts.separator ''
710
722
  opts.separator 'Options:'
711
723
 
@@ -714,7 +726,8 @@ module Howzit
714
726
  Process.exit 0
715
727
  end
716
728
 
717
- opts.on('-e', '--edit', "Edit buildnotes file in current working directory using #{File.basename(ENV['EDITOR'])}") do
729
+ opts.on('-e', '--edit', "Edit buildnotes file in current working directory
730
+ using #{File.basename(ENV['EDITOR'])}") do
718
731
  edit_note
719
732
  Process.exit 0
720
733
  end
@@ -732,7 +745,8 @@ module Howzit
732
745
  @options[:list_topics] = true
733
746
  end
734
747
 
735
- opts.on('-m', '--matching TYPE', MATCHING_OPTIONS, 'Topics matching type', "(#{MATCHING_OPTIONS.join(', ')})") do |c|
748
+ opts.on('-m', '--matching TYPE', MATCHING_OPTIONS,
749
+ 'Topics matching type', "(#{MATCHING_OPTIONS.join(', ')})") do |c|
736
750
  @options[:matching] = c
737
751
  end
738
752
 
@@ -795,7 +809,7 @@ module Howzit
795
809
  puts "\e[1;30m[\e[1;37mtasks\e[1;30m]──────────────────────────────────────┐\e[0m"
796
810
  metadata = file.extract_metadata
797
811
  topics = read_help_file(file)
798
- topics.keys.each do |topic|
812
+ topics.each_key do |topic|
799
813
  puts " \e[1;30m│\e[1;37m-\e[0m \e[1;36;40m#{template}:#{topic.sub(/^.*?:/, '')}\e[0m"
800
814
  end
801
815
  if metadata.size > 0
@@ -834,7 +848,7 @@ module Howzit
834
848
  end
835
849
  end.parse!(args)
836
850
 
837
- process(args)
851
+ @cli_args = args
838
852
  end
839
853
 
840
854
  def edit_note
@@ -851,7 +865,7 @@ module Howzit
851
865
  end
852
866
 
853
867
  ##
854
- ## @brief Traverse up directory tree looking for build notes
868
+ ## Traverse up directory tree looking for build notes
855
869
  ##
856
870
  ## @return topics dictionary
857
871
  ##
@@ -1053,7 +1067,7 @@ module Howzit
1053
1067
  `#{ENV['EDITOR']} "#{config_file}"`
1054
1068
  end
1055
1069
 
1056
- def process(args)
1070
+ def process
1057
1071
  output = []
1058
1072
 
1059
1073
  unless note_file
@@ -1107,9 +1121,9 @@ module Howzit
1107
1121
  elsif @options[:choose]
1108
1122
  topic_match = choose(topics.keys)
1109
1123
  # If there are arguments use those to search for a matching topic
1110
- elsif !args.empty?
1124
+ elsif !@cli_args.empty?
1111
1125
 
1112
- search = args.join(' ').strip.downcase
1126
+ search = @cli_args.join(' ').strip.downcase
1113
1127
  matches = match_topic(search)
1114
1128
 
1115
1129
  if matches.empty?
@@ -5,7 +5,7 @@ module Howzit
5
5
  module StringUtils
6
6
  # Just strip out color codes when requested
7
7
  def uncolor
8
- gsub(/\e\[[\d;]+m/, '').gsub(/\e]1337;SetMark/,'')
8
+ gsub(/\e\[[\d;]+m/, '').gsub(/\e\]1337;SetMark/,'')
9
9
  end
10
10
 
11
11
  # Adapted from https://github.com/pazdera/word_wrap/,
@@ -2,5 +2,5 @@
2
2
  # Primary module for this gem.
3
3
  module Howzit
4
4
  # Current Howzit version.
5
- VERSION = '1.2.8'.freeze
5
+ VERSION = '1.2.11'.freeze
6
6
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Howzit::BuildNotes do
4
- subject(:ruby_gem) { Howzit::BuildNotes.new }
4
+ subject(:ruby_gem) { Howzit::BuildNotes.new([]) }
5
5
 
6
6
  describe ".new" do
7
7
  it "makes a new instance" do
data/spec/spec_helper.rb CHANGED
@@ -1,13 +1,13 @@
1
- require 'simplecov'
1
+ # require 'simplecov'
2
2
 
3
- SimpleCov.start
3
+ # SimpleCov.start
4
4
 
5
- if ENV['CI'] == 'true'
6
- require 'codecov'
7
- SimpleCov.formatter = SimpleCov::Formatter::Codecov
8
- else
9
- SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
10
- end
5
+ # if ENV['CI'] == 'true'
6
+ # require 'codecov'
7
+ # SimpleCov.formatter = SimpleCov::Formatter::Codecov
8
+ # else
9
+ # SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
10
+ # end
11
11
 
12
12
  require 'howzit'
13
13
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.8
4
+ version: 1.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
@@ -150,20 +150,6 @@ dependencies:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.9'
153
- - !ruby/object:Gem::Dependency
154
- name: codecov
155
- requirement: !ruby/object:Gem::Requirement
156
- requirements:
157
- - - "~>"
158
- - !ruby/object:Gem::Version
159
- version: '0.1'
160
- type: :development
161
- prerelease: false
162
- version_requirements: !ruby/object:Gem::Requirement
163
- requirements:
164
- - - "~>"
165
- - !ruby/object:Gem::Version
166
- version: '0.1'
167
153
  - !ruby/object:Gem::Dependency
168
154
  name: fuubar
169
155
  requirement: !ruby/object:Gem::Requirement