lib/app/models/system_setting.rb in six-updater-web-0.13.2 vs lib/app/models/system_setting.rb in six-updater-web-0.13.3
- old
+ new
@@ -8,39 +8,28 @@
else
self.new
end
end
- def path
- path = SixUpdaterWeb::RUBY_PATH.clone
- path.gsub!("/", "\\")
+ def exec
+ "rake" # .bat on Windows
end
- def app_path
- "rake"
- end
-
def update_gamespy
self.gamespied_at = Time.now
self.save
cl = "sync:gamespy RAILS_ENV=#{ENV['RAILS_ENV']} BASE_PATH=\'#{SixUpdaterWeb::BASE_PATH}\'" # + cl
- SixUpdaterWeb.run_program(path, app_path, RAILS_ROOT, cl)
+ SixUpdaterWeb.run_program(exec, RAILS_ROOT, cl)
end
def update_gamespy_nogeo
self.gamespied_at = Time.now
self.save
cl = "sync:gamespy RAILS_ENV=#{ENV['RAILS_ENV']} NOGEO=1 BASE_PATH=\'#{SixUpdaterWeb::BASE_PATH}\'" # + cl
- SixUpdaterWeb.run_program(path, app_path, RAILS_ROOT, cl)
+ SixUpdaterWeb.run_program(exec, RAILS_ROOT, cl)
end
- #system "tools/ruby/bin/ruby tools/ruby/bin/rake sync:gamespy"
- #path = File.join(SixUpdaterWeb::BASE_PATH, 'tools', "ruby", "bin")
- #path = File.join("C:", "Ruby", "Bin")
- #path.gsub!("/", "\\")
- # \"#{path}\\rake\"
-
def synchronize
Six::Network::Panel.setlogger(logger)
l = []
begin
status = Timeout::timeout(TIMEOUT) do
@@ -59,19 +48,14 @@
def sync
self.synchronized_at = Time.now
self.save
content = nil
- #begin
- l = self.synchronize
- if l.size > 0
- content = "Synchronized #{l.size} records with server-site!" #l.map {|e| e.to_json}.join(", ")
- else
- content = "WARNING: No objects received, possibly issue with connection (timeout?), or server site"
- end
- # rescue
- # logger.debug "#{$!}"
- # content = "ERROR: Failed synchronization: #{$!}"
- #end
+ l = self.synchronize
+ if l.size > 0
+ content = "Synchronized #{l.size} records with server-site!" #l.map {|e| e.to_json}.join(", ")
+ else
+ content = "WARNING: No objects received, possibly issue with connection (timeout?), or server site"
+ end
content
end
end