six-updater-web 0.19.0 → 0.19.1
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 +1 -1
- data/lib/six-updater-web/app/controllers/main_controller.rb +48 -3
- data/lib/six-updater-web/app/views/main/_check.haml +1 -1
- data/lib/six-updater-web/app/views/main/index.haml +1 -1
- data/lib/six-updater-web/config/six-updater-web.rb +1 -1
- data/lib/six-updater-web/vendor/plugins/six-import/lib/six/import.rb +6 -9
- metadata +2 -2
    
        data/Rakefile
    CHANGED
    
    
| @@ -229,9 +229,11 @@ class MainController < ApplicationController | |
| 229 229 | 
             
                end
         | 
| 230 230 |  | 
| 231 231 | 
             
                if setting
         | 
| 232 | 
            -
                   | 
| 233 | 
            -
             | 
| 234 | 
            -
             | 
| 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?(@ | 
| 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 @ | 
| 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)
         | 
| @@ -58,11 +58,7 @@ module Six | |
| 58 58 | 
             
                    def blabla(h)
         | 
| 59 59 | 
             
                      l = []
         | 
| 60 60 | 
             
                      h.each_pair do |key, value|
         | 
| 61 | 
            -
                         | 
| 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 | 
| 99 | 
            -
                          when  | 
| 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  | 
| 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 | 
            -
                       | 
| 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
         |