io-extra 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 1.2.1 - 16-Jan-2010
2
+ * Some README updates
3
+ * Updates to the gemspec.
4
+ * Added the gem:build and gem:install rake task.
5
+ * Source code moved to github.
6
+
1
7
  == 1.2.0 - 28-Jul-2009
2
8
  * Several Linux compatibility fixes, all provided by Eric Wong.
3
9
  * Now compatible with 1.9.x thanks to Eric Wong.
data/README CHANGED
@@ -1,40 +1,44 @@
1
1
  = Description
2
- The io-extra library provides a few extra IO methods that you may find
3
- handy. They are IO.closefrom, IO.fdwalk, IO#directio? and IO#directio=.
2
+ The io-extra library provides a few extra IO methods that you may find
3
+ handy. They are IO.closefrom, IO.fdwalk, IO#directio? and IO#directio=.
4
4
 
5
- Not supported on MS Windows.
5
+ This library is not supported on MS Windows.
6
6
 
7
- Limited support for OS X.
7
+ Support for OS X is limited. See the documentation for details.
8
8
 
9
9
  = Installation
10
- == Standard Installation
11
- rake test (optional)
12
- rake install
10
+ gem install io-extra
13
11
 
14
- == Gem Installation
15
- === Remote
16
- gem install io-extra
17
- === Local
18
- rake test (optional)
19
- rake install_gem
12
+ = Synopsis
13
+ require 'io/extra'
14
+
15
+ # Close all file descriptors from 3 up.
16
+ IO.closefrom(3)
17
+
18
+ # Inspect all the open handles
19
+ IO.fdwalk(0){ |handle|
20
+ puts "=" * 40
21
+ p handle
22
+ p handle.fileno
23
+ }
20
24
 
21
25
  = Developer's Notes
22
- You might be wondering what the difference is between my implementation of
23
- IO.closefrom and a pure Ruby version that looks something like this:
26
+ You might be wondering what the difference is between my implementation of
27
+ IO.closefrom and a pure Ruby version that looks something like this:
24
28
 
25
- def IO.closefrom(n)
26
- 0.upto(n) do |fd|
27
- IO.for_fd(fd).close
28
- end
29
- end
29
+ def IO.closefrom(n)
30
+ 0.upto(n) do |fd|
31
+ IO.for_fd(fd).close
32
+ end
33
+ end
30
34
 
31
- The primary difference is that this walks all file descriptors, rather
32
- than only open file descriptors. However, I should note that this only
33
- applies if your platform supports the closefrom() function. In that case,
34
- the only advantage is speed.
35
+ The primary difference is that this walks all file descriptors, rather
36
+ than only open file descriptors. However, I should note that this only
37
+ applies if your platform supports the closefrom() function. In that case,
38
+ the only advantage is speed.
35
39
 
36
- You might also be wondering what the difference is between my implementation
37
- of IO.fdwalk and a pure Ruby version that looks something like this:
40
+ You might also be wondering what the difference is between my implementation
41
+ of IO.fdwalk and a pure Ruby version that looks something like this:
38
42
 
39
43
  def IO.fdwalk(n)
40
44
  ObjectSpace.each_object(File){ |f|
@@ -42,43 +46,41 @@ of IO.fdwalk and a pure Ruby version that looks something like this:
42
46
  }
43
47
  end
44
48
 
45
- The primary difference is that this only closes Ruby file objects, not
46
- necessarily every file handle opened by the Ruby process. For example, handles
47
- opened via system() calls.
49
+ The primary difference is that this only closes Ruby file objects, not
50
+ necessarily every file handle opened by the Ruby process. For example, handles
51
+ opened via system() calls.
48
52
 
49
53
  = Note to OS X Users
50
- The OS X platform does not support closefrom(), fdwalk() or directio(). The
51
- hand-crafted IO.closefrom function will not work because the getrlimit()
52
- function on OS X does not work. Patches welcome.
54
+ The OS X platform does not support closefrom(), fdwalk() or directio(). The
55
+ hand-crafted IO.closefrom function will not work because the getrlimit()
56
+ function on OS X does not work. Patches welcome.
53
57
 
54
58
  = Documentation
55
- For further documentation, see the io_extra.txt file or the inline
56
- documentation that was generated by RDoc (if you did a gem install).
59
+ For further documentation, see the io_extra.txt file or the inline
60
+ documentation that was generated by RDoc (if you did a gem install).
57
61
 
58
62
  = Known Issues
59
- None that I'm aware of (beyond those documented above). Please file any bug
60
- reports on the project page at http://www.rubyforge.org/projects/shards.
63
+ None that I'm aware of (beyond those documented above). Please file any bug
64
+ reports on the project page at http://www.rubyforge.org/projects/shards.
61
65
 
62
66
  = Future Plans
63
- * I may add the File::O_DIRECT open constant on platforms that support it.
64
- * Switch from C extension to FFI.
67
+ * I may add the File::O_DIRECT open constant on platforms that support it.
68
+ * Switch from C extension to FFI.
65
69
 
66
70
  = Acknowledgements
67
- Eric Wong for some great work on Linux compatibility and other fixes.
71
+ Eric Wong for some great work on Linux compatibility and other fixes.
68
72
 
69
73
  = License
70
- Artistic 2.0
74
+ Artistic 2.0
71
75
 
72
76
  = Copyright
73
- (C) 2003-2009 Daniel J. Berger
74
- All Rights Reserved
77
+ (C) 2003-2010 Daniel J. Berger
78
+ All Rights Reserved
75
79
 
76
80
  = Warranty
77
- This package is provided "as is" and without any express or
78
- implied warranties, including, without limitation, the implied
79
- warranties of merchantability and fitness for a particular purpose.
81
+ This package is provided "as is" and without any express or
82
+ implied warranties, including, without limitation, the implied
83
+ warranties of merchantability and fitness for a particular purpose.
80
84
 
81
85
  = Author
82
- Daniel J. Berger
83
- djberg96 at nospam at gmail dot com
84
- imperator on IRC (irc.freenode.net)
86
+ Daniel J. Berger
data/Rakefile CHANGED
@@ -2,55 +2,60 @@ require 'rake'
2
2
  require 'rake/clean'
3
3
  require 'rake/testtask'
4
4
  require 'rbconfig'
5
- include Config
6
5
 
7
- case RUBY_PLATFORM
8
- when /mswin/i
9
- STDERR.puts 'Not supported on this platform. Exiting.'
10
- exit(-1)
6
+ if Config::CONFIG['host_os'] =~ /mswin|win32|dos|cygwin|mingw/i
7
+ STDERR.puts 'Not supported on this platform. Exiting.'
8
+ exit(-1)
11
9
  end
12
10
 
13
11
  desc "Clean the build files for the io-extra source"
14
12
  task :clean do
15
- FileUtils.rm_rf('io') if File.exists?('io')
16
- Dir.chdir('ext') do
17
- sh 'make distclean' if File.exists?('extra.o')
13
+ FileUtils.rm_rf('io') if File.exists?('io')
14
+ Dir.chdir('ext') do
15
+ sh 'make distclean' if File.exists?('extra.o')
18
16
 
19
- FileUtils.rm_rf('extra/extra.c') if File.exists?('extra.c')
17
+ FileUtils.rm_rf('extra/extra.c') if File.exists?('extra.c')
20
18
 
21
- build_file = File.join(Dir.pwd, 'io', 'extra.' + Config::CONFIG['DLEXT'])
22
- File.delete(build_file) if File.exists?(build_file)
23
- end
19
+ build_file = File.join(Dir.pwd, 'io', 'extra.' + Config::CONFIG['DLEXT'])
20
+ File.delete(build_file) if File.exists?(build_file)
21
+ end
24
22
  end
25
23
 
26
24
  desc "Build the io-extra library (but don't install it)"
27
25
  task :build => [:clean] do
28
- Dir.chdir('ext') do
29
- ruby 'extconf.rb'
30
- sh 'make'
31
- build_file = File.join(Dir.pwd, 'extra.' + Config::CONFIG['DLEXT'])
32
- Dir.mkdir('io') unless File.exists?('io')
33
- FileUtils.cp(build_file, 'io')
34
- end
26
+ Dir.chdir('ext') do
27
+ ruby 'extconf.rb'
28
+ sh 'make'
29
+ build_file = File.join(Dir.pwd, 'extra.' + Config::CONFIG['DLEXT'])
30
+ Dir.mkdir('io') unless File.exists?('io')
31
+ FileUtils.cp(build_file, 'io')
32
+ end
35
33
  end
36
34
 
37
- desc "Install the io-extra package (non-gem)"
35
+ desc "Install the io-extra library (non-gem)"
38
36
  task :install => [:build] do
39
- Dir.chdir('ext') do
40
- sh 'make install'
41
- end
37
+ Dir.chdir('ext') do
38
+ sh 'make install'
39
+ end
42
40
  end
43
41
 
44
- desc "Install the io-extra package as a gem"
45
- task :install_gem do
46
- ruby 'io-extra.gemspec'
47
- file = Dir["io-extra*.gem"].last
48
- sh "gem install #{file}"
42
+ namespace :gem do
43
+ desc 'Build the io-extra gem'
44
+ task :build do
45
+ spec = eval(IO.read('io-extra.gemspec'))
46
+ Gem::Builder.new(spec).build
47
+ end
48
+
49
+ desc "Install the io-extra library as a gem"
50
+ task :install => [:build] do
51
+ file = Dir["io-extra*.gem"].last
52
+ sh "gem install #{file}"
53
+ end
49
54
  end
50
55
 
51
56
  desc "Run the example io-extra program"
52
57
  task :example => [:build] do
53
- ruby '-Iext examples/example_io_extra.rb'
58
+ ruby '-Iext examples/example_io_extra.rb'
54
59
  end
55
60
 
56
61
  Rake::TestTask.new do |t|
data/ext/io/extra.c CHANGED
@@ -380,6 +380,6 @@ void Init_extra(){
380
380
  rb_define_singleton_method(rb_cIO, "pwrite", s_io_pwrite, 3);
381
381
  #endif
382
382
 
383
- /* 1.2.0: The version of this library. This a string. */
384
- rb_define_const(rb_cIO, "EXTRA_VERSION", rb_str_new2("1.2.0"));
383
+ /* 1.2.1: The version of this library. This a string. */
384
+ rb_define_const(rb_cIO, "EXTRA_VERSION", rb_str_new2("1.2.1"));
385
385
  }
data/io-extra.gemspec CHANGED
@@ -1,42 +1,38 @@
1
1
  require 'rubygems'
2
2
  require 'rbconfig'
3
3
 
4
- spec = Gem::Specification.new do |gem|
5
- if Config::CONFIG['host_os'] =~ /mswin|dos|win32/i
6
- STDERR.puts 'Not supported on this platform. Exiting.'
7
- exit(-1)
8
- end
4
+ Gem::Specification.new do |spec|
5
+ if Config::CONFIG['host_os'] =~ /mswin|dos|win32|cygwin|mingw/i
6
+ STDERR.puts 'Not supported on this platform. Exiting.'
7
+ exit(-1)
8
+ end
9
9
 
10
- gem.name = 'io-extra'
11
- gem.version = '1.2.0'
12
- gem.author = 'Daniel J. Berger'
13
- gem.license = 'Artistic 2.0'
14
- gem.email = 'djberg96@gmail.com'
15
- gem.homepage = 'http://www.rubyforge.org/projects/shards'
16
- gem.platform = Gem::Platform::RUBY
17
- gem.summary = 'Adds extra methods to the IO class.'
18
- gem.test_file = 'test/test_io_extra.rb'
19
- gem.extensions = ['ext/extconf.rb']
20
- gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
10
+ spec.name = 'io-extra'
11
+ spec.version = '1.2.1'
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') }
21
20
 
22
- gem.extra_rdoc_files = [
23
- 'CHANGES',
24
- 'README',
25
- 'MANIFEST',
26
- 'ext/io/extra.c'
27
- ]
21
+ spec.extra_rdoc_files = [
22
+ 'CHANGES',
23
+ 'README',
24
+ 'MANIFEST',
25
+ 'ext/io/extra.c'
26
+ ]
28
27
 
29
- gem.rubyforge_project = 'shards'
30
- gem.required_ruby_version = '>= 1.8.0'
28
+ spec.rubyforge_project = 'shards'
29
+ spec.required_ruby_version = '>= 1.8.6'
31
30
 
32
- gem.add_development_dependency('test-unit', '>= 2.0.3')
31
+ spec.add_development_dependency('test-unit', '>= 2.0.3')
33
32
 
34
- gem.description = <<-EOF
35
- Adds the IO.closefrom, IO.fdwalk, IO.pread, IO.pread_ptr, and IO.pwrite
36
- class methods as well as the IO#directio and IO#directio? instance
37
- methods (for those platforms that support them).
38
- EOF
33
+ spec.description = <<-EOF
34
+ Adds the IO.closefrom, IO.fdwalk, IO.pread, IO.pread_ptr, and IO.pwrite
35
+ class methods as well as the IO#directio and IO#directio? instance
36
+ methods (for those platforms that support them).
37
+ EOF
39
38
  end
40
-
41
- Gem.manage_gems if Gem::RubyGemsVersion.to_f < 1.0
42
- Gem::Builder.new(spec).build
@@ -19,7 +19,7 @@ class TC_IO_Extra < Test::Unit::TestCase
19
19
  end
20
20
 
21
21
  def test_version
22
- assert_equal('1.2.0', IO::EXTRA_VERSION)
22
+ assert_equal('1.2.1', IO::EXTRA_VERSION)
23
23
  end
24
24
 
25
25
  def test_direct_constant
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: io-extra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-07-28 00:00:00 -06:00
12
+ date: 2010-01-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -22,7 +22,7 @@ dependencies:
22
22
  - !ruby/object:Gem::Version
23
23
  version: 2.0.3
24
24
  version:
25
- description: " Adds the IO.closefrom, IO.fdwalk, IO.pread, IO.pread_ptr, and IO.pwrite\n class methods as well as the IO#directio and IO#directio? instance\n methods (for those platforms that support them).\n"
25
+ description: " Adds the IO.closefrom, IO.fdwalk, IO.pread, IO.pread_ptr, and IO.pwrite\n class methods as well as the IO#directio and IO#directio? instance\n methods (for those platforms that support them).\n"
26
26
  email: djberg96@gmail.com
27
27
  executables: []
28
28
 
@@ -34,16 +34,16 @@ extra_rdoc_files:
34
34
  - MANIFEST
35
35
  - ext/io/extra.c
36
36
  files:
37
- - CHANGES
38
- - doc/io_extra.txt
37
+ - MANIFEST
39
38
  - examples/example_io_extra.rb
40
- - ext/extconf.rb
41
- - ext/io/extra.c
39
+ - README
40
+ - CHANGES
42
41
  - io-extra.gemspec
43
- - MANIFEST
44
42
  - Rakefile
45
- - README
46
43
  - test/test_io_extra.rb
44
+ - doc/io_extra.txt
45
+ - ext/io/extra.c
46
+ - ext/extconf.rb
47
47
  has_rdoc: true
48
48
  homepage: http://www.rubyforge.org/projects/shards
49
49
  licenses:
@@ -57,7 +57,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
- version: 1.8.0
60
+ version: 1.8.6
61
61
  version:
62
62
  required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  requirements: