six-updater-web 0.19.5 → 0.19.6
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/appsettings_controller.rb +2 -1
- data/lib/six-updater-web/app/controllers/main_controller.rb +5 -5
- data/lib/six-updater-web/app/models/appsetting.rb +111 -3
- data/lib/six-updater-web/app/models/arma2_oa_appsetting.rb +3 -1
- data/lib/six-updater-web/app/models/arma2_st_appsetting.rb +1 -1
- data/lib/six-updater-web/config/six-updater-web.rb +1 -1
- data/lib/six-updater-web/db/migrate/20100520101656_add_server_to_appsettings.rb +9 -0
- data/lib/six-updater-web/db/schema.rb +2 -1
- data/lib/six-updater-web/vendor/plugins/six-app_manager/lib/six/appmanager.rb +0 -104
- metadata +3 -2
data/Rakefile
CHANGED
@@ -12,6 +12,7 @@ class AppsettingsController < ApplicationController
|
|
12
12
|
:params,
|
13
13
|
:sixconfigs,
|
14
14
|
:beta,
|
15
|
+
:server,
|
15
16
|
:type,
|
16
17
|
# :created_at,
|
17
18
|
:updated_at
|
@@ -22,7 +23,7 @@ class AppsettingsController < ApplicationController
|
|
22
23
|
|
23
24
|
config.list.sorting = { :name => :asc }
|
24
25
|
|
25
|
-
[:name, :exe, :path, :modpath, :logpath, :params, :beta].each do |column|
|
26
|
+
[:name, :exe, :path, :modpath, :logpath, :params, :beta, :server].each do |column|
|
26
27
|
config.columns[column].inplace_edit = true
|
27
28
|
end
|
28
29
|
end
|
@@ -192,7 +192,7 @@ class MainController < ApplicationController
|
|
192
192
|
end
|
193
193
|
|
194
194
|
if preset
|
195
|
-
@msg << "Using preset: #{preset.name}"
|
195
|
+
@msg << "Using preset: <a href='/sixconfigs/edit/#{preset.id}' title='#{preset.mods.map{|e| e.name}.join(", ")}'>#{preset.name}</a>"
|
196
196
|
else
|
197
197
|
@msg << "No preset selected!"
|
198
198
|
act(setting, preset, action, server)
|
@@ -201,21 +201,21 @@ class MainController < ApplicationController
|
|
201
201
|
|
202
202
|
unless params["all"]
|
203
203
|
if server
|
204
|
-
@msg << "Override server: #{
|
204
|
+
@msg << "Override server: <a href='/queryservers/edit/#{queryserver.id}' title='#{queryserver.mods.map{|e| e.name}.join(", ")}'>#{queryserver.to_label}</a>"
|
205
205
|
else
|
206
206
|
if preset.server
|
207
207
|
server = preset.server
|
208
|
-
@msg << "Preset server: #{server.name}"
|
208
|
+
@msg << "Preset server: <a href='/servers/edit/#{server.id}' title='#{server.mods.map{|e| e.name}.join(", ")}'>#{server.to_label}"
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
212
212
|
|
213
213
|
if setting
|
214
|
-
@msg << "Override settings profile: #{setting.
|
214
|
+
@msg << "Override settings profile: <a href='/appsettings/edit/#{setting.id}' title='#{setting.real_exe} #{setting.real_params}'>#{setting.label}</a>"
|
215
215
|
else
|
216
216
|
if preset.appsetting
|
217
217
|
setting = preset.appsetting
|
218
|
-
@msg << "Preset settings profile: #{setting.
|
218
|
+
@msg << "Preset settings profile: <a href='/appsettings/edit/#{setting.id}' title='#{setting.real_exe} #{setting.real_params}'>#{setting.label}</a>"
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
@@ -1,7 +1,4 @@
|
|
1
1
|
class Appsetting < ActiveRecord::Base
|
2
|
-
# FIXME: This should be done automatically
|
3
|
-
include Six::Appmanager::Appsetting
|
4
|
-
|
5
2
|
has_many :sixconfigs
|
6
3
|
six_guid
|
7
4
|
|
@@ -20,6 +17,9 @@ class Appsetting < ActiveRecord::Base
|
|
20
17
|
DEFAULT_EXE_PATH = ""
|
21
18
|
DEFAULT_BETA_EXE = "arma2.exe"
|
22
19
|
DEFAULT_BETA_EXE_PATH = "beta"
|
20
|
+
DEFAULT_SERVER_EXE = "arma2server.exe"
|
21
|
+
DEFAULT_SERVER_EXE_PATH = DEFAULT_EXE_PATH
|
22
|
+
|
23
23
|
# TODO: Auto beta mod even?
|
24
24
|
DEFAULT_PARAMS = "-showScriptErrors -noSplash -noFilePatching"
|
25
25
|
DEFAULT_MODS_PARAM = "-mod=" # TODO
|
@@ -49,6 +49,14 @@ class Appsetting < ActiveRecord::Base
|
|
49
49
|
hash
|
50
50
|
end
|
51
51
|
|
52
|
+
def label
|
53
|
+
ar = []
|
54
|
+
return self.name unless self.beta || self.server
|
55
|
+
ar << "Beta" if self.beta
|
56
|
+
ar << "Server" if self.server
|
57
|
+
"#{self.name} (#{ar.join(", ")})"
|
58
|
+
end
|
59
|
+
|
52
60
|
def self.label
|
53
61
|
#self.to_s.sub("Appsetting", "")
|
54
62
|
self::FRIENDLY_NAME
|
@@ -58,7 +66,107 @@ class Appsetting < ActiveRecord::Base
|
|
58
66
|
self.to_s.sub("Appsetting", "")
|
59
67
|
end
|
60
68
|
|
69
|
+
def get_exe
|
70
|
+
edition = self.detect_edition
|
71
|
+
if self.server
|
72
|
+
edition::DEFAULT_SERVER_EXE_PATH.size == 0 ? edition::DEFAULT_SERVER_EXE : "#{edition::DEFAULT_SERVER_EXE_PATH}/#{edition::DEFAULT_SERVER_EXE}"
|
73
|
+
else
|
74
|
+
if self.beta
|
75
|
+
edition::DEFAULT_BETA_EXE_PATH.size == 0 ? edition::DEFAULT_BETA_EXE : "#{edition::DEFAULT_BETA_EXE_PATH}/#{edition::DEFAULT_BETA_EXE}"
|
76
|
+
else
|
77
|
+
edition::DEFAULT_EXE_PATH.size == 0 ? edition::DEFAULT_EXE : "#{edition::DEFAULT_EXE_PATH}/#{edition::DEFAULT_EXE}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def path_by_registry
|
83
|
+
self.class::DEFAULT_PATH
|
84
|
+
end
|
85
|
+
|
86
|
+
def real_exe
|
87
|
+
if self.exe.nil?
|
88
|
+
self.get_exe
|
89
|
+
else
|
90
|
+
self.exe
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def real_params
|
95
|
+
if self.params.nil?
|
96
|
+
self.detect_edition::DEFAULT_PARAMS
|
97
|
+
else
|
98
|
+
self.params
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def real_logpath
|
103
|
+
if self.logpath.nil?
|
104
|
+
case RUBY_PLATFORM
|
105
|
+
when /-mingw32$/, /-mswin32$/
|
106
|
+
"#{File.join(ENV['USERPROFILE'], 'appdata', 'local', 'arma 2')}"
|
107
|
+
else
|
108
|
+
nil
|
109
|
+
end
|
110
|
+
else
|
111
|
+
self.logpath
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
def real_path
|
116
|
+
if self.path.nil?
|
117
|
+
self.path_by_registry
|
118
|
+
else
|
119
|
+
self.path
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def real_modpath
|
124
|
+
if self.modpath.nil?
|
125
|
+
self.real_path
|
126
|
+
else
|
127
|
+
self.modpath
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def process_name
|
132
|
+
if self.exe
|
133
|
+
if self.exe[FOLDER]
|
134
|
+
$2
|
135
|
+
else
|
136
|
+
self.exe
|
137
|
+
end
|
138
|
+
else
|
139
|
+
self.get_exe
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
def processes
|
144
|
+
Six::Appmanager.find_process(process_name)
|
145
|
+
end
|
146
|
+
|
147
|
+
def read_logfile
|
148
|
+
Six::Appmanager.read_logfile logfile unless logfile.nil?
|
149
|
+
end
|
150
|
+
|
151
|
+
def kill!
|
152
|
+
Six::Appmanager.kill_by_name(process_name)
|
153
|
+
end
|
154
|
+
|
155
|
+
def rpt
|
156
|
+
process_name[/(.*)\./]
|
157
|
+
"#{$1}.rpt"
|
158
|
+
end
|
159
|
+
|
160
|
+
def logfile
|
161
|
+
if FileTest.directory? real_logpath
|
162
|
+
File.join(real_logpath, rpt) if FileTest.exist?(File.join(real_logpath, rpt))
|
163
|
+
else
|
164
|
+
nil
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
61
168
|
def detect_edition
|
169
|
+
# TODO: Read the appsetting.exe to figure out an edition, as a static setting by the user?
|
62
170
|
return self.class if self.class::SPECIFIC
|
63
171
|
return self.class unless self.real_path
|
64
172
|
game = nil
|
@@ -5,6 +5,9 @@ class Arma2OaAppsetting < Arma2Appsetting
|
|
5
5
|
DEFAULT_EXE = "arma2oa.exe"
|
6
6
|
DEFAULT_BETA_EXE = "arma2oa.exe"
|
7
7
|
DEFAULT_BETA_EXE_PATH = "expansion/beta"
|
8
|
+
DEFAULT_SERVER_EXE = "arma2oaserver.exe"
|
9
|
+
DEFAULT_SERVER_EXE_PATH = DEFAULT_EXE_PATH
|
10
|
+
|
8
11
|
REGKEYS = {"Arma2Oa" => ['SOFTWARE\\Bohemia Interactive Studio\\ArmA 2 OA', 'MAIN']}
|
9
12
|
|
10
13
|
FAMILY = Hash.new
|
@@ -14,5 +17,4 @@ class Arma2OaAppsetting < Arma2Appsetting
|
|
14
17
|
# return self.class unless self.real_path
|
15
18
|
# self.detect_edition
|
16
19
|
# end
|
17
|
-
|
18
20
|
end
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#
|
10
10
|
# It's strongly recommended to check this file into your version control system.
|
11
11
|
|
12
|
-
ActiveRecord::Schema.define(:version =>
|
12
|
+
ActiveRecord::Schema.define(:version => 20100520101656) do
|
13
13
|
|
14
14
|
create_table "actions", :id => false, :force => true do |t|
|
15
15
|
t.string "id", :limit => 36, :null => false
|
@@ -31,6 +31,7 @@ ActiveRecord::Schema.define(:version => 20100520101655) do
|
|
31
31
|
t.string "modpath"
|
32
32
|
t.string "type", :default => "Appsetting"
|
33
33
|
t.boolean "beta"
|
34
|
+
t.boolean "server"
|
34
35
|
end
|
35
36
|
|
36
37
|
create_table "categories", :id => false, :force => true do |t|
|
@@ -17,18 +17,6 @@ case RUBY_PLATFORM
|
|
17
17
|
end
|
18
18
|
|
19
19
|
module Six
|
20
|
-
module Bla
|
21
|
-
# Prepared
|
22
|
-
class << self
|
23
|
-
attr_accessor :process
|
24
|
-
|
25
|
-
def process
|
26
|
-
begin
|
27
|
-
@process rescue nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
20
|
module Appmanager
|
33
21
|
FOLDER = /(.*)\/(.*)/
|
34
22
|
|
@@ -136,98 +124,6 @@ module Six
|
|
136
124
|
'Error while reading logfile!'
|
137
125
|
end
|
138
126
|
end
|
139
|
-
|
140
|
-
module Appsetting
|
141
|
-
def path_by_registry
|
142
|
-
self.class::DEFAULT_PATH
|
143
|
-
end
|
144
|
-
|
145
|
-
def real_exe
|
146
|
-
if exe.nil?
|
147
|
-
if self.beta
|
148
|
-
self.detect_edition::DEFAULT_BETA_EXE_PATH.size == 0 ? self.detect_edition::DEFAULT_BETA_EXE : "#{self.detect_edition::DEFAULT_BETA_EXE_PATH}/#{self.detect_edition::DEFAULT_BETA_EXE}"
|
149
|
-
else
|
150
|
-
self.detect_edition::DEFAULT_EXE_PATH.size == 0 ? self.detect_edition::DEFAULT_EXE : "#{self.detect_edition::DEFAULT_EXE_PATH}/#{self.detect_edition::DEFAULT_EXE}"
|
151
|
-
end
|
152
|
-
else
|
153
|
-
exe
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
def real_params
|
158
|
-
if params.nil?
|
159
|
-
self.detect_edition::DEFAULT_PARAMS
|
160
|
-
else
|
161
|
-
params
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
def real_logpath
|
166
|
-
if logpath.nil?
|
167
|
-
case RUBY_PLATFORM
|
168
|
-
when /-mingw32$/, /-mswin32$/
|
169
|
-
"#{File.join(ENV['USERPROFILE'], 'appdata', 'local', 'arma 2')}"
|
170
|
-
else
|
171
|
-
nil
|
172
|
-
end
|
173
|
-
else
|
174
|
-
logpath
|
175
|
-
end
|
176
|
-
end
|
177
|
-
|
178
|
-
def real_path
|
179
|
-
if path.nil?
|
180
|
-
path_by_registry
|
181
|
-
else
|
182
|
-
self.path
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
def real_modpath
|
187
|
-
if self.modpath.nil?
|
188
|
-
self.real_path
|
189
|
-
else
|
190
|
-
self.modpath
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
def process_name
|
195
|
-
if exe
|
196
|
-
if exe[FOLDER]
|
197
|
-
$2
|
198
|
-
else
|
199
|
-
exe
|
200
|
-
end
|
201
|
-
else
|
202
|
-
'arma2.exe'
|
203
|
-
end
|
204
|
-
end
|
205
|
-
|
206
|
-
def processes
|
207
|
-
Six::Appmanager.find_process(process_name)
|
208
|
-
end
|
209
|
-
|
210
|
-
def read_logfile
|
211
|
-
Six::Appmanager.read_logfile logfile unless logfile.nil?
|
212
|
-
end
|
213
|
-
|
214
|
-
def kill!
|
215
|
-
Six::Appmanager.kill_by_name(process_name)
|
216
|
-
end
|
217
|
-
|
218
|
-
def rpt
|
219
|
-
process_name[/(.*)\./]
|
220
|
-
"#{$1}.rpt"
|
221
|
-
end
|
222
|
-
|
223
|
-
def logfile
|
224
|
-
if FileTest.directory? real_logpath
|
225
|
-
File.join(real_logpath, rpt) if FileTest.exist?(File.join(real_logpath, rpt))
|
226
|
-
else
|
227
|
-
nil
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
127
|
end
|
232
128
|
end
|
233
129
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 19
|
8
|
-
-
|
9
|
-
version: 0.19.
|
8
|
+
- 6
|
9
|
+
version: 0.19.6
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sickboy
|
@@ -254,6 +254,7 @@ files:
|
|
254
254
|
- lib/six-updater-web/db/migrate/20100520101653_add_type_to_mods_and_appsettings.rb
|
255
255
|
- lib/six-updater-web/db/migrate/20100520101654_add_beta_to_appsettings.rb
|
256
256
|
- lib/six-updater-web/db/migrate/20100520101655_add_defaults_to_type.rb
|
257
|
+
- lib/six-updater-web/db/migrate/20100520101656_add_server_to_appsettings.rb
|
257
258
|
- lib/six-updater-web/db/schema.rb
|
258
259
|
- lib/six-updater-web/doc/README_FOR_APP
|
259
260
|
- lib/six-updater-web/init.rb
|