gigamo-aurb 0.5.1 → 0.5.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.
Files changed (4) hide show
  1. data/README +1 -0
  2. data/aurb.gemspec +3 -2
  3. data/bin/aurb +20 -19
  4. metadata +2 -1
data/README ADDED
@@ -0,0 +1 @@
1
+ Coming soon.
data/aurb.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'aurb'
3
- s.version = '0.5.1'
3
+ s.version = '0.5.2'
4
4
  s.date = '2009-04-07'
5
5
  s.summary = 'A simple AUR utility'
6
6
  s.email = 'gigamo@gmail.com'
@@ -9,5 +9,6 @@ Gem::Specification.new do |s|
9
9
  s.rubyforge_project = 'aurb'
10
10
  s.has_rdoc = false
11
11
  s.authors = ['Gigamo']
12
- s.files = ['bin/aurb', 'aurb.gemspec']
12
+ s.files = ['bin/aurb', 'aurb.gemspec', 'README']
13
+ s.bindir = 'bin'
13
14
  end
data/bin/aurb CHANGED
@@ -12,7 +12,7 @@ require 'pathname'
12
12
 
13
13
  module Aurb
14
14
  Config = Struct.new(:search, :info, :sync, :dir)
15
- Version = {:major => 0, :minor => 5, :tiny => 1}
15
+ Version = {:major => 0, :minor => 5, :tiny => 2}
16
16
 
17
17
  def self.aur
18
18
  @aur ||= Aur.new
@@ -63,7 +63,7 @@ module Aurb
63
63
  puts "#{color('==>', :yellow)} Found #{package} in community repo. Pacman will do."
64
64
  exec "sudo pacman -S #{package}"
65
65
  else
66
- puts "#{color('==>', :yellow)} Downloading #{package}."
66
+ puts "#{color('==>', :yellow)} Downloading #{package}"
67
67
  open("http://aur.archlinux.org/packages/#{package}/#{package}.tar.gz") do |remote|
68
68
  File.open("#{dir}/#{package}.tar.gz", 'wb') do |local|
69
69
  local.write(remote.read)
@@ -71,7 +71,7 @@ module Aurb
71
71
  end
72
72
  end
73
73
 
74
- puts "#{color('==>', :yellow)} Unpacking #{package}."
74
+ puts "#{color('==>', :yellow)} Unpacking #{package}"
75
75
  Archive::Tar::Minitar.unpack(Zlib::GzipReader.new(File.open("#{package}.tar.gz", 'rb')), Dir.pwd)
76
76
  end
77
77
  end
@@ -84,9 +84,7 @@ module Aurb
84
84
  list(package).each do |names|
85
85
  threads << Thread.new do
86
86
  result = JSON.parse(open(@config.info % names[1]).read)
87
- if result['type'] == 'error'
88
- raise AurbError, "#{color('Fatal', :on_red)}: no results"
89
- else
87
+ unless result['type'] == 'error'
90
88
  result = result['results']
91
89
  next if in_sync? result['Name'], 'community'
92
90
  if package.any? do |pac|
@@ -100,29 +98,32 @@ module Aurb
100
98
  end
101
99
  threads.each { |t| t.join }
102
100
 
103
- puts "\n#{color('==>', :yellow)} Found #{color(count.to_s, :magenta)} #{count == 1 ? 'result' : 'results'}." if count > 0
101
+ puts "\n#{color('==>', :yellow)} Found #{color(count.to_s, :magenta)} #{count == 1 ? 'result' : 'results'}" if count > 0
104
102
  end
105
103
 
106
104
  def check_upgrade
107
105
  uppkgs, found, upcount = [], false, 0
108
- puts "#{color('==>', :yellow)} Checking for upgrades."
106
+ puts "#{color('==>', :yellow)} Checking for upgrades"
109
107
  `pacman -Qm`.each_line do |line|
110
108
  name, version = line.chomp.split
111
- result = JSON.parse(open(@config.info % name).read)['results']
112
- if (result.is_a?(Hash)) && (result['Version'] != version)
113
- if VersionNumber.new(result['Version']) > VersionNumber.new(version)
114
- found = true
115
- puts "#{color(name, :bold)}: #{color(version, :red)} -> #{color(result['Version'], :green)}"
116
- upcount += 1
117
- uppkgs << name
109
+ result = JSON.parse(open(@config.info % name).read)
110
+ unless result['type'] == 'error'
111
+ result = result['results']
112
+ if (result.is_a?(Hash)) && (result['Version'] != version)
113
+ if VersionNumber.new(result['Version']) > VersionNumber.new(version)
114
+ found = true
115
+ puts "#{color(name, :bold)} (#{color(version, :red)}) can be upgraded to #{color(result['Version'], :green)}"
116
+ upcount += 1
117
+ uppkgs << name
118
+ end
119
+ else
120
+ puts "#{color(name, :bold)} (#{color(version, :green)}) is up to date"
118
121
  end
119
- else
120
- puts "#{color(name, :bold)} is up to date"
121
122
  end
122
123
  end
123
124
 
124
125
  if found
125
- puts "\n#{color('==>', :yellow)} Found #{color(upcount.to_s, :magenta)} #{upcount == 1 ? 'upgrade' : 'upgrades'}."
126
+ puts "\n#{color('==>', :yellow)} Found #{color(upcount.to_s, :magenta)} #{upcount == 1 ? 'upgrade' : 'upgrades'}"
126
127
  uppkgs.each do |pkg|
127
128
  print "#{color('==>', :yellow)} Download '#{pkg}'? [y] "
128
129
  $stdin.gets.chomp =~ /^y/ ? download(pkg) : next
@@ -161,7 +162,7 @@ module Aurb
161
162
  OptionParser.new do |o|
162
163
  o.version = '%s.%s.%s' % [:major, :minor, :tiny].map {|v| Version[v]}
163
164
  o.program_name = 'Aurb'
164
- o.release = '2009-04-06'
165
+ o.release = '2009-04-07'
165
166
 
166
167
  o.on('-D', '--download P1,P2,...', Array, 'Download package(s). Separate by commas if multiple (no spaces).') do |d|
167
168
  self[:cmd] = "download('#{d*"', '"}')" # wow. ugly
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gigamo-aurb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gigamo
@@ -24,6 +24,7 @@ extra_rdoc_files: []
24
24
  files:
25
25
  - bin/aurb
26
26
  - aurb.gemspec
27
+ - README
27
28
  has_rdoc: false
28
29
  homepage: http://github.com/gigamo/aurb
29
30
  post_install_message: