win32-file 0.7.1 → 0.7.2

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: 047468a1a793c4485f3e336084cbdab03ec973ee
4
- data.tar.gz: f2cab49afe63c66b94995e83c0dcf7374ba52efa
3
+ metadata.gz: f3ec34d5df87b28440da5d0476baf65bd6b8a49b
4
+ data.tar.gz: 1572144c7862601cd65bc652e903ee08d6818b05
5
5
  SHA512:
6
- metadata.gz: eae986e7739d2fc6307f2ded1c1349ae1e0590248f01c98456f368215f93ba4499c358bc80986f3f80e2e83f0e62693f81565e795af1b9f71880ae965c751218
7
- data.tar.gz: 04634af88ef4466e08e8506e3c661d3afabb7fe31cf42c34f22b7ef121b9d3b07c565ba1964e079448300f5c6fecc0231de5649a5500b362c75709b8bfd76e42
6
+ metadata.gz: 9b401fa9b87331da00cf249adae527d020387241acb7687df4a6c446d554f0a35f515779b5d01e5387422bdff407b9bedf38576e11bd356050a202405e890ad1
7
+ data.tar.gz: baef5724c05e13c1e0c49e02aa6a9487916a8cbaa07fdd1241d775b941052ebc613b21419efda22bf383e04daebc764b1487b5989522a46c247b23958d473ce6
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.7.2 - 7-Oct-2014
2
+ * Replaced File.exists? with File.exist? to avoid deprecation warnings
3
+ for Ruby 2.x.
4
+ * Some minor memory improvements by explicitly freeing some pointers.
5
+ * Minor README updates.
6
+
1
7
  == 0.7.1 - 28-Apr-2014
2
8
  * Modified all custom singleton methods to accept arguments that define either
3
9
  to_str or to_path to be in line with MRI's behavior.
data/README CHANGED
@@ -3,7 +3,6 @@
3
3
  methods have been redefined to make them work properly on MS Windows.
4
4
 
5
5
  == Prerequisites
6
- * windows-pr
7
6
  * win32-file-stat
8
7
 
9
8
  == Installation
@@ -49,9 +48,9 @@
49
48
  * File.world_writable? # Not implemented in MRI
50
49
 
51
50
  == Known issues or bugs
52
- None that I'm aware of.
51
+ The File.exist? method will return true on stale symlinks.
53
52
 
54
- Please report any issues you find on the github page at:
53
+ Please report any other issues you find on the github page at:
55
54
 
56
55
  https://github.com/djberg96/win32-file/issues
57
56
 
data/Rakefile CHANGED
@@ -19,7 +19,7 @@ namespace 'gem' do
19
19
  desc 'Install the win32-file gem'
20
20
  task :install => [:create] do
21
21
  file = Dir['win32-file*.gem'].first
22
- sh "gem install #{file}"
22
+ sh "gem install -l #{file}"
23
23
  end
24
24
  end
25
25
 
@@ -9,7 +9,7 @@ class File
9
9
  extend Windows::File::Functions
10
10
 
11
11
  # The version of the win32-file library
12
- WIN32_FILE_VERSION = '0.7.1'
12
+ WIN32_FILE_VERSION = '0.7.2'
13
13
 
14
14
  class << self
15
15
  alias_method :join_orig, :join
@@ -82,6 +82,8 @@ class File
82
82
  file = wfile.encode(encoding)[/^[^\0]*/]
83
83
  file.sub!(/\\+\z/, '') # Trim trailing slashes
84
84
 
85
+ ptr.free
86
+
85
87
  file
86
88
  end
87
89
 
@@ -138,6 +140,8 @@ class File
138
140
  # Return to original encoding
139
141
  file = wfile.tr(0.chr, '').encode(encoding)
140
142
 
143
+ ptr.free
144
+
141
145
  file
142
146
  end
143
147
 
@@ -235,7 +239,7 @@ class File
235
239
  # Returns whether or not +file+ is a symlink.
236
240
  #
237
241
  def self.symlink?(file)
238
- return false unless File.exists?(file)
242
+ return false unless File.exist?(file)
239
243
 
240
244
  bool = false
241
245
  wfile = string_check(file).wincode
@@ -302,7 +306,7 @@ class File
302
306
  if symlink?(file)
303
307
  if relative_to
304
308
  result = File.join(relative_to, File.basename(readlink(file)))
305
- if File.exists?(result)
309
+ if File.exist?(result)
306
310
  result
307
311
  else
308
312
  raise SystemCallError.new(result, 2) # Errno::ENOENT
@@ -317,15 +321,17 @@ class File
317
321
 
318
322
  # Returns the path of the of the symbolic link referred to by +file+.
319
323
  #
324
+ # Unlike unixy platforms, this will raise an error if the link is stale.
325
+ #
320
326
  def self.readlink(file)
321
327
  file = string_check(file)
322
328
 
323
- if exists?(file) && !symlink?(file)
329
+ if exist?(file) && !symlink?(file)
324
330
  raise SystemCallError.new(22) # EINVAL, match the spec
325
331
  end
326
332
 
327
333
  wfile = file.wincode
328
- path = 0.chr * 512
334
+ path = 0.chr * 1024
329
335
 
330
336
  if File.directory?(file)
331
337
  flags = FILE_FLAG_BACKUP_SEMANTICS
@@ -370,35 +376,35 @@ class File
370
376
  # block device is a removable drive, cdrom or ramdisk.
371
377
  #
372
378
  def self.blockdev?(file)
373
- return false unless File.exists?(file)
379
+ return false unless File.exist?(file)
374
380
  File::Stat.new(file).blockdev?
375
381
  end
376
382
 
377
383
  # Returns whether or not the file is a character device.
378
384
  #
379
385
  def self.chardev?(file)
380
- return false unless File.exists?(file)
386
+ return false unless File.exist?(file)
381
387
  File::Stat.new(file).chardev?
382
388
  end
383
389
 
384
390
  # Returns whether or not the file is a directory.
385
391
  #
386
392
  def self.directory?(file)
387
- return false unless File.exists?(file)
393
+ return false unless File.exist?(file)
388
394
  File::Stat.new(file).directory?
389
395
  end
390
396
 
391
397
  # Returns whether or not the file is executable.
392
398
  #
393
399
  def self.executable?(file)
394
- return false unless File.exists?(file)
400
+ return false unless File.exist?(file)
395
401
  File::Stat.new(file).executable?
396
402
  end
397
403
 
398
404
  # Returns whether or not the file is a regular file.
399
405
  #
400
406
  def self.file?(file)
401
- return false unless File.exists?(file)
407
+ return false unless File.exist?(file)
402
408
  File::Stat.new(file).file?
403
409
  end
404
410
 
@@ -412,35 +418,35 @@ class File
412
418
  # Returns true if the process owner's ID is the same as one of the file's groups.
413
419
  #
414
420
  def self.grpowned?(file)
415
- return false unless File.exists?(file)
421
+ return false unless File.exist?(file)
416
422
  File::Stat.new(file).grpowned?
417
423
  end
418
424
 
419
425
  # Returns whether or not the current process owner is the owner of the file.
420
426
  #
421
427
  def self.owned?(file)
422
- return false unless File.exists?(file)
428
+ return false unless File.exist?(file)
423
429
  File::Stat.new(file).owned?
424
430
  end
425
431
 
426
432
  # Returns whether or not the file is a pipe.
427
433
  #
428
434
  def self.pipe?(file)
429
- return false unless File.exists?(file)
435
+ return false unless File.exist?(file)
430
436
  File::Stat.new(file).pipe?
431
437
  end
432
438
 
433
439
  # Returns whether or not the file is readable by the process owner.
434
440
  #
435
441
  def self.readable?(file)
436
- return false unless File.exists?(file)
442
+ return false unless File.exist?(file)
437
443
  File::Stat.new(file).readable?
438
444
  end
439
445
 
440
446
  # Synonym for File.readable?
441
447
  #
442
448
  def self.readable_real?(file)
443
- return false unless File.exists?(file)
449
+ return false unless File.exist?(file)
444
450
  File::Stat.new(file).readable_real?
445
451
  end
446
452
 
@@ -454,7 +460,7 @@ class File
454
460
  # merely returns true or false, not permission bits (or nil).
455
461
  #
456
462
  def self.world_readable?(file)
457
- return false unless File.exists?(file)
463
+ return false unless File.exist?(file)
458
464
  File::Stat.new(file).world_readable?
459
465
  end
460
466
 
@@ -462,21 +468,21 @@ class File
462
468
  # merely returns true or false, not permission bits (or nil).
463
469
  #
464
470
  def self.world_writable?(file)
465
- return false unless File.exists?(file)
471
+ return false unless File.exist?(file)
466
472
  File::Stat.new(file).world_writable?
467
473
  end
468
474
 
469
475
  # Returns whether or not the file is writable by the current process owner.
470
476
  #
471
477
  def self.writable?(file)
472
- return false unless File.exists?(file)
478
+ return false unless File.exist?(file)
473
479
  File::Stat.new(file).writable?
474
480
  end
475
481
 
476
482
  # Synonym for File.writable?
477
483
  #
478
484
  def self.writable_real?(file)
479
- return false unless File.exists?(file)
485
+ return false unless File.exist?(file)
480
486
  File::Stat.new(file).writable_real?
481
487
  end
482
488
 
@@ -28,7 +28,7 @@ class TC_Win32_File_Link < Test::Unit::TestCase
28
28
  test "symlink to a file works as expected" do
29
29
  omit_unless(@admin)
30
30
  assert_nothing_raised{ File.symlink(@@file, @link) }
31
- assert_true(File.exists?(@link))
31
+ assert_true(File.exist?(@link))
32
32
  assert_true(File.symlink?(@link))
33
33
  end
34
34
 
@@ -135,7 +135,7 @@ class TC_Win32_File_Link < Test::Unit::TestCase
135
135
  end
136
136
 
137
137
  def self.shutdown
138
- File.delete(@@file) if File.exists?(@@file)
138
+ File.delete(@@file) if File.exist?(@@file)
139
139
  @@file = nil
140
140
  end
141
141
  end
@@ -6,7 +6,7 @@ require 'test-unit'
6
6
 
7
7
  class TC_Win32_File_Misc < Test::Unit::TestCase
8
8
  test "version constant is set to expected value" do
9
- assert_equal('0.7.1', File::WIN32_FILE_VERSION)
9
+ assert_equal('0.7.2', File::WIN32_FILE_VERSION)
10
10
  end
11
11
 
12
12
  test "ffi functions are private" do
@@ -276,7 +276,7 @@ class TC_Win32_File_Path < Test::Unit::TestCase
276
276
  end
277
277
 
278
278
  def self.shutdown
279
- File.delete(@@file) if File.exists?(@@file)
279
+ File.delete(@@file) if File.exist?(@@file)
280
280
  @@file = nil
281
281
  end
282
282
  end
@@ -79,7 +79,7 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
79
79
 
80
80
  test "blockdev? returns true for block devices" do
81
81
  omit_unless(@@block_dev)
82
- omit_unless(File.exists?(@@block_dev), "No media in device - skipping")
82
+ omit_unless(File.exist?(@@block_dev), "No media in device - skipping")
83
83
  assert_true(File.blockdev?(@@block_dev))
84
84
  end
85
85
 
@@ -273,8 +273,8 @@ class TC_Win32_File_Stat < Test::Unit::TestCase
273
273
  end
274
274
 
275
275
  def self.shutdown
276
- File.delete(@@txt_file) if File.exists?(@@txt_file)
277
- File.delete(@@exe_file) if File.exists?(@@exe_file)
276
+ File.delete(@@txt_file) if File.exist?(@@txt_file)
277
+ File.delete(@@exe_file) if File.exist?(@@exe_file)
278
278
  @@txt_file = nil
279
279
  @@exe_file = nil
280
280
  @@elevated = nil
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'win32-file'
5
- spec.version = '0.7.1'
5
+ spec.version = '0.7.2'
6
6
  spec.authors = ['Daniel J. Berger', 'Park Heesob']
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: win32-file
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.7.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-04-28 00:00:00.000000000 Z
12
+ date: 2014-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ffi
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  version: '0'
129
129
  requirements: []
130
130
  rubyforge_project: win32utils
131
- rubygems_version: 2.2.2
131
+ rubygems_version: 2.4.1
132
132
  signing_key:
133
133
  specification_version: 4
134
134
  summary: Extra or redefined methods for the File class on Windows.