howzit 2.1.16 → 2.1.21

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.
@@ -62,6 +62,12 @@ describe Howzit::BuildNote do
62
62
  expect(matches.count).to eq 0
63
63
  end
64
64
 
65
+ it "matches topics containing colon even without space" do
66
+ matches = how.find_topic('git:clean')
67
+ expect(matches.count).to eq 1
68
+ expect(matches[0].title).to eq 'Git: Clean Repo'
69
+ end
70
+
65
71
  it "Handles multiple matches with best match" do
66
72
  Howzit.options[:matching] = 'fuzzy'
67
73
  Howzit.options[:multiple_matches] = :best
@@ -70,12 +76,62 @@ describe Howzit::BuildNote do
70
76
  end
71
77
  end
72
78
 
79
+ describe ".find_topic_exact" do
80
+ it "finds exact whole-word match" do
81
+ matches = how.find_topic_exact('Topic Tropic')
82
+ expect(matches.count).to eq 1
83
+ expect(matches[0].title).to eq 'Topic Tropic'
84
+ end
85
+
86
+ it "finds exact match case-insensitively" do
87
+ matches = how.find_topic_exact('topic tropic')
88
+ expect(matches.count).to eq 1
89
+ expect(matches[0].title).to eq 'Topic Tropic'
90
+ end
91
+
92
+ it "does not match partial phrases" do
93
+ matches = how.find_topic_exact('topic trop')
94
+ expect(matches.count).to eq 0
95
+ end
96
+
97
+ it "does not match single word when phrase has multiple words" do
98
+ matches = how.find_topic_exact('topic')
99
+ expect(matches.count).to eq 0
100
+ end
101
+
102
+ it "matches single-word topics" do
103
+ matches = how.find_topic_exact('Happy Bgagngagnga')
104
+ expect(matches.count).to eq 1
105
+ expect(matches[0].title).to eq 'Happy Bgagngagnga'
106
+ end
107
+
108
+ it "matches topics with colons" do
109
+ matches = how.find_topic_exact('Git: Clean Repo')
110
+ expect(matches.count).to eq 1
111
+ expect(matches[0].title).to eq 'Git: Clean Repo'
112
+ end
113
+ end
114
+
73
115
  describe ".topics" do
74
- it "contains 4 topics" do
75
- expect(how.list_topics.count).to eq 4
116
+ it "contains 7 topics" do
117
+ expect(how.list_topics.count).to eq 7
76
118
  end
77
119
  it "outputs a newline-separated string for completion" do
78
- expect(how.list_completions.scan(/\n/).count).to eq 3
120
+ expect(how.list_completions.scan(/\n/).count).to eq 6
121
+ end
122
+ end
123
+
124
+ describe "#topic_search_terms_from_cli" do
125
+ after { Howzit.cli_args = [] }
126
+
127
+ it "respects separators found inside topics" do
128
+ Howzit.cli_args = ['git:clean:blog:update post']
129
+ expect(how.send(:topic_search_terms_from_cli)).to eq(['git:clean', 'blog:update post'])
130
+ end
131
+
132
+ it "keeps comma inside matching topics" do
133
+ Howzit.cli_args = ['release, deploy,topic balogna']
134
+ expect(how.send(:topic_search_terms_from_cli)).to eq(['release, deploy', 'topic balogna'])
79
135
  end
80
136
  end
81
137
  end
data/spec/cli_spec.rb CHANGED
@@ -15,7 +15,7 @@ describe 'CLI' do
15
15
  execute_script('bin/howzit', use_bundler: true, args: %w[-L])
16
16
  expect(last_execution).to be_successful
17
17
  expect(last_execution.stdout).to match(/Topic Balogna/)
18
- expect(last_execution.stdout.split(/\n/).count).to eq 4
18
+ expect(last_execution.stdout.split(/\n/).count).to eq 7
19
19
  end
20
20
 
21
21
  it 'lists available tasks' do
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Howzit::RunReport do
6
+ before do
7
+ Howzit.run_log = []
8
+ Howzit.multi_topic_run = false
9
+ end
10
+
11
+ after do
12
+ Howzit::RunReport.reset
13
+ Howzit.multi_topic_run = false
14
+ end
15
+
16
+ it 'renders a bordered summary for single topic runs' do
17
+ Howzit::RunReport.log({ topic: 'Git: Config', task: 'Run Git Origin', success: true, exit_status: 0 })
18
+ plain = Howzit::RunReport.format.uncolor
19
+ expect(plain).to include('- [✓] Run Git Origin')
20
+ expect(plain).not_to include('Git: Config:')
21
+ top, line, bottom = plain.split("\n")
22
+ expect(top).to eq('=' * line.length)
23
+ expect(bottom).to eq('-' * line.length)
24
+ end
25
+
26
+ it 'prefixes topic titles and shows failures when multiple topics run' do
27
+ Howzit.multi_topic_run = true
28
+ Howzit::RunReport.log({ topic: 'Git: Config', task: 'Run Git Origin', success: true, exit_status: 0 })
29
+ Howzit::RunReport.log({ topic: 'Git: Clean Repo', task: 'Clean Git Repo', success: false, exit_status: 12 })
30
+ plain = Howzit::RunReport.format.uncolor
31
+ expect(plain).to include('- [✓] Git: Config: Run Git Origin')
32
+ expect(plain).to include('- [X] Git: Clean Repo: Clean Git Repo (Failed: exit code 12)')
33
+ end
34
+ end
35
+
data/spec/spec_helper.rb CHANGED
@@ -18,6 +18,8 @@ RSpec.configure do |c|
18
18
  save_buildnote
19
19
  Howzit.options[:include_upstream] = false
20
20
  Howzit.options[:default] = true
21
+ Howzit.options[:matching] = 'partial'
22
+ Howzit.options[:multiple_matches] = 'choose'
21
23
  @hz = Howzit.buildnote
22
24
  end
23
25
 
@@ -67,6 +69,18 @@ def save_buildnote
67
69
  ## Happy Bgagngagnga
68
70
 
69
71
  This one is just to throw things off
72
+
73
+ ## Git: Clean Repo
74
+
75
+ Keep Git projects tidy.
76
+
77
+ ## Blog: Update Post
78
+
79
+ Publish the latest article updates.
80
+
81
+ ## Release, Deploy
82
+
83
+ Prep and deploy the latest release.
70
84
  EONOTE
71
85
  File.open('builda.md', 'w') { |f| f.puts note }
72
86
  # puts "Saved to builda.md: #{File.exist?('builda.md')}"
data/spec/topic_spec.rb CHANGED
@@ -82,8 +82,11 @@ describe Howzit::Topic do
82
82
  end
83
83
 
84
84
  describe '.print_out' do
85
- Howzit.options[:header_format] = :block
86
- Howzit.options[:color] = false
85
+ before do
86
+ Howzit.options[:header_format] = :block
87
+ Howzit.options[:color] = false
88
+ Howzit.options[:show_all_code] = false
89
+ end
87
90
 
88
91
  it 'prints the topic title' do
89
92
  expect(topic.print_out({ single: true, header: true }).join("\n").uncolor).to match(/▌Topic Balogna/)
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.16
4
+ version: 2.1.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-13 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: bundler
@@ -276,15 +275,6 @@ executables:
276
275
  extensions: []
277
276
  extra_rdoc_files: []
278
277
  files:
279
- - ".editorconfig"
280
- - ".github/FUNDING.yml"
281
- - ".gitignore"
282
- - ".howzit.taskpaper.bak"
283
- - ".irbrc"
284
- - ".rspec"
285
- - ".rubocop.yml"
286
- - ".travis.yml"
287
- - ".yardopts"
288
278
  - CHANGELOG.md
289
279
  - Gemfile
290
280
  - Guardfile
@@ -305,7 +295,6 @@ files:
305
295
  - fish/completions/howzit.fish
306
296
  - fish/functions/bld.fish
307
297
  - howzit.gemspec
308
- - lib/.rubocop.yml
309
298
  - lib/howzit.rb
310
299
  - lib/howzit/buildnote.rb
311
300
  - lib/howzit/colors.rb
@@ -313,17 +302,18 @@ files:
313
302
  - lib/howzit/console_logger.rb
314
303
  - lib/howzit/hash.rb
315
304
  - lib/howzit/prompt.rb
305
+ - lib/howzit/run_report.rb
316
306
  - lib/howzit/stringutils.rb
317
307
  - lib/howzit/task.rb
318
308
  - lib/howzit/topic.rb
319
309
  - lib/howzit/util.rb
320
310
  - lib/howzit/version.rb
321
311
  - scripts/runtests.sh
322
- - spec/.rubocop.yml
323
312
  - spec/buildnote_spec.rb
324
313
  - spec/cli_spec.rb
325
314
  - spec/prompt_spec.rb
326
315
  - spec/ruby_gem_spec.rb
316
+ - spec/run_report_spec.rb
327
317
  - spec/spec_helper.rb
328
318
  - spec/task_spec.rb
329
319
  - spec/topic_spec.rb
@@ -334,7 +324,6 @@ homepage: https://github.com/ttscoff/howzit
334
324
  licenses:
335
325
  - MIT
336
326
  metadata: {}
337
- post_install_message:
338
327
  rdoc_options: []
339
328
  require_paths:
340
329
  - lib
@@ -349,17 +338,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
338
  - !ruby/object:Gem::Version
350
339
  version: '0'
351
340
  requirements: []
352
- rubygems_version: 3.2.15
353
- signing_key:
341
+ rubygems_version: 3.6.7
354
342
  specification_version: 4
355
343
  summary: Provides a way to access Markdown project notes by topic with query capabilities
356
344
  and the ability to execute the tasks it describes.
357
345
  test_files:
358
- - spec/.rubocop.yml
359
346
  - spec/buildnote_spec.rb
360
347
  - spec/cli_spec.rb
361
348
  - spec/prompt_spec.rb
362
349
  - spec/ruby_gem_spec.rb
350
+ - spec/run_report_spec.rb
363
351
  - spec/spec_helper.rb
364
352
  - spec/task_spec.rb
365
353
  - spec/topic_spec.rb
data/.editorconfig DELETED
@@ -1,9 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- charset = utf-8
5
- end_of_line = lf
6
- insert_final_newline = true
7
- trim_trailing_whitespace = true
8
- indent_style = space
9
- indent_size = 2
data/.github/FUNDING.yml DELETED
@@ -1,2 +0,0 @@
1
- github: [ttscoff]
2
- custom: ['https://brettterpstra.com/support/', 'https://brettterpstra.com/donate/']
data/.gitignore DELETED
@@ -1,45 +0,0 @@
1
- # Parts of this file were adapted from
2
- # GitHub’s collection of .gitignore file templates
3
- # which are Copyright (c) 2016 GitHub, Inc.
4
- # and released under the MIT License.
5
- # For more details, visit the project page:
6
- # https://github.com/github/gitignore
7
-
8
- *.gem
9
- *.rbc
10
- /.config
11
- /coverage/
12
- /InstalledFiles
13
- /pkg/
14
- /spec/reports/
15
- /spec/examples.txt
16
- /test/tmp/
17
- /test/version_tmp/
18
- /tmp/
19
-
20
- ## Specific to RubyMotion:
21
- .dat*
22
- .repl_history
23
- build/
24
-
25
- ## Documentation cache and generated files:
26
- /.yardoc/
27
- /_yardoc/
28
- /doc/
29
- /rdoc/
30
-
31
- ## Environment normalization:
32
- /.bundle/
33
- /vendor/bundle
34
- /lib/bundler/man/
35
-
36
- # for a library or gem, you might want to ignore these files since the code is
37
- # intended to run in multiple environments; otherwise, check them in:
38
- Gemfile.lock
39
- .ruby-version
40
- .ruby-gemset
41
-
42
- # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
43
- .rvmrc
44
- results.log
45
- html
@@ -1,27 +0,0 @@
1
- Inbox:
2
- - Topic summaries @na
3
- Maybe in square brackets on line after topic title, or as a blockquote. When doing a list of available topics, include its summary in the output. Ignore or specially style summary when viewing full topic.
4
- - Named positional arguments for topics @na
5
- Parenthesis after title like a function (arg1, arg2). Variables can have default values (arg1 = testing) and are available as [%var1] replacements in scripts
6
- howzit:
7
- New Features:
8
- Ideas:
9
- - Nested topics @maybe @na
10
- Allow increased header levels to nest topics within a parent
11
- Running/viewing a parent includes all nested subtopics
12
- All topics still available via search
13
- When reading file, set a base level from first header, then test each additional topic title to see whether it's greater than the current level. If so, change current level and begin collecting subtopics at the same level
14
- Howzit::Topic has a subtopic attribute, consisting of an array of Topics. Each of these Topics also has a subtopics attr. These are collected and assigned during initila reading of note file
15
- When read in, a topic is added to the top level build notes topic, as well as appended to its parent's subtopics if it's a higher level than the base
16
- just need methods to determine base level (first # match) and check the current headers level when discovering a topic (count #)
17
-
18
- no, wait. topics should read in their own children. Determine base header level, split topics at that level, then recurse each topic the same way
19
- include statements will need to be adjusted to allow includes as children. Multiple at symbols could indicate the level to nest at, two symbols would indicate that the include belonged to the last parent. When importing, adjust base header levels appropriately (increase 1).
20
- Bugs:
21
- Archive:
22
- - Add a preview when selecting topic with fzf @priority(3) @na @done(2022-08-06) @project(Inbox)
23
- Search Definitions:
24
- Top Priority @search(@priority = 5 and not @done)
25
- High Priority @search(@priority > 3 and not @done)
26
- Maybe @search(@maybe)
27
- Next @search(@na and not @done and not project = "Archive")
data/.irbrc DELETED
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
- `gem rdoc binbundle --ri`
3
-
4
- # rubocop:disable Style/MixinUsage
5
- include Howzit # standard:disable all
6
- # rubocop:enable Style/MixinUsage
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.rubocop.yml DELETED
@@ -1,48 +0,0 @@
1
- require:
2
- - rubocop-rspec
3
- - rubocop-rake
4
-
5
- AllCops:
6
- Include:
7
- - Gemfile
8
- - Guardfile
9
- - Rakefile
10
- - bin/howzit
11
- - lib/**/*.rb
12
-
13
- Style/StringLiterals:
14
- Enabled: true
15
- EnforcedStyle: single_quotes
16
-
17
- Style/StringLiteralsInInterpolation:
18
- Enabled: true
19
- EnforcedStyle: single_quotes
20
-
21
- Layout/LineLength:
22
- Max: 120
23
-
24
- Metrics/MethodLength:
25
- Max: 45
26
-
27
- Metrics/BlockLength:
28
- Max: 45
29
- Exclude:
30
- - Rakefile
31
- - bin/howzit
32
- - lib/*.rb
33
-
34
- Metrics/ClassLength:
35
- Max: 300
36
-
37
- Metrics/PerceivedComplexity:
38
- Max: 30
39
-
40
- Metrics/AbcSize:
41
- Max: 45
42
-
43
- Metrics/CyclomaticComplexity:
44
- Max: 20
45
-
46
- Style/RegexpLiteral:
47
- Exclude:
48
- - Guardfile
data/.travis.yml DELETED
@@ -1,17 +0,0 @@
1
- ---
2
- language: ruby
3
- sudo: required
4
- dist: trusty
5
- cache: bundler
6
- rvm:
7
- - ruby-2.6.4
8
- - ruby-2.7.0
9
- - ruby-3.0.1
10
- install:
11
- - gem install bundler --version '2.2.29'
12
- - bundle install
13
- script: "bundle exec rspec spec --exclude-pattern 'cli*'"
14
- branches:
15
- only:
16
- - main
17
- - develop
data/.yardopts DELETED
@@ -1,6 +0,0 @@
1
- --markup=markdown
2
- lib/**/*.rb
3
- -
4
- README.md
5
- CHANGELOG.md
6
- LICENSE.txt
data/lib/.rubocop.yml DELETED
@@ -1 +0,0 @@
1
- inherit_from: ../.rubocop.yml
data/spec/.rubocop.yml DELETED
@@ -1,4 +0,0 @@
1
- inherit_from: ../.rubocop.yml
2
-
3
- Style/StringLiterals:
4
- Enabled: false