win32-file-stat 1.4.0 → 1.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 21ab123edd8396ff02c8327a373ccfc68e4308c7
4
- data.tar.gz: fef46107af70e7f8807936e64ae5e6764323998e
3
+ metadata.gz: 8bd37a04637609ed685cbbcc71a621b2660169e4
4
+ data.tar.gz: 9123576b418e37ecfe320c96e35c42b6c60f9bba
5
5
  SHA512:
6
- metadata.gz: 26b1420a147218155fe47a17ea9f427b631b212a56733f27e569c58d838472bc0908d94b9d15defda9be00a7de1ea63faf7356c92901d1755a5652973fd17e6d
7
- data.tar.gz: 7499482990e1e4a68d52607f612227cf22f11f37ea1a4defb2d62ab6d11fb31b1c0700e2e383989e8d7f4ab57d0df867ca722f4d9b48844fd3daffaad2289cd8
6
+ metadata.gz: 715f01129adafd4c12b71ba8db1ea9c52f6a45e566cfad6427df6ed74c453f5cd43905c3cd2a044ec454dafbc2a8741c6d414a8bde2e2e1f8e46ffb9a6869685
7
+ data.tar.gz: 6f5b6e59efa693919ad1268cdc01acd8e978d9a82b36263d4c73a58049bed44cdcd98ef080ab14c860411eb8ef6d9b7bb80f4a308a45ed403de7a6bc6b130b7b
data/CHANGES CHANGED
@@ -1,3 +1,8 @@
1
+ == 1.4.1 - 12-Feb-2014
2
+ * The #writable and #writable_real methods now always return fals if the file
3
+ has been marked readonly.
4
+ * Fixed an rdev test and added a writable test.
5
+
1
6
  == 1.4.0 - 16-Dec-2013
2
7
  * Conversion to FFI.
3
8
  * Now requires Ruby 1.9 or later.
data/README CHANGED
@@ -70,7 +70,7 @@
70
70
  you would end up using the pretty_print in pp.rb, which would break.
71
71
 
72
72
  == Copyright
73
- (C) 2003-2013, Daniel J. Berger, All Rights Reserved.
73
+ (C) 2003-2014, Daniel J. Berger, All Rights Reserved.
74
74
 
75
75
  == License
76
76
  Artistic 2.0
@@ -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.0'
58
+ WIN32_FILE_STAT_VERSION = '1.4.1'
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
@@ -125,15 +125,6 @@ class File::Stat
125
125
  @rdev = data[:dwVolumeSerialNumber]
126
126
  end
127
127
 
128
- @readable = access_check(path, GENERIC_READ)
129
- @readable_real = @readable
130
-
131
- @writable = access_check(path, GENERIC_WRITE)
132
- @writable_real = @writable
133
-
134
- @world_readable = access_check_world(path, FILE_READ_DATA)
135
- @world_writable = access_check_world(path, FILE_WRITE_DATA)
136
-
137
128
  # Not supported and/or meaningless on MS Windows
138
129
  @dev_major = nil
139
130
  @dev_minor = nil
@@ -179,6 +170,15 @@ class File::Stat
179
170
 
180
171
  @mode = get_mode
181
172
 
173
+ @readable = access_check(path, GENERIC_READ)
174
+ @readable_real = @readable
175
+
176
+ @writable = access_check(path, GENERIC_WRITE) && !@readonly
177
+ @writable_real = @writable
178
+
179
+ @world_readable = access_check_world(path, FILE_READ_DATA)
180
+ @world_writable = access_check_world(path, FILE_WRITE_DATA) && !@readonly
181
+
182
182
  if @reparse_point
183
183
  @symlink = get_symlink(path)
184
184
  else
@@ -53,7 +53,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
53
53
  end
54
54
 
55
55
  test "version is set to expected value" do
56
- assert_equal('1.4.0', File::Stat::WIN32_FILE_STAT_VERSION)
56
+ assert_equal('1.4.1', File::Stat::WIN32_FILE_STAT_VERSION)
57
57
  end
58
58
 
59
59
  test "constructor does not modify argument" do
@@ -166,7 +166,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
166
166
 
167
167
  test "dev custom method basic functionality" do
168
168
  assert_respond_to(@stat, :rdev)
169
- assert_kind_of(Fixnum, @stat.rdev)
169
+ assert_kind_of(Numeric, @stat.rdev)
170
170
  end
171
171
 
172
172
  test "dev custom method returns expected value" do
@@ -599,6 +599,13 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
599
599
  assert_false(File::Stat.new(@@sys_file).writable?)
600
600
  end
601
601
 
602
+ test "a file marked as readonly is not considered writable" do
603
+ File.chmod(0644, @@txt_file)
604
+ assert_true(File::Stat.new(@@txt_file).writable?)
605
+ File.chmod(0444, @@txt_file)
606
+ assert_false(File::Stat.new(@@txt_file).writable?)
607
+ end
608
+
602
609
  test "writable_real? basic functionality" do
603
610
  assert_respond_to(@stat, :writable_real?)
604
611
  assert_boolean(@stat.writable_real?)
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'win32-file-stat'
3
- spec.version = '1.4.0'
3
+ spec.version = '1.4.1'
4
4
  spec.authors = ['Daniel J. Berger', 'Park Heesob']
5
5
  spec.license = 'Artistic 2.0'
6
6
  spec.email = 'djberg96@gmail.com'
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.0
4
+ version: 1.4.1
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: 2013-12-16 00:00:00.000000000 Z
12
+ date: 2014-02-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -82,14 +82,14 @@ extra_rdoc_files:
82
82
  - MANIFEST
83
83
  files:
84
84
  - CHANGES
85
+ - MANIFEST
86
+ - README
87
+ - Rakefile
85
88
  - lib/win32/file/stat.rb
86
89
  - lib/win32/file/windows/constants.rb
87
90
  - lib/win32/file/windows/functions.rb
88
91
  - lib/win32/file/windows/helper.rb
89
92
  - lib/win32/file/windows/structs.rb
90
- - MANIFEST
91
- - Rakefile
92
- - README
93
93
  - test/test_file_stat.rb
94
94
  - win32-file-stat.gemspec
95
95
  homepage: http://www.github.com/djberg96/win32-file-stat
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project: Win32Utils
115
- rubygems_version: 2.0.3
115
+ rubygems_version: 2.2.2
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: A File::Stat class tailored to MS Windows