gigamo-aurb 0.5.7 → 0.5.8

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 (3) hide show
  1. data/aurb.gemspec +2 -2
  2. data/bin/aurb +22 -23
  3. metadata +2 -2
data/aurb.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'aurb'
3
- s.version = '0.5.7'
4
- s.date = %q{2009-04-14}
3
+ s.version = '0.5.8'
4
+ s.date = %q{2009-04-15}
5
5
  s.summary = %q{A simple AUR utility}
6
6
  s.email = %q{gigamo@gmail.com}
7
7
  s.homepage = %q{http://github.com/gigamo/aurb}
data/bin/aurb CHANGED
@@ -5,7 +5,7 @@ require 'rubygems'
5
5
  module Aurb
6
6
 
7
7
  DlPath = File.join(File.expand_path('~'), 'abs') # Change me!
8
- Config = Struct.new :search, :info, :sync, :dir
8
+ Config = Struct.new :search, :info, :sync, :dir # Don't change me!
9
9
 
10
10
  def self.aur
11
11
  @aur ||= Aur.new
@@ -63,8 +63,7 @@ class Aur
63
63
  list(package).each do |names|
64
64
  if names.first == package
65
65
  if in_sync? package
66
- puts "#{ansi('==>', :yellow)} Found #{package} in community repo. Pacman!"
67
- exec "sudo pacman -S #{package}"
66
+ puts "#{ansi('==>', :yellow)} Found #{package} in community. Use pacman!"
68
67
  else
69
68
  Dir.chdir(@config.dir) do
70
69
  fetch package
@@ -88,20 +87,19 @@ class Aur
88
87
 
89
88
  unless result['type'] == 'error'
90
89
  result = result['results']
90
+
91
91
  next if in_sync? result['Name']
92
92
 
93
93
  if package.any? do |pac| # Check both name and description for matches
94
94
  (result['Name'].include?(pac)) || (result['Description'].include?(pac))
95
95
  end
96
96
  count += 1
97
+
97
98
  puts "[#{result['OutOfDate'] == '1' ? ansi('✘', :red) : ansi('✔', :green)}] \
98
99
  #{ansi(result['Name'], :blue)} (#{result['Version']}): #{result['Description']}"
99
100
  end
100
101
  end
101
102
  end
102
-
103
- puts "\n#{ansi('==>', :yellow)} Found #{ansi(count.to_s, :magenta)} \
104
- #{count == 1 ? 'result' : 'results'}"
105
103
  end
106
104
 
107
105
  # Checks the aur for upgrades to local packages that were not found in any
@@ -110,6 +108,7 @@ class Aur
110
108
  def check_upgrade
111
109
  count, upgradable = 0, []
112
110
 
111
+ puts "#{ansi('==>', :yellow)} Searching for upgrades. This may take a while..."
113
112
  `pacman -Qm`.each_line do |line|
114
113
  name, version = line.chomp.split
115
114
  result = json(@config.info % name)
@@ -117,6 +116,8 @@ class Aur
117
116
  unless result['type'] == 'error'
118
117
  result = result['results']
119
118
 
119
+ next if in_sync? result['Name']
120
+
120
121
  if (result.is_a?(Hash)) && (result['Version'] != version)
121
122
  require 'facets/version'
122
123
 
@@ -124,21 +125,20 @@ class Aur
124
125
  count += 1
125
126
  upgradable << name
126
127
 
127
- puts "#{ansi(name, :blink)} (#{ansi(version, :red)}) \
128
- can be upgraded to #{ansi(result['Version'], :green)}"
128
+ puts "#{ansi(name, :bold)} #{ansi(version, :red)} -> \
129
+ #{ansi(result['Version'], :green)}"
129
130
  end
130
- else
131
- puts "#{ansi(name, :bold)} (#{ansi(version, :green)}) is up to date"
132
131
  end
133
132
  end
134
133
  end
135
134
 
136
- puts "\n#{ansi('==>', :yellow)} Found #{ansi(count.to_s, :magenta)} \
137
- #{count == 1 ? 'upgrade' : 'upgrades'}"
138
-
139
- unless upgradable.empty?
135
+ if upgradable.empty? && count == 0
136
+ puts "#{ansi('==>', :yellow)} Everything is up to date"
137
+ else
140
138
  require 'readline'
141
139
 
140
+ puts "#{ansi('==>', :yellow)} Targets (#{count}): #{upgradable.join(', ')}"
141
+
142
142
  upgradable.each do |pkg|
143
143
  answer = Readline::readline("#{ansi('==>', :yellow)} Download #{pkg}? ")
144
144
  answer =~ /^y|yes$/i ? download(pkg) : next
@@ -164,13 +164,10 @@ private
164
164
 
165
165
  info, list = json(@config.search % CGI::escape(package)), []
166
166
 
167
- if info['type'] == 'error'
168
- raise AurbError, "#{ansi('Fatal', :on_red)}: no results"
169
- end
170
-
171
- info['results'].each do |result|
172
- next if in_sync? result['Name']
173
- list << [result['Name'], result['ID']]
167
+ unless info['type'] == 'error'
168
+ info['results'].each do |result|
169
+ list << [result['Name'], result['ID']]
170
+ end
174
171
  end
175
172
 
176
173
  list.sort
@@ -232,16 +229,18 @@ private
232
229
  require 'optparse'
233
230
 
234
231
  OptionParser.new do |o|
235
- o.version = [0, 5, 7].join('.')
232
+ o.version = [0, 5, 8].join('.')
236
233
  o.program_name = 'Aurb'
237
- o.release = '2009-04-14'
234
+ o.release = '2009-04-15'
238
235
 
239
236
  o.on('-D', '--download P1,P2,...', Array, "Download package(s).") do |d|
240
237
  self[:cmd] = "download('#{d*"', '"}')"
241
238
  end
239
+
242
240
  o.on('-S', '--search PKG', 'Search for a package.') do |s|
243
241
  self[:cmd] = "search('#{s}')"
244
242
  end
243
+
245
244
  o.on('-U', '--upgrade', 'Check the AUR for upgrades.') do
246
245
  self[:cmd] = 'check_upgrade'
247
246
  end
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.7
4
+ version: 0.5.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gigamo
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-04-14 00:00:00 -07:00
12
+ date: 2009-04-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency