six-updater-web 0.23.1 → 0.23.2

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ require 'rake/testtask'
7
7
 
8
8
  spec = Gem::Specification.new do |s|
9
9
  s.name = 'six-updater-web'
10
- s.version = '0.23.1'
10
+ s.version = '0.23.2'
11
11
  s.has_rdoc = false
12
12
  #s.extra_rdoc_files = ['README', 'LICENSE']
13
13
  s.summary = 'Your summary here'
@@ -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 "app manager"
354
- #setting.processes.each { |entry| @msg << "Process to be killed: #{entry}" }
355
- #setting.kill!
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.real_path)
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.real_path)
277
+ Six::Appmanager.kill_by_name(self.process_name, self.full_path)
274
278
  end
275
279
 
276
280
  def rpt
@@ -51,7 +51,7 @@
51
51
  &nbsp;
52
52
  = submit_tag "Save"
53
53
  &nbsp;
54
- = submit_tag "App Manager"
54
+ = submit_tag "Stop game"
55
55
  &nbsp;
56
56
  = submit_tag "Edit Userconfig"
57
57
  %p
@@ -1,7 +1,9 @@
1
- Process Manager
1
+ Warning - Open processes
2
+ =# link_to "Kill all", "/main/pm/?setting=#{@setting_used.id}&kill_all=true"
2
3
  %br
3
- = link_to "Kill all", "/main/pm/?setting=#{@setting.id}&kill_all=true"
4
- - @setting.processes.each do |p|
5
- = p
6
- = link_to "Kill", "/main/pm/?setting=#{@setting.id}&kill=#{p}"
7
- %br
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 (@check.size + @skip.size + @install.size + @disabled.size + @special.size) > 0
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
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
@@ -22,7 +22,7 @@ case RUBY_VERSION
22
22
  end
23
23
 
24
24
  module SixUpdaterWeb
25
- VERSION = "0.23.1"
25
+ VERSION = "0.23.2"
26
26
  COMPONENT = "six-updater-web"
27
27
 
28
28
  DEFAULT_IP = "127.0.0.1" unless defined?(DEFAULT_IP)
@@ -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).each { |process| kill(process) }
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.info File.join(path, name).sub("/", "\\").downcase
82
- logger.info full.downcase
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 23
8
- - 1
9
- version: 0.23.1
8
+ - 2
9
+ version: 0.23.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sickboy