pindo 5.1.0 → 5.1.1
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.
- checksums.yaml +4 -4
- data/lib/pindo/command/web/run.rb +18 -2
- data/lib/pindo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '05592fa0b0cb7bf97bec159a83fd562ab7fd0cbd08305e4f1a71cd827612bf01'
|
4
|
+
data.tar.gz: 717a3c0b905d7482974d04c4e901ec8f3fefe08a95dc1128af5263747a2435bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b7772dd3ad4793df33b3ff90d20847b2676ab0c6b6583d0fa176eb43c010e4bde2e6e2755d1009a4b3bd92c14ab34b8690f97074b9ba7f3042d059abba27dfb
|
7
|
+
data.tar.gz: bbe8a06d9b55eaf57d247a83a8976b46ce2922ec8f4a1538ee2e889d09ce4638a9216d70eca2b7a3eb1fb3ec7d6c54c70e6188e98d9b0579fd78814501a6aee2
|
@@ -5,6 +5,7 @@ require 'fileutils'
|
|
5
5
|
require 'pindo/base/executable'
|
6
6
|
require 'pindo/module/build/buildhelper'
|
7
7
|
require 'webrick' # 添加WebRick HTTP服务器
|
8
|
+
require 'socket'
|
8
9
|
|
9
10
|
module Pindo
|
10
11
|
class Command
|
@@ -145,6 +146,18 @@ module Pindo
|
|
145
146
|
end
|
146
147
|
end
|
147
148
|
|
149
|
+
# 获取本机局域网IP地址
|
150
|
+
def get_local_ip
|
151
|
+
ip = nil
|
152
|
+
Socket.ip_address_list.each do |addr_info|
|
153
|
+
if addr_info.ipv4? && !addr_info.ipv4_loopback?
|
154
|
+
ip = addr_info.ip_address
|
155
|
+
break
|
156
|
+
end
|
157
|
+
end
|
158
|
+
return ip || 'localhost'
|
159
|
+
end
|
160
|
+
|
148
161
|
# 启动HTTP服务器
|
149
162
|
def start_http_server(webgl_dir, port)
|
150
163
|
begin
|
@@ -170,7 +183,8 @@ module Pindo
|
|
170
183
|
:DocumentRoot => webgl_dir,
|
171
184
|
:Logger => WEBrick::Log.new(nil, WEBrick::Log::ERROR),
|
172
185
|
:AccessLog => @args_debug ? nil : [],
|
173
|
-
:DoNotReverseLookup => true
|
186
|
+
:DoNotReverseLookup => true,
|
187
|
+
:BindAddress => '0.0.0.0' # 绑定到所有网络接口,使其在局域网可访问
|
174
188
|
)
|
175
189
|
|
176
190
|
# 挂载处理程序
|
@@ -211,8 +225,10 @@ module Pindo
|
|
211
225
|
end
|
212
226
|
|
213
227
|
# 启动服务器并返回
|
228
|
+
local_ip = get_local_ip
|
214
229
|
UI.puts("启动WebGL HTTP服务器,端口: #{port},目录: #{webgl_dir}")
|
215
|
-
UI.puts("
|
230
|
+
UI.puts("本地访问地址: http://localhost:#{port}/index.html")
|
231
|
+
UI.puts("局域网访问地址: http://#{local_ip}:#{port}/index.html")
|
216
232
|
return server
|
217
233
|
rescue Exception => e
|
218
234
|
UI.puts("启动HTTP服务器失败: #{e.message}")
|
data/lib/pindo/version.rb
CHANGED