Module Bat
In: lib/bat.rb

Methods

Classes and Modules

Class Bat::Bzr
Class Bat::Optparser
Class Bat::OrigBuilder
Class Bat::PullLP

Public Instance methods

Returns true if File is available and the only one of it‘s kind (necessary if a wildcard is used).

Sanity checks changelog. It expects to be executed in ../ from the changelog (i.e. it will read debian/changelog and fail if it is not readable).

Depending on your changelog entry it will prevent unwanted backports or uploads with wrong version number to target distribution (TD) If the suffix indicates BD but the distribution indacates TD it exists with code 1 after explaining the situtation using a KDialog. If the suffix doesn‘t indicate TD but the version does it will query for user input and possibly exit with code 1.

Debuild -S -sa -k"KEY". This method expects to be used within the main source tree directory.

Nuke given directory and recreate it. If enter is set to true it will also enter the directory right away.

Dput to defined location. If no location is defined it will query for input via gets (thus this won‘t work with scripts that require an argument by default, not yet anyway).

Wrapper around Bat::pt. It will add the word ERROR to the output. And exit with code 1.

Evaluates error code and puts a string as warning (using wrn) if keeprunning is true and code != 0. If keeprunning is false it calls err.

Gets latest bzr branch from a specified kubuntu-members application branch.

Opens SSL connection to launchpad.net and tries to get url. If the HTTP response is not HTTPOK, it will invoke a warning and return without value. Otherwise it returns the response object.

Gets latest available source from Launchpad, using pull-lp-source from the ubuntu-dev-tools package. It expects at least the application name and will use the default target distribution unless something else gets defined. If the used prev directory is already available it will use Bat::dir_revive to nuke it and recreate it.

Construct URL for a package owned by the kubuntu-members team on LP

Parses a given application or language name according to a predefined conversation list. The default conversion would be from Kubuntu names to upstream names (e.g. kde4libs => kdelibs).

Information if require can‘t load the required file, It can tell the user what package to install in order to fix a failed require.

Parse changelog. It reads the very first line of debian/changelog and splits it into application, version, distribution and urgency.

Wrapper around IO#puts. It will add custom formating to ensure batmessages are more visible than regular terminal output. It expects @batpart to be set. Thus you can influence it at runtime, eventually this will change to harddetection of the part using the script name.

    pt("Reading your emails")               #=> .!!!~~~~>Bat batget: Reading your emails
    pt("Reading your emails", " seriously") #=> .!!!~~~~>Bat batget seriously: Reading your emails

Output script synopsis. mandatory contains a comma seperated list of mandatory arguments, while optional contains a comma seperated list of optional arguments.

    synopsis("PACKAGENAME,PATH")       #=> ./batget.rb PACKAGENAME|PATH
    synopsis("PATH","download,upload") #=> ./batget.rb PATH [download|upload]
    synopsis(,"download,upload")       #=> ./batget.rb [download|upload]

Bat::Optparser provides a more powerful implementation of option parsing, in a lot of cases you would only need a simple approach however. For example when you only parse one argument anyway.

Wrapper for wget.

Before running wget it will try to remove the file passed as argument url. That said Bat::wget should only be used if this behavior is expected (e.g when replacing files with an online stored more up-to-date version).

    Dir.glob("*")                             #=> ["example.rb"]
    Bat::wget("http://example.tld/examle.rb")
    Dir.glob("*")                             #=> ["example.rb"]

    Dir.glob("*")                             #=> ["example.rb"]
    %x[wget "http://example.tld/examle.rb"]
    Dir.glob("*")                             #=> ["example.rb", "example.rb.1"]

Wrapper around Bat::pt. It will add the word WARNING to the output.

[Validate]