swhid 0.4.1 → 0.4.2

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: 55ef264a7547cae4c3e201c8c4b745ea42437173efd681623bf7307c0bf58b0d
4
- data.tar.gz: d851e19c5511018c5ded8e853306650414b1708a99fd10837f2e6d62a6266f13
3
+ metadata.gz: 16ba287ac96b6a5e50f4dd578cbb4af414d360dd1b4de71d0d8c335eca848891
4
+ data.tar.gz: a4d5c2f729d7cb608abbfdec6dea9813c8baf4c64fbc78c703bef2cb40836f86
5
5
  SHA512:
6
- metadata.gz: db250c4038a39aa01d3a73c83a1d11ebf907a7465649b69cbff3ed3c9b44e758519c2573ca949fabc996b43ae737a5259d41c1d143ecb1dc980813dc2d6c54cc
7
- data.tar.gz: abaa8a4ca6c33cc718c28f573641a207c6458c8dcb4df4440759583cd1dd9394a60c507c0d29795e4149218b1bcba8b212ee83114e1bbf6a6f0ebe99135328ef
6
+ metadata.gz: 04e2af979856db63384d9080b60182e0e62ffbf6ddeb93dc6037c52a22979eaed8b00d116aa3c7ca47081c2984314b157dd308493d7d1f66159b3c62088f1d18
7
+ data.tar.gz: e10d4fa950666e101c872cb033b4e094bcc149131eebddac8431623569805ea7b909633417b4b30da628d3f3774ef2a34dcac05bcb5fb86f34159845d45a871a
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.2] - 2026-01-14
4
+
5
+ ### Fixed
6
+ - CLI now reads stdin and writes stdout in binary mode (fixes CRLF and binary file handling on Windows)
7
+ - Normalize path separators for Git index lookups on Windows
8
+
9
+ ### Added
10
+ - CLI integration tests for binary content and line ending preservation
11
+
3
12
  ## [0.4.1] - 2026-01-13
4
13
 
5
14
  ### Fixed
data/exe/swhid CHANGED
@@ -6,6 +6,9 @@ require "swhid"
6
6
  require "optparse"
7
7
  require "json"
8
8
 
9
+ # Ensure consistent LF line endings on all platforms
10
+ $stdout.binmode
11
+
9
12
  class SwhidCLI
10
13
  def initialize(args)
11
14
  @args = args
@@ -96,6 +99,7 @@ class SwhidCLI
96
99
  end
97
100
 
98
101
  def compute_content_swhid
102
+ $stdin.binmode
99
103
  content = $stdin.read
100
104
 
101
105
  swhid = Swhid.from_content(content)
@@ -86,13 +86,16 @@ module Swhid
86
86
  full_path = File.realpath(full_path) rescue File.expand_path(full_path)
87
87
  repo_workdir = File.realpath(repo_workdir) rescue File.expand_path(repo_workdir)
88
88
 
89
+ # Normalize path separators for consistent comparison (especially on Windows)
90
+ full_path = full_path.tr("\\", "/")
91
+ repo_workdir = repo_workdir.tr("\\", "/")
92
+
89
93
  # Ensure repo_workdir ends with separator for proper prefix matching
90
- repo_workdir = repo_workdir.chomp("/").chomp("\\") + "/"
94
+ repo_workdir = repo_workdir.chomp("/") + "/"
91
95
 
92
96
  return nil unless full_path.start_with?(repo_workdir)
93
97
 
94
- relative = full_path.sub(repo_workdir, "")
95
- relative.tr("\\", "/")
98
+ full_path.sub(repo_workdir, "")
96
99
  end
97
100
  end
98
101
  end
data/lib/swhid/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Swhid
4
- VERSION = "0.4.1"
4
+ VERSION = "0.4.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: swhid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt