six-updater-web 0.23.1 → 0.23.2
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.
- data/Rakefile +1 -1
- data/lib/six-updater-web/app/controllers/main_controller.rb +11 -21
- data/lib/six-updater-web/app/models/appsetting.rb +6 -2
- data/lib/six-updater-web/app/views/main/_left.haml +1 -1
- data/lib/six-updater-web/app/views/main/_pm.haml +8 -6
- data/lib/six-updater-web/app/views/main/_right.haml +28 -28
- data/lib/six-updater-web/config/six-updater-web.rb +1 -1
- data/lib/six-updater-web/vendor/plugins/six-app_manager/lib/six/appmanager.rb +9 -4
- metadata +2 -2
data/Rakefile
CHANGED
@@ -18,6 +18,12 @@ class MainController < ApplicationController
|
|
18
18
|
@inweb = @system_setting.inweb
|
19
19
|
@queryserver = Queryserver.new
|
20
20
|
|
21
|
+
if params[:kill]
|
22
|
+
procs = params[:kill].split(",")
|
23
|
+
procs.each { |entry| Six::Appmanager.kill(entry.to_i); @msg << "Process killed: #{entry}" } # @msg << "Process to be killed: #{entry}";
|
24
|
+
sleep 1
|
25
|
+
end
|
26
|
+
|
21
27
|
if @system_setting.synchronized_at
|
22
28
|
ok = false if @system_setting.synchronized_at > 30.minutes.ago
|
23
29
|
end
|
@@ -269,10 +275,7 @@ class MainController < ApplicationController
|
|
269
275
|
end
|
270
276
|
end
|
271
277
|
|
272
|
-
procs = setting.processes
|
273
|
-
unless procs.empty?
|
274
|
-
@error << "<b>WARNING:</b> There seem to be open arma processes: #{setting.real_exe} - Pids: #{procs}"
|
275
|
-
end
|
278
|
+
@procs = setting.processes
|
276
279
|
|
277
280
|
preset.all_mods(server, setting).each do |mod|
|
278
281
|
mod.update_version(setting.real_path) # TODO: this already runs in updater_yml, but there doesn't run if autoskip is disabled
|
@@ -304,6 +307,7 @@ class MainController < ApplicationController
|
|
304
307
|
end
|
305
308
|
end
|
306
309
|
|
310
|
+
@setting_used = setting
|
307
311
|
case params["commit"].downcase
|
308
312
|
when "edit preset"
|
309
313
|
redirect_to "/sixconfigs/edit/#{preset.id}"
|
@@ -350,10 +354,9 @@ class MainController < ApplicationController
|
|
350
354
|
@msg << "Saved six-updater.yml!"
|
351
355
|
@msg << "<b>A window should open displaying the update process progress</b>"
|
352
356
|
|
353
|
-
when "
|
354
|
-
|
355
|
-
|
356
|
-
@pm = true
|
357
|
+
when "stop game"
|
358
|
+
setting.kill!.each { |entry| @msg << "Process killed: #{entry}" }
|
359
|
+
sleep 1
|
357
360
|
|
358
361
|
when "read mods"
|
359
362
|
Mod.read_modfolders(setting)
|
@@ -366,19 +369,6 @@ class MainController < ApplicationController
|
|
366
369
|
act(setting, preset, action, server)
|
367
370
|
end
|
368
371
|
|
369
|
-
def pm
|
370
|
-
@setting = Appsetting.find(params[:setting])
|
371
|
-
@msg = []
|
372
|
-
if params[:kill_all]
|
373
|
-
@setting.processes.each { |entry| @msg << "Process to be killed: #{entry}" }
|
374
|
-
@setting.kill!
|
375
|
-
end
|
376
|
-
if params[:kill]
|
377
|
-
procs = params[:kill].split(",")
|
378
|
-
procs.each { |entry| @msg << "Process to be killed: #{entry}"; Six::Appmanager.kill(entry) }
|
379
|
-
end
|
380
|
-
end
|
381
|
-
|
382
372
|
def fetch
|
383
373
|
@system_setting = SystemSetting.singleton
|
384
374
|
setting = nil
|
@@ -261,8 +261,12 @@ class Appsetting < ActiveRecord::Base
|
|
261
261
|
File.basename(ex)
|
262
262
|
end
|
263
263
|
|
264
|
+
def full_path
|
265
|
+
File.dirname(File.join(self.real_path, self.real_exe)).gsub("\\", "/")
|
266
|
+
end
|
267
|
+
|
264
268
|
def processes
|
265
|
-
Six::Appmanager.find_process(process_name, self.
|
269
|
+
Six::Appmanager.find_process(self.process_name, self.full_path)
|
266
270
|
end
|
267
271
|
|
268
272
|
def read_logfile
|
@@ -270,7 +274,7 @@ class Appsetting < ActiveRecord::Base
|
|
270
274
|
end
|
271
275
|
|
272
276
|
def kill!
|
273
|
-
Six::Appmanager.kill_by_name(process_name, self.
|
277
|
+
Six::Appmanager.kill_by_name(self.process_name, self.full_path)
|
274
278
|
end
|
275
279
|
|
276
280
|
def rpt
|
@@ -1,7 +1,9 @@
|
|
1
|
-
|
1
|
+
Warning - Open processes
|
2
|
+
=# link_to "Kill all", "/main/pm/?setting=#{@setting_used.id}&kill_all=true"
|
2
3
|
%br
|
3
|
-
|
4
|
-
- @
|
5
|
-
|
6
|
-
|
7
|
-
|
4
|
+
%lu
|
5
|
+
- @procs.each do |p|
|
6
|
+
%li
|
7
|
+
= p
|
8
|
+
\-
|
9
|
+
= link_to "Kill", "/main/?kill=#{p}"
|
@@ -13,43 +13,43 @@
|
|
13
13
|
%br
|
14
14
|
#{params[:commit]}
|
15
15
|
- if @msg.size > 0
|
16
|
-
%br
|
17
16
|
%div{:class => "green"}
|
18
17
|
%ul
|
19
18
|
- @msg.each do |m|
|
20
19
|
%li= m
|
21
20
|
- if @error.size > 0
|
22
|
-
%br
|
23
21
|
%div{:class => "red"}
|
24
22
|
%ul
|
25
23
|
- @error.each do |e|
|
26
24
|
%li= e
|
25
|
+
- if @procs.size > 0
|
26
|
+
%div{:class => "red"}
|
27
|
+
= render :partial => "main/pm"
|
27
28
|
%table{ :border => 1, :cellpadding => "5", :width => "100%"}
|
28
29
|
%tr
|
29
30
|
%td
|
30
|
-
- if
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
%br
|
31
|
+
- if @check.size > 0
|
32
|
+
%b To be checked
|
33
|
+
%br
|
34
|
+
= render :partial => "check", :locals => {:mods => @check}
|
35
|
+
%br
|
36
|
+
- if @skip.size > 0
|
37
|
+
%b To be skipped
|
38
|
+
%br
|
39
|
+
= render :partial => "check", :locals => {:mods => @skip}
|
40
|
+
%br
|
41
|
+
- if @install.size > 0
|
42
|
+
%b Not installed
|
43
|
+
%br
|
44
|
+
= render :partial => "check", :locals => {:mods => @install}
|
45
|
+
%br
|
46
|
+
- if @special.size > 0
|
47
|
+
%b Special (Hover over modname to see why)
|
48
|
+
%br
|
49
|
+
= render :partial => "check", :locals => {:mods => @special}
|
50
|
+
%br
|
51
|
+
- if @disabled.size > 0
|
52
|
+
%b Disabled
|
53
|
+
%br
|
54
|
+
= render :partial => "check", :locals => {:mods => @disabled}
|
55
|
+
%br
|
@@ -49,7 +49,10 @@ module Six
|
|
49
49
|
# TODO: Kill by ... multiple properties. gamefolder, etc.
|
50
50
|
|
51
51
|
def kill_by_name(name, path = nil)
|
52
|
-
find_process(name, path)
|
52
|
+
procs = find_process(name, path)
|
53
|
+
logger.debug "Procs: #{procs}"
|
54
|
+
procs.each { |process| kill(process) }
|
55
|
+
procs
|
53
56
|
end
|
54
57
|
|
55
58
|
def find_process(name, path)
|
@@ -66,6 +69,7 @@ module Six
|
|
66
69
|
reg = /([0-9]*)$/
|
67
70
|
line[reg]
|
68
71
|
pid = $1
|
72
|
+
next if pid.nil?
|
69
73
|
line.sub!(reg, "")
|
70
74
|
line.strip!
|
71
75
|
line[/^([\w ]*\.\w*)[ ]*(.*)/]
|
@@ -74,13 +78,14 @@ module Six
|
|
74
78
|
|
75
79
|
case image.downcase
|
76
80
|
when name.downcase
|
81
|
+
pid = pid.to_i
|
82
|
+
next unless pid > 0
|
77
83
|
unless path && !full.nil?
|
78
84
|
pids << pid
|
79
85
|
next
|
80
86
|
end
|
81
|
-
logger.
|
82
|
-
|
83
|
-
if File.join(path, name).sub("/", "\\").downcase == full.downcase
|
87
|
+
logger.debug "Full: #{full.downcase}"
|
88
|
+
if File.join(path, name).gsub("/", "\\").downcase == full.downcase
|
84
89
|
pids << pid
|
85
90
|
end
|
86
91
|
end
|