utils 0.59.2 → 0.60.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: dbe0007addc8116defba0c532f3f9b2266c49f5676ed64c461a58882234abc74
4
- data.tar.gz: 5f59ed14c8e97ba588c03fe8f103a66addbec60f3ea2a9c942570825a979a6b8
3
+ metadata.gz: 5d5a13dd0dc3c72e4110c54d7b218275b8ffe0aaffb79d1ad14d0e8c4de2201f
4
+ data.tar.gz: e35c204313debe613cbe39e915f986d84faf6ff0ef9c0a7d3529eeabcab8f628
5
5
  SHA512:
6
- metadata.gz: ec001d02e5cf6b9844532b0495d2b64e78e1503d120d831725ec77bb86e8c56929a68d8774de1593c890488a4b99d1b94d89dfb831d2dfb410b1effe93d28e9c
7
- data.tar.gz: 78021684fb51db6b4a926046edb9cc38e56caf20d75937f3fad4c9df9533418bd56e3a9815173751755cfe96964cabba41631a0764ab73f45b61ac9f4690063c
6
+ metadata.gz: f2755da93986eb39d4c2736578fa26acba7b8a3a4d8a56baaf30c509eb008260eb30281ad26dfba430ab5d031381f5f84ae8a0f4e2fdacc635e96aa105f0ec72
7
+ data.tar.gz: 8169b9827f29e237e589e76cc98a732a0bda047f524eeccdeaf2e1a0aadc18accdc879fecdbb00c1b19fdb318b52dac193c795bba4cfddf4043db7ebaedd90fc
data/Rakefile CHANGED
@@ -29,6 +29,7 @@ GemHadar do
29
29
  dependency 'search_ui', '~> 0.0'
30
30
  dependency 'all_images', '~> 0.5.0'
31
31
  dependency 'ollama-ruby'
32
+ dependency 'kramdown-ansi'
32
33
  dependency 'simplecov'
33
34
  dependency 'debug'
34
35
 
data/bin/code_comment CHANGED
@@ -36,96 +36,53 @@ model = ENV.fetch('OLLAMA_MODEL', 'llama3.1')
36
36
  #methods = call_sites.map { fetch_method(_1) } * ?\n
37
37
 
38
38
  cheatsheet = <<EOT
39
- # YARD CHEATSHEET http://yardoc.org
40
-
41
- ## May 2020 - updated fork: https://gist.github.com/phansch/db18a595d2f5f1ef16646af72fe1fb0e
42
-
43
- cribbed from http://pastebin.com/xgzeAmBn
44
-
45
- Templates to remind you of the options and formatting for the different types of objects you might
46
- want to document using YARD.
47
-
48
- ## Modules
49
-
50
- # Namespace for classes and modules that handle serving documentation over HTTP
51
-
52
- ## Classes
53
-
54
- # Abstract base class for CLI utilities. Provides some helper methods for
55
- # the option parser
56
- #
57
- # @author Full Name
58
- # @abstract
59
- # @attr [Types] attribute_name a full description of the attribute
60
- # @attr_reader [Types] name description of a readonly attribute
61
- # @attr_writer [Types] name description of writeonly attribute
62
- # @deprecated Describe the reason or provide alt. references here
63
-
64
- ## Methods
65
-
66
- # An alias to {Parser::SourceParser}'s parsing method
67
- #
68
- # @author Donovan Bray
69
- #
70
- # @see http://example.com Description of URL
71
- # @see SomeOtherClass#method
72
- #
73
- # @deprecated Use {#my_new_method} instead of this method because
74
- # it uses a library that is no longer supported in Ruby 1.9.
75
- # The new method accepts the same parameters.
76
- #
77
- # @abstract
78
- # @private
79
- #
80
- # @param subject [String] The subject
81
- # @param from [String] ('nobody') From address
82
- # @param to [String] Recipient email
83
- # @param body [String] ('') The email's body
84
- #
85
- # @param (see User#initialize)
86
- # @param [OptionParser] opts the option parser object
87
- # @param [Array<String>] args the arguments passed from input. This
88
- # array will be modified.
89
- # @param [Array<String, Symbol>] list the list of strings and symbols.
90
- #
91
- # The options parsed out of the commandline.
92
- # Default options are:
93
- # :format => :dot
94
- #
95
- # @example Reverse a string
96
- # "mystring.reverse" #=> "gnirtsym"
97
- #
98
- # @example Parse a glob of files
99
- # YARD.parse('lib/**/*.rb')
100
- #
101
- # @raise [ExceptionClass] description
102
- #
103
- # @return [optional, types, ...] description
104
- # @return [true] always returns true
105
- # @return [void]
106
- # @return [String, nil] the contents of our object or nil
107
- # if the object has not been filled with data.
108
- #
109
- # We don't care about the "type" here:
110
- # @return the object
111
- #
112
- # @return [String, #read] a string or object that responds to #read
113
- # @return description here with no types
114
-
115
- ## Anywhere
116
-
117
- # @todo Add support for Jabberwocky service
118
- # There is an open source Jabberwocky library available
119
- # at http://somesite.com that can be integrated easily
120
- # into the project.
121
-
122
- ## Blocks
123
-
124
- # for block {|a, b, c| ... }
125
- # @yield [a, b, c] Description of block
126
- #
127
- # @yieldparam [optional, types, ...] argname description
128
- # @yieldreturn [optional, types, ...] description
39
+ Documenting Code with YARD
40
+
41
+ By default, YARD is compatible with the same RDoc syntax most Ruby developers
42
+ are already familiar with. However, one of the biggest advantages of YARD is
43
+ the extended meta-data syntax, commonly known as "tags", that you can use to
44
+ express small bits of information in a structured and formal manner. While RDoc
45
+ syntax expects you to describe your method in a completely free-form manner,
46
+ YARD recommends declaring your parameters, return types, etc. with the @tag
47
+ syntax, which makes outputting the documentation more consistent and easier to
48
+ read. Consider the RDoc documentation for a method to_format:
49
+
50
+ # Converts the object into textual markup given a specific `format`
51
+ # (defaults to `:html`)
52
+ #
53
+ # == Parameters:
54
+ # format::
55
+ # A Symbol declaring the format to convert the object to. This
56
+ # can be `:text` or `:html`.
57
+ #
58
+ # == Returns:
59
+ # A string representing the object in a specified
60
+ # format.
61
+ #
62
+ def to_format(format = :html)
63
+ # format the object
64
+ end
65
+
66
+ While this may seem easy enough to read and understand, it's hard for a machine
67
+ to properly pull this data back out of our documentation. Also we've tied our
68
+ markup to our content, and now our documentation becomes hard to maintain if we
69
+ decide later to change our markup style (maybe we don't want the ":" suffix on
70
+ our headers anymore).
71
+
72
+ In YARD, we would simply define our method as:
73
+
74
+ # Converts the object into textual markup given a specific format.
75
+ #
76
+ # @param format [Symbol] the format type, `:text` or `:html`
77
+ # @return [String] the object converted into the expected format.
78
+ # @raise [CannotFormatException] the object cannot be formatted
79
+ def to_format(format = :html)
80
+ # format the object
81
+ end
82
+
83
+ Using tags we can add semantic metadata to our code without worrying about
84
+ presentation. YARD will handle presentation for us when we decide to generate
85
+ documentation later.
129
86
  EOT
130
87
 
131
88
  system = <<EOT
data/lib/utils/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Utils
2
2
  # Utils version
3
- VERSION = '0.59.2'
3
+ VERSION = '0.60.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/lib/utils.rb CHANGED
@@ -10,8 +10,6 @@ module Utils
10
10
  require 'utils/probe_server'
11
11
  require 'utils/ssh_tunnel_specification'
12
12
  require 'utils/line_blamer'
13
- require 'utils/markdown'
14
- require 'utils/pager'
15
13
 
16
14
  require 'utils/xt/source_location_extension'
17
15
  class ::Object
data/utils.gemspec CHANGED
@@ -1,19 +1,19 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: utils 0.59.2 ruby lib
2
+ # stub: utils 0.60.0 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "utils".freeze
6
- s.version = "0.59.2".freeze
6
+ s.version = "0.60.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]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2024-10-27"
11
+ s.date = "2024-10-31"
12
12
  s.description = "This ruby gem provides some useful command line utilities".freeze
13
13
  s.email = "flori@ping.de".freeze
14
- s.executables = ["ascii7".freeze, "blameline".freeze, "changes".freeze, "classify".freeze, "code_comment".freeze, "commit_message".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "git-empty".freeze, "git-md".freeze, "git-versions".freeze, "json_check".freeze, "long_lines".freeze, "md".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "print_method".freeze, "probe".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/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/markdown.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/pager.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
16
- s.files = [".github/dependabot.yml".freeze, ".github/workflows/codeql-analysis.yml".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/changes".freeze, "bin/classify".freeze, "bin/code_comment".freeze, "bin/commit_message".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/git-empty".freeze, "bin/git-md".freeze, "bin/git-versions".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/md".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/print_method".freeze, "bin/probe".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/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.rb".freeze, "lib/utils/line_blamer.rb".freeze, "lib/utils/line_formatter.rb".freeze, "lib/utils/markdown.rb".freeze, "lib/utils/md5.rb".freeze, "lib/utils/pager.rb".freeze, "lib/utils/patterns.rb".freeze, "lib/utils/probe_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze, "utils.gemspec".freeze]
14
+ s.executables = ["ascii7".freeze, "blameline".freeze, "changes".freeze, "classify".freeze, "code_comment".freeze, "commit_message".freeze, "create_cstags".freeze, "create_tags".freeze, "discover".freeze, "edit".freeze, "edit_wait".freeze, "enum".freeze, "git-empty".freeze, "git-versions".freeze, "json_check".freeze, "long_lines".freeze, "myex".freeze, "number_files".freeze, "on_change".freeze, "path".freeze, "print_method".freeze, "probe".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/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.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_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.rb".freeze]
16
+ s.files = [".github/dependabot.yml".freeze, ".github/workflows/codeql-analysis.yml".freeze, "COPYING".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "bin/ascii7".freeze, "bin/blameline".freeze, "bin/changes".freeze, "bin/classify".freeze, "bin/code_comment".freeze, "bin/commit_message".freeze, "bin/create_cstags".freeze, "bin/create_tags".freeze, "bin/discover".freeze, "bin/edit".freeze, "bin/edit_wait".freeze, "bin/enum".freeze, "bin/git-empty".freeze, "bin/git-versions".freeze, "bin/json_check".freeze, "bin/long_lines".freeze, "bin/myex".freeze, "bin/number_files".freeze, "bin/on_change".freeze, "bin/path".freeze, "bin/print_method".freeze, "bin/probe".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/editor.rb".freeze, "lib/utils/file_xt.rb".freeze, "lib/utils/finder.rb".freeze, "lib/utils/grepper.rb".freeze, "lib/utils/irb.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_server.rb".freeze, "lib/utils/ssh_tunnel_specification.rb".freeze, "lib/utils/version.rb".freeze, "lib/utils/xt/source_location_extension.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]
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency(%q<search_ui>.freeze, ["~> 0.0".freeze])
34
34
  s.add_runtime_dependency(%q<all_images>.freeze, ["~> 0.5.0".freeze])
35
35
  s.add_runtime_dependency(%q<ollama-ruby>.freeze, [">= 0".freeze])
36
+ s.add_runtime_dependency(%q<kramdown-ansi>.freeze, [">= 0".freeze])
36
37
  s.add_runtime_dependency(%q<simplecov>.freeze, [">= 0".freeze])
37
38
  s.add_runtime_dependency(%q<debug>.freeze, [">= 0".freeze])
38
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.59.2
4
+ version: 0.60.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-27 00:00:00.000000000 Z
11
+ date: 2024-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
+ - !ruby/object:Gem::Dependency
168
+ name: kramdown-ansi
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - ">="
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
174
+ type: :runtime
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - ">="
179
+ - !ruby/object:Gem::Version
180
+ version: '0'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: simplecov
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -208,11 +222,9 @@ executables:
208
222
  - edit_wait
209
223
  - enum
210
224
  - git-empty
211
- - git-md
212
225
  - git-versions
213
226
  - json_check
214
227
  - long_lines
215
- - md
216
228
  - myex
217
229
  - number_files
218
230
  - on_change
@@ -242,9 +254,7 @@ extra_rdoc_files:
242
254
  - lib/utils/irb.rb
243
255
  - lib/utils/line_blamer.rb
244
256
  - lib/utils/line_formatter.rb
245
- - lib/utils/markdown.rb
246
257
  - lib/utils/md5.rb
247
- - lib/utils/pager.rb
248
258
  - lib/utils/patterns.rb
249
259
  - lib/utils/probe_server.rb
250
260
  - lib/utils/ssh_tunnel_specification.rb
@@ -270,11 +280,9 @@ files:
270
280
  - bin/edit_wait
271
281
  - bin/enum
272
282
  - bin/git-empty
273
- - bin/git-md
274
283
  - bin/git-versions
275
284
  - bin/json_check
276
285
  - bin/long_lines
277
- - bin/md
278
286
  - bin/myex
279
287
  - bin/number_files
280
288
  - bin/on_change
@@ -301,9 +309,7 @@ files:
301
309
  - lib/utils/irb.rb
302
310
  - lib/utils/line_blamer.rb
303
311
  - lib/utils/line_formatter.rb
304
- - lib/utils/markdown.rb
305
312
  - lib/utils/md5.rb
306
- - lib/utils/pager.rb
307
313
  - lib/utils/patterns.rb
308
314
  - lib/utils/probe_server.rb
309
315
  - lib/utils/ssh_tunnel_specification.rb
data/bin/git-md DELETED
@@ -1,51 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'utils/markdown'
4
- include Utils::Markdown
5
- require 'utils/pager'
6
- require 'term/ansicolor'
7
- include Term::ANSIColor
8
- require 'shellwords'
9
-
10
- cmd = %{git log --color=always --pretty=format:"commit %H%C(auto)%d%nDate: %Cgreen%cD (%cr)%Creset%nAuthor: %Cblue%an <%ae>%Creset%n%nMARKUP%n%s%n%n%b%nMARKDOWN%n"}
11
-
12
- core_pager = `git config get core.pager`.chomp.full?
13
- git_pager = ENV['GIT_PAGER'].full?
14
- default_pager = ENV['PAGER'].full?
15
- if fallback_pager = `which less`.chomp.full? || `which more`.chomp.full?
16
- fallback_pager << ' -r'
17
- end
18
- my_pager = git_pager || core_pager || default_pager || fallback_pager
19
-
20
- repo_url = case git_origin_url = `git remote get-url origin`.chomp
21
- when %r(\Ahttps://)
22
- u = git_origin_url.sub(%r(\.git\z), '')
23
- u << '/commit/'
24
- when %r(\Agit@github.com:([^.]+))
25
- "https://github.com/#$1/commit/"
26
- end
27
-
28
- Utils::Pager.pager(command: my_pager) do |output|
29
- IO.popen("#{cmd} #{Shellwords.join(ARGV)}") do |log|
30
- until log.eof?
31
- message = nil
32
- log.each do |line|
33
- case line
34
- when /^MARKUP$/
35
- message = ''
36
- when /^MARKDOWN$/
37
- output.puts markdown(message + "\n---\n")
38
- message = nil
39
- else
40
- if message
41
- message << line
42
- else
43
- output.puts line.sub(/(?<=^commit )(\h{40})/) {
44
- yellow { repo_url ? hyperlink(repo_url + $1) { $1 } : $1 }
45
- }
46
- end
47
- end
48
- end
49
- end
50
- end
51
- end
data/bin/md DELETED
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'utils/markdown'
4
- include Utils::Markdown
5
- require 'utils/pager'
6
-
7
- rendered = markdown(ARGF.read)
8
- default_pager = ENV['PAGER'].full?
9
- if fallback_pager = `which less`.chomp.full? || `which more`.chomp.full?
10
- fallback_pager << ' -r'
11
- end
12
- my_pager = default_pager || fallback_pager
13
-
14
- Utils::Pager.pager(lines: rendered.count(?\n), command: my_pager) do |output|
15
- output.puts rendered
16
- end
@@ -1,11 +0,0 @@
1
- require 'ollama'
2
-
3
- module Utils
4
- module Markdown
5
- module_function
6
-
7
- def markdown(message)
8
- Ollama::Utils::ANSIMarkdown.parse(message)
9
- end
10
- end
11
- end
data/lib/utils/pager.rb DELETED
@@ -1,30 +0,0 @@
1
- require 'tins'
2
-
3
- module Utils
4
- module Pager
5
- module_function
6
-
7
- def pager(command: nil, lines: nil, &block)
8
- if block
9
- if my_pager = pager(command:, lines:)
10
- IO.popen(my_pager, 'w') do |output|
11
- output.sync = true
12
- yield output
13
- output.close
14
- end
15
- else
16
- yield STDOUT
17
- end
18
- else
19
- return unless STDOUT.tty?
20
- if lines
21
- if lines >= Tins::Terminal.lines
22
- pager(command:)
23
- end
24
- else
25
- command
26
- end
27
- end
28
- end
29
- end
30
- end