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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +6 -0
- data/Rakefile +1 -1
- data/lib/ptools.rb +7 -7
- data/ptools.gemspec +1 -1
- data/spec/constants_spec.rb +1 -1
- data/spec/whereis_spec.rb +2 -1
- data/spec/which_spec.rb +4 -1
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52a384685fb45ac34ece293d9737f556d741f78072e000a36747ef940944f269
|
|
4
|
+
data.tar.gz: 6c0958dbcbd53d5f95787b16356c0f5b5f741a605ef572460b1332ae01e8bce9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
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.
|
|
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') == "\
|
|
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') == "\
|
|
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
|
|
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
|
|
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
|
-
["\
|
|
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
data/spec/constants_spec.rb
CHANGED
|
@@ -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.
|
|
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(
|
|
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
|
-
|
|
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
metadata.gz.sig
CHANGED
|
Binary file
|