six-updater-web 0.19.4 → 0.19.5
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/helpers/appsettings_helper.rb +1 -1
- data/lib/six-updater-web/app/models/appsetting.rb +95 -22
- data/lib/six-updater-web/app/models/arma2_appsetting.rb +4 -3
- data/lib/six-updater-web/app/models/arma2_oa_appsetting.rb +11 -13
- data/lib/six-updater-web/app/models/arma2_oa_co_appsetting.rb +2 -1
- data/lib/six-updater-web/app/models/arma2_oa_co_mod.rb +1 -1
- data/lib/six-updater-web/app/models/arma2_oa_st_appsetting.rb +2 -0
- data/lib/six-updater-web/app/models/arma2_oa_st_mod.rb +0 -1
- data/lib/six-updater-web/app/models/arma2_st_appsetting.rb +3 -1
- data/lib/six-updater-web/app/models/mod.rb +6 -2
- data/lib/six-updater-web/app/views/main/index.haml +6 -14
- data/lib/six-updater-web/config/six-updater-web.rb +1 -1
- data/lib/six-updater-web/public/images/active_scaffold/DO_NOT_EDIT +2 -2
- data/lib/six-updater-web/public/javascripts/active_scaffold/DO_NOT_EDIT +2 -2
- data/lib/six-updater-web/public/stylesheets/active_scaffold/DO_NOT_EDIT +2 -2
- data/lib/six-updater-web/vendor/plugins/six-app_manager/lib/six/appmanager.rb +3 -3
- metadata +2 -2
data/Rakefile
CHANGED
@@ -20,6 +20,6 @@ module AppsettingsHelper
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def type_form_column(record, t, options)
|
23
|
-
collection_select(:record, :type, ["Arma2Appsetting", "Arma2OaAppsetting"], :to_s, :to_s, {}, {:name => options[:name]})
|
23
|
+
collection_select(:record, :type, ["Arma2Appsetting", "Arma2StAppsetting", "Arma2OaAppsetting", "Arma2OaStAppsetting", "Arma2OaCoAppsetting"], :to_s, :to_s, {}, {:name => options[:name]})
|
24
24
|
end
|
25
25
|
end
|
@@ -5,6 +5,17 @@ class Appsetting < ActiveRecord::Base
|
|
5
5
|
has_many :sixconfigs
|
6
6
|
six_guid
|
7
7
|
|
8
|
+
# Defaults to ArmA2 atm...
|
9
|
+
SPECIFIC = false
|
10
|
+
FRIENDLY_NAME = "ArmA 2 (Any)"
|
11
|
+
|
12
|
+
# TODO: Auto enumurate from model properties?
|
13
|
+
# folders: expansion, common, addons
|
14
|
+
# files: arma2.exe, arma2server.exe (-.exe for linux), arma2oa.exe, arma2oaserver.exe, addons/chernarus.pbo
|
15
|
+
FAMILY = Hash.new
|
16
|
+
FAMILY["Arma2"] = [["arma2.exe", "arma2server.exe"], {"Arma2St" => []}]
|
17
|
+
FAMILY["Arma2Oa"] = [["arma2oa.exe", "arma2oaserver.exe"], {"Arma2OaCo" => ["addons/"], "Arma2OaSt" => ["!addons/"]}]
|
18
|
+
|
8
19
|
DEFAULT_EXE = "arma2.exe"
|
9
20
|
DEFAULT_EXE_PATH = ""
|
10
21
|
DEFAULT_BETA_EXE = "arma2.exe"
|
@@ -14,20 +25,16 @@ class Appsetting < ActiveRecord::Base
|
|
14
25
|
DEFAULT_MODS_PARAM = "-mod=" # TODO
|
15
26
|
DEFAULT_BETA_MODS = ["beta"]
|
16
27
|
|
17
|
-
REGKEY = ['SOFTWARE\\Bohemia Interactive Studio\\ArmA 2', 'MAIN']
|
18
|
-
|
19
28
|
# TODO: Windows-only
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
if self.type.nil? || !(["Appsetting", "Arma2Appsetting", "Arma2OaAppsetting"].include?(self.type))
|
27
|
-
self.type = "Appsetting"
|
28
|
-
end
|
29
|
+
REGKEYS = {"Arma2Oa" => ['SOFTWARE\\Bohemia Interactive Studio\\ArmA 2 OA', 'MAIN'], "Arma2" => ['SOFTWARE\\Bohemia Interactive Studio\\ArmA 2', 'MAIN']}
|
30
|
+
path = nil
|
31
|
+
|
32
|
+
self::REGKEYS.each_pair do |k, v|
|
33
|
+
path = begin; Win32::Registry.open(Win32::Registry::HKEY_LOCAL_MACHINE, v[0])[v[1]]; rescue; nil; end
|
34
|
+
break if path
|
29
35
|
end
|
30
|
-
=
|
36
|
+
DEFAULT_PATH = path
|
37
|
+
|
31
38
|
|
32
39
|
def to_updater_yml
|
33
40
|
hash = Hash.new
|
@@ -42,21 +49,87 @@ class Appsetting < ActiveRecord::Base
|
|
42
49
|
hash
|
43
50
|
end
|
44
51
|
|
45
|
-
def
|
46
|
-
|
47
|
-
|
48
|
-
Arma2StAppsetting.found_type
|
49
|
-
when "arma2oa.exe"
|
50
|
-
Arma2OaAppsetting.found_type
|
51
|
-
else
|
52
|
-
self.class
|
53
|
-
end
|
52
|
+
def self.label
|
53
|
+
#self.to_s.sub("Appsetting", "")
|
54
|
+
self::FRIENDLY_NAME
|
54
55
|
end
|
55
56
|
|
56
|
-
def self.
|
57
|
+
def self.short
|
57
58
|
self.to_s.sub("Appsetting", "")
|
58
59
|
end
|
59
60
|
|
61
|
+
def detect_edition
|
62
|
+
return self.class if self.class::SPECIFIC
|
63
|
+
return self.class unless self.real_path
|
64
|
+
game = nil
|
65
|
+
cond = nil
|
66
|
+
ed = nil
|
67
|
+
self.class::FAMILY.each_pair do |key, value|
|
68
|
+
found = false
|
69
|
+
# Find game
|
70
|
+
value[0].each do |e|
|
71
|
+
case e
|
72
|
+
when /\/$/
|
73
|
+
# folder
|
74
|
+
found = File.directory?(File.join(self.real_path, e))
|
75
|
+
else
|
76
|
+
# file
|
77
|
+
case RUBY_PLATFORM
|
78
|
+
when /-mingw32$/, /-mswin32$/
|
79
|
+
else
|
80
|
+
e = e.clone
|
81
|
+
e.sub!(/\.exe$/)
|
82
|
+
end
|
83
|
+
found = File.exists?(File.join(self.real_path, e))
|
84
|
+
end
|
85
|
+
break if found
|
86
|
+
end
|
87
|
+
next unless found
|
88
|
+
game = key
|
89
|
+
|
90
|
+
# Find edition
|
91
|
+
found = nil
|
92
|
+
cond = true
|
93
|
+
ed = nil
|
94
|
+
value[1].each_pair do |edition, conditions|
|
95
|
+
ed = edition
|
96
|
+
conditions.each do |condition|
|
97
|
+
c = condition.clone
|
98
|
+
reverse = c.sub!(/^!/, "")
|
99
|
+
case c
|
100
|
+
when /\/$/
|
101
|
+
# folder
|
102
|
+
found = File.directory?(File.join(self.real_path, c))
|
103
|
+
else
|
104
|
+
case RUBY_PLATFORM
|
105
|
+
when /-mingw32$/, /-mswin32$/
|
106
|
+
else
|
107
|
+
c = c.clone
|
108
|
+
c.sub!(/\.exe$/)
|
109
|
+
end
|
110
|
+
# file
|
111
|
+
found = File.exists?(File.join(self.real_path, c))
|
112
|
+
end
|
113
|
+
cond = reverse ? !found : found
|
114
|
+
break if cond
|
115
|
+
end
|
116
|
+
game = ed if cond
|
117
|
+
next unless cond
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
return nil unless game
|
122
|
+
Object.const_get("#{game}Appsetting")
|
123
|
+
end
|
124
|
+
|
125
|
+
def found_type
|
126
|
+
#Arma2StAppsetting
|
127
|
+
# TODO: Add detection support based on user settings (exe/path)
|
128
|
+
return self.class unless self.real_path
|
129
|
+
d = self.detect_edition
|
130
|
+
d ? d : self.class
|
131
|
+
end
|
132
|
+
|
60
133
|
def found_types
|
61
134
|
self.found_type.types
|
62
135
|
end
|
@@ -1,20 +1,18 @@
|
|
1
1
|
class Arma2OaAppsetting < Arma2Appsetting
|
2
|
+
FRIENDLY_NAME = "A2 Op. Arrowhead (Any)"
|
3
|
+
|
4
|
+
# TODO: Specific server support like done with Beta?
|
2
5
|
DEFAULT_EXE = "arma2oa.exe"
|
3
6
|
DEFAULT_BETA_EXE = "arma2oa.exe"
|
4
7
|
DEFAULT_BETA_EXE_PATH = "expansion/beta"
|
5
|
-
|
8
|
+
REGKEYS = {"Arma2Oa" => ['SOFTWARE\\Bohemia Interactive Studio\\ArmA 2 OA', 'MAIN']}
|
9
|
+
|
10
|
+
FAMILY = Hash.new
|
11
|
+
FAMILY["Arma2Oa"] = [["arma2oa.exe", "arma2oaserver.exe"], {"Arma2OaCo" => ["addons/"], "Arma2OaSt" => ["!addons/"]}]
|
6
12
|
|
7
|
-
def found_type
|
8
|
-
return self.class unless self.real_path
|
9
|
-
|
10
|
-
|
11
|
-
rdir = File.directory?(dir) ? dir : File.join(self.real_path, "Addons")
|
12
|
-
rdir = File.join(self.real_path, "AddOns") unless File.directory?(rdir)
|
13
|
+
# def found_type
|
14
|
+
# return self.class unless self.real_path
|
15
|
+
# self.detect_edition
|
16
|
+
# end
|
13
17
|
|
14
|
-
if File.exists?(File.join(rdir, "chernarus.pbo")) || File.exists?(File.join(rdir, "Chernarus.pbo"))
|
15
|
-
Arma2OaCoAppsetting
|
16
|
-
else
|
17
|
-
Arma2OaStAppsetting
|
18
|
-
end
|
19
|
-
end
|
20
18
|
end
|
@@ -29,11 +29,15 @@ class Mod < ActiveRecord::Base
|
|
29
29
|
self.to_s.sub("Mod", "")
|
30
30
|
end
|
31
31
|
|
32
|
+
def self.short
|
33
|
+
self.to_s.sub("Mod", "")
|
34
|
+
end
|
35
|
+
|
32
36
|
def self.types
|
33
37
|
return [Arma2Mod] if self.class == Appsetting
|
34
38
|
e = self
|
35
39
|
unless e.nil? || [Mod, ActiveRecord::Base].include?(e)
|
36
|
-
types << e
|
40
|
+
types << e
|
37
41
|
e = e.class
|
38
42
|
end
|
39
43
|
types
|
@@ -46,7 +50,7 @@ class Mod < ActiveRecord::Base
|
|
46
50
|
# setting.type == "ArmA2OaSt" (ArmA2Oa, ArmA2)
|
47
51
|
# self.type == "ArmA2Oa"
|
48
52
|
return nil if setting.nil?
|
49
|
-
self.type.nil? ? true : setting.found_types.map{|e| e.
|
53
|
+
self.type.nil? ? true : setting.found_types.map{|e| e.short }.include?(self.class.short)
|
50
54
|
end
|
51
55
|
|
52
56
|
def real_name
|
@@ -61,24 +61,16 @@
|
|
61
61
|
%table{ :border => 1, :cellpadding => "5", :width => "100%"}
|
62
62
|
%tr
|
63
63
|
%td
|
64
|
-
Edition: #{link_to @current_setting.nice_found_type, nil, :title => "Supports mods for: #{@current_setting.found_types.map{|e| e.label}.join(", ")}" }
|
65
|
-
Last sync
|
66
|
-
|
67
|
-
= time_ago_in_words(@system_setting.synchronized_at)
|
68
|
-
ago,
|
69
|
-
- else
|
70
|
-
never,
|
71
|
-
Gamespy
|
72
|
-
- if @system_setting.gamespied_at
|
73
|
-
= time_ago_in_words(@system_setting.gamespied_at)
|
74
|
-
ago.
|
75
|
-
- else
|
76
|
-
never.
|
64
|
+
Edition: #{link_to @current_setting.nice_found_type, nil, :title => "Supports mods for: #{@current_setting.found_types.map{|e| e.label}.join(", ")}" },
|
65
|
+
Last sync #{@system_setting.synchronized_at ? time_ago_in_words(@system_setting.synchronized_at) + " ago" : "never"}
|
66
|
+
Gamespy #{@system_setting.gamespied_at ? time_ago_in_words(@system_setting.gamespied_at) + " ago" : "never"}
|
77
67
|
%br
|
78
68
|
%br
|
79
69
|
= @msg.join("<br />")
|
80
70
|
%br
|
81
|
-
|
71
|
+
Autoskip: #{@autoskip ? "Enabled" : "Disaabled"}.
|
72
|
+
%br
|
73
|
+
- if (@check.size + @skip.size + @install.size + @disabled.size) > 0
|
82
74
|
- if @check.size > 0
|
83
75
|
%br
|
84
76
|
To be checked:
|
@@ -1,2 +1,2 @@
|
|
1
|
-
Any changes made to files in sub-folders will be lost.
|
2
|
-
See http://activescaffold.com/tutorials/faq#custom-css.
|
1
|
+
Any changes made to files in sub-folders will be lost.
|
2
|
+
See http://activescaffold.com/tutorials/faq#custom-css.
|
@@ -1,2 +1,2 @@
|
|
1
|
-
Any changes made to files in sub-folders will be lost.
|
2
|
-
See http://activescaffold.com/tutorials/faq#custom-css.
|
1
|
+
Any changes made to files in sub-folders will be lost.
|
2
|
+
See http://activescaffold.com/tutorials/faq#custom-css.
|
@@ -1,2 +1,2 @@
|
|
1
|
-
Any changes made to files in sub-folders will be lost.
|
2
|
-
See http://activescaffold.com/tutorials/faq#custom-css.
|
1
|
+
Any changes made to files in sub-folders will be lost.
|
2
|
+
See http://activescaffold.com/tutorials/faq#custom-css.
|
@@ -145,9 +145,9 @@ module Six
|
|
145
145
|
def real_exe
|
146
146
|
if exe.nil?
|
147
147
|
if self.beta
|
148
|
-
self.
|
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
149
|
else
|
150
|
-
self.
|
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
151
|
end
|
152
152
|
else
|
153
153
|
exe
|
@@ -156,7 +156,7 @@ module Six
|
|
156
156
|
|
157
157
|
def real_params
|
158
158
|
if params.nil?
|
159
|
-
self.
|
159
|
+
self.detect_edition::DEFAULT_PARAMS
|
160
160
|
else
|
161
161
|
params
|
162
162
|
end
|