sane 0.23.5 → 0.23.6
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/ChangeLog +3 -1
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/sane/socket_ips.rb +34 -0
- data/spec/spec.sane.rb +4 -0
- metadata +80 -78
data/ChangeLog
CHANGED
data/Rakefile
CHANGED
@@ -7,5 +7,5 @@ Jeweler::Tasks.new do |s|
|
|
7
7
|
s.description = s.summary = %q{Helpers for ruby core to make it easier to work with--things that are missing from core but should arguably be there}
|
8
8
|
s.email = ["rogerdpack@gmail.com"]
|
9
9
|
s.add_dependency 'os'
|
10
|
-
s.add_dependency 'andand' # turns out to be pretty useful...
|
10
|
+
#s.add_dependency 'andand' # turns out to be pretty useful...
|
11
11
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.23.
|
1
|
+
0.23.6
|
@@ -0,0 +1,34 @@
|
|
1
|
+
class Numeric
|
2
|
+
def ord; self; end unless RUBY_VERSION[0..2] == '1.9' # helper for 1.8/1.9
|
3
|
+
end
|
4
|
+
|
5
|
+
require 'socket' # sane already loads it for BasicSocket.reverse_lookup
|
6
|
+
|
7
|
+
class Socket
|
8
|
+
class << self
|
9
|
+
def get_host_ips
|
10
|
+
get_ips(Socket.gethostname)
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_ips hostname
|
14
|
+
begin
|
15
|
+
|
16
|
+
socket_info = Socket.getaddrinfo(hostname, nil,
|
17
|
+
Socket::AF_UNSPEC, Socket::SOCK_STREAM, nil,
|
18
|
+
Socket::AI_CANONNAME).select{|type| type[0] == 'AF_INET'}
|
19
|
+
|
20
|
+
raise if socket_info.length == 0
|
21
|
+
ips = socket_info.map{|info| info[3]}
|
22
|
+
return ips
|
23
|
+
rescue => e # getaddrinfo failed...
|
24
|
+
begin
|
25
|
+
ipInt = gethostbyname(hostname)[3] # do a DNS lookup
|
26
|
+
return ["%d.%d.%d.%d" % [ipInt[0].ord, ipInt[1].ord, ipInt[2].ord, ipInt[3].ord]]
|
27
|
+
rescue SocketError # happens in certain instances...
|
28
|
+
return nil
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
data/spec/spec.sane.rb
CHANGED
metadata
CHANGED
@@ -1,92 +1,88 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sane
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 79
|
4
5
|
prerelease:
|
5
|
-
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 23
|
9
|
+
- 6
|
10
|
+
version: 0.23.6
|
6
11
|
platform: ruby
|
7
12
|
authors:
|
8
|
-
|
13
|
+
- Roger Pack
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
17
|
|
13
|
-
date: 2011-
|
14
|
-
default_executable:
|
18
|
+
date: 2011-09-23 00:00:00 Z
|
15
19
|
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
31
|
-
none: false
|
32
|
-
requirements:
|
33
|
-
- - ">="
|
34
|
-
- !ruby/object:Gem::Version
|
35
|
-
version: "0"
|
36
|
-
type: :runtime
|
37
|
-
version_requirements: *id002
|
20
|
+
- !ruby/object:Gem::Dependency
|
21
|
+
name: os
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
version: "0"
|
32
|
+
type: :runtime
|
33
|
+
version_requirements: *id001
|
38
34
|
description: Helpers for ruby core to make it easier to work with--things that are missing from core but should arguably be there
|
39
35
|
email:
|
40
|
-
|
36
|
+
- rogerdpack@gmail.com
|
41
37
|
executables: []
|
42
38
|
|
43
39
|
extensions: []
|
44
40
|
|
45
41
|
extra_rdoc_files:
|
46
|
-
|
47
|
-
|
48
|
-
|
42
|
+
- ChangeLog
|
43
|
+
- README
|
44
|
+
- TODO
|
49
45
|
files:
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
46
|
+
- ChangeLog
|
47
|
+
- README
|
48
|
+
- Rakefile
|
49
|
+
- VERSION
|
50
|
+
- lib/_dbg.rb
|
51
|
+
- lib/sane.rb
|
52
|
+
- lib/sane/array_ave.rb
|
53
|
+
- lib/sane/array_blank.rb
|
54
|
+
- lib/sane/array_contain.rb
|
55
|
+
- lib/sane/array_select_bang.rb
|
56
|
+
- lib/sane/assert.rb
|
57
|
+
- lib/sane/bugs.rb
|
58
|
+
- lib/sane/contain.rb
|
59
|
+
- lib/sane/file.rb
|
60
|
+
- lib/sane/file_filename.rb
|
61
|
+
- lib/sane/file_home.rb
|
62
|
+
- lib/sane/float.rb
|
63
|
+
- lib/sane/hash_hashes.rb
|
64
|
+
- lib/sane/hash_minus_hash.rb
|
65
|
+
- lib/sane/irb_startup_options.rb
|
66
|
+
- lib/sane/map_by.rb
|
67
|
+
- lib/sane/pp.rb
|
68
|
+
- lib/sane/pps.rb
|
69
|
+
- lib/sane/require_relative.rb
|
70
|
+
- lib/sane/sane_random.rb
|
71
|
+
- lib/sane/socket_ips.rb
|
72
|
+
- lib/sane/string_blank.rb
|
73
|
+
- lib/sane/test.rb
|
74
|
+
- lib/sane/test/assertions.rb
|
75
|
+
- lib/sane/thread.rb
|
76
|
+
- spec/files/pp_after.rb
|
77
|
+
- spec/files/pp_before_hand.rb
|
78
|
+
- spec/files/test.rb
|
79
|
+
- spec/go2.rb
|
80
|
+
- spec/req_rel_bug/recreate.rb
|
81
|
+
- spec/spec.sane.rb
|
82
|
+
- spec/subdir/go.rb
|
83
|
+
- spec/subdir2/require_relative2.rb
|
84
|
+
- todo
|
85
|
+
- TODO
|
90
86
|
homepage: http://github.com/rogerdpack/sane_ruby
|
91
87
|
licenses: []
|
92
88
|
|
@@ -94,23 +90,29 @@ post_install_message:
|
|
94
90
|
rdoc_options: []
|
95
91
|
|
96
92
|
require_paths:
|
97
|
-
|
93
|
+
- lib
|
98
94
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
95
|
none: false
|
100
96
|
requirements:
|
101
|
-
|
102
|
-
|
103
|
-
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
hash: 3
|
100
|
+
segments:
|
101
|
+
- 0
|
102
|
+
version: "0"
|
104
103
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
104
|
none: false
|
106
105
|
requirements:
|
107
|
-
|
108
|
-
|
109
|
-
|
106
|
+
- - ">="
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
hash: 3
|
109
|
+
segments:
|
110
|
+
- 0
|
111
|
+
version: "0"
|
110
112
|
requirements: []
|
111
113
|
|
112
114
|
rubyforge_project:
|
113
|
-
rubygems_version: 1.
|
115
|
+
rubygems_version: 1.7.2
|
114
116
|
signing_key:
|
115
117
|
specification_version: 3
|
116
118
|
summary: Helpers for ruby core to make it easier to work with--things that are missing from core but should arguably be there
|