six-updater-web 0.15.4 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +4 -4
- data/bin/six-get +22 -0
- data/bin/six-updater-web +2 -2
- data/bin/six-updater-web-rake +2 -2
- data/lib/six-updater-web/app/controllers/dependentmods_controller.rb +7 -0
- data/lib/six-updater-web/app/controllers/mods_controller.rb +2 -1
- data/lib/six-updater-web/app/helpers/dependentmods_helper.rb +2 -0
- data/lib/six-updater-web/app/models/dependentmod.rb +4 -0
- data/lib/six-updater-web/app/models/mod.rb +13 -1
- data/lib/six-updater-web/app/models/sixconfig.rb +12 -1
- data/lib/six-updater-web/config/environment.rb +7 -1
- data/lib/six-updater-web/config/six-updater-web.rb +73 -1
- data/lib/six-updater-web/db/migrate/20100517174105_create_dependentmods.rb +14 -0
- data/lib/six-updater-web/db/migrate/20100518094056_change3_columns_mods.rb +13 -0
- data/lib/six-updater-web/db/migrate/20100520101650_add_more_indexes.rb +12 -0
- data/lib/six-updater-web/db/schema.rb +12 -2
- data/lib/six-updater-web/lib/tasks/get.rake +156 -0
- data/lib/six-updater-web/lib/tasks/sync.rake +1 -85
- data/lib/six-updater-web/public/goldberg/stylesheets/layout.css +1 -1
- data/lib/six-updater-web/six-get.rb +1 -0
- data/lib/six-updater-web/test/functional/dependentmods_controller_test.rb +8 -0
- data/lib/six-updater-web/test/unit/dependentmod_test.rb +8 -0
- data/lib/six-updater-web/test/unit/helpers/dependentmods_helper_test.rb +4 -0
- data/lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/view_helpers.rb +2 -1
- data/lib/six-updater-web/vendor/plugins/activescaffold_advanced_search/lib/helpers/view_helpers.rb +2 -1
- data/lib/six-updater-web/vendor/plugins/six-db_manager/db/goldberg_controller_actions.yml +6 -0
- data/lib/six-updater-web/vendor/plugins/six-db_manager/db/goldberg_site_controllers.yml +5 -0
- metadata +21 -8
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.
|
10
|
+
s.version = '0.16.0'
|
11
11
|
s.has_rdoc = false
|
12
12
|
#s.extra_rdoc_files = ['README', 'LICENSE']
|
13
13
|
s.summary = 'Your summary here'
|
@@ -17,10 +17,10 @@ spec = Gem::Specification.new do |s|
|
|
17
17
|
s.files = %w(LICENSE README Rakefile) + Dir.glob("{bin,spec}/**/*") + Dir.glob("lib/**/*")
|
18
18
|
s.require_path = "lib"
|
19
19
|
s.bindir = "bin"
|
20
|
-
s.executables = ['six-updater-web', 'six-updater-web-rake']
|
20
|
+
s.executables = ['six-updater-web', 'six-updater-web-rake', 'six-get']
|
21
21
|
s.add_dependency('uuidtools', '>= 2.0.0')
|
22
|
-
s.add_dependency('six-updater', '>= 0.
|
23
|
-
s.add_dependency('rails', '2.3.
|
22
|
+
s.add_dependency('six-updater', '>= 0.17.0')
|
23
|
+
s.add_dependency('rails', '2.3.6')
|
24
24
|
s.add_dependency('haml', '>= 2.2.0')
|
25
25
|
s.add_dependency('RedCloth', '>= 4.2.2')
|
26
26
|
end
|
data/bin/six-get
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
require 'rake'
|
4
|
+
|
5
|
+
begin
|
6
|
+
unless ARGV.empty?
|
7
|
+
ARGV[0] = "get:#{ARGV[0]}"
|
8
|
+
end
|
9
|
+
load 'six-updater-web/_rake.rb'
|
10
|
+
rescue => e
|
11
|
+
puts e.class, e.message, e.backtrace.join("\n")
|
12
|
+
begin
|
13
|
+
require 'fileutils'
|
14
|
+
path = File.join(SixUpdaterWeb::DATA_PATH, 'logs')
|
15
|
+
FileUtils.mkdir_p path unless File.exists?(path)
|
16
|
+
File.open(File.join(path, "six-updater-web-error.log"), 'w') {|f| f.puts e.class, e.message, e.backtrace.join("\n")}
|
17
|
+
rescue => e
|
18
|
+
puts "ERROR: #{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
19
|
+
end
|
20
|
+
sleep 5
|
21
|
+
Process.exit(1) # Return error-1
|
22
|
+
end
|
data/bin/six-updater-web
CHANGED
@@ -10,8 +10,8 @@ rescue => e
|
|
10
10
|
path = File.join(SixUpdaterWeb::DATA_PATH, 'logs')
|
11
11
|
FileUtils.mkdir_p path unless File.exists?(path)
|
12
12
|
File.open(File.join(path, "six-updater-web-error.log"), 'w') {|f| f.puts e.class, e.message, e.backtrace.join("\n")}
|
13
|
-
rescue
|
14
|
-
puts "ERROR: #{
|
13
|
+
rescue => e
|
14
|
+
puts "ERROR: #{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
15
15
|
end
|
16
16
|
sleep 5
|
17
17
|
Process.exit(1) # Return error-1
|
data/bin/six-updater-web-rake
CHANGED
@@ -11,8 +11,8 @@ rescue => e
|
|
11
11
|
path = File.join(SixUpdaterWeb::DATA_PATH, 'logs')
|
12
12
|
FileUtils.mkdir_p path unless File.exists?(path)
|
13
13
|
File.open(File.join(path, "six-updater-web-error.log"), 'w') {|f| f.puts e.class, e.message, e.backtrace.join("\n")}
|
14
|
-
rescue
|
15
|
-
puts "ERROR: #{
|
14
|
+
rescue => e
|
15
|
+
puts "ERROR: #{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
16
16
|
end
|
17
17
|
sleep 5
|
18
18
|
Process.exit(1) # Return error-1
|
@@ -10,6 +10,7 @@ class ModsController < ApplicationController
|
|
10
10
|
:sixconfigs,
|
11
11
|
:networks,
|
12
12
|
:queryservers,
|
13
|
+
:depmods,
|
13
14
|
# :created_at,
|
14
15
|
:updated_at,
|
15
16
|
:priority,
|
@@ -36,7 +37,7 @@ class ModsController < ApplicationController
|
|
36
37
|
# config.columns[:changelog_link].label = "Changelog"
|
37
38
|
config.columns[:queryservers].label = "Gamespy servers"
|
38
39
|
|
39
|
-
[:networks, :servers, :queryservers, :sixconfigs].each do |c|
|
40
|
+
[:depmods, :networks, :servers, :queryservers, :sixconfigs].each do |c|
|
40
41
|
config.columns[c].form_ui = :record_select
|
41
42
|
end
|
42
43
|
|
@@ -4,8 +4,20 @@ class Mod < ActiveRecord::Base
|
|
4
4
|
has_and_belongs_to_many :queryservers
|
5
5
|
has_and_belongs_to_many :networks
|
6
6
|
|
7
|
+
has_many :dependentmods
|
8
|
+
has_many :depmods, :through => :dependentmods
|
9
|
+
|
7
10
|
six_guid
|
8
11
|
|
12
|
+
def all_depmods
|
13
|
+
mods = []
|
14
|
+
self.depmods.each do |mod|
|
15
|
+
mods << mod
|
16
|
+
mods += mod.all_depmods
|
17
|
+
end
|
18
|
+
mods.uniq
|
19
|
+
end
|
20
|
+
|
9
21
|
def real_name
|
10
22
|
return unless self.name
|
11
23
|
case RUBY_PLATFORM
|
@@ -17,7 +29,7 @@ class Mod < ActiveRecord::Base
|
|
17
29
|
end
|
18
30
|
|
19
31
|
def installed?
|
20
|
-
!self.version_local.empty?
|
32
|
+
self.version_local && !self.version_local.empty?
|
21
33
|
end
|
22
34
|
|
23
35
|
def exists?(setting)
|
@@ -17,7 +17,9 @@ class Sixconfig < ActiveRecord::Base
|
|
17
17
|
m += srv.mods if srv
|
18
18
|
self.mods.each { |mod| m << mod unless m.include?(mod) }
|
19
19
|
m.each {|mod| if (mod.new_record? && !mod.exists?(self.appsetting)); mod.disabled = true; end }
|
20
|
-
|
20
|
+
ms = []
|
21
|
+
m.each {|mod| ms << mod; ms += mod.all_depmods}
|
22
|
+
ms.uniq
|
21
23
|
end
|
22
24
|
|
23
25
|
def exec
|
@@ -131,6 +133,15 @@ class Sixconfig < ActiveRecord::Base
|
|
131
133
|
end
|
132
134
|
end
|
133
135
|
|
136
|
+
def imp(setting = Appsetting.new)
|
137
|
+
Mod.find(:all).each do |mod|
|
138
|
+
mod.update_version(setting.real_path)
|
139
|
+
mod.save if mod.changed?
|
140
|
+
next unless mod.installed?
|
141
|
+
self.mods << mod unless self.mods.include?(mod)
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
134
145
|
def self.start_updater(cl)
|
135
146
|
SixUpdaterWeb.run_program(self.exec, SixUpdaterWeb::BASE_PATH, cl)
|
136
147
|
end
|
@@ -1,7 +1,13 @@
|
|
1
1
|
# Be sure to restart your server when you modify this file
|
2
2
|
|
3
3
|
# Specifies gem version of Rails to use when vendor/rails is not present
|
4
|
-
RAILS_GEM_VERSION = '2.3.
|
4
|
+
RAILS_GEM_VERSION = '2.3.6' unless defined? RAILS_GEM_VERSION
|
5
|
+
|
6
|
+
class String
|
7
|
+
def safe_concat(v)
|
8
|
+
self.concat(v)
|
9
|
+
end
|
10
|
+
end
|
5
11
|
|
6
12
|
# Bootstrap the Rails environment, frameworks, and default configuration
|
7
13
|
require_relative 'boot'
|
@@ -22,7 +22,7 @@ case RUBY_VERSION
|
|
22
22
|
end
|
23
23
|
|
24
24
|
module SixUpdaterWeb
|
25
|
-
VERSION = "0.
|
25
|
+
VERSION = "0.16.0"
|
26
26
|
COMPONENT = "six-updater-web"
|
27
27
|
|
28
28
|
DEFAULT_IP = "127.0.0.1" unless defined?(DEFAULT_IP)
|
@@ -119,6 +119,78 @@ module SixUpdaterWeb
|
|
119
119
|
|
120
120
|
module_function
|
121
121
|
|
122
|
+
def update_gamespy
|
123
|
+
puts "Fetching server info..."
|
124
|
+
geo = ENV['NOGEO'] ? "" : nil
|
125
|
+
#geo = ""
|
126
|
+
puts "Pings and Countries: #{geo.nil?}"
|
127
|
+
puts ""
|
128
|
+
|
129
|
+
q = Six::Query::GamespyMaster.new(geo)
|
130
|
+
h = q.process
|
131
|
+
|
132
|
+
puts ""
|
133
|
+
puts "Received #{h.size} servers"
|
134
|
+
|
135
|
+
puts ""
|
136
|
+
puts "Updating database..."
|
137
|
+
|
138
|
+
i, saved = 0, 0
|
139
|
+
ids = []
|
140
|
+
#hasj = Hash.new
|
141
|
+
timestart = Time.now
|
142
|
+
h.each_pair do |key, e|
|
143
|
+
i += 1
|
144
|
+
time = Time.now
|
145
|
+
r = Queryserver.import(e)
|
146
|
+
next unless r
|
147
|
+
if r[0].changed?
|
148
|
+
#hasj[r[0].id] = r[1]
|
149
|
+
saved += 1
|
150
|
+
r[0].save
|
151
|
+
else
|
152
|
+
ids << r[0].id
|
153
|
+
end
|
154
|
+
print "#{i} / #{h.keys.size}, took #{SixUpdaterWeb::stamp(time)}s\r"
|
155
|
+
end
|
156
|
+
puts "Saved: #{saved}, Unchanged: #{h.keys.size - saved}. Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
157
|
+
|
158
|
+
=begin
|
159
|
+
timestart = Time.now
|
160
|
+
puts "Updating #{hasj.keys.size} records..."
|
161
|
+
begin
|
162
|
+
Queryserver.update(hasj.keys, hasj.values) unless hasj.keys.empty?
|
163
|
+
rescue => e
|
164
|
+
puts "#{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
165
|
+
sleep 3
|
166
|
+
ensure
|
167
|
+
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
168
|
+
end
|
169
|
+
=end
|
170
|
+
|
171
|
+
timestart = Time.now
|
172
|
+
puts "Tagging... #{ids.size} records"
|
173
|
+
begin
|
174
|
+
Queryserver.update_all("updated_at = '#{Time.now}'", ["id in (?)",ids]) unless ids.empty?
|
175
|
+
rescue => e
|
176
|
+
puts "#{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
177
|
+
ensure
|
178
|
+
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
179
|
+
end
|
180
|
+
|
181
|
+
puts "Pruning database..."
|
182
|
+
timestart = Time.now
|
183
|
+
Queryserver.prune
|
184
|
+
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
185
|
+
|
186
|
+
puts "Cleaning database..."
|
187
|
+
timestart = Time.now
|
188
|
+
Queryserver.clean
|
189
|
+
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
190
|
+
puts ""
|
191
|
+
puts "Done!"
|
192
|
+
end
|
193
|
+
|
122
194
|
def logger
|
123
195
|
ActiveRecord::Base.logger
|
124
196
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
class CreateDependentmods < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :dependentmods do |t| # , :id => false
|
4
|
+
t.string :mod_id, :limit => 36
|
5
|
+
t.string :depmod_id, :limit => 36
|
6
|
+
|
7
|
+
t.timestamps :lock_version => false
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.down
|
12
|
+
drop_table :dependentmods
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
class Change3ColumnsMods < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
add_column :mods, :size, :integer, :default => 0
|
4
|
+
add_column :mods, :size_wd, :integer, :default => 0
|
5
|
+
add_column :mods, :updated_version, :datetime
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.down
|
9
|
+
remove_column :mods, :size
|
10
|
+
remove_column :mods, :size_wd
|
11
|
+
remove_column :mods, :updated_version
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
class AddMoreIndexes < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
#add_index :mods_queryservers, :mod_id # Already exists
|
4
|
+
#add_index :mods_queryservers, :queryserver_id # Already exists
|
5
|
+
add_index :queryservers, :name
|
6
|
+
add_index :queryservers, [:ip, :port]
|
7
|
+
#add_index :mods, :name # Already exists
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.down
|
11
|
+
end
|
12
|
+
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 => 20100518094056) 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,13 @@ ActiveRecord::Schema.define(:version => 20100425143140) do
|
|
31
31
|
t.string "modpath"
|
32
32
|
end
|
33
33
|
|
34
|
+
create_table "dependentmods", :force => true do |t|
|
35
|
+
t.string "mod_id", :limit => 36
|
36
|
+
t.string "depmod_id", :limit => 36
|
37
|
+
t.datetime "created_at"
|
38
|
+
t.datetime "updated_at"
|
39
|
+
end
|
40
|
+
|
34
41
|
create_table "goldberg_content_pages", :force => true do |t|
|
35
42
|
t.string "title"
|
36
43
|
t.string "name", :null => false
|
@@ -159,7 +166,7 @@ ActiveRecord::Schema.define(:version => 20100425143140) do
|
|
159
166
|
end
|
160
167
|
|
161
168
|
create_table "mods", :id => false, :force => true do |t|
|
162
|
-
t.string "id",
|
169
|
+
t.string "id", :limit => 36, :null => false
|
163
170
|
t.string "name"
|
164
171
|
t.datetime "created_at"
|
165
172
|
t.datetime "updated_at"
|
@@ -169,6 +176,9 @@ ActiveRecord::Schema.define(:version => 20100425143140) do
|
|
169
176
|
t.boolean "disabled"
|
170
177
|
t.string "path"
|
171
178
|
t.integer "priority"
|
179
|
+
t.integer "size", :default => 0
|
180
|
+
t.integer "size_wd", :default => 0
|
181
|
+
t.datetime "updated_version"
|
172
182
|
end
|
173
183
|
|
174
184
|
create_table "mods_networks", :id => false, :force => true do |t|
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# Basic apt-get like behaviour
|
2
|
+
namespace :get do
|
3
|
+
|
4
|
+
def get_preset
|
5
|
+
name = ENV['PRESET'] ? ENV['PRESET'] : "console"
|
6
|
+
set = ENV['SETTING'] ? ENV['SETTING'] : "console"
|
7
|
+
preset = ENV['DYNAMIC'] ? Sixconfig.new : Sixconfig.find_by_name(name) ? Sixconfig.find_by_name(name) : Sixconfig.new(:name => name)
|
8
|
+
if !preset.appsetting || ENV['SETTING']
|
9
|
+
preset.appsetting = if Appsetting.find_by_name(set)
|
10
|
+
Appsetting.find_by_name(set)
|
11
|
+
else
|
12
|
+
Appsetting.new(:name => set)
|
13
|
+
end
|
14
|
+
preset.appsetting.save if preset.appsetting.changed? || preset.appsetting.new?
|
15
|
+
#preset.save
|
16
|
+
end
|
17
|
+
preset
|
18
|
+
end
|
19
|
+
|
20
|
+
# Display the mods setup for the preset, local version, remote version, etc
|
21
|
+
# List installed mods, local version, remote version, etc
|
22
|
+
# You can first import
|
23
|
+
task :list => :environment do
|
24
|
+
preset = get_preset
|
25
|
+
puts "#{preset.name} (#{preset.mods.size} mods)"
|
26
|
+
preset.mods.each do |mod|
|
27
|
+
depmods = mod.all_depmods
|
28
|
+
puts "#{mod.name} (v#{mod.version_local}/#{mod.version}, #{mod.size}B, Last updated: #{mod.updated_version}), #{depmods.size} dependencies: #{depmods.map{|e| e.name}.join(", ")}"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
# Find selected available mods, and their dependencies
|
33
|
+
task :query => :environment do
|
34
|
+
mods = []
|
35
|
+
if ENV['MOD']
|
36
|
+
ENV['MOD'].split(",").each do |mod|
|
37
|
+
mods << Mod.find_by_name(mod)
|
38
|
+
end
|
39
|
+
else
|
40
|
+
mods = Mod.find(:all)
|
41
|
+
end
|
42
|
+
mods.each do |mod|
|
43
|
+
depmods = mod.all_depmods
|
44
|
+
puts "#{mod.name} (v#{mod.version}, #{mod.size}B, Last updated: #{mod.updated_version}), #{depmods.size} dependencies: #{depmods.map{|e| e.name}.join(", ")}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
# Find selected available servers, and their dependencies
|
49
|
+
task :query_server => :environment do
|
50
|
+
servers = []
|
51
|
+
if ENV['SERVER']
|
52
|
+
ENV['SERVER'].split(",").each do |server|
|
53
|
+
servers << Queryserver.find_by_name(server)
|
54
|
+
end
|
55
|
+
else
|
56
|
+
servers = Queryserver.find(:all)
|
57
|
+
end
|
58
|
+
servers.each do |server|
|
59
|
+
puts "#{server.name}: #{server.country} / #{server.ping}ms"
|
60
|
+
server.mods.each do |mod|
|
61
|
+
depmods = mod.all_depmods
|
62
|
+
puts "#{mod.name} (v#{mod.version}, #{mod.size}B, Last updated: #{mod.updated_version}), #{depmods.size} dependencies: #{depmods.map{|e| e.name}.join(", ")}"
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
# Import the mods installed on system into the preset
|
68
|
+
task :import => :environment do
|
69
|
+
preset = get_preset
|
70
|
+
preset.imp
|
71
|
+
preset.mods.each do |mod|
|
72
|
+
depmods = mod.all_depmods
|
73
|
+
puts "#{mod.name} (v#{mod.version}, #{mod.size}B, Last updated: #{mod.updated_version}), #{depmods.size} dependencies: #{depmods.map{|e| e.name}.join(", ")}"
|
74
|
+
end
|
75
|
+
preset.save unless ENV['DYNAMIC']
|
76
|
+
end
|
77
|
+
|
78
|
+
# Save yaml with selected mod including dependencies
|
79
|
+
task :save => :environment do
|
80
|
+
# Create dynamic preset
|
81
|
+
preset = get_preset
|
82
|
+
|
83
|
+
# Find specified mod(s)
|
84
|
+
# Dependent mods are auto handled through Sixconfig instance method all_mods
|
85
|
+
ENV['MOD'].split(",").each do |mod|
|
86
|
+
m = Mod.find_by_name(mod)
|
87
|
+
if m
|
88
|
+
preset.mods << m unless preset.mods.include? m
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
# Set mods skip status if FORCE parameter included
|
93
|
+
preset.all_mods.each {|mod| mod.skip = false} if ENV['FORCE']
|
94
|
+
|
95
|
+
puts "Saving (incl dependencies): #{preset.all_mods.map {|e| "#{e.name} (#{e.size}B)"}.join(",")}"
|
96
|
+
|
97
|
+
# Output the updater yaml
|
98
|
+
preset.output_yml
|
99
|
+
|
100
|
+
# Save the console preset
|
101
|
+
preset.save unless ENV['DYNAMIC']
|
102
|
+
end
|
103
|
+
|
104
|
+
# Upgrade the installed mods
|
105
|
+
task :upgrade => :environment do
|
106
|
+
# Select default preset or Create dynamic preset
|
107
|
+
preset = get_preset
|
108
|
+
|
109
|
+
# Set mods skip status if FORCE parameter included
|
110
|
+
preset.all_mods.each {|mod| mod.skip = false} if ENV['FORCE']
|
111
|
+
|
112
|
+
puts "Upgrading (incl dependencies): #{preset.all_mods.map {|e| "#{e.name} (#{e.size}B)" }.join(",")}"
|
113
|
+
|
114
|
+
# Output the updater yaml
|
115
|
+
preset.output_yml(preset.appsetting) #, server
|
116
|
+
# Run the config through the updater
|
117
|
+
Sixconfig.start_updater("--update --wait")
|
118
|
+
# Save the console preset
|
119
|
+
preset.save unless ENV['DYNAMIC']
|
120
|
+
end
|
121
|
+
|
122
|
+
# Install the selected mod including dependencies
|
123
|
+
task :install => :environment do
|
124
|
+
# Select default preset or Create dynamic preset
|
125
|
+
preset = get_preset
|
126
|
+
|
127
|
+
# Find specified mod(s)
|
128
|
+
# Dependent mods are auto handled through Sixconfig instance method all_mods
|
129
|
+
ENV['MOD'].split(",").each do |mod|
|
130
|
+
preset.mods << Mod.find_by_name(mod)
|
131
|
+
end
|
132
|
+
|
133
|
+
# Set mods skip status if FORCE parameter included
|
134
|
+
preset.all_mods.each {|mod| mod.skip = false} if ENV['FORCE']
|
135
|
+
|
136
|
+
puts "Installing (incl dependencies): #{preset.all_mods.map {|e| "#{e.name} (#{e.size}B)" }.join(",")}"
|
137
|
+
|
138
|
+
# Output the updater yaml
|
139
|
+
preset.output_yml(preset.appsetting) #, server
|
140
|
+
# Run the config through the updater
|
141
|
+
Sixconfig.start_updater("--install --wait")
|
142
|
+
# Save the console preset
|
143
|
+
preset.save unless ENV['DYNAMIC']
|
144
|
+
end
|
145
|
+
|
146
|
+
# Update the list of mods/mirrors
|
147
|
+
task :update => :environment do
|
148
|
+
system_setting = SystemSetting.singleton
|
149
|
+
puts system_setting.sync
|
150
|
+
end
|
151
|
+
|
152
|
+
# Update the list of servers
|
153
|
+
task :update_servers => :environment do
|
154
|
+
SixUpdaterWeb.update_gamespy
|
155
|
+
end
|
156
|
+
end
|
@@ -5,75 +5,7 @@ namespace :sync do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
task :gamespy => :environment do
|
8
|
-
|
9
|
-
geo = ENV['NOGEO'] ? "" : nil
|
10
|
-
#geo = ""
|
11
|
-
puts "Pings and Countries: #{geo.nil?}"
|
12
|
-
puts ""
|
13
|
-
|
14
|
-
q = Six::Query::GamespyMaster.new(geo)
|
15
|
-
h = q.process
|
16
|
-
|
17
|
-
puts ""
|
18
|
-
puts "Received #{h.size} servers"
|
19
|
-
|
20
|
-
puts ""
|
21
|
-
puts "Updating database..."
|
22
|
-
|
23
|
-
i, saved = 0, 0
|
24
|
-
ids = []
|
25
|
-
#hasj = Hash.new
|
26
|
-
timestart = Time.now
|
27
|
-
h.each_pair do |key, e|
|
28
|
-
i += 1
|
29
|
-
time = Time.now
|
30
|
-
r = Queryserver.import(e)
|
31
|
-
next unless r
|
32
|
-
if r[0].changed?
|
33
|
-
#hasj[r[0].id] = r[1]
|
34
|
-
saved += 1
|
35
|
-
r[0].save
|
36
|
-
else
|
37
|
-
ids << r[0].id
|
38
|
-
end
|
39
|
-
print "#{i} / #{h.keys.size}, took #{SixUpdaterWeb::stamp(time)}s\r"
|
40
|
-
end
|
41
|
-
puts "Saved: #{saved}, Unchanged: #{h.keys.size - saved}. Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
42
|
-
|
43
|
-
=begin
|
44
|
-
timestart = Time.now
|
45
|
-
puts "Updating #{hasj.keys.size} records..."
|
46
|
-
begin
|
47
|
-
Queryserver.update(hasj.keys, hasj.values) unless hasj.keys.empty?
|
48
|
-
rescue => e
|
49
|
-
puts "#{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
50
|
-
sleep 3
|
51
|
-
ensure
|
52
|
-
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
53
|
-
end
|
54
|
-
=end
|
55
|
-
|
56
|
-
timestart = Time.now
|
57
|
-
puts "Tagging... #{ids.size} records"
|
58
|
-
begin
|
59
|
-
Queryserver.update_all("updated_at = '#{Time.now}'", ["id in (?)",ids]) unless ids.empty?
|
60
|
-
rescue => e
|
61
|
-
puts "#{e.class}: #{e.message} #{e.backtrace.join("\n")}"
|
62
|
-
ensure
|
63
|
-
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
64
|
-
end
|
65
|
-
|
66
|
-
puts "Pruning database..."
|
67
|
-
timestart = Time.now
|
68
|
-
Queryserver.prune
|
69
|
-
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
70
|
-
|
71
|
-
puts "Cleaning database..."
|
72
|
-
timestart = Time.now
|
73
|
-
Queryserver.clean
|
74
|
-
puts "Took: #{SixUpdaterWeb::stamp(timestart)}s"
|
75
|
-
puts ""
|
76
|
-
puts "Done!"
|
8
|
+
SixUpdaterWeb.update_gamespy
|
77
9
|
sleep 3
|
78
10
|
end
|
79
11
|
|
@@ -84,20 +16,4 @@ namespace :sync do
|
|
84
16
|
task :data => :environment do
|
85
17
|
Six::Dbmanager.reload_data
|
86
18
|
end
|
87
|
-
|
88
|
-
task :integrated => :environment do
|
89
|
-
Sixconfig.start_updater_inweb("--install")
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
|
94
|
-
task :export => :environment do
|
95
|
-
if ENV.include?("preset")
|
96
|
-
config = Sixconfig.find(ENV['preset'].to_i)
|
97
|
-
File.open(File.join(SixUpdaterWeb::DATA_PATH, 'six-updater.yml'), 'w') do |file|
|
98
|
-
file.puts config.to_updater_yml
|
99
|
-
end
|
100
|
-
else
|
101
|
-
puts "Error: No preset selected"
|
102
|
-
end
|
103
19
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
system "rake get:#{ARGV.join(" ")}"
|
data/lib/six-updater-web/vendor/plugins/active_scaffold/lib/active_scaffold/helpers/view_helpers.rb
CHANGED
@@ -119,7 +119,8 @@ module ActiveScaffold
|
|
119
119
|
options[:concat] += '_ie' if options[:concat].is_a? String
|
120
120
|
ie_css = stylesheet_link_tag(*active_scaffold_ie_stylesheets(frontend).push(options))
|
121
121
|
|
122
|
-
js + "\n" + css + "\n<!--[if IE]>" + ie_css + "<![endif]-->\n"
|
122
|
+
#js + "\n" + css + "\n<!--[if IE]>" + ie_css + "<![endif]-->\n"
|
123
|
+
"#{js}\n#{css}\n<!--[if IE]>#{ie_css}<![endif]-->\n"
|
123
124
|
end
|
124
125
|
|
125
126
|
# a general-use loading indicator (the "stuff is happening, please wait" feedback)
|
data/lib/six-updater-web/vendor/plugins/activescaffold_advanced_search/lib/helpers/view_helpers.rb
CHANGED
@@ -9,7 +9,8 @@ module ActiveScaffold
|
|
9
9
|
# ie_css = stylesheet_link_tag(ActiveScaffold::Config::Core.asset_path("export-stylesheet-ie.css", frontend))
|
10
10
|
ie_css = ""
|
11
11
|
js = javascript_include_tag(ActiveScaffold::Config::Core.asset_path('advanced_search.js', frontend))
|
12
|
-
active_scaffold_includes_without_advanced_search + "\n" + css + "\n<!--[if IE]>" + ie_css + "<![endif]-->\n" + js
|
12
|
+
#active_scaffold_includes_without_advanced_search + "\n" + css + "\n<!--[if IE]>" + ie_css + "<![endif]-->\n" + js
|
13
|
+
"#{active_scaffold_includes_without_advanced_search}\n#{css}\n<!--[if IE]>#{ie_css}<![endif]-->\n#{js}"
|
13
14
|
end
|
14
15
|
alias_method_chain :active_scaffold_includes, :advanced_search
|
15
16
|
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
8
|
-
-
|
9
|
-
version: 0.
|
7
|
+
- 16
|
8
|
+
- 0
|
9
|
+
version: 0.16.0
|
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-05-
|
17
|
+
date: 2010-05-23 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -42,9 +42,9 @@ dependencies:
|
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
segments:
|
44
44
|
- 0
|
45
|
-
-
|
45
|
+
- 17
|
46
46
|
- 0
|
47
|
-
version: 0.
|
47
|
+
version: 0.17.0
|
48
48
|
type: :runtime
|
49
49
|
version_requirements: *id002
|
50
50
|
- !ruby/object:Gem::Dependency
|
@@ -58,8 +58,8 @@ dependencies:
|
|
58
58
|
segments:
|
59
59
|
- 2
|
60
60
|
- 3
|
61
|
-
-
|
62
|
-
version: 2.3.
|
61
|
+
- 6
|
62
|
+
version: 2.3.6
|
63
63
|
type: :runtime
|
64
64
|
version_requirements: *id003
|
65
65
|
- !ruby/object:Gem::Dependency
|
@@ -97,6 +97,7 @@ email: sb@dev-heaven.net
|
|
97
97
|
executables:
|
98
98
|
- six-updater-web
|
99
99
|
- six-updater-web-rake
|
100
|
+
- six-get
|
100
101
|
extensions: []
|
101
102
|
|
102
103
|
extra_rdoc_files: []
|
@@ -105,11 +106,13 @@ files:
|
|
105
106
|
- LICENSE
|
106
107
|
- README
|
107
108
|
- Rakefile
|
109
|
+
- bin/six-get
|
108
110
|
- bin/six-updater-web
|
109
111
|
- bin/six-updater-web-rake
|
110
112
|
- lib/six-updater-web/app/controllers/actions_controller.rb
|
111
113
|
- lib/six-updater-web/app/controllers/application_controller.rb
|
112
114
|
- lib/six-updater-web/app/controllers/appsettings_controller.rb
|
115
|
+
- lib/six-updater-web/app/controllers/dependentmods_controller.rb
|
113
116
|
- lib/six-updater-web/app/controllers/logsessions_controller.rb
|
114
117
|
- lib/six-updater-web/app/controllers/logs_controller.rb
|
115
118
|
- lib/six-updater-web/app/controllers/logviews_controller.rb
|
@@ -124,6 +127,7 @@ files:
|
|
124
127
|
- lib/six-updater-web/app/helpers/actions_helper.rb
|
125
128
|
- lib/six-updater-web/app/helpers/application_helper.rb
|
126
129
|
- lib/six-updater-web/app/helpers/appsettings_helper.rb
|
130
|
+
- lib/six-updater-web/app/helpers/dependentmods_helper.rb
|
127
131
|
- lib/six-updater-web/app/helpers/logsessions_helper.rb
|
128
132
|
- lib/six-updater-web/app/helpers/logs_helper.rb
|
129
133
|
- lib/six-updater-web/app/helpers/logviews_helper.rb
|
@@ -137,6 +141,7 @@ files:
|
|
137
141
|
- lib/six-updater-web/app/helpers/system_settings_helper.rb
|
138
142
|
- lib/six-updater-web/app/models/action.rb
|
139
143
|
- lib/six-updater-web/app/models/appsetting.rb
|
144
|
+
- lib/six-updater-web/app/models/dependentmod.rb
|
140
145
|
- lib/six-updater-web/app/models/log.rb
|
141
146
|
- lib/six-updater-web/app/models/logsession.rb
|
142
147
|
- lib/six-updater-web/app/models/log_observer.rb
|
@@ -213,10 +218,14 @@ files:
|
|
213
218
|
- lib/six-updater-web/db/migrate/20100409114653_add_priority_and_path_to_mods.rb
|
214
219
|
- lib/six-updater-web/db/migrate/20100425121901_create_networks.rb
|
215
220
|
- lib/six-updater-web/db/migrate/20100425143140_change_repositories_column.rb
|
221
|
+
- lib/six-updater-web/db/migrate/20100517174105_create_dependentmods.rb
|
222
|
+
- lib/six-updater-web/db/migrate/20100518094056_change3_columns_mods.rb
|
223
|
+
- lib/six-updater-web/db/migrate/20100520101650_add_more_indexes.rb
|
216
224
|
- lib/six-updater-web/db/schema.rb
|
217
225
|
- lib/six-updater-web/doc/README_FOR_APP
|
218
226
|
- lib/six-updater-web/init.rb
|
219
227
|
- lib/six-updater-web/lib/tasks/fixtures.rake
|
228
|
+
- lib/six-updater-web/lib/tasks/get.rake
|
220
229
|
- lib/six-updater-web/lib/tasks/sync.rake
|
221
230
|
- lib/six-updater-web/lib/wrapper.rb
|
222
231
|
- lib/six-updater-web/log/production.log
|
@@ -297,8 +306,10 @@ files:
|
|
297
306
|
- lib/six-updater-web/script/plugin
|
298
307
|
- lib/six-updater-web/script/runner
|
299
308
|
- lib/six-updater-web/script/server
|
309
|
+
- lib/six-updater-web/six-get.rb
|
300
310
|
- lib/six-updater-web/test/functional/actions_controller_test.rb
|
301
311
|
- lib/six-updater-web/test/functional/configs_controller_test.rb
|
312
|
+
- lib/six-updater-web/test/functional/dependentmods_controller_test.rb
|
302
313
|
- lib/six-updater-web/test/functional/logsessions_controller_test.rb
|
303
314
|
- lib/six-updater-web/test/functional/logs_controller_test.rb
|
304
315
|
- lib/six-updater-web/test/functional/logviews_controller_test.rb
|
@@ -314,8 +325,10 @@ files:
|
|
314
325
|
- lib/six-updater-web/test/test_helper.rb
|
315
326
|
- lib/six-updater-web/test/unit/action_test.rb
|
316
327
|
- lib/six-updater-web/test/unit/config_test.rb
|
328
|
+
- lib/six-updater-web/test/unit/dependentmod_test.rb
|
317
329
|
- lib/six-updater-web/test/unit/helpers/actions_helper_test.rb
|
318
330
|
- lib/six-updater-web/test/unit/helpers/configs_helper_test.rb
|
331
|
+
- lib/six-updater-web/test/unit/helpers/dependentmods_helper_test.rb
|
319
332
|
- lib/six-updater-web/test/unit/helpers/logsessions_helper_test.rb
|
320
333
|
- lib/six-updater-web/test/unit/helpers/logs_helper_test.rb
|
321
334
|
- lib/six-updater-web/test/unit/helpers/logviews_helper_test.rb
|