six-updater-web 0.19.0 → 0.19.1

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.19.0'
10
+ s.version = '0.19.1'
11
11
  s.has_rdoc = false
12
12
  #s.extra_rdoc_files = ['README', 'LICENSE']
13
13
  s.summary = 'Your summary here'
@@ -229,9 +229,11 @@ class MainController < ApplicationController
229
229
  end
230
230
 
231
231
  if setting
232
- setting.type = "Arma2Appsetting" if setting.type.nil? || setting.type.empty?
233
- setting.save
234
- setting = Arma2Appsetting.find(setting.id)
232
+ if setting.type.nil? || setting.type.empty? || setting.type == "Appsetting"
233
+ setting.type = "Arma2Appsetting"
234
+ setting.save
235
+ setting = Appsetting.find(setting.id)
236
+ end
235
237
  else
236
238
  setting = Arma2Appsetting.new
237
239
  end
@@ -406,10 +408,53 @@ class MainController < ApplicationController
406
408
 
407
409
  private
408
410
  def act(setting, preset, action, server)
411
+ @current_setting = setting ? setting : Arma2Appsetting.new
412
+
413
+ @preset = if @system_setting.favorite_preset
414
+ begin
415
+ Sixconfig.find(@system_setting.favorite_preset.to_s)
416
+ rescue
417
+ Sixconfig.new
418
+ end
419
+ else
420
+ Sixconfig.new
421
+ end
422
+
423
+ @server = if @system_setting.favorite_server
424
+ begin
425
+ Server.find(@system_setting.favorite_server.to_s)
426
+ rescue
427
+ Server.new
428
+ end
429
+ else
430
+ Server.new
431
+ end
432
+
433
+ @action = if @system_setting.favorite_action
434
+ begin
435
+ Action.find(@system_setting.favorite_action.to_s)
436
+ rescue
437
+ Action.new
438
+ end
439
+ else
440
+ Action.new
441
+ end
442
+
443
+ @setting = if @system_setting.favorite_settings_profile
444
+ begin
445
+ Appsetting.find(@system_setting.favorite_settings_profile.to_s)
446
+ rescue
447
+ Appsetting.new
448
+ end
449
+ else
450
+ Appsetting.new
451
+ end
452
+ =begin
409
453
  @preset = preset ? preset : Sixconfig.new
410
454
  @server = server ? server : Queryserver.new
411
455
  @action = action ? action : Action.new
412
456
  @setting = setting ? setting : Arma2Appsetting.new
457
+ =end
413
458
  end
414
459
 
415
460
  def fetch_param(ar, ty, default = nil)
@@ -19,4 +19,4 @@
19
19
  %td= link_to "Info", "http://updater.dev-heaven.net/mods/show/#{mod.id}", :target => "_blank"
20
20
  %td= link_to "Changelog", "http://updater.dev-heaven.net/mods/changelog/#{mod.id}", :target => "_blank"
21
21
  %td= mod.class.label
22
- %td= mod.version_match?(@setting)
22
+ %td= mod.version_match?(@current_setting)
@@ -61,7 +61,7 @@
61
61
  %table{ :border => 1, :cellpadding => "5", :width => "100%"}
62
62
  %tr
63
63
  %td
64
- Edition: #{link_to @setting.nice_found_type, nil, :title => "Supports mods for: #{@setting.found_types.map{|e| e.label}.join(", ")}" } Autoskip: #{@autoskip ? @autoskip : false}.
64
+ Edition: #{link_to @current_setting.nice_found_type, nil, :title => "Supports mods for: #{@current_setting.found_types.map{|e| e.label}.join(", ")}" } Autoskip: #{@autoskip ? @autoskip : false}.
65
65
  Last sync
66
66
  - if @system_setting.synchronized_at
67
67
  = time_ago_in_words(@system_setting.synchronized_at)
@@ -22,7 +22,7 @@ case RUBY_VERSION
22
22
  end
23
23
 
24
24
  module SixUpdaterWeb
25
- VERSION = "0.19.0"
25
+ VERSION = "0.19.1"
26
26
  COMPONENT = "six-updater-web"
27
27
 
28
28
  DEFAULT_IP = "127.0.0.1" unless defined?(DEFAULT_IP)
@@ -58,11 +58,7 @@ module Six
58
58
  def blabla(h)
59
59
  l = []
60
60
  h.each_pair do |key, value|
61
- case key
62
- when self.to_s.downcase
63
- c = self.from_hash value
64
- l << c
65
- end
61
+ l << self.from_hash(value.merge({:type => key.camelize.singularize}))
66
62
  end
67
63
  l
68
64
  end
@@ -95,11 +91,11 @@ module Six
95
91
  def from_hash( hash )
96
92
  h = hash.dup
97
93
  h.each do |key, value|
98
- case value.class.to_s
99
- when 'Array'
94
+ case value
95
+ when Array
100
96
  h[key].map! { |e|
101
97
  Object.const_get(key.camelize.singularize).from_hash e }
102
- when 'Hash'
98
+ when Hash
103
99
  h[key] = Object.const_get(key.camelize).from_hash value
104
100
  end
105
101
  end
@@ -124,7 +120,8 @@ module Six
124
120
  else
125
121
  n = self.new h
126
122
  end
127
- logger.debug "#{n.class} #{n.id} #{n.changed?}: #{"#{n.inspect} - #{previous}" if n.changed?}"
123
+ n.type = h[:type] if h[:type] if n.respond_to?(:type)
124
+ logger.info "#{n.class} #{n.id} #{n.changed?}: #{"#{n.inspect} - #{previous}" if n.changed?}"
128
125
  n.save if n.changed?# || n.new?
129
126
  n
130
127
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 19
8
- - 0
9
- version: 0.19.0
8
+ - 1
9
+ version: 0.19.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Sickboy