ollama_chat 0.0.39 → 0.0.40

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: 1889968881db471ab1e18058241170ca20b6b0c4933b5f230796b61100d3fc65
4
- data.tar.gz: 9c62ba5958195194cdb562d041d62785304928eab15849e4cb562a3e3fbb9e60
3
+ metadata.gz: dd56f9c3db76f0f261f6e75863e8c26276d3271cffdc7f1053e6a447922459bb
4
+ data.tar.gz: 3d8330fecf97e96fb63a9e6efaff6c34849c98ef0508bcf06385940701f1418d
5
5
  SHA512:
6
- metadata.gz: e02db941ef17c62a5dc8107fc189ea3fe13f20ba4936d22245f3f732e84bf9c697b98a33372300d0f3270aff4e0d7cbb93971d3c4d8a0cdeb246e308b27ef631
7
- data.tar.gz: 31e70f4b3b9c4cd2ab990f41b4642818de01127b3c5ad700172a9a030cca86e27189287c4a4fbdbf6eeb46f5546cf77da847f1f331d14ea83f9e242673312c92
6
+ metadata.gz: a7733d610b5962b9636a4fa2e4e38307923295dde7e11dddd7ae9063469cdbad19aefaec8b4775ab81ca4444a4c79f874c861fc16676d67b501dccff5a673736
7
+ data.tar.gz: 2b668abbc41bb56afc4590fff58f54fd66aa927a8ffc2761d3e9bdaff4e3bc20bbf8ec04d9ed7fb2fa47e3e31463e77e6dc6bca69a6f8188f15f691cd76ca986
data/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changes
2
2
 
3
+ ## 2025-11-20 v0.0.40
4
+
5
+ - Improved Vim server name generation to ensure uniqueness by replacing
6
+ `Pathname.pwd.to_s.upcase` with `File.basename` and `Digest::MD5.hexdigest`
7
+ - Modified `default_server_name` method to create server names in the format
8
+ `MYAPP-3F2B4D8A` instead of just `MYAPP`
9
+ - Enhanced documentation for `OllamaChat::Vim#initialize` and `OllamaChat::Vim.default_server_name` methods
10
+
3
11
  ## 2025-11-14 v0.0.39
4
12
 
5
13
  - Updated `tins` dependency version from `~> 1.41` to `~> 1.47` in `Rakefile` and `ollama_chat.gemspec`
@@ -1,6 +1,6 @@
1
1
  module OllamaChat
2
2
  # OllamaChat version
3
- VERSION = '0.0.39'
3
+ VERSION = '0.0.40'
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:
@@ -1,5 +1,4 @@
1
1
  require 'tempfile'
2
- require 'pathname'
3
2
 
4
3
  # A class that provides functionality for inserting text into Vim buffers via
5
4
  # remote communication.
@@ -11,23 +10,38 @@ class OllamaChat::Vim
11
10
  # Initializes a new Vim server connection
12
11
  #
13
12
  # Creates a new OllamaChat::Vim instance for interacting with a specific Vim
14
- # server. If no server name is provided, it defaults to using the current
15
- # working directory as the server identifier.
13
+ # server. If no server name is provided, it derives a standardized server
14
+ # name based on the current working directory using the default_server_name
15
+ # method.
16
16
  #
17
17
  # @param server_name [String, nil] The name of the Vim server to connect to.
18
- # If nil or empty, defaults to the current working directory path in
19
- # uppercase
18
+ # If nil or empty, defaults to a server name derived from the current working
19
+ # directory using {default_server_name}
20
+ # @return [OllamaChat::Vim] A new Vim instance configured with the specified
21
+ # server name
20
22
  def initialize(server_name)
21
- server_name.full? or server_name = default_server_name
23
+ server_name.full? or server_name = self.class.default_server_name
22
24
  @server_name = server_name
23
25
  end
24
26
 
25
- # The default server name is derived from the current working directory It
26
- # converts the absolute path to uppercase for consistent identification This
27
- # approach ensures each working directory gets a unique server identifier The
28
- # server name format makes it easy to distinguish different Vim sessions
29
- def default_server_name
30
- Pathname.pwd.to_s.upcase
27
+ # The default_server_name method generates a standardized server name
28
+ # based on a given name or the current working directory.
29
+ #
30
+ # This method creates a unique server identifier by combining the basename
31
+ # of the provided name (or current working directory) with a truncated
32
+ # MD5 hash digest of the full path. The resulting name is converted to
33
+ # uppercase for consistent formatting.
34
+ #
35
+ # @param name [ String ] the base name to use for server identification
36
+ # defaults to the current working directory
37
+ #
38
+ # @return [ String ] a formatted server name suitable for use with Vim
39
+ # server connections
40
+ def self.default_server_name(name = Dir.pwd)
41
+ prefix = File.basename(name)
42
+ suffix = Digest::MD5.hexdigest(name)[0, 8]
43
+ name = [ prefix, suffix ] * ?-
44
+ name.upcase
31
45
  end
32
46
 
33
47
  # Inserts text at the current cursor position in Vim
data/ollama_chat.gemspec CHANGED
@@ -1,9 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: ollama_chat 0.0.39 ruby lib
2
+ # stub: ollama_chat 0.0.40 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "ollama_chat".freeze
6
- s.version = "0.0.39".freeze
6
+ s.version = "0.0.40".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]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ollama_chat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.39
4
+ version: 0.0.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank