evaryont-arson 2.0.2 → 2.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/PKGBUILD CHANGED
@@ -1,6 +1,6 @@
1
1
  # Contributor: Colin 'Evaryont' Shea <evaryont@saphrix.com>
2
2
  pkgname=arson
3
- pkgver=2.0.2
3
+ pkgver=2.1.1
4
4
  pkgrel=1
5
5
  pkgdesc="The HOT AUR search helper!"
6
6
  arch=(any)
@@ -11,7 +11,7 @@ makedepends=(rubygems)
11
11
  filename="evaryont-$pkgname-$pkgver.gem"
12
12
  source=(http://gems.github.com/gems/$filename)
13
13
  noextract=($filename)
14
- md5sums=('978da401438c6d18b78ad0e89254111a')
14
+ md5sums=('f509e388af796c211e53266a5fb34114')
15
15
 
16
16
  build() {
17
17
  cd $srcdir
data/README.mkd CHANGED
@@ -1,6 +1,6 @@
1
1
  # This is arson 2.0, the hot AUR search helper!
2
2
 
3
- There is 3 primary (and only, ever) functions of arson:
3
+ There is 3 functions of arson:
4
4
 
5
5
  * Searching
6
6
  * Downloading
@@ -27,25 +27,24 @@ results to you, in color.
27
27
 
28
28
  ### Downloading
29
29
 
30
- If you pass arson the parameter "aur/foo" (however many spaces between) it will
31
- attempt to download the package. Or, if the search results only have 1 result,
32
- arson will download that package instead of displaying only 1. If you pass the
33
- category (i.e. "aur-system/arson") arson will understand that as well.
34
-
30
+ To download a package, pass "-d" to arson. Any other arguments will be converted
31
+ into a single string (space separated) and arson will try to download a package
32
+ with that exact name. e.g.:
33
+ arson -d arson # Downloads the package "arson"
34
+ arson -d pacman color # Downloads the package "pacman color"
35
+ arson won't perform any clean up on the passed parameters, so (using the 2nd
36
+ example) arson will try to find the 'pacman color' package while you probably
37
+ meant the 'pacman-color' package.
35
38
 
36
39
  -----
37
40
 
38
41
  ### Updating
39
42
 
40
- If you pass "?" as the only parameter, arson will search through the locally
41
- installed foreign packages (as reported by `pacman -Qm') and return a list
42
- of possible updates available in the AUR.
43
+ If you pass -u to arson, it will search through the locally installed foreign
44
+ packages (as reported by `pacman -Qm') and return a list of possible updates
45
+ available in the AUR.
43
46
 
44
47
  -----
45
48
 
46
- You can not pass anything to arson to get a quick summary of these options.
47
-
48
-
49
- (ps: Yes, I did report arson as dead, and within the hour restart development
50
- on it. I'm crazy like that, I guess. Also, Daenyth and rson wanted me to
51
- continue. Yay having people who actually like my software!)
49
+ You can not pass anything or pass -h or --help to arson to get a quick summary of
50
+ these options.
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
- :patch: 2
3
2
  :major: 2
4
- :minor: 0
3
+ :minor: 1
4
+ :patch: 1
data/arson.gemspec CHANGED
@@ -2,26 +2,25 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{arson}
5
- s.version = "2.0.2"
5
+ s.version = "2.1.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Colin 'Evaryont' Shea"]
9
- s.date = %q{2009-05-07}
9
+ s.date = %q{2009-06-16}
10
10
  s.default_executable = %q{arson}
11
11
  s.description = %q{The HOT AUR search helper}
12
12
  s.email = %q{evaryont@saphrix.com}
13
13
  s.executables = ["arson"]
14
- s.files = ["PKGBUILD", "README.mkd", "Rakefile", "VERSION.yml", "arson.gemspec", "bin/arson", "lib/arson.rb", "lib/arson/colorful.rb", "lib/arson/download.rb", "lib/arson/search.rb", "lib/arson/upgrade.rb", "lib/arson/version.rb"]
15
- s.has_rdoc = true
14
+ s.files = ["PKGBUILD", "README.mkd", "Rakefile", "VERSION.yml", "arson.gemspec", "bin/arson", "lib/arson.rb", "lib/arson/colorful.rb", "lib/arson/config.rb", "lib/arson/download.rb", "lib/arson/search.rb", "lib/arson/upgrade.rb", "lib/arson/version.rb"]
16
15
  s.homepage = %q{http://evaryont.github.com/arson/}
17
16
  s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
18
17
  s.require_paths = ["lib"]
19
- s.rubygems_version = %q{1.3.1}
18
+ s.rubygems_version = %q{1.3.3}
20
19
  s.summary = %q{The HOT AUR search helper}
21
20
 
22
21
  if s.respond_to? :specification_version then
23
22
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
- s.specification_version = 2
23
+ s.specification_version = 3
25
24
 
26
25
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
27
26
  s.add_runtime_dependency(%q<json>, [">= 1.1.3"])
data/bin/arson CHANGED
@@ -4,34 +4,43 @@ $:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
4
4
 
5
5
  require 'arson'
6
6
  require 'arson/colorful'
7
+ require 'optparse'
7
8
 
9
+ Arson::Config.write unless File.exists? Arson::Config::FILE_PATH
8
10
 
9
- if ARGV.to_s == ""
10
- puts "arson #{Arson::VERSION.join('.')} [Colin 'Evaryont' Shea <evaryont@saphrix.com>]"
11
- puts "Please specifiy what to search for as the parameters to this script:"
12
- puts Arson.colorful(:italic, " #{Arson::PROGRAM} pacman")
13
- puts ""
14
- puts "If you want to download a package, run #{Arson::PROGRAM} as such:"
15
- puts Arson.colorful(:italic, " #{Arson::PROGRAM} aur/arson")
16
- puts "(note: you can include the -category bit if you wish)"
17
- puts ""
18
- puts "Passing '?' to arson will cause it to check for any upgrades"
19
- exit 1
20
- end
11
+ options = {:download => 0}
12
+ opts = OptionParser.new do |opts|
13
+ opts.banner = "Usage: arson [options]"
21
14
 
22
- # Old regexp /^aur(?:-.*)\/(.*)$/
23
- if pkg = ARGV.to_s.scan(/aur(-.*?)?\/(.*)/i).flatten[1]
24
- if pkg = Arson.find_exact(pkg)
25
- puts "Downloading #{pkg['Name']}..."
26
- Arson.download(pkg)
15
+ opts.on("-d", "--download", "Download the exact package name", "Repeating this will download other depenedencies in AUR") do
16
+ options[:download] += 1
17
+ end
18
+
19
+ opts.on("-u", "--upgrade", "Check for upgrades") do
20
+ options[:upgrade] = true
21
+ end
22
+
23
+ opts.on_tail("-h", "--help", "Show this message") do
24
+ puts opts
27
25
  exit 0
28
- else
29
- warn "I think you attempted to download a package, but I couldn't find it"
26
+ end
27
+
28
+ opts.on_tail("--version", "Show version") do
29
+ puts "arson v#{Arson::VERSION.join('.')}"
30
+ puts "Copyright (C) 2008 Colin Shea <colin@evaryont.me>"
31
+ puts "Licensed under the GPLv3, all rights reserved"
30
32
  exit 0
31
33
  end
34
+
32
35
  end
36
+ ARGV.empty? ? opts.parse!(["-h"]) : opts.parse!(ARGV)
33
37
 
34
- if ARGV.to_s =~ /\?/
38
+ if options[:download] > 0 and ARGV.empty?
39
+ warn "Missing names of packages to download!"
40
+ exit 1
41
+ end
42
+
43
+ if options[:upgrade]
35
44
  print "Checking for upgrades..."
36
45
  $stdout.flush
37
46
  upgrades = Arson.check_upgrades
@@ -39,12 +48,24 @@ if ARGV.to_s =~ /\?/
39
48
  print "\n"
40
49
  $stdout.flush
41
50
  upgrades.each do |line, new_version|
42
- puts "#{line.strip} #{Arson::ASCII_CHECK} #{Arson.colorful("Green", new_version)}"
51
+ puts "#{line.strip} #{Arson.colorful("Green", new_version)}"
43
52
  end
44
53
  else
45
54
  puts "Nothing to update"
46
55
  end
47
56
  exit 0
57
+ elsif options[:download] > 0
58
+ exit_code = 0
59
+ ARGV.each do |pkg|
60
+ if pkg = Arson.find_exact(pkg)
61
+ puts "Downloading #{pkg['Name']}..."
62
+ Arson.download(pkg)
63
+ else
64
+ warn "No such package '#{pkg}'"
65
+ exit_code = 1
66
+ end
67
+ end
68
+ exit exit_code
48
69
  end
49
70
 
50
71
  packages = Arson.search(ARGV)
@@ -70,8 +91,10 @@ elsif packages.length == 1
70
91
  exit 0
71
92
  end
72
93
 
73
- if File.exists? "/usr/bin/pacman-color"
74
- exec "/usr/bin/pacman-color -Ss #{ARGV.join(' ')}"
75
- else
76
- exec "/usr/bin/pacman -Ss #{ARGV.join(' ')}"
94
+ if Arson::Config["run-pacman"]
95
+ if File.exists? "/usr/bin/pacman-color" and Arson::Config["color"]
96
+ exec "/usr/bin/pacman-color -Ss #{ARGV.join(' ')}"
97
+ else
98
+ exec "/usr/bin/pacman -Ss #{ARGV.join(' ')}"
99
+ end
77
100
  end
@@ -1,7 +1,7 @@
1
1
  class Arson
2
2
  class << self
3
3
  def colorful(color, string)
4
- return string unless $stdout.tty?
4
+ return string unless $stdout.tty? and Arson::Config["color"]
5
5
  colored = ""
6
6
  if color.is_a? String
7
7
  Colors[color].each do |effect|
@@ -0,0 +1,27 @@
1
+ require 'yaml'
2
+
3
+ class Arson
4
+ module Config
5
+
6
+ # The location of the configuration file (hard coded for now)
7
+ FILE_PATH = File.expand_path(File.join("~", ".arson.yaml"))
8
+ # The loaded configuration
9
+ LOADED_YAML = File.exists?(FILE_PATH) ? open(FILE_PATH) {|f| YAML::load(f) } : {}
10
+ # Default configuration values
11
+ DEFAULTS = {"dir" => File.expand_path("~"), "pacman" => true, "color" => true}
12
+ # Merged values representing a combination of the user's choices
13
+ # and the defaults
14
+ MERGED = LOADED_YAML ? DEFAULTS.merge(LOADED_YAML) : DEFAULTS
15
+
16
+ # Returns the value for that configuration option (as a string)
17
+ def self.[](option)
18
+ MERGED[option.to_s]
19
+ end
20
+
21
+ def self.write
22
+ open(FILE_PATH, "w") do |file|
23
+ file.write(DEFAULTS.to_yaml)
24
+ end
25
+ end
26
+ end
27
+ end
@@ -20,16 +20,18 @@ class Arson
20
20
  # After the file is downloaded, it is attempted to be unpacked using
21
21
  # tar and gunzip formats.
22
22
  def real_download(url)
23
- open(url) do |tar|
24
- # Write the stream to a file, b is JIC
25
- File.open(File.basename(url), "wb") do |file|
26
- file.write(tar.read)
23
+ Dir.chdir(Arson::Config["dir"]) do
24
+ open(url) do |tar|
25
+ # Write the stream to a file, b (binary) is JIC
26
+ File.open(File.basename(url), "wb") do |file|
27
+ file.write(tar.read)
28
+ end
27
29
  end
30
+ tgz = Zlib::GzipReader.new(File.open(File.basename(url), 'rb'))
31
+ # Extract pkg.tar.gz to `pwd`, instead of `pwd`/pkg
32
+ Archive::Tar::Minitar.unpack(tgz, Dir.pwd)
33
+ FileUtils.mv File.basename(url), File.join(Dir.pwd, File.basename(url)[0..-8])
28
34
  end
29
- tgz = Zlib::GzipReader.new(File.open(File.basename(url), 'rb'))
30
- # Extract pkg.tar.gz to `pwd`, instead of `pwd`/pkg
31
- Archive::Tar::Minitar.unpack(tgz, Dir.pwd)
32
- FileUtils.mv File.basename(url), File.join(Dir.pwd, File.basename(url)[0..-8])
33
35
  end
34
36
  end
35
37
  end
data/lib/arson/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Automattically generated by `rake version:write' - use version:bump to change
2
2
  # this, do not edit this directly, as it will be overwritten!
3
3
  class Arson
4
- VERSION = [2, 0, 2]
4
+ VERSION = [2, 1, 1]
5
5
  end
data/lib/arson.rb CHANGED
@@ -7,6 +7,7 @@ require 'facets/minitar'
7
7
  require 'facets/version'
8
8
 
9
9
  require 'arson/version'
10
+ require 'arson/config'
10
11
  require 'arson/search'
11
12
  require 'arson/download'
12
13
  require 'arson/upgrade'
@@ -18,6 +19,7 @@ class Arson
18
19
  Categories = %w{nil nil daemons devel editors emulators games gnome
19
20
  i18n kde lib modules multimedia network office
20
21
  science system x11 xfce kernels}
22
+
21
23
  # Defaults from pacman-color
22
24
  Colors = {"Magenta" => [:bold, :magenta],
23
25
  "White" => [:bold],
@@ -29,14 +31,11 @@ class Arson
29
31
  # And support for user modifications. Note that inline comments (ie
30
32
  # "White = gray # blah blah") aren't supported and cause this to crash
31
33
  Colors.merge!( Hash[ open("/etc/pacman.d/color.conf").readlines.map(&:strip).reject do |line|
32
- line=~ /^#/||line=~ /^$/
34
+ line=~ /^#/ || line=~ /^$/
33
35
  end.map do |line|
34
- a=line.split("=").map(&:strip); [a[0], a[1].sub(/intensive/, "bold").split.map(&:to_sym)]
36
+ array = line.split("=").map(&:strip)
37
+ [a[0], a[1].sub(/intensive/, "bold").split.map(&:to_sym)]
35
38
  end ] ) if File.exists? "/etc/pacman.d/color.conf"
36
39
 
37
40
  PROGRAM = File.basename($0)
38
-
39
- # These will possibly be redefined later.
40
- ASCII_X = '✘'
41
- ASCII_CHECK = '✔'
42
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evaryont-arson
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.2
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin 'Evaryont' Shea
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-07 00:00:00 -07:00
12
+ date: 2009-06-16 00:00:00 -07:00
13
13
  default_executable: arson
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -49,11 +49,12 @@ files:
49
49
  - bin/arson
50
50
  - lib/arson.rb
51
51
  - lib/arson/colorful.rb
52
+ - lib/arson/config.rb
52
53
  - lib/arson/download.rb
53
54
  - lib/arson/search.rb
54
55
  - lib/arson/upgrade.rb
55
56
  - lib/arson/version.rb
56
- has_rdoc: true
57
+ has_rdoc: false
57
58
  homepage: http://evaryont.github.com/arson/
58
59
  post_install_message:
59
60
  rdoc_options:
@@ -78,7 +79,7 @@ requirements: []
78
79
  rubyforge_project:
79
80
  rubygems_version: 1.2.0
80
81
  signing_key:
81
- specification_version: 2
82
+ specification_version: 3
82
83
  summary: The HOT AUR search helper
83
84
  test_files: []
84
85