system-getifaddrs 0.1.1 → 0.1.2
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.
- data/Gemfile +4 -0
- data/Gemfile.lock +21 -0
- data/README.markdown +46 -0
- data/Rakefile +5 -45
- data/lib/system/getifaddrs/version.rb +5 -0
- data/lib/system/getifaddrs.rb +1 -1
- data/system-getifaddrs.gemspec +14 -58
- metadata +48 -88
- data/README.rdoc +0 -39
- data/TODO +0 -0
- data/VERSION +0 -1
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
system-getifaddrs (0.1.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (0.9.2)
|
10
|
+
rake-compiler (0.7.9)
|
11
|
+
rake
|
12
|
+
rspec (1.3.2)
|
13
|
+
|
14
|
+
PLATFORMS
|
15
|
+
ruby
|
16
|
+
|
17
|
+
DEPENDENCIES
|
18
|
+
rake
|
19
|
+
rake-compiler
|
20
|
+
rspec (~> 1.3)
|
21
|
+
system-getifaddrs!
|
data/README.markdown
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# system-ifaddrs 
|
2
|
+
|
3
|
+
This lib is a wrapper for get\_ifaddrs C routine.
|
4
|
+
|
5
|
+
The original routine returns a linked list that contains avaliable inet interfaces.
|
6
|
+
This lib walks on list and return an hash that contains the interface names and sub-hashes with respectives ip addresses and netmasks.
|
7
|
+
|
8
|
+
## Example
|
9
|
+
|
10
|
+
Supose that /sbin/ifconfig returns:
|
11
|
+
|
12
|
+
```bash
|
13
|
+
lo Link encap:Local Loopback
|
14
|
+
inet addr:127.0.0.1 Mask:255.0.0.0
|
15
|
+
inet6 addr: ::1/128 Scope:Host
|
16
|
+
UP LOOPBACK RUNNING MTU:16436 Metric:1
|
17
|
+
RX packets:86688 errors:0 dropped:0 overruns:0 frame:0
|
18
|
+
TX packets:86688 errors:0 dropped:0 overruns:0 carrier:0
|
19
|
+
collisions:0 txqueuelen:0
|
20
|
+
RX bytes:10903658 (10.3 MiB) TX bytes:10903658 (10.3 MiB)
|
21
|
+
```
|
22
|
+
|
23
|
+
Consider test.rb below:
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
# test.rb
|
27
|
+
require "pp"
|
28
|
+
require "system/getifaddrs"
|
29
|
+
pp System.get_ifaddrs
|
30
|
+
```
|
31
|
+
|
32
|
+
When test.rb is executed:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
$ ruby test.rb
|
36
|
+
```
|
37
|
+
|
38
|
+
Should return:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
{:lo=>{:inet_addr=>"127.0.0.1", :netmask=>"255.0.0.0"}}
|
42
|
+
```
|
43
|
+
|
44
|
+
## Copyright
|
45
|
+
|
46
|
+
Copyright (c) 2010 Bruno Coimbra. See LICENSE for details.
|
data/Rakefile
CHANGED
@@ -1,50 +1,10 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'jeweler'
|
6
|
-
Jeweler::Tasks.new do |gem|
|
7
|
-
gem.name = "system-getifaddrs"
|
8
|
-
gem.summary = %Q{This lib is a wrapper for get_ifaddrs C routine}
|
9
|
-
gem.description = %Q{This lib is a wrapper for get_ifaddrs C routine. The original routine returns a linked list that contains avaliable inet interfaces. This lib walks on list and return an hash that contains the interface names and sub-hashes with respectives ip addresses and netmasks.}
|
10
|
-
gem.email = "bbcoimbra@gmail.com"
|
11
|
-
gem.homepage = "http://github.com/bbcoimbra/system-getifaddrs"
|
12
|
-
gem.authors = ["Bruno Coimbra"]
|
13
|
-
gem.add_development_dependency "jeweler"
|
14
|
-
gem.add_development_dependency "rspec"
|
15
|
-
gem.add_development_dependency "rake-compiler"
|
16
|
-
gem.extensions << 'ext/rb_getifaddrs/extconf.rb'
|
17
|
-
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
18
|
-
end
|
19
|
-
rescue LoadError
|
20
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
21
|
-
end
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
22
3
|
|
23
4
|
require 'spec/rake/spectask'
|
24
|
-
Spec::Rake::SpecTask.new
|
25
|
-
spec.libs << 'lib' << 'spec'
|
26
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
27
|
-
end
|
28
|
-
|
29
|
-
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
30
|
-
spec.libs << 'lib' << 'spec'
|
31
|
-
spec.pattern = 'spec/**/*_spec.rb'
|
32
|
-
spec.rcov = true
|
33
|
-
end
|
34
|
-
|
35
|
-
require 'rake/rdoctask'
|
36
|
-
Rake::RDocTask.new do |rdoc|
|
37
|
-
if File.exist?('VERSION')
|
38
|
-
version = File.read('VERSION')
|
39
|
-
else
|
40
|
-
version = ""
|
41
|
-
end
|
42
|
-
|
43
|
-
rdoc.rdoc_dir = 'rdoc'
|
44
|
-
rdoc.title = "system-ifaddrs #{version}"
|
45
|
-
rdoc.rdoc_files.include('README*')
|
46
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
-
end
|
5
|
+
Spec::Rake::SpecTask.new
|
48
6
|
|
49
7
|
require 'rake/extensiontask'
|
50
8
|
Rake::ExtensionTask.new('rb_getifaddrs')
|
9
|
+
|
10
|
+
task :default => [:compile, :spec]
|
data/lib/system/getifaddrs.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), 'rb_getifaddrs')
|
1
|
+
require File.join(File.dirname(__FILE__), '..', 'rb_getifaddrs')
|
data/system-getifaddrs.gemspec
CHANGED
@@ -1,66 +1,22 @@
|
|
1
|
-
#
|
2
|
-
|
3
|
-
|
4
|
-
# -*- encoding: utf-8 -*-
|
1
|
+
# -*- encodign: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "system/getifaddrs/version"
|
5
4
|
|
6
5
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version =
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
6
|
+
s.name = "system-getifaddrs"
|
7
|
+
s.version = System::Getifaddrs::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
11
9
|
s.authors = ["Bruno Coimbra"]
|
12
|
-
s.date = %q{2010-09-14}
|
13
|
-
s.description = %q{This lib is a wrapper for get_ifaddrs C routine. The original routine returns a linked list that contains avaliable inet interfaces. This lib walks on list and return an hash that contains the interface names and sub-hashes with respectives ip addresses and netmasks.}
|
14
10
|
s.email = %q{bbcoimbra@gmail.com}
|
15
|
-
s.extensions = ["ext/rb_getifaddrs/extconf.rb", "ext/rb_getifaddrs/extconf.rb"]
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"LICENSE",
|
18
|
-
"README.rdoc",
|
19
|
-
"TODO"
|
20
|
-
]
|
21
|
-
s.files = [
|
22
|
-
".document",
|
23
|
-
".gitignore",
|
24
|
-
"LICENSE",
|
25
|
-
"README.rdoc",
|
26
|
-
"Rakefile",
|
27
|
-
"TODO",
|
28
|
-
"VERSION",
|
29
|
-
"ext/rb_getifaddrs/extconf.rb",
|
30
|
-
"ext/rb_getifaddrs/rb_getifaddrs.c",
|
31
|
-
"lib/system/.gitignore",
|
32
|
-
"lib/system/getifaddrs.rb",
|
33
|
-
"spec/spec_helper.rb",
|
34
|
-
"spec/system-ifaddrs_spec.rb",
|
35
|
-
"system-getifaddrs.gemspec"
|
36
|
-
]
|
37
11
|
s.homepage = %q{http://github.com/bbcoimbra/system-getifaddrs}
|
38
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
39
|
-
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.7}
|
41
12
|
s.summary = %q{This lib is a wrapper for get_ifaddrs C routine}
|
42
|
-
s.
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
53
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
54
|
-
s.add_development_dependency(%q<rake-compiler>, [">= 0"])
|
55
|
-
else
|
56
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
57
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
58
|
-
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
59
|
-
end
|
60
|
-
else
|
61
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
62
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
63
|
-
s.add_dependency(%q<rake-compiler>, [">= 0"])
|
64
|
-
end
|
13
|
+
s.description = %q{This lib is a wrapper for get_ifaddrs C routine. The original routine returns a linked list that contains avaliable inet interfaces. This lib walks on list and return an hash that contains the interface names and sub-hashes with respectives ip addresses and netmasks.}
|
14
|
+
s.add_development_dependency(%q<rspec>, "~> 1.3")
|
15
|
+
s.add_development_dependency(%q<rake-compiler>, [">= 0"])
|
16
|
+
s.extensions = `git ls-files -- ext/*`.split("\n").select{|f| f =~ /extconf/}
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
65
21
|
end
|
66
22
|
|
metadata
CHANGED
@@ -1,125 +1,85 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: system-getifaddrs
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 1
|
10
|
-
version: 0.1.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.2
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Bruno Coimbra
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
22
|
-
name: jeweler
|
23
|
-
prerelease: false
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ">="
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 3
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
version: "0"
|
33
|
-
type: :development
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2011-10-16 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
36
15
|
name: rspec
|
37
|
-
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
16
|
+
requirement: &72689390 !ruby/object:Gem::Requirement
|
39
17
|
none: false
|
40
|
-
requirements:
|
41
|
-
- -
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
segments:
|
45
|
-
- 0
|
46
|
-
version: "0"
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
47
22
|
type: :development
|
48
|
-
version_requirements: *id002
|
49
|
-
- !ruby/object:Gem::Dependency
|
50
|
-
name: rake-compiler
|
51
23
|
prerelease: false
|
52
|
-
|
24
|
+
version_requirements: *72689390
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rake-compiler
|
27
|
+
requirement: &72689130 !ruby/object:Gem::Requirement
|
53
28
|
none: false
|
54
|
-
requirements:
|
55
|
-
- -
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
version: "0"
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
61
33
|
type: :development
|
62
|
-
|
63
|
-
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *72689130
|
36
|
+
description: This lib is a wrapper for get_ifaddrs C routine. The original routine
|
37
|
+
returns a linked list that contains avaliable inet interfaces. This lib walks on
|
38
|
+
list and return an hash that contains the interface names and sub-hashes with respectives
|
39
|
+
ip addresses and netmasks.
|
64
40
|
email: bbcoimbra@gmail.com
|
65
41
|
executables: []
|
66
|
-
|
67
|
-
extensions:
|
68
|
-
- ext/rb_getifaddrs/extconf.rb
|
42
|
+
extensions:
|
69
43
|
- ext/rb_getifaddrs/extconf.rb
|
70
|
-
extra_rdoc_files:
|
71
|
-
|
72
|
-
- README.rdoc
|
73
|
-
- TODO
|
74
|
-
files:
|
44
|
+
extra_rdoc_files: []
|
45
|
+
files:
|
75
46
|
- .document
|
76
47
|
- .gitignore
|
48
|
+
- Gemfile
|
49
|
+
- Gemfile.lock
|
77
50
|
- LICENSE
|
78
|
-
- README.
|
51
|
+
- README.markdown
|
79
52
|
- Rakefile
|
80
|
-
- TODO
|
81
|
-
- VERSION
|
82
53
|
- ext/rb_getifaddrs/extconf.rb
|
83
54
|
- ext/rb_getifaddrs/rb_getifaddrs.c
|
84
55
|
- lib/system/.gitignore
|
85
56
|
- lib/system/getifaddrs.rb
|
57
|
+
- lib/system/getifaddrs/version.rb
|
86
58
|
- spec/spec_helper.rb
|
87
59
|
- spec/system-ifaddrs_spec.rb
|
88
60
|
- system-getifaddrs.gemspec
|
89
|
-
has_rdoc: true
|
90
61
|
homepage: http://github.com/bbcoimbra/system-getifaddrs
|
91
62
|
licenses: []
|
92
|
-
|
93
63
|
post_install_message:
|
94
|
-
rdoc_options:
|
95
|
-
|
96
|
-
require_paths:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
97
66
|
- lib
|
98
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
99
68
|
none: false
|
100
|
-
requirements:
|
101
|
-
- -
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
|
104
|
-
|
105
|
-
- 0
|
106
|
-
version: "0"
|
107
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
74
|
none: false
|
109
|
-
requirements:
|
110
|
-
- -
|
111
|
-
- !ruby/object:Gem::Version
|
112
|
-
|
113
|
-
segments:
|
114
|
-
- 0
|
115
|
-
version: "0"
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
116
79
|
requirements: []
|
117
|
-
|
118
80
|
rubyforge_project:
|
119
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.8.10
|
120
82
|
signing_key:
|
121
83
|
specification_version: 3
|
122
84
|
summary: This lib is a wrapper for get_ifaddrs C routine
|
123
|
-
test_files:
|
124
|
-
- spec/system-ifaddrs_spec.rb
|
125
|
-
- spec/spec_helper.rb
|
85
|
+
test_files: []
|
data/README.rdoc
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
= system-ifaddrs
|
2
|
-
|
3
|
-
This lib is a wrapper for get_ifaddrs C routine.
|
4
|
-
|
5
|
-
The original routine returns a linked list that contains avaliable inet interfaces.
|
6
|
-
This lib walks on list and return an hash that contains the interface names and sub-hashes with respectives ip addresses and netmasks.
|
7
|
-
|
8
|
-
== Example
|
9
|
-
|
10
|
-
Supose that /sbin/ifconfig returns:
|
11
|
-
|
12
|
-
lo Link encap:Local Loopback
|
13
|
-
inet addr:127.0.0.1 Mask:255.0.0.0
|
14
|
-
inet6 addr: ::1/128 Scope:Host
|
15
|
-
UP LOOPBACK RUNNING MTU:16436 Metric:1
|
16
|
-
RX packets:86688 errors:0 dropped:0 overruns:0 frame:0
|
17
|
-
TX packets:86688 errors:0 dropped:0 overruns:0 carrier:0
|
18
|
-
collisions:0 txqueuelen:0
|
19
|
-
RX bytes:10903658 (10.3 MiB) TX bytes:10903658 (10.3 MiB)
|
20
|
-
|
21
|
-
Consider test.rb below:
|
22
|
-
|
23
|
-
# test.rb
|
24
|
-
require "pp"
|
25
|
-
require "system/getifaddrs"
|
26
|
-
pp System.get_ifaddrs
|
27
|
-
|
28
|
-
When test.rb is executed:
|
29
|
-
|
30
|
-
$ ruby test.rb
|
31
|
-
|
32
|
-
Should return:
|
33
|
-
|
34
|
-
{:lo=>{:inet_addr=>"127.0.0.1", :netmask=>"255.0.0.0"}}
|
35
|
-
|
36
|
-
|
37
|
-
== Copyright
|
38
|
-
|
39
|
-
Copyright (c) 2010 Bruno Coimbra. See LICENSE for details.
|
data/TODO
DELETED
File without changes
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.1
|