six-updater 0.19.6 → 0.20.0
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 +3 -3
 - data/lib/six/updater.rb +2 -2
 - data/lib/six/updater/mod.rb +24 -5
 - data/lib/six/updater/options.rb +4 -0
 - data/lib/six/updater/rsyncrepo.rb +4 -0
 - metadata +4 -4
 
    
        data/Rakefile
    CHANGED
    
    | 
         @@ -13,7 +13,7 @@ require 'rake/testtask' 
     | 
|
| 
       13 
13 
     | 
    
         
             
            spec = Gem::Specification.new do |s|
         
     | 
| 
       14 
14 
     | 
    
         
             
              s.platform = "x86-mingw32"
         
     | 
| 
       15 
15 
     | 
    
         
             
              s.name = 'six-updater'
         
     | 
| 
       16 
     | 
    
         
            -
              s.version = '0. 
     | 
| 
      
 16 
     | 
    
         
            +
              s.version = '0.20.0'
         
     | 
| 
       17 
17 
     | 
    
         
             
              s.has_rdoc = true
         
     | 
| 
       18 
18 
     | 
    
         
             
              s.extra_rdoc_files = ['README', 'LICENSE']
         
     | 
| 
       19 
19 
     | 
    
         
             
              s.summary = 'Your summary here'
         
     | 
| 
         @@ -35,7 +35,7 @@ end 
     | 
|
| 
       35 
35 
     | 
    
         
             
            spec3 = Gem::Specification.new do |s|
         
     | 
| 
       36 
36 
     | 
    
         
             
              s.platform = "x86-mswin32"
         
     | 
| 
       37 
37 
     | 
    
         
             
              s.name = 'six-updater'
         
     | 
| 
       38 
     | 
    
         
            -
              s.version = '0. 
     | 
| 
      
 38 
     | 
    
         
            +
              s.version = '0.20.0'
         
     | 
| 
       39 
39 
     | 
    
         
             
              s.has_rdoc = true
         
     | 
| 
       40 
40 
     | 
    
         
             
              s.extra_rdoc_files = ['README', 'LICENSE']
         
     | 
| 
       41 
41 
     | 
    
         
             
              s.summary = 'Your summary here'
         
     | 
| 
         @@ -56,7 +56,7 @@ end 
     | 
|
| 
       56 
56 
     | 
    
         | 
| 
       57 
57 
     | 
    
         
             
            spec2 = Gem::Specification.new do |s|
         
     | 
| 
       58 
58 
     | 
    
         
             
              s.name = 'six-updater'
         
     | 
| 
       59 
     | 
    
         
            -
              s.version = '0. 
     | 
| 
      
 59 
     | 
    
         
            +
              s.version = '0.20.0'
         
     | 
| 
       60 
60 
     | 
    
         
             
              s.has_rdoc = true
         
     | 
| 
       61 
61 
     | 
    
         
             
              s.extra_rdoc_files = ['README', 'LICENSE']
         
     | 
| 
       62 
62 
     | 
    
         
             
              s.summary = 'Your summary here'
         
     | 
    
        data/lib/six/updater.rb
    CHANGED
    
    | 
         @@ -31,7 +31,7 @@ case RUBY_VERSION 
     | 
|
| 
       31 
31 
     | 
    
         
             
            when /1\.8\.[0-9]/
         
     | 
| 
       32 
32 
     | 
    
         
             
              class Array
         
     | 
| 
       33 
33 
     | 
    
         
             
                def sample
         
     | 
| 
       34 
     | 
    
         
            -
                  self[rand 
     | 
| 
      
 34 
     | 
    
         
            +
                  self[rand(self.size)]
         
     | 
| 
       35 
35 
     | 
    
         
             
                end
         
     | 
| 
       36 
36 
     | 
    
         
             
              end
         
     | 
| 
       37 
37 
     | 
    
         
             
            end
         
     | 
| 
         @@ -39,7 +39,7 @@ end 
     | 
|
| 
       39 
39 
     | 
    
         
             
            module Six
         
     | 
| 
       40 
40 
     | 
    
         
             
              # TODO: Evaluate if this module should be a class instead?
         
     | 
| 
       41 
41 
     | 
    
         
             
              module Updater
         
     | 
| 
       42 
     | 
    
         
            -
                VERSION = '0. 
     | 
| 
      
 42 
     | 
    
         
            +
                VERSION = '0.20.0'
         
     | 
| 
       43 
43 
     | 
    
         
             
                COMPONENT = 'six-updater'
         
     | 
| 
       44 
44 
     | 
    
         
             
                LOG_LIMIT = 9999
         
     | 
| 
       45 
45 
     | 
    
         | 
    
        data/lib/six/updater/mod.rb
    CHANGED
    
    | 
         @@ -31,9 +31,6 @@ module Six 
     | 
|
| 
       31 
31 
     | 
    
         
             
                    @changed = false
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
       33 
33 
     | 
    
         
             
                    @installed = if FileTest.exists?(File.join(@path, '.rsync'))
         
     | 
| 
       34 
     | 
    
         
            -
                      # TODO: Temporary, downcase all files and process the configs
         
     | 
| 
       35 
     | 
    
         
            -
                      Six::Cleanup.process(@path)
         
     | 
| 
       36 
     | 
    
         
            -
             
     | 
| 
       37 
34 
     | 
    
         
             
                      @repository = RsyncRepo.new(@modconfig[:repository], @path, :log => log)
         
     | 
| 
       38 
35 
     | 
    
         
             
                      true
         
     | 
| 
       39 
36 
     | 
    
         
             
                    else
         
     | 
| 
         @@ -110,6 +107,27 @@ module Six 
     | 
|
| 
       110 
107 
     | 
    
         
             
                    @repository.repository.reset(nil, {:hard => true})
         
     | 
| 
       111 
108 
     | 
    
         
             
                  end
         
     | 
| 
       112 
109 
     | 
    
         | 
| 
      
 110 
     | 
    
         
            +
                  # Convert process
         
     | 
| 
      
 111 
     | 
    
         
            +
                  def convert
         
     | 
| 
      
 112 
     | 
    
         
            +
                    if @installed
         
     | 
| 
      
 113 
     | 
    
         
            +
                      log.warn "Already a six-updater repository, not converting."
         
     | 
| 
      
 114 
     | 
    
         
            +
                    else
         
     | 
| 
      
 115 
     | 
    
         
            +
                      unless File.directory?(@path)
         
     | 
| 
      
 116 
     | 
    
         
            +
                        log.warn "Modfolder doesn't exist"
         
     | 
| 
      
 117 
     | 
    
         
            +
                        return
         
     | 
| 
      
 118 
     | 
    
         
            +
                      end
         
     | 
| 
      
 119 
     | 
    
         
            +
                      opts = {}
         
     | 
| 
      
 120 
     | 
    
         
            +
                      opts.merge!({:log => log}) if @config[:verbose]
         
     | 
| 
      
 121 
     | 
    
         
            +
                      @repository = RsyncRepo.new(@modconfig[:repository], @path, :log => log)
         
     | 
| 
      
 122 
     | 
    
         
            +
                      begin
         
     | 
| 
      
 123 
     | 
    
         
            +
                        @repository.convert(opts)
         
     | 
| 
      
 124 
     | 
    
         
            +
                      rescue => e
         
     | 
| 
      
 125 
     | 
    
         
            +
                        log.warn 'WARNING: Error during conversion..'
         
     | 
| 
      
 126 
     | 
    
         
            +
                        log.debug "ERROR: #{e.class} #{e.message} #{e.backtrace.join("\n")}"            
         
     | 
| 
      
 127 
     | 
    
         
            +
                      end
         
     | 
| 
      
 128 
     | 
    
         
            +
                    end
         
     | 
| 
      
 129 
     | 
    
         
            +
                  end
         
     | 
| 
      
 130 
     | 
    
         
            +
             
     | 
| 
       113 
131 
     | 
    
         
             
                  # UPDATE Process
         
     | 
| 
       114 
132 
     | 
    
         
             
                  def update
         
     | 
| 
       115 
133 
     | 
    
         
             
                    if self.skip?
         
     | 
| 
         @@ -128,10 +146,10 @@ module Six 
     | 
|
| 
       128 
146 
     | 
    
         | 
| 
       129 
147 
     | 
    
         
             
                    @stat[:previous] = @repository.version
         
     | 
| 
       130 
148 
     | 
    
         
             
                    log.info "Current Version: #{@stat[:previous]}, checking for updates..."
         
     | 
| 
       131 
     | 
    
         
            -
                    done = @repository.update
         
     | 
| 
       132 
     | 
    
         
            -
                    @stat[:current] = @repository.version
         
     | 
| 
      
 149 
     | 
    
         
            +
                    done = begin; @repository.update; rescue => e; log.debug "#{e.class} #{e.message}: #{e.backtrace.join("\n")}"; nil; end
         
     | 
| 
       133 
150 
     | 
    
         | 
| 
       134 
151 
     | 
    
         
             
                    begin
         
     | 
| 
      
 152 
     | 
    
         
            +
                      @stat[:current] = @repository.version
         
     | 
| 
       135 
153 
     | 
    
         
             
                      @repository.status(true)
         
     | 
| 
       136 
154 
     | 
    
         
             
                    rescue => e
         
     | 
| 
       137 
155 
     | 
    
         
             
                      log.warn 'WARNING: Update seems to have completed but there was a status error..'
         
     | 
| 
         @@ -165,6 +183,7 @@ module Six 
     | 
|
| 
       165 
183 
     | 
    
         
             
                    unless done
         
     | 
| 
       166 
184 
     | 
    
         
             
                      log.warn 'WARNING: Update was unable to complete. This could be due to a server / connection problem, or due to files in use or out of synch repositories. Please make sure ArmA is closed, retry, otherwise reset and retry'
         
     | 
| 
       167 
185 
     | 
    
         
             
                      log_status
         
     | 
| 
      
 186 
     | 
    
         
            +
                      true
         
     | 
| 
       168 
187 
     | 
    
         
             
                      # TODO: Add display of stats for changed files etc
         
     | 
| 
       169 
188 
     | 
    
         
             
                    end
         
     | 
| 
       170 
189 
     | 
    
         
             
                  end
         
     | 
    
        data/lib/six/updater/options.rb
    CHANGED
    
    | 
         @@ -30,6 +30,10 @@ module Six 
     | 
|
| 
       30 
30 
     | 
    
         
             
                      todo << :update if bool
         
     | 
| 
       31 
31 
     | 
    
         
             
                    end
         
     | 
| 
       32 
32 
     | 
    
         | 
| 
      
 33 
     | 
    
         
            +
                    opts.on("-n", "--convert", "Convert each mod available on the updater network to updater") do |bool|
         
     | 
| 
      
 34 
     | 
    
         
            +
                      todo << :convert if bool
         
     | 
| 
      
 35 
     | 
    
         
            +
                    end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
       33 
37 
     | 
    
         
             
                    opts.on("-r", "--reset", "Resets the modfolders to latest commit status. All modifications lost") do |bool|
         
     | 
| 
       34 
38 
     | 
    
         
             
                      todo << :reset if bool
         
     | 
| 
       35 
39 
     | 
    
         
             
                    end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version 
     | 
|
| 
       4 
4 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       5 
5 
     | 
    
         
             
              segments: 
         
     | 
| 
       6 
6 
     | 
    
         
             
              - 0
         
     | 
| 
       7 
     | 
    
         
            -
              -  
     | 
| 
       8 
     | 
    
         
            -
              -  
     | 
| 
       9 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 7 
     | 
    
         
            +
              - 20
         
     | 
| 
      
 8 
     | 
    
         
            +
              - 0
         
     | 
| 
      
 9 
     | 
    
         
            +
              version: 0.20.0
         
     | 
| 
       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-05- 
     | 
| 
      
 17 
     | 
    
         
            +
            date: 2010-05-23 00:00:00 +02:00
         
     | 
| 
       18 
18 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       19 
19 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       20 
20 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     |