utils 0.91.1 → 0.93.0

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: 445a34dfb046f503673d8d79d19f849bab86cc2921049ab040f1f9871b62ef4f
4
- data.tar.gz: 28837676f6b0c58fd9985cae2c07d7f27cd1c3c972a2cf8d2f9d07808cf78e67
3
+ metadata.gz: 4412a2649cf7a18654f0cdec0cf7fa86ba33cb15c8cf88e2ef1ba10267753cd4
4
+ data.tar.gz: 30095f823b5fad6f66e79667d82f88757d47f04d28cde52fe7706c1731331d6b
5
5
  SHA512:
6
- metadata.gz: c4aac97722bdad61a2c9bdde3a4c7bcc88290c9b93f19ff4ce5a0c7d9dbd674d72257d29632e3902afc2f74dfa36b07462bf255c38c64e786fcb26144206b4ef
7
- data.tar.gz: df5d06a009a41901dd0ec399e70819c62517e7c04381b4cb297388451e48bc94d876f05e3a5207f939f0e481b1e3d2a09f7912ecdf4785e5e8a163122f3ef64e
6
+ metadata.gz: 0aa5db98d16b760637beb04b4fa5fcd99cb951854b9bb6f8714bc350f2351bb2acbe26fc2220e35b7caf3e079f0b19c3fa74f218bc44107ad03d98c7cbbcb5c2
7
+ data.tar.gz: fdb6289ad43454ed499fbdf9ae17051d5b24e93c474dc9ddc81c1f34661135e1c5275bc9dfee6b0b505a017c5a64b9c8c8a28e1caa744f9d7ae255e4ea115951
data/.contexts/lib.rb ADDED
@@ -0,0 +1,23 @@
1
+ context do
2
+ namespace "structure" do
3
+ command "tree", tags: %w[ project_structure ]
4
+ end
5
+
6
+ namespace "lib" do
7
+ Dir['lib/**/*.rb'].each do |filename|
8
+ file filename, tags: 'lib'
9
+ end
10
+ end
11
+
12
+ namespace "gems" do
13
+ file Dir['*.gemspec'].first
14
+ file 'Gemfile'
15
+ file 'Gemfile.lock'
16
+ end
17
+
18
+ file 'Rakefile', tags: 'gem_hadar'
19
+
20
+ file 'README.md', tags: 'documentation'
21
+
22
+ meta ruby: RUBY_DESCRIPTION
23
+ end
data/bin/discover CHANGED
@@ -94,7 +94,7 @@ Version is #{File.basename($0)} #{Utils::VERSION}.
94
94
  exit 1
95
95
  end
96
96
 
97
- args = go 'n:I:i:a:p:lLcreEvdsDgh', defaults: { ?a => '\\w' }
97
+ args = go 'n:I:i:a:p:P:lLcreEvdsDgh', defaults: { ?a => '\\w' }
98
98
  args[?h] and usage
99
99
 
100
100
  Term::ANSIColor.coloring = (STDIN.tty? && ENV['TERM'] !~ /dumb/) && !args[?c]
data/bin/search CHANGED
@@ -227,7 +227,7 @@ def usage
227
227
  exit 1
228
228
  end
229
229
 
230
- args = go 'r:p:I:A:B:C:s:S:n:N:a:i:G:cfFlLeEvgh'
230
+ args = go 'r:p:I:A:B:C:s:S:n:N:a:i:G:P:cfFlLeEvgh'
231
231
  args[?h] and usage
232
232
  pattern = ARGV.shift or usage
233
233
  roots = (ARGV.empty? ? [ Dir.pwd ] : ARGV).map { |f| File.expand_path(f) }
@@ -205,8 +205,9 @@ class Utils::ConfigFile
205
205
  #
206
206
  # @return [ TrueClass, FalseClass ] true if the basename matches any prune pattern,
207
207
  # false otherwise
208
- def prune?(basename)
209
- Array(prune_dirs).any? { |pd| pd.match(basename.to_s) }
208
+ def prune?(basename, additional_dirs: nil)
209
+ ([ Array(prune_dirs), Array(additional_dirs) ].compact.flatten).
210
+ any? { |pd| pd.match(basename.to_s) }
210
211
  end
211
212
 
212
213
  # The skip? method determines whether a file should be skipped based on
@@ -155,7 +155,7 @@ module Utils::Finder::Files
155
155
  s = filename.stat
156
156
  bn = filename.pathname.basename
157
157
  if !s ||
158
- s.directory? && @config.discover.prune?(bn) ||
158
+ s.directory? && @config.discover.prune?(bn, additional_dirs: @args[?P]) ||
159
159
  s.file? && @config.discover.skip?(bn)
160
160
  then
161
161
  @args[?v] and warn "Pruning #{filename.inspect}."
data/lib/utils/grepper.rb CHANGED
@@ -138,7 +138,7 @@ class Utils::Grepper
138
138
  @filename = filename
139
139
  @output = []
140
140
  bn, s = File.basename(filename), File.stat(filename)
141
- if !s || s.directory? && @config.search.prune?(bn)
141
+ if !s || s.directory? && @config.search.prune?(bn, additional_dirs: @args[?P])
142
142
  @args[?v] and warn "Pruning #{filename.inspect}."
143
143
  prune
144
144
  end
@@ -67,8 +67,8 @@ module Utils::IRB::Shell
67
67
  ri(*patterns, doc: 'yri')
68
68
  end
69
69
 
70
- # The ai method interacts with an Ollama chat service to process queries
71
- # and optionally return responses.
70
+ # The ocs method interacts with an Ollama chat service to process queries and
71
+ # optionally return responses.
72
72
  #
73
73
  # This method constructs command-line arguments for the ollama_chat_send
74
74
  # utility based on the provided options, executes the command with the
@@ -85,7 +85,7 @@ module Utils::IRB::Shell
85
85
  #
86
86
  # @return [ String, nil ] the response from the Ollama chat service if
87
87
  # respond is true, otherwise nil
88
- def ai(query, command: false, respond: false, parse: false, dir: ?.)
88
+ def ocs(query, command: false, respond: false, parse: false, dir: ?.)
89
89
  dir = File.expand_path(dir)
90
90
  args = {
91
91
  ?r => respond,
@@ -258,7 +258,7 @@ else
258
258
  # full description or abbreviated version
259
259
  #
260
260
  # @return [ String ] the appropriate description based on the full parameter value
261
- def description(example, full: ENV['VERBOSE'].to_i == 1)
261
+ def description(example, full: true)
262
262
  if full
263
263
  example.example.full_description
264
264
  else
@@ -296,9 +296,22 @@ else
296
296
  failed: ?❌,
297
297
  pending: ?⏩
298
298
  )
299
- args = [ status_emoji[status], location(example), run_time(example), description(example) ]
300
- uncolored = "%s %s # %3.3fs %s" % args
301
- uncolored = uncolored[0, Tins::Terminal.columns]
299
+ description = self.description(example)
300
+ uncolored = nil
301
+ cols = Tins::Terminal.columns - 1
302
+ redone = false
303
+ 1.times do
304
+ args = [ status_emoji[status], location(example), run_time(example), description ]
305
+ uncolored = "%s %s # %3.3fs %s" % args
306
+ if !redone && uncolored.size > cols
307
+ description = self.description(example, full: false)
308
+ redone = true
309
+ redo
310
+ else
311
+ break
312
+ end
313
+ end
314
+ uncolored = uncolored[0, cols]
302
315
  case status
303
316
  when :passed
304
317
  success_color(uncolored)
@@ -322,7 +335,7 @@ else
322
335
  #
323
336
  # @return [ String ] the input text wrapped with green color ANSI escape codes
324
337
  def success_color(text)
325
- Term::ANSIColor.green(text)
338
+ Term::ANSIColor.bright_green(text)
326
339
  end
327
340
 
328
341
  # The failure_color method applies red color formatting to the provided
@@ -336,7 +349,7 @@ else
336
349
  #
337
350
  # @return [ String ] the colorized text wrapped with red formatting codes
338
351
  def failure_color(text)
339
- Term::ANSIColor.red(text)
352
+ Term::ANSIColor.bright_red(text)
340
353
  end
341
354
 
342
355
  # The pending_color method applies yellow color formatting to the
@@ -350,7 +363,7 @@ else
350
363
  #
351
364
  # @return [ String ] the colorized text with yellow formatting applied
352
365
  def pending_color(text)
353
- Term::ANSIColor.yellow(text)
366
+ Term::ANSIColor.bright_yellow(text)
354
367
  end
355
368
 
356
369
  # The location method extracts and formats the file path and line number
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.91.1'
3
+ VERSION = '0.93.0'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
data/utils.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.91.1 ruby lib
2
+ # stub: utils 0.93.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.91.1".freeze
6
+ s.version = "0.93.0".freeze
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["ascii7".freeze, "blameline".freeze, "changes".freeze, "classify".freeze, "code_comment".freeze, "code_indexer".freeze, "commit_message".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "git-empty".freeze, "git-versions".freeze, "irb_client".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "on_change".freeze, "path".freeze, "print_method".freeze, "probe".freeze, "rainbow".freeze, "rd2md".freeze, "search".freeze, "sedit".freeze, "serve".freeze, "ssh-tunnel".freeze, "strip_spaces".freeze, "sync_dir".freeze, "untest".freeze, "utils-utilsrc".freeze, "vcf2alias".freeze, "yaml_check".freeze]
15
15
  s.extra_rdoc_files = ["README.md".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/config_file/block_config.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/finder/files.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/irb_server.rb".freeze, "lib/utils/irb/regexp.rb".freeze, "lib/utils/irb/shell.rb".freeze, "lib/utils/irb/shell/wrappers.rb".freeze, "lib/utils/irb/string.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe.rb".freeze, "lib/utils/probe/probe_client.rb".freeze, "lib/utils/probe/probe_server.rb".freeze, "lib/utils/probe/process_job.rb".freeze, "lib/utils/probe/server_handling.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xdg.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
16
- s.files = ["Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/changes".freeze, "bin/classify".freeze, "bin/code_comment".freeze, "bin/code_indexer".freeze, "bin/commit_message".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_client".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/print_method".freeze, "bin/probe".freeze, "bin/rainbow".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/sync_dir".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "bin/yaml_check".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/config_file/block_config.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/finder/files.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/irb_server.rb".freeze, "lib/utils/irb/regexp.rb".freeze, "lib/utils/irb/shell.rb".freeze, "lib/utils/irb/shell/wrappers.rb".freeze, "lib/utils/irb/string.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe.rb".freeze, "lib/utils/probe/probe_client.rb".freeze, "lib/utils/probe/probe_server.rb".freeze, "lib/utils/probe/process_job.rb".freeze, "lib/utils/probe/server_handling.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xdg.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "tests/test_helper.rb".freeze, "tests/utils_test.rb".freeze, "utils.gemspec".freeze]
16
+ s.files = [".contexts/lib.rb".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/changes".freeze, "bin/classify".freeze, "bin/code_comment".freeze, "bin/code_indexer".freeze, "bin/commit_message".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/irb_client".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/print_method".freeze, "bin/probe".freeze, "bin/rainbow".freeze, "bin/rd2md".freeze, "bin/search".freeze, "bin/sedit".freeze, "bin/serve".freeze, "bin/ssh-tunnel".freeze, "bin/strip_spaces".freeze, "bin/sync_dir".freeze, "bin/untest".freeze, "bin/utils-utilsrc".freeze, "bin/vcf2alias".freeze, "bin/yaml_check".freeze, "lib/utils.rb".freeze, "lib/utils/config_file.rb".freeze, "lib/utils/config_file/block_config.rb".freeze, "lib/utils/editor.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/finder/files.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/irb/irb_server.rb".freeze, "lib/utils/irb/regexp.rb".freeze, "lib/utils/irb/shell.rb".freeze, "lib/utils/irb/shell/wrappers.rb".freeze, "lib/utils/irb/string.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe.rb".freeze, "lib/utils/probe/probe_client.rb".freeze, "lib/utils/probe/probe_server.rb".freeze, "lib/utils/probe/process_job.rb".freeze, "lib/utils/probe/server_handling.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xdg.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "tests/test_helper.rb".freeze, "tests/utils_test.rb".freeze, "utils.gemspec".freeze]
17
17
  s.homepage = "http://github.com/flori/utils".freeze
18
18
  s.licenses = ["GPL-2.0".freeze]
19
19
  s.rdoc_options = ["--title".freeze, "Utils - Some useful command line utilities".freeze, "--main".freeze, "README.md".freeze]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.91.1
4
+ version: 0.93.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -341,6 +341,7 @@ extra_rdoc_files:
341
341
  - lib/utils/xdg.rb
342
342
  - lib/utils/xt/source_location_extension.rb
343
343
  files:
344
+ - ".contexts/lib.rb"
344
345
  - Gemfile
345
346
  - LICENSE
346
347
  - README.md