pacmine 0.0.1
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/.gemtest +0 -0
- data/History.txt +6 -0
- data/Manifest.txt +6 -0
- data/README.txt +31 -0
- data/Rakefile +34 -0
- data/bin/pacmine +47 -0
- data/lib/pacmine.rb +65 -0
- data/test/test_pacmine.rb +8 -0
- metadata +84 -0
data/.gemtest
ADDED
File without changes
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
= pacmine
|
2
|
+
|
3
|
+
* http://pacmine.somewhere
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
* pacmine is a small tool to get a list of the packages a person maintains from archlinux.org.
|
8
|
+
|
9
|
+
== FEATURES/PROBLEMS:
|
10
|
+
|
11
|
+
* Given a maintainer's username, pacmine queries the package database at
|
12
|
+
* archlinux.org/packages and return a list of the packages that person
|
13
|
+
* maintains.
|
14
|
+
|
15
|
+
== SYNOPSIS:
|
16
|
+
|
17
|
+
pacmine list aaron
|
18
|
+
|
19
|
+
== REQUIREMENTS:
|
20
|
+
|
21
|
+
* commander
|
22
|
+
* hpricot
|
23
|
+
|
24
|
+
== INSTALL:
|
25
|
+
|
26
|
+
* If you have rubygems set up: gem install pacmine
|
27
|
+
* Or from the AUR: [link to follow]
|
28
|
+
|
29
|
+
== LICENSE:
|
30
|
+
|
31
|
+
GPL version 3, or at your option, any later version.
|
data/Rakefile
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
|
6
|
+
# Hoe.plugin :compiler
|
7
|
+
# Hoe.plugin :compiler
|
8
|
+
# Hoe.plugin :compiler
|
9
|
+
# Hoe.plugin :compiler
|
10
|
+
# Hoe.plugin :gem_prelude_sucks
|
11
|
+
# Hoe.plugin :gem_prelude_sucks
|
12
|
+
# Hoe.plugin :gem_prelude_sucks
|
13
|
+
# Hoe.plugin :gem_prelude_sucks
|
14
|
+
# Hoe.plugin :inline
|
15
|
+
# Hoe.plugin :inline
|
16
|
+
# Hoe.plugin :inline
|
17
|
+
# Hoe.plugin :inline
|
18
|
+
# Hoe.plugin :minitest
|
19
|
+
# Hoe.plugin :minitest
|
20
|
+
# Hoe.plugin :minitest
|
21
|
+
# Hoe.plugin :racc
|
22
|
+
# Hoe.plugin :racc
|
23
|
+
# Hoe.plugin :racc
|
24
|
+
# Hoe.plugin :racc
|
25
|
+
# Hoe.plugin :rubyforge
|
26
|
+
# Hoe.plugin :rubyforge
|
27
|
+
# Hoe.plugin :rubyforge
|
28
|
+
# Hoe.plugin :rubyforge
|
29
|
+
|
30
|
+
Hoe.spec 'pacmine' do
|
31
|
+
developer('Peter Lewis', 'pete@muddygoat.org')
|
32
|
+
end
|
33
|
+
|
34
|
+
# vim: syntax=ruby
|
data/bin/pacmine
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'commander/import'
|
4
|
+
require 'pacmine'
|
5
|
+
|
6
|
+
# For rubygems
|
7
|
+
VERSION = '0.0.1'
|
8
|
+
|
9
|
+
# For commander
|
10
|
+
program :version, '0.0.1'
|
11
|
+
program :description, "A tool to get a list of someone's packages from archlinux.org"
|
12
|
+
|
13
|
+
# Default to the intro / help page
|
14
|
+
default_command :help
|
15
|
+
|
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.'
|
20
|
+
c.action do |args, options|
|
21
|
+
|
22
|
+
# Set the to be the maintainer to pull packages for.
|
23
|
+
if args[0]
|
24
|
+
maintainer = args[0]
|
25
|
+
else
|
26
|
+
maintainer = "orphan"
|
27
|
+
end
|
28
|
+
|
29
|
+
# If we've been passed a --file <filename>, then query that instead of the
|
30
|
+
# archlinux.org server.
|
31
|
+
if options.file
|
32
|
+
if args[0]
|
33
|
+
warn "It doesn't make sense to specify a user when using --file."
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
# Get the package list from the given file - no user needed
|
37
|
+
packages = get_package_list nil, options.file
|
38
|
+
else
|
39
|
+
# Pull package list page from archlinux.org for given user
|
40
|
+
packages = get_package_list args[0]
|
41
|
+
end
|
42
|
+
|
43
|
+
# And print out the repo and package names
|
44
|
+
packages.each { |package| puts "#{package[:repo]} #{package[:pkgname]}" }
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
data/lib/pacmine.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'hpricot'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
# Get a list of packages for the maintainer specified
|
5
|
+
# If file is a string containing a filename, query that instead, ignoring
|
6
|
+
# whichever maintainer username was given.
|
7
|
+
def get_package_list maintainer, file=nil
|
8
|
+
|
9
|
+
# Query the package source
|
10
|
+
if file
|
11
|
+
begin
|
12
|
+
doc = Hpricot( File.open(file, "r") { |f| f.read } )
|
13
|
+
rescue
|
14
|
+
warn "There was a problem reading the file specified."
|
15
|
+
exit 1
|
16
|
+
end
|
17
|
+
else
|
18
|
+
begin
|
19
|
+
doc = open("http://www.archlinux.org/packages/?sort=&q=&maintainer=#{maintainer}&limit=9999") { |f| Hpricot(f) }
|
20
|
+
rescue
|
21
|
+
warn "There was a problem querying www.archlinux.org for the package list."
|
22
|
+
exit 1
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
# Get the results table from the document
|
27
|
+
table = doc.at("//table[@class='results']")
|
28
|
+
|
29
|
+
# Put each of the rows in the table into an array
|
30
|
+
begin
|
31
|
+
rows = table.search("//tr")
|
32
|
+
rescue
|
33
|
+
warn "Could not find any packages."
|
34
|
+
exit 1
|
35
|
+
end
|
36
|
+
|
37
|
+
# Remove the first row, which contains column headers
|
38
|
+
rows.shift
|
39
|
+
|
40
|
+
# We will store our list of packages here
|
41
|
+
packages = Array.new
|
42
|
+
|
43
|
+
# Collect the packages and their repos from the array of rows,
|
44
|
+
# put them in to the packages array.
|
45
|
+
rows.each do |row|
|
46
|
+
|
47
|
+
# The columns (td elements) for this row
|
48
|
+
columns = row.search("//td")
|
49
|
+
|
50
|
+
# The repo is in column 1
|
51
|
+
repo = columns[1].inner_html.downcase
|
52
|
+
|
53
|
+
# The package name is in column 2 as a hyperlink
|
54
|
+
pkgname = columns[2].at("//a").inner_html
|
55
|
+
|
56
|
+
# Add this package and repo name to the packages array
|
57
|
+
packages.push ({:repo => repo, :pkgname => pkgname})
|
58
|
+
|
59
|
+
end
|
60
|
+
|
61
|
+
# Finally, remove duplicates and return.
|
62
|
+
# (For example, packages with multiple architectures will be duplicated).
|
63
|
+
packages.uniq
|
64
|
+
|
65
|
+
end
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: pacmine
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Peter Lewis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-10 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: hoe
|
16
|
+
requirement: &11169040 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.12'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *11169040
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rdoc
|
27
|
+
requirement: &6675700 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.10'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *6675700
|
36
|
+
description: ! '* pacmine is a small tool to get a list of the packages a person maintains
|
37
|
+
from archlinux.org.'
|
38
|
+
email:
|
39
|
+
- pete@muddygoat.org
|
40
|
+
executables:
|
41
|
+
- pacmine
|
42
|
+
extensions: []
|
43
|
+
extra_rdoc_files:
|
44
|
+
- History.txt
|
45
|
+
- Manifest.txt
|
46
|
+
- README.txt
|
47
|
+
files:
|
48
|
+
- History.txt
|
49
|
+
- Manifest.txt
|
50
|
+
- README.txt
|
51
|
+
- Rakefile
|
52
|
+
- bin/pacmine
|
53
|
+
- lib/pacmine.rb
|
54
|
+
- test/test_pacmine.rb
|
55
|
+
- .gemtest
|
56
|
+
homepage: http://pacmine.somewhere
|
57
|
+
licenses: []
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options:
|
60
|
+
- --main
|
61
|
+
- README.txt
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
none: false
|
72
|
+
requirements:
|
73
|
+
- - ! '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
requirements: []
|
77
|
+
rubyforge_project: pacmine
|
78
|
+
rubygems_version: 1.8.11
|
79
|
+
signing_key:
|
80
|
+
specification_version: 3
|
81
|
+
summary: ! '* pacmine is a small tool to get a list of the packages a person maintains
|
82
|
+
from archlinux.org.'
|
83
|
+
test_files:
|
84
|
+
- test/test_pacmine.rb
|