pacmine 0.0.1 → 0.0.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 (5) hide show
  1. data/History.txt +4 -0
  2. data/README.txt +5 -2
  3. data/bin/pacmine +19 -6
  4. data/lib/pacmine.rb +17 -0
  5. metadata +10 -10
data/History.txt CHANGED
@@ -4,3 +4,7 @@
4
4
 
5
5
  * Queries archlinux.org for a maintainer's packages.
6
6
 
7
+ === 0.0.2 / 2012-01-10
8
+
9
+ * Add ability to filter results by repository and package name.
10
+
data/README.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  = pacmine
2
2
 
3
- * http://pacmine.somewhere
3
+ * https://rubygems.org/gems/pacmine
4
4
 
5
5
  == DESCRIPTION:
6
6
 
@@ -15,6 +15,9 @@
15
15
  == SYNOPSIS:
16
16
 
17
17
  pacmine list aaron
18
+ pacmine list orphan
19
+ pacmine list plewis --repo community
20
+ pacmine list orphan --filter "kde"
18
21
 
19
22
  == REQUIREMENTS:
20
23
 
@@ -24,7 +27,7 @@
24
27
  == INSTALL:
25
28
 
26
29
  * If you have rubygems set up: gem install pacmine
27
- * Or from the AUR: [link to follow]
30
+ * Or from the AUR: https://aur.archlinux.org/packages.php?ID=55713
28
31
 
29
32
  == LICENSE:
30
33
 
data/bin/pacmine CHANGED
@@ -4,22 +4,27 @@ require 'commander/import'
4
4
  require 'pacmine'
5
5
 
6
6
  # For rubygems
7
- VERSION = '0.0.1'
7
+ VERSION = '0.0.2'
8
8
 
9
9
  # For commander
10
- program :version, '0.0.1'
10
+ program :version, '0.0.2'
11
11
  program :description, "A tool to get a list of someone's packages from archlinux.org"
12
12
 
13
13
  # Default to the intro / help page
14
14
  default_command :help
15
15
 
16
16
  command :list do |c|
17
- c.syntax = 'pacmine list [user]'
18
- c.description = "List the packages maintained by the specified user. Defaults to 'orphan'."
19
- c.option '--file <filename>', String, 'Query the specified file instead of archlinux.org.'
17
+ c.syntax = "pacmine list [user]
18
+
19
+ List packages maintained by a particular user. Defaults to 'orphan'."
20
+
21
+ c.description = "List packages."
22
+ c.option '--file <filename>', String, 'Query the specified file instead of searching on archlinux.org/packages.'
23
+ c.option '--repo <repository>', String, 'Only consider packages from the specified repository.'
24
+ c.option '--filter <regexp>', String, 'Only consider packages whose name match the regular expression.'
20
25
  c.action do |args, options|
21
26
 
22
- # Set the to be the maintainer to pull packages for.
27
+ # Set this to be the maintainer to pull packages for.
23
28
  if args[0]
24
29
  maintainer = args[0]
25
30
  else
@@ -40,6 +45,14 @@ command :list do |c|
40
45
  packages = get_package_list args[0]
41
46
  end
42
47
 
48
+ # Do any filtering we were asked to do
49
+ if options.repo
50
+ packages = filter_by_repo(packages, options.repo)
51
+ end
52
+ if options.filter
53
+ packages = filter_by_name(packages, options.filter)
54
+ end
55
+
43
56
  # And print out the repo and package names
44
57
  packages.each { |package| puts "#{package[:repo]} #{package[:pkgname]}" }
45
58
 
data/lib/pacmine.rb CHANGED
@@ -63,3 +63,20 @@ def get_package_list maintainer, file=nil
63
63
  packages.uniq
64
64
 
65
65
  end
66
+
67
+ # This method takes an array of packages and filters it by repo.
68
+ # Another package array is returned, with only those packages in 'repo' present.
69
+ def filter_by_repo(packages, repo)
70
+
71
+ packages.keep_if { |package| package[:repo] === repo }
72
+
73
+ end
74
+
75
+ # This method takes an array of packages and filters it by name.
76
+ # Another package array is returned, with only those packages whose name matches
77
+ # the regular expression given.
78
+ def filter_by_name(packages, regexp)
79
+
80
+ packages.keep_if { |package| package[:pkgname].match(regexp) }
81
+
82
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pacmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,27 +12,27 @@ cert_chain: []
12
12
  date: 2012-01-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: hoe
16
- requirement: &11169040 !ruby/object:Gem::Requirement
15
+ name: rdoc
16
+ requirement: &8353280 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '2.12'
21
+ version: '3.10'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *11169040
24
+ version_requirements: *8353280
25
25
  - !ruby/object:Gem::Dependency
26
- name: rdoc
27
- requirement: &6675700 !ruby/object:Gem::Requirement
26
+ name: hoe
27
+ requirement: &8352760 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
31
31
  - !ruby/object:Gem::Version
32
- version: '3.10'
32
+ version: '2.12'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *6675700
35
+ version_requirements: *8352760
36
36
  description: ! '* pacmine is a small tool to get a list of the packages a person maintains
37
37
  from archlinux.org.'
38
38
  email:
@@ -53,7 +53,7 @@ files:
53
53
  - lib/pacmine.rb
54
54
  - test/test_pacmine.rb
55
55
  - .gemtest
56
- homepage: http://pacmine.somewhere
56
+ homepage: https://rubygems.org/gems/pacmine
57
57
  licenses: []
58
58
  post_install_message:
59
59
  rdoc_options: