lib/aurb.rb in aurb-1.3.0 vs lib/aurb.rb in aurb-1.4.0

- old
+ new

@@ -1,59 +1,13 @@ #!/usr/bin/env ruby # encoding: utf-8 -$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__)) - -require 'logger' require 'open-uri' - require 'zlib' require 'yajl' -require 'ansi' require 'archive/tar/minitar' -module Aurb #:nodoc: - autoload :Aur, 'aurb/aur' +libdir = File.dirname(__FILE__) +$LOAD_PATH.unshift libdir unless $LOAD_PATH.include?(libdir) - class AurbError < StandardError - def self.status_code(code = nil) - return @code unless code - @code = code - end - - def status_code - self.class.status_code - end - end - - class NoResultsError < AurbError - status_code 7 - - def initialize - super('No results found') - end - end - - class DownloadError < AurbError - status_code 10 - end - - class << self - def logger - @logger ||= Logger.new(STDOUT) - end - - def aur_rpc_path(type, arg) - "http://aur.archlinux.org/rpc.php?type=#{type}&arg=#{arg}" - end - - def aur_download_path(pkg) - "http://aur.archlinux.org/packages/#{pkg}/#{pkg}.tar.gz" - end - - def aur - @aur ||= Aur.new - end - end -end - +require 'aurb/base' require 'aurb/core_ext'