pbind 0.5.0 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pbind/command/serv.rb +18 -16
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 188a8efa18d88d36de925fe34667cd6274a872b0
|
4
|
+
data.tar.gz: c389977bfa6c78eb268743e545d5bf816d5f799b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 288d8e612006eb685cd64803fbe732899480d983b5742e4df4bad4c32d4b654c53b3c225e2d266e24e6bb433bf3a284c89a68bf431303829de125673cdfc664c
|
7
|
+
data.tar.gz: e9a1c3c49dd2f403bbc8363c1928ca75ba857c09a0837e3edf0736d80430d11ec05ac9c0122b1efe42944b2f66a64053fe628cfc646d31f133c45c106e0f9115
|
data/lib/pbind/command/serv.rb
CHANGED
@@ -62,34 +62,36 @@ module Pbind
|
|
62
62
|
|
63
63
|
addr = server.addr
|
64
64
|
addr.shift
|
65
|
-
puts "server is on #{
|
65
|
+
puts "#{'Pbind server is on'.bold} #{local_ip.underline}"
|
66
66
|
|
67
67
|
loop do
|
68
68
|
Thread.start(server.accept) do |client|
|
69
69
|
@clients.push client
|
70
70
|
loop do
|
71
|
-
|
72
|
-
if
|
73
|
-
|
71
|
+
req = client.readpartial(1024)
|
72
|
+
if req != nil
|
73
|
+
handle_request(client, req)
|
74
74
|
end
|
75
75
|
end
|
76
76
|
client.close
|
77
77
|
end
|
78
78
|
end
|
79
|
+
end
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
# puts "send #{line}"
|
88
|
-
# send_json(client, line)
|
89
|
-
# end
|
81
|
+
def handle_request(client, req)
|
82
|
+
if req.start_with?('[C]')
|
83
|
+
puts "client #{req[3..-1].green} connected"
|
84
|
+
elsif req.end_with?('.json')
|
85
|
+
send_json([client], req)
|
86
|
+
end
|
87
|
+
end
|
90
88
|
|
91
|
-
|
92
|
-
|
89
|
+
def local_ip
|
90
|
+
addr_infos = Socket.ip_address_list
|
91
|
+
local_addr_info = addr_infos.select { |info|
|
92
|
+
info.ipv4? and info.ip_address != '127.0.0.1'
|
93
|
+
}
|
94
|
+
local_addr_info[0].ip_address
|
93
95
|
end
|
94
96
|
|
95
97
|
def listen_file_changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pbind
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Galen Lin
|
@@ -113,8 +113,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
115
|
rubyforge_project:
|
116
|
-
rubygems_version: 2.6.
|
116
|
+
rubygems_version: 2.6.6
|
117
117
|
signing_key:
|
118
118
|
specification_version: 4
|
119
119
|
summary: Pbind xcodeproj helper
|
120
120
|
test_files: []
|
121
|
+
has_rdoc:
|