io-extra 1.2.5 → 1.4.0
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 +7 -0
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +0 -0
- data/CHANGES +45 -0
- data/MANIFEST +5 -2
- data/README +20 -16
- data/ext/extconf.rb +5 -4
- data/ext/io/extra.c +152 -278
- data/lib/io-extra.rb +17 -0
- data/test/test_io_extra.rb +21 -28
- metadata +77 -75
- metadata.gz.sig +0 -0
- data/Rakefile +0 -93
- data/doc/io_extra.txt +0 -85
- data/examples/example_io_extra.rb +0 -42
- data/examples/example_pread.rb +0 -24
- data/io-extra.gemspec +0 -38
@@ -1,42 +0,0 @@
|
|
1
|
-
##############################################################################
|
2
|
-
# test.rb
|
3
|
-
#
|
4
|
-
# This is a small test program for the io-extra library. Modify as you see
|
5
|
-
# fit. You can run this via the 'rake example' task.
|
6
|
-
##############################################################################
|
7
|
-
require "io/extra"
|
8
|
-
p IO::EXTRA_VERSION
|
9
|
-
|
10
|
-
fh = File.open("foo.txt","w+")
|
11
|
-
|
12
|
-
=begin
|
13
|
-
p fh.directio?
|
14
|
-
|
15
|
-
fh.directio = IO::DIRECTIO_ON
|
16
|
-
p fh.directio?
|
17
|
-
|
18
|
-
fh.close
|
19
|
-
=end
|
20
|
-
|
21
|
-
IO.fdwalk(0){ |handle|
|
22
|
-
p handle
|
23
|
-
p handle.fileno
|
24
|
-
puts
|
25
|
-
}
|
26
|
-
|
27
|
-
=begin
|
28
|
-
STDIN.close
|
29
|
-
|
30
|
-
# Should print "Hello" 2 times
|
31
|
-
IO.fdwalk(0){ |fd|
|
32
|
-
puts "Hello #{fd}"
|
33
|
-
}
|
34
|
-
|
35
|
-
|
36
|
-
IO.closefrom(0)
|
37
|
-
|
38
|
-
puts "Done" # Shouldn't see this
|
39
|
-
=end
|
40
|
-
|
41
|
-
fh.close
|
42
|
-
File.delete("foo.txt") if File.exists?("foo.txt")
|
data/examples/example_pread.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
########################################################################
|
2
|
-
# example_pread.rb
|
3
|
-
#
|
4
|
-
# Example program demonstrating the use of IO.pread.
|
5
|
-
########################################################################
|
6
|
-
require 'io/extra'
|
7
|
-
require 'tmpdir'
|
8
|
-
|
9
|
-
# Create a temporary file with a little data in it.
|
10
|
-
file = File.join(Dir.tmpdir, 'pread_test.txt')
|
11
|
-
File.open(file, 'w'){ |fh| 100.times{ |n| fh.puts "Hello: #{n}" } }
|
12
|
-
|
13
|
-
# Read from the file using pread.
|
14
|
-
begin
|
15
|
-
fh = File.open(file)
|
16
|
-
|
17
|
-
puts "Handle position before read: #{fh.pos}"
|
18
|
-
puts IO.pread(fh.fileno, 18, 0)
|
19
|
-
|
20
|
-
puts "Handle position after read: #{fh.pos}"
|
21
|
-
puts IO.pread(fh.fileno, 18, 0)
|
22
|
-
ensure
|
23
|
-
fh.close
|
24
|
-
end
|
data/io-extra.gemspec
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rbconfig'
|
3
|
-
|
4
|
-
Gem::Specification.new do |spec|
|
5
|
-
if RbConfig::CONFIG['host_os'] =~ /mswin|dos|win32|cygwin|mingw|windows/i
|
6
|
-
STDERR.puts 'Not supported on this platform. Exiting.'
|
7
|
-
exit(-1)
|
8
|
-
end
|
9
|
-
|
10
|
-
spec.name = 'io-extra'
|
11
|
-
spec.version = '1.2.5'
|
12
|
-
spec.author = 'Daniel J. Berger'
|
13
|
-
spec.license = 'Artistic 2.0'
|
14
|
-
spec.email = 'djberg96@gmail.com'
|
15
|
-
spec.homepage = 'http://www.rubyforge.org/projects/shards'
|
16
|
-
spec.summary = 'Adds extra methods to the IO class.'
|
17
|
-
spec.test_file = 'test/test_io_extra.rb'
|
18
|
-
spec.extensions = ['ext/extconf.rb']
|
19
|
-
spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
|
20
|
-
|
21
|
-
spec.extra_rdoc_files = [
|
22
|
-
'CHANGES',
|
23
|
-
'README',
|
24
|
-
'MANIFEST',
|
25
|
-
'ext/io/extra.c'
|
26
|
-
]
|
27
|
-
|
28
|
-
spec.rubyforge_project = 'shards'
|
29
|
-
spec.required_ruby_version = '>= 1.8.6'
|
30
|
-
|
31
|
-
spec.add_development_dependency('test-unit', '>= 2.1.1')
|
32
|
-
|
33
|
-
spec.description = <<-EOF
|
34
|
-
Adds the IO.closefrom, IO.fdwalk, IO.pread, IO.pread_ptr, IO.pwrite, and
|
35
|
-
IO.writev singleton methods as well as the IO#directio and IO#directio?
|
36
|
-
instance methods (for those platforms that support them).
|
37
|
-
EOF
|
38
|
-
end
|