win32-file-stat 1.4.2 → 1.4.3

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: f4a8344517f65f38afc25399ed53ba90e4042790
4
- data.tar.gz: 082ee54ef5f8683133ac1a6debd4100aa689dbd2
3
+ metadata.gz: ee8c0c3a76c7fcc22794899ff2cb0e0f455ba6e0
4
+ data.tar.gz: 73fbaca95c61912ef6e62f7baa2bf26c3a6f9f66
5
5
  SHA512:
6
- metadata.gz: c739e1e16beb1130f1cba2c27dcb94e53758a6df15dc9bf8eea30789da0626ae1cec9a9481bd811437603583353974df7bb18b792e7e09ad5160c33d218c801f
7
- data.tar.gz: 73012b9bd897383edf5208ebd42b163350f7bdef8acc9c44ff9eac56eb041d99754e92a2e55ea5156a08e1c771a5694ad3faff4e1e2f3f52940c473620e850d5
6
+ metadata.gz: 7cd9985c5a62e7d71e99f586dfe2f18dc1f49fedc4c808db474fa2f5f0b790870612d1f114450de484e93bdeda2b34e1c1339efe2773cc4401a7f3ef6fe56680
7
+ data.tar.gz: 0db9479f32582058da50eaff0afff77226f9fa51e7a520aeb2dd0b9e5f2ee63c260f9d3ae0cf1f96cb8bf9cf421b57d5857c44ffbcf0677ce3d8b4dc95e7990a
data/CHANGES CHANGED
@@ -1,10 +1,14 @@
1
+ == 1.4.3 - 8-May-2014
2
+ * The #writable? method now ignores the readonly attribute if it's a directory.
3
+ * Replaced File.exists? with File.exist? to avoid warnings in Ruby 2.1.x.
4
+
1
5
  == 1.4.2 - 28-Apr-2014
2
6
  * Allow the File::Stat.new method to accept objects that respond to to_str
3
7
  or to_path to mimic MRI.
4
8
 
5
9
  == 1.4.1 - 12-Feb-2014
6
- * The #writable and #writable_real methods now always return false if the file
7
- has been marked readonly.
10
+ * The #writable? and #writable_real? methods now always return false if the
11
+ file has been marked readonly.
8
12
  * Fixed an rdev test and added a writable test.
9
13
 
10
14
  == 1.4.0 - 16-Dec-2013
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ namespace :gem do
19
19
  desc "Install the win32-file-stat gem"
20
20
  task :install => [:create] do
21
21
  file = Dir["win32-file-stat*.gem"].first
22
- sh "gem install #{file}"
22
+ sh "gem install -l #{file}"
23
23
  end
24
24
  end
25
25
 
@@ -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.2'
58
+ WIN32_FILE_STAT_VERSION = '1.4.3'
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
@@ -173,7 +173,13 @@ class File::Stat
173
173
  @readable = access_check(path, GENERIC_READ)
174
174
  @readable_real = @readable
175
175
 
176
- @writable = access_check(path, GENERIC_WRITE) && !@readonly
176
+ # The MSDN docs say that the readonly attribute is honored for directories
177
+ if @directory
178
+ @writable = access_check(path, GENERIC_WRITE)
179
+ else
180
+ @writable = access_check(path, GENERIC_WRITE) && !@readonly
181
+ end
182
+
177
183
  @writable_real = @writable
178
184
 
179
185
  @world_readable = access_check_world(path, FILE_READ_DATA)
@@ -54,7 +54,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
54
54
  end
55
55
 
56
56
  test "version is set to expected value" do
57
- assert_equal('1.4.2', File::Stat::WIN32_FILE_STAT_VERSION)
57
+ assert_equal('1.4.3', File::Stat::WIN32_FILE_STAT_VERSION)
58
58
  end
59
59
 
60
60
  test "constructor does not modify argument" do
@@ -460,7 +460,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
460
460
 
461
461
  # Not sure how to test properly in a generic way, but works on my local network
462
462
  test "rdev works on unc path" do
463
- omit_unless(Etc.getlogin == "djberge" && File.exists?("//scipio/users"))
463
+ omit_unless(Etc.getlogin == "djberge" && File.exist?("//scipio/users"))
464
464
  assert_true(File::Stat.new("//scipio/users").rdev > 1000)
465
465
  end
466
466
 
@@ -604,6 +604,15 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
604
604
  assert_false(File::Stat.new(@@sys_file).writable?)
605
605
  end
606
606
 
607
+ test "writable? returns expected result for system directory" do
608
+ dir = "C:/Program Files"
609
+ if @@elevated
610
+ assert_true(File::Stat.new(dir).writable?)
611
+ else
612
+ assert_false(File::Stat.new(dir).writable?)
613
+ end
614
+ end
615
+
607
616
  test "a file marked as readonly is not considered writable" do
608
617
  File.chmod(0644, @@txt_file)
609
618
  assert_true(File::Stat.new(@@txt_file).writable?)
@@ -638,7 +647,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
638
647
 
639
648
  def teardown
640
649
  SetFileAttributes(@@txt_file, @attr) # Set file back to normal
641
- File.delete(@temp) if File.exists?(@temp)
650
+ File.delete(@temp) if File.exist?(@temp)
642
651
  @dir = nil
643
652
  @stat = nil
644
653
  @attr = nil
@@ -646,8 +655,8 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
646
655
  end
647
656
 
648
657
  def self.shutdown
649
- File.delete(@@txt_file) if File.exists?(@@txt_file)
650
- File.delete(@@exe_file) if File.exists?(@@exe_file)
658
+ File.delete(@@txt_file) if File.exist?(@@txt_file)
659
+ File.delete(@@exe_file) if File.exist?(@@exe_file)
651
660
 
652
661
  @@block_dev = nil
653
662
  @@txt_file = nil
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'win32-file-stat'
3
- spec.version = '1.4.2'
3
+ spec.version = '1.4.3'
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.2
4
+ version: 1.4.3
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-04-28 00:00:00.000000000 Z
12
+ date: 2014-05-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi