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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db715d301b4fc5e584009030dadb851473c9768c86d4d12f2012c9f8beb63cae
4
- data.tar.gz: bebbea7e8157eaac6f99aa6fd93a7ca68279c70cd33ea1d808fd85b80d5eec67
3
+ metadata.gz: a0bcb8cd4c6087a5219e9943663296ab79fd4c57476acf204656ab36a129dc72
4
+ data.tar.gz: 8ecd0f3292dddee4d3b1bf239fa174edaa9dad559971f6bb799f109d11be0bf7
5
5
  SHA512:
6
- metadata.gz: e6feed1c4c5a73936fe6ffe7a8e455dd131b6373efda23c5cf53ae269abecffa303b0d9d871b1972fda2c82ae7101947514ee4c4b516930d5e4974564f98b5ff
7
- data.tar.gz: 3f43e6f529dbe829e1893347bceeaa225bffb5f14f9e578a366c78e7c1bffd20afbe06b81b50a0e4edfb4fe37e631f1db5a94c84d43ca0a96396ff0260306d67
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
- # 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
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::InjectionTransferFile, nil)
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::InjectionProject, project_file)
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
- Thread.new do
135
- while (command = read_int) != Command::InjectionEOF
136
- case command
137
- when Command::InjectionComplete
138
- puts "Injection Complete"
139
- when Command::InjectionPause
140
- when Command::InjectionSign
141
- dylib = read_message
142
- signer = Signer.new
143
- ret = signer.codeSignDylib(dylib)
144
- @server.send_command(Command::InjectionSigned, ret ? '1' : '0')
145
- when Command::InjectionError
146
- puts "Injection error: #{read_message}"
147
- else
148
- puts "InjectionServer: Unexpected case #{command}"
149
- exit
150
- end
151
- end
152
- puts "command end"
153
- end
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/***/Documents/workspace/third/HotReloadClient/Example/Pods"
24
- # HotReload.new().startServer(project_path)
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
- @client.write(line)
114
- puts "#{line.bytesize}"
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.0
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-24 00:00:00.000000000 Z
11
+ date: 2019-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler