hotreload 0.2.0 → 0.2.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/config.rb +27 -18
- data/lib/hotreload.rb +27 -24
- data/lib/main.rb +3 -2
- data/lib/server.rb +11 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0bcb8cd4c6087a5219e9943663296ab79fd4c57476acf204656ab36a129dc72
|
4
|
+
data.tar.gz: 8ecd0f3292dddee4d3b1bf239fa174edaa9dad559971f6bb799f109d11be0bf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91a0e7d524d74791309ded5d64ecb3d45ebc6b8c11d470c052decf073b6a8f61063a303cf0e64f22d6df224509598b5e5689fcb0edc5e6101bfd3ac7ef5bdd53
|
7
|
+
data.tar.gz: 94fb0379f748f484b8931e780ec24033f735aa0a73b876d8cba47eb0ffd378bb07a7eb3f7b010a4d52b9bb3c21f56cefd67d5716ac2688d4a696731cbcdced33
|
data/lib/config.rb
CHANGED
@@ -8,25 +8,34 @@ end
|
|
8
8
|
# Command
|
9
9
|
module Command
|
10
10
|
# responses from client
|
11
|
-
InjectionComplete = 0
|
12
|
-
InjectionPause = 1
|
13
|
-
InjectionSign = 2
|
14
|
-
InjectionError = 3
|
11
|
+
# InjectionComplete = 0
|
12
|
+
# InjectionPause = 1
|
13
|
+
# InjectionSign = 2
|
14
|
+
# InjectionError = 3
|
15
|
+
#
|
16
|
+
# # commands to Client
|
17
|
+
# InjectionProject = 4
|
18
|
+
# InjectionLog = 5
|
19
|
+
# InjectionSigned = 6
|
20
|
+
# InjectionLoad = 7
|
21
|
+
# InjectionInject = 8
|
22
|
+
# InjectionXprobe = 9
|
23
|
+
# InjectionEval = 10
|
24
|
+
# InjectionVaccineSettingChanged = 11
|
25
|
+
#
|
26
|
+
# InjectionTransferFile = 12
|
27
|
+
# HRCommandTransferFileNameFinished = 13
|
28
|
+
# HRCommandTransferFileSizeFinished = 14
|
29
|
+
# HRCommandTransferFileFinished = 15
|
30
|
+
#
|
15
31
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
InjectionEval = 10
|
24
|
-
InjectionVaccineSettingChanged = 11
|
25
|
-
|
26
|
-
InjectionTransferFile = 12
|
27
|
-
HRCommandTransferFileNameFinished = 13
|
28
|
-
HRCommandTransferFileSizeFinished = 14
|
29
|
-
HRCommandTransferFileFinished = 15
|
32
|
+
HRCommandComplete = 0
|
33
|
+
HRCommandBuilding = 1
|
34
|
+
HRCommandSetProject = 2
|
35
|
+
HRCommandTransferFile = 3
|
36
|
+
HRCommandTransferFileNameFinished = 4
|
37
|
+
HRCommandTransferFileSizeFinished = 5
|
38
|
+
HRCommandTransferFileFinished = 6
|
30
39
|
|
31
40
|
InjectionEOF = ~0
|
32
41
|
end
|
data/lib/hotreload.rb
CHANGED
@@ -84,6 +84,7 @@ class HotReload
|
|
84
84
|
def inject(source)
|
85
85
|
Thread.new do
|
86
86
|
# rebuild
|
87
|
+
@server.send_command(Command::HRCommandBuilding, source)
|
87
88
|
dylib = build(source)
|
88
89
|
if !dylib
|
89
90
|
puts "build failed"
|
@@ -92,13 +93,15 @@ class HotReload
|
|
92
93
|
|
93
94
|
symbol_file = get_symbol_file
|
94
95
|
|
95
|
-
@server.send_command(Command::
|
96
|
+
@server.send_command(Command::HRCommandTransferFile, nil)
|
96
97
|
|
97
98
|
puts "start transfer file"
|
98
99
|
file_tmp = "#{@hot_reload_tmp_path}/hotreload#{@hot_reload_id}"
|
99
100
|
@server.send_file(dylib)
|
100
101
|
@server.send_file("#{file_tmp}.o")
|
101
102
|
@server.send_file(symbol_file)
|
103
|
+
|
104
|
+
# @server.send_command(Command::HRCommandComplete, source)
|
102
105
|
puts "finish transfer file"
|
103
106
|
end
|
104
107
|
end
|
@@ -123,35 +126,35 @@ class HotReload
|
|
123
126
|
end
|
124
127
|
|
125
128
|
def set_project(project_file)
|
126
|
-
@server.send_command(Command::
|
129
|
+
@server.send_command(Command::HRCommandSetProject, project_file)
|
127
130
|
@watcher = FileWatcher.new(@project_path)
|
128
131
|
@watcher.startWatcher do |file|
|
129
132
|
changeFiles(file)
|
130
133
|
end
|
131
134
|
end
|
132
135
|
|
133
|
-
def listen_command
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
end
|
136
|
+
# def listen_command
|
137
|
+
# Thread.new do
|
138
|
+
# while (command = read_int) != Command::InjectionEOF
|
139
|
+
# case command
|
140
|
+
# when Command::InjectionComplete
|
141
|
+
# puts "Injection Complete"
|
142
|
+
# when Command::InjectionPause
|
143
|
+
# when Command::InjectionSign
|
144
|
+
# dylib = read_message
|
145
|
+
# signer = Signer.new
|
146
|
+
# ret = signer.codeSignDylib(dylib)
|
147
|
+
# @server.send_command(Command::InjectionSigned, ret ? '1' : '0')
|
148
|
+
# when Command::InjectionError
|
149
|
+
# puts "Injection error: #{read_message}"
|
150
|
+
# else
|
151
|
+
# puts "InjectionServer: Unexpected case #{command}"
|
152
|
+
# exit
|
153
|
+
# end
|
154
|
+
# end
|
155
|
+
# puts "command end"
|
156
|
+
# end
|
157
|
+
# end
|
155
158
|
|
156
159
|
# rebuild file
|
157
160
|
def build(file)
|
data/lib/main.rb
CHANGED
@@ -20,5 +20,6 @@ require_relative 'hotreload'
|
|
20
20
|
|
21
21
|
|
22
22
|
|
23
|
-
project_path = "/Users
|
24
|
-
|
23
|
+
# project_path = "/Users//Documents/workspace/third/HotReloadClient/Example/Pods"
|
24
|
+
project_path = "/Users/shijishan/Documents/workspace/spring/gif/Pods"
|
25
|
+
HotReload.new().startServer(project_path)
|
data/lib/server.rb
CHANGED
@@ -108,12 +108,21 @@ class Server
|
|
108
108
|
puts "send file size failed, #{size}"
|
109
109
|
end
|
110
110
|
|
111
|
+
content = ""
|
111
112
|
File.open(file, "r") do |f|
|
112
113
|
f.each_line do |line|
|
113
|
-
|
114
|
-
|
114
|
+
content += line
|
115
|
+
if content.bytesize >= 102400
|
116
|
+
@client.write(content)
|
117
|
+
puts "read size #{content.bytesize} of file:#{file}"
|
118
|
+
content = ""
|
119
|
+
end
|
115
120
|
end
|
116
121
|
end
|
122
|
+
if content.bytesize >= 0
|
123
|
+
@client.write(content)
|
124
|
+
puts "read size #{content.bytesize} of file:#{file}"
|
125
|
+
end
|
117
126
|
|
118
127
|
command = read_int
|
119
128
|
if command != HRCommandTransferFileFinished
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hotreload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- shantj
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-11-
|
11
|
+
date: 2019-11-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|