six-updater-web 0.20.5 → 0.20.7

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.20.5'
10
+ s.version = '0.20.7'
11
11
  s.has_rdoc = false
12
12
  #s.extra_rdoc_files = ['README', 'LICENSE']
13
13
  s.summary = 'Your summary here'
@@ -207,8 +207,8 @@ class MainController < ApplicationController
207
207
  if server
208
208
  @msg << "Override server: <a href='/queryservers/edit/#{queryserver.id}' title='#{queryserver.mods.map{|e| e.name}.join(", ")}'>#{queryserver.to_label}</a>"
209
209
  else
210
- if preset.server
211
- server = preset.server
210
+ if preset.get_server
211
+ server = preset.get_server
212
212
  @msg << "Preset server: <a href='/servers/edit/#{server.id}' title='#{server.mods.map{|e| e.name}.join(", ")}'>#{server.to_label}"
213
213
  end
214
214
  end
@@ -6,6 +6,7 @@ class SixconfigsController < ApplicationController
6
6
  config.columns = [
7
7
  :name,
8
8
  :mods,
9
+ :queryserver,
9
10
  :server,
10
11
  :appsetting,
11
12
  :action,
@@ -22,7 +23,7 @@ class SixconfigsController < ApplicationController
22
23
  config.create.columns.exclude :exec
23
24
 
24
25
 
25
- [:mods, :server, :appsetting, :action].each do |c|
26
+ [:mods, :queryserver, :server, :appsetting, :action].each do |c|
26
27
  config.columns[c].form_ui = :record_select
27
28
  end
28
29
 
@@ -14,10 +14,11 @@ class Mod < ActiveRecord::Base
14
14
 
15
15
 
16
16
  def all_dependentmods(mods = [])
17
+ mods += [self]
17
18
  self.mods.each do |mod|
18
19
  next if mods.include?(mod)
19
- mods << mod
20
20
  mods += mod.all_dependentmods(mods)
21
+ mods << mod
21
22
  end
22
23
  mods.uniq
23
24
  end
@@ -10,6 +10,7 @@ class Queryserver < ActiveRecord::Base
10
10
  serialize :signatures, Array
11
11
 
12
12
  has_and_belongs_to_many :mods
13
+ has_many :sixconfigs
13
14
 
14
15
  def address
15
16
  [self.ip, self.port].join(":")
@@ -107,6 +108,10 @@ class Queryserver < ActiveRecord::Base
107
108
  s
108
109
  end
109
110
 
111
+ def to_updater_yml
112
+ self.dynamic_server.to_updater_yml
113
+ end
114
+
110
115
  def exec2
111
116
  ""
112
117
  end
@@ -1,5 +1,7 @@
1
1
  class Sixconfig < ActiveRecord::Base
2
2
  has_and_belongs_to_many :mods
3
+
4
+ belongs_to :queryserver
3
5
  belongs_to :server
4
6
  belongs_to :appsetting
5
7
  belongs_to :action
@@ -12,13 +14,13 @@ class Sixconfig < ActiveRecord::Base
12
14
  end
13
15
  end
14
16
 
15
- def all_mods(srv = self.server)
17
+ def all_mods(srv = self.get_server)
16
18
  m = []
17
19
  m += srv.mods if srv
18
20
  self.mods.each { |mod| m << mod unless m.include?(mod) }
19
21
  m.each {|mod| if (mod.new_record? && !mod.exists?(self.appsetting)); mod.disabled = true; end }
20
22
  ms = []
21
- m.each {|mod| ms << mod; ms += mod.all_dependentmods}
23
+ m.each {|mod| ms += mod.all_dependentmods; ms << mod }
22
24
  ms.uniq
23
25
  end
24
26
 
@@ -59,6 +61,25 @@ class Sixconfig < ActiveRecord::Base
59
61
  end
60
62
  end
61
63
 
64
+
65
+ def get_server
66
+ if self.queryserver.nil?
67
+ if self.server.nil?
68
+ return nil
69
+ else
70
+ begin
71
+ self.server
72
+ rescue
73
+ end
74
+ end
75
+ else
76
+ begin
77
+ self.queryserver
78
+ rescue
79
+ end
80
+ end
81
+ end
82
+
62
83
  def auto_skip_status(setting_override = false, server_override = nil, force = false)
63
84
  setting = if setting_override
64
85
  setting_override
@@ -68,7 +89,7 @@ class Sixconfig < ActiveRecord::Base
68
89
  srv = if server_override
69
90
  server_override
70
91
  else
71
- self.server
92
+ self.get_server
72
93
  end
73
94
 
74
95
  setting = Appsetting.new unless setting
@@ -102,7 +123,7 @@ class Sixconfig < ActiveRecord::Base
102
123
  srv = if server_override
103
124
  server_override
104
125
  else
105
- self.server
126
+ self.get_server
106
127
  end
107
128
 
108
129
  setting = Appsetting.new unless setting
@@ -22,7 +22,7 @@ case RUBY_VERSION
22
22
  end
23
23
 
24
24
  module SixUpdaterWeb
25
- VERSION = "0.20.5"
25
+ VERSION = "0.20.7"
26
26
  COMPONENT = "six-updater-web"
27
27
 
28
28
  DEFAULT_IP = "127.0.0.1" unless defined?(DEFAULT_IP)
@@ -0,0 +1,9 @@
1
+ class AddQueryserverToSixconfigs < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :sixconfigs, :queryserver_id, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :sixconfigs, :queryserver_id
8
+ end
9
+ 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 => 20100715142960) do
12
+ ActiveRecord::Schema.define(:version => 20100715142961) do
13
13
 
14
14
  create_table "actions", :id => false, :force => true do |t|
15
15
  t.string "id", :limit => 36, :null => false
@@ -315,6 +315,7 @@ ActiveRecord::Schema.define(:version => 20100715142960) do
315
315
  t.string "appsetting_id", :limit => 36
316
316
  t.string "server_id", :limit => 36
317
317
  t.string "action_id", :limit => 36
318
+ t.integer "queryserver_id"
318
319
  end
319
320
 
320
321
  create_table "system_settings", :force => true do |t|
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 20
8
- - 5
9
- version: 0.20.5
8
+ - 7
9
+ version: 0.20.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-07-16 00:00:00 +02:00
17
+ date: 2010-07-20 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -256,6 +256,7 @@ files:
256
256
  - lib/six-updater-web/db/migrate/20100520101655_add_defaults_to_type.rb
257
257
  - lib/six-updater-web/db/migrate/20100520101656_add_server_to_appsettings.rb
258
258
  - lib/six-updater-web/db/migrate/20100715142960_add_beta_to_system_settings.rb
259
+ - lib/six-updater-web/db/migrate/20100715142961_add_queryserver_to_sixconfigs.rb
259
260
  - lib/six-updater-web/db/schema.rb
260
261
  - lib/six-updater-web/doc/README_FOR_APP
261
262
  - lib/six-updater-web/init.rb