six-updater-web 0.12.6 → 0.12.7
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/app/controllers/main_controller.rb +7 -6
- data/lib/config/six-updater-web.rb +69 -69
- metadata +3 -3
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ class MainController < ApplicationController
|
|
2
2
|
def index
|
3
3
|
@msg = []
|
4
4
|
@skip, @install, @check, @disabled = [], [], [], []
|
5
|
-
preset, server, action, setting, reset, ok = nil, nil, nil, nil, false, true
|
5
|
+
preset, queryserver, server, action, setting, reset, ok = nil, nil, nil, nil, nil, false, true
|
6
6
|
grab = false
|
7
7
|
save_fav = true
|
8
8
|
|
@@ -115,7 +115,8 @@ class MainController < ApplicationController
|
|
115
115
|
end
|
116
116
|
|
117
117
|
begin
|
118
|
-
|
118
|
+
queryserver = Queryserver.find(@system_setting.favorite_server)
|
119
|
+
#server = Server.find(@system_setting.favorite_server)
|
119
120
|
rescue
|
120
121
|
end
|
121
122
|
|
@@ -130,10 +131,10 @@ class MainController < ApplicationController
|
|
130
131
|
end
|
131
132
|
|
132
133
|
preset = fetch_param([:config], Sixconfig, preset)
|
133
|
-
server = fetch_param([:server], Server, server)
|
134
|
+
#server = fetch_param([:server], Server, server)
|
134
135
|
action = fetch_param([:act], Action, action)
|
135
136
|
setting = fetch_param([:setting], Appsetting, setting)
|
136
|
-
queryserver = fetch_param([:gamespy], Queryserver,
|
137
|
+
queryserver = fetch_param([:gamespy], Queryserver, queryserver)
|
137
138
|
if queryserver
|
138
139
|
@queryserver = queryserver.id
|
139
140
|
server = queryserver.dynamic_server
|
@@ -145,8 +146,8 @@ class MainController < ApplicationController
|
|
145
146
|
end
|
146
147
|
|
147
148
|
if save_fav
|
148
|
-
@system_setting.favorite_server = if server
|
149
|
-
|
149
|
+
@system_setting.favorite_server = if queryserver #server
|
150
|
+
queryserver.id unless queryserver.new_record?
|
150
151
|
else
|
151
152
|
nil
|
152
153
|
end
|
@@ -9,8 +9,17 @@ case RUBY_PLATFORM
|
|
9
9
|
end
|
10
10
|
require 'open3'
|
11
11
|
|
12
|
+
case RUBY_VERSION
|
13
|
+
when /1\.8\.[0-9]/
|
14
|
+
class Array
|
15
|
+
def to_s
|
16
|
+
"[#{self.join(', ')}]"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
12
21
|
module SixUpdaterWeb
|
13
|
-
VERSION = "0.12.
|
22
|
+
VERSION = "0.12.7"
|
14
23
|
|
15
24
|
COMPONENT = "six-updater-web"
|
16
25
|
SIX_PORT = 3000 unless defined?(SIX_PORT)
|
@@ -56,11 +65,12 @@ module SixUpdaterWeb
|
|
56
65
|
# end
|
57
66
|
#end
|
58
67
|
|
68
|
+
rpath, distro = nil, nil
|
59
69
|
case RUBY_PLATFORM
|
60
70
|
when /-mingw32$/, /-mswin32$/
|
61
71
|
TEMP_PATH = if ENV['TEMP']
|
62
72
|
if ENV['TEMP'].size > 0
|
63
|
-
File.directory?(ENV['TEMP']) ? ENV['TEMP']
|
73
|
+
File.directory?(ENV['TEMP']) ? "#{ENV['TEMP']}" : BASE_PATH
|
64
74
|
else
|
65
75
|
BASE_PATH
|
66
76
|
end
|
@@ -79,35 +89,33 @@ module SixUpdaterWeb
|
|
79
89
|
tpath.gsub!('/', '\\')
|
80
90
|
ENV['PATH'] = "" unless ENV['PATH']
|
81
91
|
ENV['PATH'] = "#{tpath};#{ENV['PATH']}" unless ENV['PATH'].include?(tpath)
|
82
|
-
else
|
83
|
-
HOME_PATH = ENV['HOME']
|
84
|
-
TEMP_PATH = '/tmp'
|
85
|
-
end
|
86
|
-
DATA_PATH = File.join(File.exists?(File.join(BASE_PATH, "legacy.txt")) ? BASE_PATH : HOME_PATH, "six-updater") # COMPONENT)
|
87
92
|
|
88
|
-
rpath = nil
|
89
|
-
begin
|
90
|
-
rpath = Win32::Registry.open(Win32::Registry::HKEY_LOCAL_MACHINE, ARMA2_STEAM[0])[ARMA2_STEAM[1]]
|
91
|
-
DISTRO = "STEAM"
|
92
|
-
rescue
|
93
|
-
begin
|
94
|
-
rpath = Win32::Registry.open(Win32::Registry::HKEY_LOCAL_MACHINE, ARMA2_ALT[0])[ARMA2_ALT[1]]
|
95
|
-
DISTRO = "ALT"
|
96
|
-
rescue
|
97
93
|
begin
|
98
|
-
rpath = Win32::Registry.open(Win32::Registry::HKEY_LOCAL_MACHINE,
|
99
|
-
|
94
|
+
rpath = Win32::Registry.open(Win32::Registry::HKEY_LOCAL_MACHINE, ARMA2_STEAM[0])[ARMA2_STEAM[1]]
|
95
|
+
distro = "STEAM"
|
100
96
|
rescue
|
101
|
-
|
97
|
+
begin
|
98
|
+
rpath = Win32::Registry.open(Win32::Registry::HKEY_LOCAL_MACHINE, ARMA2_ALT[0])[ARMA2_ALT[1]]
|
99
|
+
distro = "ALT"
|
100
|
+
rescue
|
101
|
+
begin
|
102
|
+
rpath = Win32::Registry.open(Win32::Registry::HKEY_LOCAL_MACHINE, ARMA2[0])[ARMA2[1]]
|
103
|
+
distro = "STANDARD"
|
104
|
+
rescue
|
105
|
+
end
|
106
|
+
end
|
102
107
|
end
|
103
|
-
|
108
|
+
else
|
109
|
+
HOME_PATH = "#{ENV['HOME']}"
|
110
|
+
TEMP_PATH = '/tmp'
|
104
111
|
end
|
105
|
-
|
112
|
+
DATA_PATH = File.join(File.exists?(File.join(BASE_PATH, "legacy.txt")) ? BASE_PATH : HOME_PATH, "six-updater") # COMPONENT)
|
113
|
+
ARMA_PATH, DISTRO = rpath, distro
|
106
114
|
|
107
115
|
module_function
|
108
116
|
|
109
|
-
def logger
|
110
|
-
ActiveRecord::Base.logger
|
117
|
+
def logger
|
118
|
+
ActiveRecord::Base.logger
|
111
119
|
end
|
112
120
|
|
113
121
|
def initialize(config)
|
@@ -116,31 +124,42 @@ module SixUpdaterWeb
|
|
116
124
|
end
|
117
125
|
end
|
118
126
|
|
127
|
+
def prepare_data_path
|
128
|
+
# Arrange appdata!
|
129
|
+
lf = File.join(DATA_PATH, "logs")
|
130
|
+
FileUtils.mkdir_p(lf) unless File.directory?(lf)
|
131
|
+
df = File.join(DATA_PATH, "db")
|
132
|
+
FileUtils.mkdir_p(df) unless File.directory?(df)
|
133
|
+
db = File.join(DATA_PATH, "db", "production.sqlite3")
|
134
|
+
FileUtils.cp(File.join(BASE_PATH, "db", "production.sqlite3"), db) unless File.exists?(db)
|
135
|
+
end
|
136
|
+
|
137
|
+
def print_info
|
138
|
+
puts "Six Updater Web (GUI) #{VERSION}, by Sickboy"
|
139
|
+
puts "BASE: #{BASE_PATH}"
|
140
|
+
puts "DATA: #{DATA_PATH}"
|
141
|
+
puts "ARMA: #{DISTRO} PATH: #{ARMA_PATH}"
|
142
|
+
end
|
143
|
+
|
119
144
|
def after_initialize
|
120
|
-
if defined?(OLDLOCATION) #(TAR2RUBYSCRIPT) #|| RUBYSCRIPT2EXE.is_compiling?
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
operation
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
shell.ShellExecute(file_to_use, arguments, directory, operation, show)
|
139
|
-
rescue
|
140
|
-
#logger.warn "Unable to open browser: #{$!}"
|
141
|
-
end
|
142
|
-
#end
|
143
|
-
end
|
145
|
+
if defined?(OLDLOCATION && SPECIAL) #(TAR2RUBYSCRIPT) #|| RUBYSCRIPT2EXE.is_compiling?
|
146
|
+
case RUBY_PLATFORM
|
147
|
+
when /-mingw32$/, /-mswin32$/
|
148
|
+
return unless defined?(OPEN_BROWSER)
|
149
|
+
#Thread.new() do
|
150
|
+
file_to_use = "#{LOCAL_URL}:#{SIX_PORT}/main"
|
151
|
+
arguments = nil
|
152
|
+
directory = nil
|
153
|
+
operation = "OPEN"
|
154
|
+
show = nil
|
155
|
+
# sleep 3
|
156
|
+
begin
|
157
|
+
shell = WIN32OLE.new('Shell.Application')
|
158
|
+
shell.ShellExecute(file_to_use, arguments, directory, operation, show)
|
159
|
+
rescue
|
160
|
+
#logger.warn "Unable to open browser: #{$!}"
|
161
|
+
end
|
162
|
+
#end
|
144
163
|
end
|
145
164
|
end
|
146
165
|
|
@@ -170,6 +189,7 @@ module SixUpdaterWeb
|
|
170
189
|
)
|
171
190
|
else
|
172
191
|
Dir.chdir(startpath) do
|
192
|
+
# TODO: Properly create seperate process like on windows..
|
173
193
|
p = Process.fork do
|
174
194
|
logger.info "#{app_path} #{cl}"
|
175
195
|
system "#{app_path} #{cl}"
|
@@ -184,31 +204,11 @@ module SixUpdaterWeb
|
|
184
204
|
end
|
185
205
|
end
|
186
206
|
|
187
|
-
|
188
|
-
when /1\.8\.[0-9]/
|
189
|
-
class Array
|
190
|
-
def to_s
|
191
|
-
"[#{self.join(', ')}]"
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
|
196
|
-
puts "Six Updater Web (GUI) #{SixUpdaterWeb::VERSION}, by Sickboy"
|
197
|
-
puts "BASE: #{SixUpdaterWeb::BASE_PATH}"
|
198
|
-
puts "DATA: #{SixUpdaterWeb::DATA_PATH}"
|
199
|
-
puts "ARMA: #{SixUpdaterWeb::DISTRO} PATH: #{SixUpdaterWeb::ARMA_PATH}"
|
207
|
+
SixUpdaterWeb.print_info
|
200
208
|
|
201
209
|
if defined?(SixUpdaterWeb::OLDLOCATION)
|
202
|
-
|
203
|
-
lf = File.join(SixUpdaterWeb::DATA_PATH, "logs")
|
204
|
-
FileUtils.mkdir_p(lf) unless File.directory?(lf)
|
205
|
-
df = File.join(SixUpdaterWeb::DATA_PATH, "db")
|
206
|
-
FileUtils.mkdir_p(df) unless File.directory?(df)
|
207
|
-
db = File.join(SixUpdaterWeb::DATA_PATH, "db", "production.sqlite3")
|
208
|
-
FileUtils.cp(File.join(SixUpdaterWeb::BASE_PATH, "db", "production.sqlite3"), db) unless File.exists?(db)
|
209
|
-
end
|
210
|
+
SixUpdaterWeb.prepare_data_path
|
210
211
|
|
211
|
-
if defined?(SixUpdaterWeb::OLDLOCATION)
|
212
212
|
module Rails
|
213
213
|
class Configuration
|
214
214
|
def database_configuration
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 12
|
8
|
-
-
|
9
|
-
version: 0.12.
|
8
|
+
- 7
|
9
|
+
version: 0.12.7
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Sickboy
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-28 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|