aurb 1.2.1 → 1.2.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/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{aurb}
8
- s.version = "1.2.1"
8
+ s.version = "1.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Gigamo"]
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/aurb/core_ext/object.rb",
34
34
  "lib/aurb/core_ext/string.rb",
35
35
  "lib/aurb/version.rb",
36
+ "performance/aur.rb",
36
37
  "test/test_helper.rb",
37
38
  "test/unit/test_aur.rb",
38
39
  "test/unit/test_support.rb"
@@ -61,7 +61,7 @@ module Aurb
61
61
  upgradables << name.to_sym if upgradable?(name, version)
62
62
  end
63
63
  end.each(&:join)
64
- upgradables
64
+ upgradables.delete_if(&:blank?)
65
65
  end
66
66
 
67
67
  protected
@@ -83,13 +83,16 @@ module Aurb
83
83
  json = parse_json(Aurb.aur_rpc_path(:search, URI.escape(package.to_s)))
84
84
  return [] if json.type =~ /error/
85
85
  ids = json.results.map(&:ID)
86
+ results = []
86
87
  ids.inject([]) do |ary, id|
87
- parse_json Aurb.aur_rpc_path(:info, id) do |json|
88
- next if json.type =~ /error/
89
- ary << json.results.symbolize_keys
88
+ ary << Thread.new do
89
+ parse_json Aurb.aur_rpc_path(:info, id) do |json|
90
+ next if json.type =~ /error/
91
+ results << json.results.symbolize_keys
92
+ end
90
93
  end
91
- ary
92
- end
94
+ end.each(&:join)
95
+ results
93
96
  end
94
97
 
95
98
  private
@@ -25,8 +25,7 @@ module Aurb
25
25
  def download(*pkgs)
26
26
  pkgs = Aurb.aur.download(*pkgs)
27
27
  puts 'No downloadable packages found'.colorize(:red) and return if pkgs.blank?
28
- opts = options.dup
29
- path = opts[:path][0] == '/' ? opts[:path] : File.join(Dir.pwd, opts[:path])
28
+ path = options.path[0] == '/' ? options.path : File.join(Dir.pwd, options.path)
30
29
  if File.exist?(path)
31
30
  path = File.expand_path(path)
32
31
  else
@@ -41,7 +40,7 @@ module Aurb
41
40
  end
42
41
  end
43
42
  Archive::Tar::Minitar.unpack Zlib::GzipReader.new(File.open(local, 'rb')), Dir.pwd
44
- File.delete local unless opts.keep?
43
+ File.delete local unless options.keep?
45
44
  end
46
45
  puts "(#{index+1}/#{pkgs.size}) downloaded #{local}"
47
46
  end
@@ -1,3 +1,3 @@
1
1
  module Aurb
2
- VERSION = '1.2.1'.freeze
2
+ VERSION = '1.2.2'.freeze
3
3
  end
@@ -0,0 +1,16 @@
1
+ require 'pp'
2
+ require 'benchmark'
3
+
4
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
5
+
6
+ require 'aurb'
7
+
8
+ Benchmark.bm 5 do |x|
9
+ x.report 'search' do
10
+ Aurb.aur.search *:quake
11
+ end
12
+
13
+ x.report 'upgrade' do
14
+ Aurb.aur.upgrade *`pacman -Qm`.split(/\n/)
15
+ end
16
+ end
@@ -12,7 +12,7 @@ class AurTest < Test::Unit::TestCase
12
12
  ]
13
13
 
14
14
  versions.each do |version|
15
- assert Aurb::Aur::Version.new(version[:old]) < Aurb::Aur::Version.new(version[:new])
15
+ assert_operator Aurb::Aur::Version.new(version[:old]), :<, Aurb::Aur::Version.new(version[:new])
16
16
  end
17
17
  end
18
18
  end
@@ -21,8 +21,7 @@ class AurTest < Test::Unit::TestCase
21
21
  context 'Aurb::Aur #' do
22
22
  context 'upgrade' do
23
23
  setup do
24
- @list = ['aurb 0.0.0-0',
25
- 'aurb 9.9.9-9']
24
+ @list = "aurb 0.0.0-0\naurb 9.9.9-9".split(/\n/)
26
25
  end
27
26
 
28
27
  should 'return an array' do
@@ -39,7 +38,6 @@ class AurTest < Test::Unit::TestCase
39
38
  setup do
40
39
  @package_working = 'aurb'
41
40
  @package_faulty = 'foobarbaz'
42
- @package_multi = 'aurb', 'yaourt'
43
41
  end
44
42
 
45
43
  should 'return an array' do
@@ -61,7 +59,6 @@ class AurTest < Test::Unit::TestCase
61
59
  setup do
62
60
  @package_working = 'aurb'
63
61
  @package_faulty = 'foobarbaz'
64
- @package_multi = 'aurb', 'yaourt'
65
62
  end
66
63
 
67
64
  should 'return an array of results' do
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.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gigamo
@@ -87,6 +87,7 @@ files:
87
87
  - lib/aurb/core_ext/object.rb
88
88
  - lib/aurb/core_ext/string.rb
89
89
  - lib/aurb/version.rb
90
+ - performance/aur.rb
90
91
  - test/test_helper.rb
91
92
  - test/unit/test_aur.rb
92
93
  - test/unit/test_support.rb