gigamo-aurb 0.6.1 → 0.6.2
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/aurb.gemspec +1 -1
 - data/bin/aurb +36 -23
 - metadata +1 -1
 
    
        data/aurb.gemspec
    CHANGED
    
    
    
        data/bin/aurb
    CHANGED
    
    | 
         @@ -26,7 +26,11 @@ module Util 
     | 
|
| 
       26 
26 
     | 
    
         
             
              def ansi text, effect
         
     | 
| 
       27 
27 
     | 
    
         
             
                require 'facets/ansicode' unless defined? ANSICode
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
       29 
     | 
    
         
            -
                 
     | 
| 
      
 29 
     | 
    
         
            +
                if @opts[:color]
         
     | 
| 
      
 30 
     | 
    
         
            +
                  ANSICode.send(effect.to_sym) << text << ANSICode.clear
         
     | 
| 
      
 31 
     | 
    
         
            +
                else
         
     | 
| 
      
 32 
     | 
    
         
            +
                  text
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
       30 
34 
     | 
    
         
             
              end
         
     | 
| 
       31 
35 
     | 
    
         
             
              module_function :ansi
         
     | 
| 
       32 
36 
     | 
    
         
             
            end
         
     | 
| 
         @@ -63,17 +67,26 @@ class Aur 
     | 
|
| 
       63 
67 
     | 
    
         
             
              #   download('awesome-git', 'aurb')
         
     | 
| 
       64 
68 
     | 
    
         
             
              #
         
     | 
| 
       65 
69 
     | 
    
         
             
              def download *packages
         
     | 
| 
      
 70 
     | 
    
         
            +
                require 'readline'
         
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
| 
       66 
72 
     | 
    
         
             
                packages = packages[0] if packages[0].is_a? Array
         
     | 
| 
       67 
     | 
    
         
            -
             
     | 
| 
       68 
     | 
    
         
            -
             
     | 
| 
       69 
     | 
    
         
            -
             
     | 
| 
       70 
     | 
    
         
            -
             
     | 
| 
       71 
     | 
    
         
            -
             
     | 
| 
       72 
     | 
    
         
            -
             
     | 
| 
       73 
     | 
    
         
            -
             
     | 
| 
       74 
     | 
    
         
            -
             
     | 
| 
       75 
     | 
    
         
            -
             
     | 
| 
       76 
     | 
    
         
            -
                          puts "  
     | 
| 
      
 73 
     | 
    
         
            +
             
     | 
| 
      
 74 
     | 
    
         
            +
                puts "Targets (#{packages.length}): #{packages.join(', ')}"
         
     | 
| 
      
 75 
     | 
    
         
            +
                answer = Readline::readline "Proceed? [y/n] "
         
     | 
| 
      
 76 
     | 
    
         
            +
             
     | 
| 
      
 77 
     | 
    
         
            +
                if answer =~ /^y|yes$/i
         
     | 
| 
      
 78 
     | 
    
         
            +
                  packages.each do |package|
         
     | 
| 
      
 79 
     | 
    
         
            +
                    list(package).each do |names|
         
     | 
| 
      
 80 
     | 
    
         
            +
                      if names[0] == package
         
     | 
| 
      
 81 
     | 
    
         
            +
                        if in_sync? package
         
     | 
| 
      
 82 
     | 
    
         
            +
                          puts ":: Found #{package} in community. Use pacman!"
         
     | 
| 
      
 83 
     | 
    
         
            +
                        else
         
     | 
| 
      
 84 
     | 
    
         
            +
                          Dir.chdir(@config.dir) do
         
     | 
| 
      
 85 
     | 
    
         
            +
                            fetch package
         
     | 
| 
      
 86 
     | 
    
         
            +
                            untar package
         
     | 
| 
      
 87 
     | 
    
         
            +
             
     | 
| 
      
 88 
     | 
    
         
            +
                            puts "(#{packages.index(package)+1}/#{packages.length}) downloaded #{package}"
         
     | 
| 
      
 89 
     | 
    
         
            +
                          end
         
     | 
| 
       77 
90 
     | 
    
         
             
                        end
         
     | 
| 
       78 
91 
     | 
    
         
             
                      end
         
     | 
| 
       79 
92 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -137,17 +150,7 @@ class Aur 
     | 
|
| 
       137 
150 
     | 
    
         
             
                  end
         
     | 
| 
       138 
151 
     | 
    
         
             
                end
         
     | 
| 
       139 
152 
     | 
    
         | 
| 
       140 
     | 
    
         
            -
                 
     | 
| 
       141 
     | 
    
         
            -
                  puts ":: Everything is up to date"
         
     | 
| 
       142 
     | 
    
         
            -
                else
         
     | 
| 
       143 
     | 
    
         
            -
                  require 'readline'
         
     | 
| 
       144 
     | 
    
         
            -
             
     | 
| 
       145 
     | 
    
         
            -
                  puts ":: Targets (#{upgradable.length}): #{upgradable.join(', ')}"
         
     | 
| 
       146 
     | 
    
         
            -
                  answer = Readline::readline "Proceed by downloading these packages? [y/n] "
         
     | 
| 
       147 
     | 
    
         
            -
                  if answer =~ /^y|yes$/i
         
     | 
| 
       148 
     | 
    
         
            -
                    download upgradable
         
     | 
| 
       149 
     | 
    
         
            -
                  end
         
     | 
| 
       150 
     | 
    
         
            -
                end
         
     | 
| 
      
 153 
     | 
    
         
            +
                upgradable.empty? ? puts(':: Everything up to date') : download(upgradable)
         
     | 
| 
       151 
154 
     | 
    
         
             
              end
         
     | 
| 
       152 
155 
     | 
    
         | 
| 
       153 
156 
     | 
    
         
             
            private
         
     | 
| 
         @@ -228,11 +231,15 @@ private 
     | 
|
| 
       228 
231 
     | 
    
         
             
              def parse
         
     | 
| 
       229 
232 
     | 
    
         
             
                require 'optparse'
         
     | 
| 
       230 
233 
     | 
    
         | 
| 
      
 234 
     | 
    
         
            +
                self[:color] = true
         
     | 
| 
      
 235 
     | 
    
         
            +
             
     | 
| 
       231 
236 
     | 
    
         
             
                OptionParser.new do |o|
         
     | 
| 
       232 
     | 
    
         
            -
                  o.version      = [0, 6,  
     | 
| 
      
 237 
     | 
    
         
            +
                  o.version      = [0, 6, 2].join('.')
         
     | 
| 
       233 
238 
     | 
    
         
             
                  o.program_name = 'Aurb'
         
     | 
| 
       234 
239 
     | 
    
         
             
                  o.release      = '2009-04-19'
         
     | 
| 
       235 
240 
     | 
    
         | 
| 
      
 241 
     | 
    
         
            +
                  o.separator 'Actions:'
         
     | 
| 
      
 242 
     | 
    
         
            +
             
     | 
| 
       236 
243 
     | 
    
         
             
                  o.on '-D', '--download P1,P2,...', Array, "Download package(s)." do |d|
         
     | 
| 
       237 
244 
     | 
    
         
             
                    self[:cmd] = "download('#{d*"', '"}')"
         
     | 
| 
       238 
245 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -244,6 +251,12 @@ private 
     | 
|
| 
       244 
251 
     | 
    
         
             
                  o.on '-U', '--upgrade', 'Check the AUR for upgrades.' do
         
     | 
| 
       245 
252 
     | 
    
         
             
                    self[:cmd] = 'check_upgrade'
         
     | 
| 
       246 
253 
     | 
    
         
             
                  end
         
     | 
| 
      
 254 
     | 
    
         
            +
             
     | 
| 
      
 255 
     | 
    
         
            +
                  o.separator 'Optional:'
         
     | 
| 
      
 256 
     | 
    
         
            +
             
     | 
| 
      
 257 
     | 
    
         
            +
                  o.on '-C', '--[no-]color', 'Toggle colored output' do |c|
         
     | 
| 
      
 258 
     | 
    
         
            +
                    self[:color] = c
         
     | 
| 
      
 259 
     | 
    
         
            +
                  end
         
     | 
| 
       247 
260 
     | 
    
         
             
                end.parse! @@args
         
     | 
| 
       248 
261 
     | 
    
         
             
              end
         
     | 
| 
       249 
262 
     | 
    
         
             
            end
         
     |