net-proto 1.0.4-x86-mswin32-60 → 1.0.5-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,3 +1,10 @@
1
+ == 1.0.5 - ???
2
+ * Changed license to Artistic 2.0.
3
+ * Added a build_binary_gem task.
4
+ * Cleaned up and refactored the gemspec a bit, including the addition of
5
+ a license and an updated description.
6
+ * Switched test-unit from a runtime dependency to a dev dependency.
7
+
1
8
  == 1.0.4 - 6-Jan-2008
2
9
  * The struct returned by Net::Proto.getprotoent is now frozen. This is
3
10
  strictly read-only data.
data/MANIFEST CHANGED
@@ -4,7 +4,7 @@
4
4
  * Rakefile
5
5
  * net-proto.gemspec
6
6
  * doc/netproto.txt
7
- * examples/test_proto.rb
7
+ * examples/example_net_proto.rb
8
8
  * ext/version.h
9
9
  * ext/generic/generic.c
10
10
  * ext/linux/linux.c
data/Rakefile ADDED
@@ -0,0 +1,79 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/testtask'
4
+ require 'rbconfig'
5
+ include Config
6
+
7
+ desc 'Clean the build files for the net-proto source'
8
+ task :clean do
9
+ make = RUBY_PLATFORM.match('mswin') ? 'nmake' : 'make'
10
+ Dir.chdir('ext') do
11
+ proto_file = 'proto.' + Config::CONFIG['DLEXT']
12
+ if File.exists?('proto.o') || File.exists?(proto_file)
13
+ sh "#{make} distclean"
14
+ end
15
+ FileUtils.rm_rf('proto.c') if File.exists?('proto.c')
16
+ FileUtils.rm_rf('net') if File.exists?('net')
17
+ end
18
+ FileUtils.rm_rf('net') if File.exists?('net')
19
+ end
20
+
21
+ desc 'Build the net-proto library'
22
+ task :build => [:clean] do
23
+ make = RUBY_PLATFORM.match('mswin') ? 'nmake' : 'make'
24
+ Dir.chdir('ext') do
25
+ ruby 'extconf.rb'
26
+ sh make
27
+ build_file = 'proto.' + Config::CONFIG['DLEXT']
28
+ Dir.mkdir('net') unless File.exists?('net')
29
+ FileUtils.cp(build_file, 'net')
30
+ end
31
+ end
32
+
33
+ desc 'Install the net-proto library (non-gem)'
34
+ task :install => [:build] do
35
+ Dir.chdir('ext') do
36
+ sh 'make install'
37
+ end
38
+ end
39
+
40
+ desc 'Install the net-proto library (gem)'
41
+ task :install_gem do
42
+ ruby 'net-proto.gemspec'
43
+ file = Dir["net-proto*.gem"].last
44
+ sh "gem install #{file}"
45
+ end
46
+
47
+ desc 'Run the example net-proto program'
48
+ task :example => [:build] do
49
+ Dir.mkdir('net') unless File.exists?('net')
50
+ ruby '-Iext examples/example_net_proto.rb'
51
+ end
52
+
53
+ Rake::TestTask.new do |t|
54
+ task :test => :build
55
+ t.libs << 'ext'
56
+ t.warning = true
57
+ t.verbose = true
58
+ end
59
+
60
+ desc 'Build a standard gem'
61
+ task :build_gem => :clean do
62
+ rm_rf('lib') if File.exists?('lib')
63
+ spec = eval(IO.read('net-proto.gemspec'))
64
+ Gem::Builder.new(spec).build
65
+ end
66
+
67
+ desc 'Build a binary gem'
68
+ task :build_binary_gem => [:build] do
69
+ file = 'ext/net/proto.' + CONFIG['DLEXT']
70
+ mkdir_p('lib/net')
71
+ mv(file, 'lib/net')
72
+
73
+ spec = eval(IO.read('net-proto.gemspec'))
74
+ spec.extensions = nil
75
+ spec.files = spec.files.reject{ |f| f.include?('ext/') }
76
+ spec.platform = Gem::Platform::CURRENT
77
+
78
+ Gem::Builder.new(spec).build
79
+ end
@@ -0,0 +1,26 @@
1
+ #########################################################################
2
+ # example_net_proto.rb
3
+ #
4
+ # A generic test program for general futzing. You cna run this example
5
+ # code via the 'rake example' task.
6
+ #########################################################################
7
+ require 'net/proto''
8
+ include Net
9
+
10
+ puts "VERSION: " + Proto::VERSION
11
+
12
+ puts "UDP port: " + Proto.getprotobyname("udp").to_s
13
+ puts "Port 1: " + Proto.getprotobynumber(1).to_s
14
+
15
+ unless File::ALT_SEPARATOR
16
+ puts "Name\t\tProto\tAliases"
17
+ puts "=========================="
18
+
19
+ Proto.getprotoent.each{ |s|
20
+ if s.name.length > 7
21
+ puts s.name + "\t" + s.proto.to_s + "\t" + s.aliases.join(", ")
22
+ else
23
+ puts s.name + "\t\t" + s.proto.to_s + "\t" + s.aliases.join(", ")
24
+ end
25
+ }
26
+ end
data/lib/net/proto.so CHANGED
Binary file
data/net-proto.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ require 'rubygems'
2
+
3
+ # To build a regular gem => rake build_gem
4
+ # To build a binary gem => rake build_binary_gem
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = 'net-proto'
8
+ gem.version = '1.0.5'
9
+ gem.author = 'Daniel J. Berger'
10
+ gem.license = 'Artistic 2.0'
11
+ gem.email = 'djberg96@gmail.com'
12
+ gem.homepage = 'http://www.rubyforge.org/projects/sysutils'
13
+ gem.platform = Gem::Platform::RUBY
14
+ gem.summary = 'A Ruby interface for determining protocol information'
15
+ gem.test_file = 'test/test_net_proto.rb'
16
+ gem.has_rdoc = true
17
+ gem.extensions = ['ext/extconf.rb']
18
+ gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
19
+
20
+ gem.rubyforge_project = 'sysutils'
21
+ gem.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST', 'doc/netproto.txt']
22
+
23
+ gem.add_development_dependency('test-unit', '>= 2.0.3')
24
+
25
+ gem.description = <<-EOF
26
+ The net-proto library provides an interface for get protocol information
27
+ by name or by number. It can also iterate over the list of protocol
28
+ entries defined on your system.
29
+ EOF
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: net-proto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: x86-mswin32-60
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -9,20 +9,20 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-01-07 00:00:00 -07:00
12
+ date: 2009-09-12 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: test-unit
17
- type: :runtime
17
+ type: :development
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
21
  - - ">="
22
22
  - !ruby/object:Gem::Version
23
- version: 2.0.2
23
+ version: 2.0.3
24
24
  version:
25
- description: The net-proto package provides the getprotobyname(), getprotobynumber() and the getprotoent() methods for Ruby.
25
+ description: " The net-proto library provides an interface for get protocol information\n by name or by number. It can also iterate over the list of protocol\n entries defined on your system.\n"
26
26
  email: djberg96@gmail.com
27
27
  executables: []
28
28
 
@@ -33,17 +33,20 @@ extra_rdoc_files:
33
33
  - README
34
34
  - MANIFEST
35
35
  - doc/netproto.txt
36
- - ext/windows/windows.c
37
36
  files:
37
+ - CHANGES
38
38
  - doc/netproto.txt
39
- - test/test_net_proto.rb
39
+ - examples/example_net_proto.rb
40
40
  - lib/net/proto.so
41
- - CHANGES
42
- - README
43
41
  - MANIFEST
44
- - ext/windows/windows.c
42
+ - net-proto.gemspec
43
+ - Rakefile
44
+ - README
45
+ - test/test_net_proto.rb
45
46
  has_rdoc: true
46
47
  homepage: http://www.rubyforge.org/projects/sysutils
48
+ licenses:
49
+ - Artistic 2.0
47
50
  post_install_message:
48
51
  rdoc_options: []
49
52
 
@@ -53,7 +56,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
53
56
  requirements:
54
57
  - - ">="
55
58
  - !ruby/object:Gem::Version
56
- version: 1.8.0
59
+ version: "0"
57
60
  version:
58
61
  required_rubygems_version: !ruby/object:Gem::Requirement
59
62
  requirements:
@@ -64,9 +67,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
67
  requirements: []
65
68
 
66
69
  rubyforge_project: sysutils
67
- rubygems_version: 1.3.1
70
+ rubygems_version: 1.3.5
68
71
  signing_key:
69
- specification_version: 2
70
- summary: The net-proto package provides the getprotobyname(), getprotobynumber() and the getprotoent() methods for Ruby.
72
+ specification_version: 3
73
+ summary: A Ruby interface for determining protocol information
71
74
  test_files:
72
75
  - test/test_net_proto.rb
@@ -1,86 +0,0 @@
1
- /***********************
2
- * proto.c (windows.c)
3
- ***********************/
4
- #include <ruby.h>
5
- #include <version.h>
6
- #include <windows.h>
7
-
8
- #ifdef __cplusplus
9
- extern "C"
10
- {
11
- #endif
12
-
13
- /*
14
- * call-seq:
15
- * Proto.getprotobyname(name)
16
- *
17
- * Given a protocol string, returns the corresponding number, or nil if not
18
- * found.
19
- *
20
- * Examples:
21
- *
22
- * Net::Proto.getprotobyname("tcp") # => 6
23
- * Net::Proto.getprotobyname("bogus") # => nil
24
- */
25
- static VALUE np_getprotobyname(VALUE klass, VALUE rbProtoName){
26
- struct protoent* p;
27
- VALUE v_proto_num = Qnil;
28
-
29
- SafeStringValue(rbProtoName);
30
- p = getprotobyname(StringValuePtr(rbProtoName));
31
-
32
- if(p)
33
- v_proto_num = INT2FIX(p->p_proto);
34
-
35
- return v_proto_num;
36
- }
37
-
38
- /*
39
- * call-seq:
40
- * Proto.getprotobynumber(num)
41
- *
42
- * Given a protocol number, returns the corresponding string, or nil if not
43
- * found.
44
- *
45
- * Examples:
46
- *
47
- * Net::Proto.getprotobynumber(6) # => "tcp"
48
- * Net::Proto.getprotobynumber(999) # => nil
49
- */
50
- static VALUE np_getprotobynumber(VALUE klass, VALUE v_proto_num)
51
- {
52
- struct protoent* p;
53
- VALUE v_proto_name = Qnil;
54
-
55
- p = getprotobynumber(NUM2INT(v_proto_num));
56
-
57
- if(p)
58
- v_proto_name = rb_str_new2(p->p_name);
59
-
60
- return v_proto_name;
61
- }
62
-
63
- void Init_proto()
64
- {
65
- VALUE mNet, cProto;
66
-
67
- /* The Net module serves only as a namespace */
68
- mNet = rb_define_module("Net");
69
-
70
- /* The Proto class encapsulates network protocol information */
71
- cProto = rb_define_class_under(mNet, "Proto", rb_cObject);
72
-
73
- /* Class Methods */
74
- rb_define_singleton_method(cProto,"getprotobyname",np_getprotobyname,1);
75
- rb_define_singleton_method(cProto,"getprotobynumber",np_getprotobynumber,1);
76
-
77
- /* There is no constructor */
78
- rb_funcall(cProto, rb_intern("private_class_method"), 1, ID2SYM(rb_intern("new")));
79
-
80
- /* 1.0.4: The version of this library. This is a string, not a number */
81
- rb_define_const(cProto, "VERSION", rb_str_new2(NET_PROTO_VERSION));
82
- }
83
-
84
- #ifdef __cplusplus
85
- }
86
- #endif