sane 0.23.5 → 0.23.6

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,4 +1,6 @@
1
- # 3: add hash_set_operators
1
+ 0.25.6 add Socket.get_host_ips, remove dependency on andand until I need it again.
2
+
3
+ # 3: add hash_set_operators
2
4
  # 0.2.2: add Regex+Regex, bug fixes
3
5
  # 0.2.0:
4
6
  # add irb simple prompt, auto indent by default [sane defaults!]
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.5
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
@@ -184,5 +184,9 @@ describe Sane do
184
184
  1_000_000.0.comma_format.should == '1,000,000.0'
185
185
  end
186
186
 
187
+ it 'should have socket ips' do
188
+ Socket.get_host_ips.length.should be > 0
189
+ end
190
+
187
191
 
188
192
  end
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
- version: 0.23.5
6
+ segments:
7
+ - 0
8
+ - 23
9
+ - 6
10
+ version: 0.23.6
6
11
  platform: ruby
7
12
  authors:
8
- - Roger Pack
13
+ - Roger Pack
9
14
  autorequire:
10
15
  bindir: bin
11
16
  cert_chain: []
12
17
 
13
- date: 2011-06-11 00:00:00 -06:00
14
- default_executable:
18
+ date: 2011-09-23 00:00:00 Z
15
19
  dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: os
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
25
- type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: andand
29
- prerelease: false
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
- - rogerdpack@gmail.com
36
+ - rogerdpack@gmail.com
41
37
  executables: []
42
38
 
43
39
  extensions: []
44
40
 
45
41
  extra_rdoc_files:
46
- - ChangeLog
47
- - README
48
- - TODO
42
+ - ChangeLog
43
+ - README
44
+ - TODO
49
45
  files:
50
- - ChangeLog
51
- - README
52
- - Rakefile
53
- - VERSION
54
- - lib/_dbg.rb
55
- - lib/sane.rb
56
- - lib/sane/array_ave.rb
57
- - lib/sane/array_blank.rb
58
- - lib/sane/array_contain.rb
59
- - lib/sane/array_select_bang.rb
60
- - lib/sane/assert.rb
61
- - lib/sane/bugs.rb
62
- - lib/sane/contain.rb
63
- - lib/sane/file.rb
64
- - lib/sane/file_filename.rb
65
- - lib/sane/file_home.rb
66
- - lib/sane/float.rb
67
- - lib/sane/hash_hashes.rb
68
- - lib/sane/hash_minus_hash.rb
69
- - lib/sane/irb_startup_options.rb
70
- - lib/sane/map_by.rb
71
- - lib/sane/pp.rb
72
- - lib/sane/pps.rb
73
- - lib/sane/require_relative.rb
74
- - lib/sane/sane_random.rb
75
- - lib/sane/string_blank.rb
76
- - lib/sane/test.rb
77
- - lib/sane/test/assertions.rb
78
- - lib/sane/thread.rb
79
- - spec/files/pp_after.rb
80
- - spec/files/pp_before_hand.rb
81
- - spec/files/test.rb
82
- - spec/go2.rb
83
- - spec/req_rel_bug/recreate.rb
84
- - spec/spec.sane.rb
85
- - spec/subdir/go.rb
86
- - spec/subdir2/require_relative2.rb
87
- - todo
88
- - TODO
89
- has_rdoc: true
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
- - lib
93
+ - lib
98
94
  required_ruby_version: !ruby/object:Gem::Requirement
99
95
  none: false
100
96
  requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: "0"
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
- - !ruby/object:Gem::Version
109
- version: "0"
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.5.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