six-updater-web 0.23.6 → 0.23.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 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.23.6'
10
+ s.version = '0.23.7'
11
11
  s.has_rdoc = false
12
12
  #s.extra_rdoc_files = ['README', 'LICENSE']
13
13
  s.summary = 'Your summary here'
@@ -264,7 +264,9 @@ class Appsetting < ActiveRecord::Base
264
264
  end
265
265
 
266
266
  def full_path
267
- File.dirname(File.join(self.real_path, self.real_exe)).gsub("\\", "/")
267
+ rp = self.real_path
268
+ return nil if rp.nil?
269
+ File.dirname(File.join(rp, self.real_exe)).gsub("\\", "/")
268
270
  end
269
271
 
270
272
  def processes
@@ -42,7 +42,7 @@ class Repository < ActiveRecord::Base
42
42
  end
43
43
 
44
44
  def ping
45
- SixUpdaterWeb.run_program("ping", SixUpdaterWeb::BASE_PATH, "-f -l #{PING_PACKET_SIZE} -r 9 -n 30 -t #{self.address}")
45
+ SixUpdaterWeb.run_program("ping", SixUpdaterWeb::BASE_PATH, "-f -l #{PING_PACKET_SIZE} -n 30 #{self.address}")
46
46
  end
47
47
 
48
48
  def tracert
@@ -47,9 +47,16 @@ class SystemSetting < ActiveRecord::Base
47
47
  end
48
48
 
49
49
  def synchronize
50
- Six::Network::Panel.setlogger(logger)
50
+ begin
51
+ # TODO: This should be in after_initialize yet there it fails..
52
+ SixUpdaterWeb.update_site_controllers # Update the list of controllers - give default adminstrator permission to
53
+ rescue => e
54
+ logger.debug "ERROR: #{e.class} #{e.message} #{e.backtrace.join("\n")}"
55
+ end
56
+
51
57
  l = []
52
58
  begin
59
+ Six::Network::Panel.setlogger(logger)
53
60
  status = Timeout::timeout(TIMEOUT) do
54
61
  Six::Network::Panel.login(self.server_username, self.server_password, true)
55
62
  end
@@ -1,17 +1,17 @@
1
- # Settings specified here will take precedence over those in config/environment.rb
2
-
3
- # In the development environment your application's code is reloaded on
4
- # every request. This slows down response time but is perfect for development
5
- # since you don't have to restart the webserver when you make code changes.
6
- config.cache_classes = false
7
-
8
- # Log error messages when you accidentally call methods on nil.
9
- config.whiny_nils = true
10
-
11
- # Show full error reports and disable caching
12
- config.action_controller.consider_all_requests_local = true
13
- config.action_view.debug_rjs = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send
1
+ # Settings specified here will take precedence over those in config/environment.rb
2
+
3
+ # In the development environment your application's code is reloaded on
4
+ # every request. This slows down response time but is perfect for development
5
+ # since you don't have to restart the webserver when you make code changes.
6
+ config.cache_classes = false
7
+
8
+ # Log error messages when you accidentally call methods on nil.
9
+ config.whiny_nils = true
10
+
11
+ # Show full error reports and disable caching
12
+ config.action_controller.consider_all_requests_local = true
13
+ config.action_view.debug_rjs = true
14
+ config.action_controller.perform_caching = false
15
+
16
+ # Don't care if the mailer can't send
17
17
  config.action_mailer.raise_delivery_errors = false
@@ -23,7 +23,7 @@ end
23
23
  require 'open3'
24
24
 
25
25
  module SixUpdaterWeb
26
- VERSION = "0.23.6"
26
+ VERSION = "0.23.7"
27
27
  COMPONENT = "six-updater-web"
28
28
 
29
29
  DEFAULT_IP = "127.0.0.1" unless defined?(DEFAULT_IP)
@@ -241,12 +241,10 @@ module SixUpdaterWeb
241
241
 
242
242
  def after_initialize
243
243
  if defined?(OLDLOCATION && SPECIAL)
244
- # Update data in tables; nah, rather start warning users on main page?
245
- #Six::Dbmanager.check
246
-
244
+ # Open the browser
245
+ return unless defined?(OPEN_BROWSER)
247
246
  case RUBY_PLATFORM
248
247
  when /-mingw32$/, /-mswin32$/
249
- return unless defined?(OPEN_BROWSER)
250
248
  Thread.new() do
251
249
  file_to_use = "#{LOCAL_URL}/main"
252
250
  sleep 3
@@ -264,22 +262,59 @@ module SixUpdaterWeb
264
262
  system "start #{file_to_use}"
265
263
  end
266
264
  end
267
- =begin
268
- arguments = nil
269
- directory = nil
270
- operation = "OPEN"
271
- show = nil
272
- #begin
273
- shell = WIN32OLE.new('Shell.Application')
274
- shell.ShellExecute(file_to_use, arguments, directory, operation, show)
275
- #rescue => e
276
- #logger.warn "Unable to open browser: ERROR: #{e.class} #{e.message} #{e.backtrace.join("\n")}"
277
- #end
278
- =end
279
265
  end
280
266
  end
281
267
  end
282
268
 
269
+ def update_site_controllers
270
+ from_classes = Goldberg::SiteController.classes
271
+ from_db = Goldberg::SiteController.find(:all,
272
+ :order => 'name')
273
+ known = Hash.new
274
+ missing = Array.new
275
+ for dbc in from_db do
276
+ if from_classes.has_key? dbc.name
277
+ known[dbc.name] = dbc
278
+ else
279
+ missing << dbc
280
+ end
281
+ end
282
+
283
+ unknown = Hash.new
284
+ app = Array.new
285
+ builtin = Array.new
286
+
287
+ for name in from_classes.keys.sort do
288
+ if known.has_key? name
289
+ if known[name].builtin == 1
290
+ builtin << known[name]
291
+ else
292
+ app << known[name]
293
+ end
294
+ else
295
+ unknown[name] = from_classes[name]
296
+ end
297
+ end
298
+
299
+ saved = false
300
+ logger.info "Unknown: #{unknown.inspect}"
301
+ unknown.keys.each do |name|
302
+ h = Hash.new
303
+ h[:name] = name
304
+ h[:permission_id] = 1 # TODO: Search for it instead?
305
+ h[:builtin] = 0
306
+ site_controller = Goldberg::SiteController.new(h)
307
+ if site_controller.save
308
+ #flash[:notice] = 'SiteController was successfully created.'
309
+ saved = true
310
+ else
311
+ #foreign
312
+ #render :action => 'new'
313
+ end
314
+ end
315
+ Goldberg::Role.rebuild_cache if saved
316
+ end
317
+
283
318
  def run_program(exec, startpath, cl)
284
319
  logger.info "Current Path: #{Dir.pwd}, BASE_PATH: #{BASE_PATH}, DATA_PATH: #{DATA_PATH}"
285
320
  logger.info "Starting with #{cl} from #{startpath}"
@@ -80,7 +80,7 @@ module Six
80
80
  when name.downcase
81
81
  pid = pid.to_i
82
82
  next unless pid > 0
83
- unless path && !full.nil?
83
+ if path.nil? || full.nil?
84
84
  pids << pid
85
85
  next
86
86
  end
@@ -128,7 +128,7 @@ module Six
128
128
  n = self.new h
129
129
  end
130
130
  n.type = h[:type] if h[:type] if n.respond_to?(:type)
131
- logger.info "#{n.class} #{n.id} #{n.changed?}: #{"#{n.inspect} - #{previous}" if n.changed?}"
131
+ #logger.info "#{n.class} #{n.id} #{n.changed?}: #{"#{n.inspect} - #{previous}" if n.changed?}"
132
132
  n.save if n.changed?# || n.new?
133
133
  n
134
134
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 23
8
- - 6
9
- version: 0.23.6
8
+ - 7
9
+ version: 0.23.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-27 00:00:00 +02:00
17
+ date: 2010-07-28 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency