utils 0.89.1 → 0.91.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.
@@ -40,7 +40,7 @@ else
40
40
  # interface compatibility
41
41
  def start(_ignore)
42
42
  output.puts "Storing error list in #{@errors_lst.path.inspect}: "
43
- output.puts ?- * Tins::Terminal.columns
43
+ output.puts ?━ * Tins::Terminal.columns
44
44
  end
45
45
 
46
46
  # The close method closes the error log file handle.
@@ -66,8 +66,8 @@ else
66
66
  # @param summary [ Object ] the summary object to be processed and displayed
67
67
  def dump_summary(summary)
68
68
  line = summary_line(summary)
69
- @errors_lst.puts ?= * 80, line
70
- output.puts ?= * Tins::Terminal.columns, line
69
+ @errors_lst.puts ?═ * 80, line
70
+ output.puts ?═ * Tins::Terminal.columns, line
71
71
  end
72
72
 
73
73
  # The example_passed method outputs a formatted line for a passed test
@@ -290,10 +290,16 @@ else
290
290
  #
291
291
  # @return [ String ] the formatted and colorized test result string
292
292
  def format_line(example)
293
- args = [ location(example), run_time(example), description(example) ]
294
- uncolored = "%s # S %3.3fs %s" % args
293
+ status = execution_result(example).status
294
+ status_emoji = Hash.new { ?❔ }.merge(
295
+ passed: ?✅,
296
+ failed: ?❌,
297
+ pending: ?⏩
298
+ )
299
+ args = [ status_emoji[status], location(example), run_time(example), description(example) ]
300
+ uncolored = "%s %s # %3.3fs %s" % args
295
301
  uncolored = uncolored[0, Tins::Terminal.columns]
296
- case execution_result(example).status
302
+ case status
297
303
  when :passed
298
304
  success_color(uncolored)
299
305
  when :failed
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.89.1'
3
+ VERSION = '0.91.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:
@@ -43,6 +43,9 @@ module Utils
43
43
  filename = nil
44
44
  linenumber = nil
45
45
  rangeend = nil
46
+ if defined? super
47
+ filename, linenumber = super
48
+ end
46
49
  if respond_to?(:to_str)
47
50
  string = to_str
48
51
  case
@@ -59,19 +62,25 @@ module Utils
59
62
  else
60
63
  filename = string
61
64
  end
62
- else
65
+ elsif !linenumber
63
66
  filename = to_s
64
67
  end
65
68
  array = linenumber ? [ filename, linenumber ] : [ filename, 1 ]
66
- array_singleton_class = class << array; self; end
67
- array_singleton_class.instance_eval do
69
+ decorate_object(array, filename:, linenumber:, rangeend:)
70
+ end
71
+
72
+ private
73
+
74
+ def decorate_object(object, filename: nil, linenumber: nil, rangeend: nil)
75
+ sc = object.singleton_class
76
+ sc.instance_eval do
68
77
  define_method(:filename) { filename }
69
78
  define_method(:linenumber) { linenumber }
70
79
  define_method(:rangeend) { rangeend }
71
80
  define_method(:to_s) { [ filename, linenumber ].compact * ':' }
72
81
  define_method(:range) { rangeend ? "#{to_s}-#{rangeend}" : "#{to_s}" }
73
82
  end
74
- array
83
+ object
75
84
  end
76
85
  end
77
86
  end
data/lib/utils.rb CHANGED
@@ -20,7 +20,25 @@ module Utils
20
20
  require 'utils/line_blamer'
21
21
 
22
22
  require 'utils/xt/source_location_extension'
23
+ # Extend all existing modules that define source_location with our
24
+ # enhancements.
25
+ # This ensures compatibility with existing code that may have overridden
26
+ # source_location while avoiding conflicts with Ruby's core classes. The
27
+ # ObjectSpace iteration discovers all modules that already have
28
+ # source_location methods, and we prepend our extension to them. We rescue
29
+ # TypeError to handle cases where prepending isn't possible (e.g., certain
30
+ # core classes or frozen modules). Finally, we also prepend to ::Object
31
+ # itself to ensure the extension is applied to the root class.
32
+ # This approach maintains backward compatibility while ensuring comprehensive
33
+ # coverage of all classes that might need source location enhancement.
34
+ ObjectSpace.each_object(Module).
35
+ select { it.method_defined?(:source_location) }.
36
+ reject { it <= Utils::Xt::SourceLocationExtension }.
37
+ each do
38
+ it.prepend(Utils::Xt::SourceLocationExtension)
39
+ rescue TypeError
40
+ end
23
41
  class ::Object
24
- include Utils::Xt::SourceLocationExtension
42
+ prepend Utils::Xt::SourceLocationExtension
25
43
  end
26
44
  end
data/utils.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.89.1 ruby lib
2
+ # stub: utils 0.91.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.89.1".freeze
6
+ s.version = "0.91.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]
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
12
12
  s.description = "This ruby gem provides some useful command line utilities".freeze
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
- 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/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/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]
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]
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.89.1
4
+ version: 0.91.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
@@ -323,6 +323,10 @@ extra_rdoc_files:
323
323
  - lib/utils/grepper.rb
324
324
  - lib/utils/irb.rb
325
325
  - lib/utils/irb/irb_server.rb
326
+ - lib/utils/irb/regexp.rb
327
+ - lib/utils/irb/shell.rb
328
+ - lib/utils/irb/shell/wrappers.rb
329
+ - lib/utils/irb/string.rb
326
330
  - lib/utils/line_blamer.rb
327
331
  - lib/utils/line_formatter.rb
328
332
  - lib/utils/md5.rb
@@ -383,6 +387,10 @@ files:
383
387
  - lib/utils/grepper.rb
384
388
  - lib/utils/irb.rb
385
389
  - lib/utils/irb/irb_server.rb
390
+ - lib/utils/irb/regexp.rb
391
+ - lib/utils/irb/shell.rb
392
+ - lib/utils/irb/shell/wrappers.rb
393
+ - lib/utils/irb/string.rb
386
394
  - lib/utils/line_blamer.rb
387
395
  - lib/utils/line_formatter.rb
388
396
  - lib/utils/md5.rb