Sha256: a1ebcc870dbe48d9b349fc57596accf96dceda1b1292ffa50dac8a5379a31053

Contents?: true

Size: 1001 Bytes

Versions: 1

Compression:

Stored size: 1001 Bytes

Contents

#!/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'

  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/core_ext'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
aurb-1.3.0 lib/aurb.rb