aurb 1.2.4 → 1.3.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/README.md +4 -0
- data/VERSION +1 -1
- data/aurb.gemspec +2 -2
- data/lib/aurb/aur.rb +18 -6
- data/lib/aurb/cli.rb +16 -5
- data/lib/aurb/version.rb +1 -1
- data/lib/aurb.rb +11 -2
- data/performance/aur.rb +12 -4
- metadata +2 -2
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.3.0
|
data/aurb.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{aurb}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gigamo"]
|
12
|
-
s.date = %q{2010-03-
|
12
|
+
s.date = %q{2010-03-07}
|
13
13
|
s.default_executable = %q{aurb}
|
14
14
|
s.email = %q{gigamo@gmail.com}
|
15
15
|
s.executables = ["aurb"]
|
data/lib/aurb/aur.rb
CHANGED
@@ -53,6 +53,16 @@ module Aurb
|
|
53
53
|
end.delete_if(&:blank?)
|
54
54
|
end
|
55
55
|
|
56
|
+
# Returns all available info for a given package name.
|
57
|
+
#
|
58
|
+
# info('aurb') # => {:ID => ..., :Name => 'aurb', ...}
|
59
|
+
def info(package)
|
60
|
+
parse_json Aurb.aur_rpc_path(:info, package.to_s) do |json|
|
61
|
+
return if json.type =~ /error/
|
62
|
+
json.results
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
56
66
|
# Returns a +list+ of names of packages that have an upgrade
|
57
67
|
# available to them, which could then in turn be passed on to
|
58
68
|
# the +download+ method.
|
@@ -73,6 +83,14 @@ module Aurb
|
|
73
83
|
|
74
84
|
protected
|
75
85
|
|
86
|
+
# Shortcut to the +Yajl+ JSON parser.
|
87
|
+
def parse_json(json)
|
88
|
+
json = Yajl::Parser.new.parse(open(json).read)
|
89
|
+
yield json rescue json
|
90
|
+
end
|
91
|
+
|
92
|
+
private
|
93
|
+
|
76
94
|
# Compare version of local +package+ with the one on the AUR.
|
77
95
|
def upgradable?(package, version)
|
78
96
|
local_version = Version.new(version)
|
@@ -83,11 +101,5 @@ module Aurb
|
|
83
101
|
end
|
84
102
|
remote_version && local_version < remote_version
|
85
103
|
end
|
86
|
-
|
87
|
-
# Shortcut to the +Yajl+ JSON parser.
|
88
|
-
def parse_json(json)
|
89
|
-
json = Yajl::Parser.new.parse(open(json).read)
|
90
|
-
yield json rescue json
|
91
|
-
end
|
92
104
|
end
|
93
105
|
end
|
data/lib/aurb/cli.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# encoding: utf-8
|
3
3
|
|
4
|
-
$LOAD_PATH.unshift File.dirname(__FILE__) + '/..'
|
4
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/..')
|
5
5
|
require 'thor'
|
6
6
|
require 'aurb'
|
7
7
|
|
@@ -24,12 +24,12 @@ module Aurb
|
|
24
24
|
:banner => 'Keep the tarball after downloading'
|
25
25
|
def download(*pkgs)
|
26
26
|
pkgs = Aurb.aur.download(*pkgs)
|
27
|
-
|
27
|
+
raise Aurb::NoResultsError if pkgs.blank?
|
28
28
|
path = options.path[0] == '/' ? options.path : File.join(Dir.pwd, options.path)
|
29
29
|
if File.exist?(path)
|
30
30
|
path = File.expand_path(path)
|
31
31
|
else
|
32
|
-
raise
|
32
|
+
raise Aurb::DownloadError, "'#{path}' is not a valid path"
|
33
33
|
end
|
34
34
|
pkgs.each_with_index do |package, index|
|
35
35
|
local = package.split('/')[-1]
|
@@ -49,7 +49,7 @@ module Aurb
|
|
49
49
|
desc 'search PACKAGES', 'Search for packages'
|
50
50
|
def search(*pkgs)
|
51
51
|
pkgs = Aurb.aur.search(*pkgs)
|
52
|
-
|
52
|
+
raise Aurb::NoResultsError if pkgs.blank?
|
53
53
|
pkgs.each do |package|
|
54
54
|
status = package.OutOfDate == '1' ? '✘'.colorize(:red) : '✔'.colorize(:green)
|
55
55
|
name, version, description = package.Name.colorize(:yellow),
|
@@ -59,11 +59,22 @@ module Aurb
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
desc 'info PACKAGE', 'List all available information for a given package'
|
63
|
+
def info(pkg)
|
64
|
+
info = Aurb.aur.info(pkg)
|
65
|
+
raise Aurb::NoResultsError if info.blank?
|
66
|
+
info.each do |key, value|
|
67
|
+
print key.colorize(:yellow)
|
68
|
+
(key.size..11).each { print ' ' }
|
69
|
+
print value, "\n"
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
62
73
|
desc 'upgrade', 'Search for upgrades to installed packages'
|
63
74
|
def upgrade
|
64
75
|
list = `pacman -Qm`.split(/\n/)
|
65
76
|
pkgs = Aurb.aur.upgrade(*list)
|
66
|
-
|
77
|
+
raise Aurb::NoResultsError if pkgs.blank?
|
67
78
|
pkgs.each do |package|
|
68
79
|
puts "#{package.to_s.colorize(:yellow)} has an upgrade available"
|
69
80
|
end
|
data/lib/aurb/version.rb
CHANGED
data/lib/aurb.rb
CHANGED
@@ -25,8 +25,17 @@ module Aurb #:nodoc:
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
-
class
|
29
|
-
|
28
|
+
class NoResultsError < AurbError
|
29
|
+
status_code 7
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
super('No results found')
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
class DownloadError < AurbError
|
37
|
+
status_code 10
|
38
|
+
end
|
30
39
|
|
31
40
|
class << self
|
32
41
|
def logger
|
data/performance/aur.rb
CHANGED
@@ -5,12 +5,20 @@ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
|
5
5
|
|
6
6
|
require 'aurb'
|
7
7
|
|
8
|
-
Benchmark.bm
|
9
|
-
x.report '
|
8
|
+
Benchmark.bm 20 do |x|
|
9
|
+
x.report 'aurb upgrade' do
|
10
|
+
Aurb.aur.upgrade *`pacman -Qm`.split(/\n/)
|
11
|
+
end
|
12
|
+
|
13
|
+
x.report 'aurb search' do
|
10
14
|
Aurb.aur.search *:quake
|
11
15
|
end
|
12
16
|
|
13
|
-
x.report '
|
14
|
-
|
17
|
+
x.report 'slurpy search' do
|
18
|
+
`slurpy --search quake`
|
19
|
+
end
|
20
|
+
|
21
|
+
x.report 'bauerbill search' do
|
22
|
+
`bauerbill -Ss quake --aur`
|
15
23
|
end
|
16
24
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: aurb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
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: 2010-03-
|
12
|
+
date: 2010-03-07 00:00:00 +01:00
|
13
13
|
default_executable: aurb
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|