ptools 1.5.1 → 1.5.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: 36d688bdf86ee95a0f1f6d422f75825903fc8ed26d821a69d617134d146a25e3
4
- data.tar.gz: 574b230aff9a5b095f59cdbb6f1d7b65bc78b27970d4cc2ecc25a1fd67ecbaf0
3
+ metadata.gz: 52a384685fb45ac34ece293d9737f556d741f78072e000a36747ef940944f269
4
+ data.tar.gz: 6c0958dbcbd53d5f95787b16356c0f5b5f741a605ef572460b1332ae01e8bce9
5
5
  SHA512:
6
- metadata.gz: 7a6ede88a24e97f927f6dcc81e9887a0d2b260013fe8e14931796489ec35723d9276651ddcd6ebd6d88cad32f65e0f1298234a0626af95b3b3c0ee157cc1c70a
7
- data.tar.gz: 4bab6fdf21c8d7f0c3bae158319bb5b2131125d0d757e2d0c24b0d430345b7b7162bcf4b70e44d481c7d7c46aae7b3ead9545f4ad920038023511aa1190dc30d
6
+ metadata.gz: 77fbacd1d02cd4f9b3c9b934d841f5f546709f524f63f67b87bc11d24afd94d14699811958c826fa81a67e29325467993602d99d8fe035978e6328b8ed6142a4
7
+ data.tar.gz: b322c4c6e990af6dade89f9182b745abccfb54e108752ffe6ffd63f392f94d86b930a3ff73912f1a3c9a62b9023bc55f2b586d157bdfe228ee79cdb490184c7f
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 1.5.2 - 4-Dec-2025
2
+ * Reverted a change that was causing frozen string warnings in Ruby 3.4.x.
3
+ Thanks go to Daniel Straßner for the report.
4
+ * Fixed a potential warning in the wc method.
5
+ * Updated the Rakefile to run specs with warnings enabled by default.
6
+
1
7
  ## 1.5.1 - 27-Nov-2025
2
8
  * Refactoring release.
3
9
  * The wc('all') method now only does a single read instead of a double read.
data/Rakefile CHANGED
@@ -82,7 +82,7 @@ namespace 'spec' do
82
82
 
83
83
  RSpec::Core::RakeTask.new(:all) do |t|
84
84
  t.pattern = 'spec/*_spec.rb'
85
- t.rspec_opts = '-f documentation'
85
+ t.rspec_opts = '-f documentation -w'
86
86
  end
87
87
  end
88
88
 
data/lib/ptools.rb CHANGED
@@ -3,7 +3,7 @@ require 'win32/file' if File::ALT_SEPARATOR
3
3
 
4
4
  class File
5
5
  # The version of the ptools library.
6
- PTOOLS_VERSION = '1.5.1'.freeze
6
+ PTOOLS_VERSION = '1.5.2'.freeze
7
7
 
8
8
  # :stopdoc:
9
9
 
@@ -332,7 +332,7 @@ class File
332
332
  # 'lines'.
333
333
  #
334
334
  def self.wc(filename, option = 'all')
335
- option.downcase!
335
+ option = option.downcase
336
336
  valid = %w[all bytes characters chars lines words]
337
337
 
338
338
  raise ArgumentError, "Invalid option: '#{option}'" unless valid.include?(option)
@@ -430,19 +430,19 @@ class File
430
430
  # Is the file a jpeg file?
431
431
  #
432
432
  def self.jpg?(file)
433
- File.read(file, 10, nil, :encoding => 'binary') == "\xFF\xD8\xFF\xE0\x00\x10JFIF".force_encoding(Encoding::BINARY)
433
+ File.read(file, 10, nil, :encoding => 'binary') == String.new("\377\330\377\340\000\020JFIF").force_encoding(Encoding::BINARY)
434
434
  end
435
435
 
436
436
  # Is the file a png file?
437
437
  #
438
438
  def self.png?(file)
439
- File.read(file, 4, nil, :encoding => 'binary') == "\x89PNG".force_encoding(Encoding::BINARY)
439
+ File.read(file, 4, nil, :encoding => 'binary') == String.new("\211PNG").force_encoding(Encoding::BINARY)
440
440
  end
441
441
 
442
442
  # Is the file a gif?
443
443
  #
444
444
  def self.gif?(file)
445
- %w[GIF89a GIF97a].include?(File.read(file, 6, nil, :encoding => 'binary'))
445
+ %w[GIF89a GIF97a].include?(File.read(file, 6))
446
446
  end
447
447
 
448
448
  # Is the file a tiff?
@@ -450,7 +450,7 @@ class File
450
450
  def self.tiff?(file)
451
451
  return false if File.size(file) < 12
452
452
 
453
- bytes = File.read(file, 4, nil, :encoding => 'binary')
453
+ bytes = File.read(file, 4)
454
454
 
455
455
  # II is Intel, MM is Motorola
456
456
  return false if bytes[0..1] != 'II' && bytes[0..1] != 'MM'
@@ -465,6 +465,6 @@ class File
465
465
  # Is the file an ico file?
466
466
  #
467
467
  def self.ico?(file)
468
- ["\x00\x00\x01\x00".force_encoding(Encoding::BINARY), "\x00\x00\x02\x00".force_encoding(Encoding::BINARY)].include?(File.read(file, 4, nil, :encoding => 'binary'))
468
+ ["\000\000\001\000", "\000\000\002\000"].include?(File.read(file, 4, nil, :encoding => 'binary'))
469
469
  end
470
470
  end
data/ptools.gemspec CHANGED
@@ -2,7 +2,7 @@ require 'rbconfig'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'ptools'
5
- spec.version = '1.5.1'
5
+ spec.version = '1.5.2'
6
6
  spec.license = 'Apache-2.0'
7
7
  spec.author = 'Daniel J. Berger'
8
8
  spec.email = 'djberg96@gmail.com'
@@ -13,7 +13,7 @@ RSpec.describe File, :constants do
13
13
  let(:windows) { File::ALT_SEPARATOR }
14
14
 
15
15
  example 'PTOOLS_VERSION constant is set to expected value' do
16
- expect(File::PTOOLS_VERSION).to eq('1.5.1')
16
+ expect(File::PTOOLS_VERSION).to eq('1.5.2')
17
17
  expect(File::PTOOLS_VERSION.frozen?).to be true
18
18
  end
19
19
 
data/spec/whereis_spec.rb CHANGED
@@ -44,7 +44,8 @@ RSpec.describe File, :whereis do
44
44
  example 'whereis returns expected values' do
45
45
  expect{ @actual_locs = described_class.whereis(ruby) }.not_to raise_error
46
46
  expect(@actual_locs).to be_a(Array)
47
- expect((@expected_locs & @actual_locs).size > 0).to be true
47
+ expect(@actual_locs).not_to be_empty
48
+ expect(@actual_locs.first).to include(ruby)
48
49
  end
49
50
 
50
51
  example 'whereis returns nil if program not found' do
data/spec/which_spec.rb CHANGED
@@ -63,7 +63,10 @@ describe File, :which do
63
63
  end
64
64
 
65
65
  example 'which returns argument if an existent absolute path is provided' do
66
- expect(described_class.which(@ruby)).to eq(@exe), 'May fail on a symlink'
66
+ result = described_class.which(@ruby)
67
+ expect(result).not_to be_nil
68
+ expect(described_class.exist?(result)).to be true
69
+ expect(described_class.executable?(result)).to be true
67
70
  end
68
71
 
69
72
  example 'which returns nil if a non-existent absolute path is provided' do
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ptools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
metadata.gz.sig CHANGED
Binary file