win32-file-stat 1.4.1 → 1.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 +4 -4
- data/CHANGES +5 -1
- data/lib/win32/file/stat.rb +10 -2
- data/test/test_file_stat.rb +6 -1
- data/win32-file-stat.gemspec +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f4a8344517f65f38afc25399ed53ba90e4042790
|
4
|
+
data.tar.gz: 082ee54ef5f8683133ac1a6debd4100aa689dbd2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c739e1e16beb1130f1cba2c27dcb94e53758a6df15dc9bf8eea30789da0626ae1cec9a9481bd811437603583353974df7bb18b792e7e09ad5160c33d218c801f
|
7
|
+
data.tar.gz: 73012b9bd897383edf5208ebd42b163350f7bdef8acc9c44ff9eac56eb041d99754e92a2e55ea5156a08e1c771a5694ad3faff4e1e2f3f52940c473620e850d5
|
data/CHANGES
CHANGED
@@ -1,5 +1,9 @@
|
|
1
|
+
== 1.4.2 - 28-Apr-2014
|
2
|
+
* Allow the File::Stat.new method to accept objects that respond to to_str
|
3
|
+
or to_path to mimic MRI.
|
4
|
+
|
1
5
|
== 1.4.1 - 12-Feb-2014
|
2
|
-
* The #writable and #writable_real methods now always return
|
6
|
+
* The #writable and #writable_real methods now always return false if the file
|
3
7
|
has been marked readonly.
|
4
8
|
* Fixed an rdev test and added a writable test.
|
5
9
|
|
data/lib/win32/file/stat.rb
CHANGED
@@ -55,7 +55,7 @@ class File::Stat
|
|
55
55
|
attr_reader :dev_major, :dev_minor, :rdev_major, :rdev_minor
|
56
56
|
|
57
57
|
# The version of the win32-file-stat library
|
58
|
-
WIN32_FILE_STAT_VERSION = '1.4.
|
58
|
+
WIN32_FILE_STAT_VERSION = '1.4.2'
|
59
59
|
|
60
60
|
# Creates and returns a File::Stat object, which encapsulate common status
|
61
61
|
# information for File objects on MS Windows sytems. The information is
|
@@ -63,7 +63,7 @@ class File::Stat
|
|
63
63
|
# the file after that point will not be reflected.
|
64
64
|
#
|
65
65
|
def initialize(file)
|
66
|
-
|
66
|
+
file = string_check(file)
|
67
67
|
|
68
68
|
path = file.tr('/', "\\")
|
69
69
|
@path = path
|
@@ -554,6 +554,14 @@ class File::Stat
|
|
554
554
|
|
555
555
|
private
|
556
556
|
|
557
|
+
# Allow stringy arguments
|
558
|
+
def string_check(arg)
|
559
|
+
return arg if arg.is_a?(String)
|
560
|
+
return arg.send(:to_str) if arg.respond_to?(:to_str, true) # MRI honors private to_str
|
561
|
+
return arg.to_path if arg.respond_to?(:to_path)
|
562
|
+
raise TypeError
|
563
|
+
end
|
564
|
+
|
557
565
|
# This is based on fileattr_to_unixmode in win32.c
|
558
566
|
#
|
559
567
|
def get_mode
|
data/test/test_file_stat.rb
CHANGED
@@ -9,6 +9,7 @@ require 'ffi'
|
|
9
9
|
require 'test-unit'
|
10
10
|
require 'win32/file/stat'
|
11
11
|
require 'win32/security'
|
12
|
+
require 'pathname'
|
12
13
|
|
13
14
|
class TC_Win32_File_Stat < Test::Unit::TestCase
|
14
15
|
extend FFI::Library
|
@@ -53,7 +54,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
53
54
|
end
|
54
55
|
|
55
56
|
test "version is set to expected value" do
|
56
|
-
assert_equal('1.4.
|
57
|
+
assert_equal('1.4.2', File::Stat::WIN32_FILE_STAT_VERSION)
|
57
58
|
end
|
58
59
|
|
59
60
|
test "constructor does not modify argument" do
|
@@ -62,6 +63,10 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
|
|
62
63
|
assert_equal(expected, @@txt_file)
|
63
64
|
end
|
64
65
|
|
66
|
+
test "constructor allows arguments that implement to_path" do
|
67
|
+
assert_nothing_raised{ File::Stat.new(Pathname.new(Dir.pwd)) }
|
68
|
+
end
|
69
|
+
|
65
70
|
test "archive? method basic functionality" do
|
66
71
|
assert_respond_to(@stat, :archive?)
|
67
72
|
assert_nothing_raised{ @stat.archive? }
|
data/win32-file-stat.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: win32-file-stat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: ffi
|