Skip to content

Commit

Permalink
move more docs to db.c and rpm.c
Browse files Browse the repository at this point in the history
  • Loading branch information
dmacvicar committed Aug 29, 2011
1 parent 571215d commit 772e254
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 123 deletions.
9 changes: 1 addition & 8 deletions ext/rpm/db.c
Expand Up @@ -1299,14 +1299,7 @@ Init_rpm_transaction(void)
rb_undef_method(rpm_cTransaction, "dup");
rb_undef_method(rpm_cTransaction, "clone");

/*
* @attr [Number] type Type of event
* @attr [Number] key Key transactions
* @attr [Package] package Package being processed
* @attr [Number] amount Progress
* @attr [Number] total Total size
*/
rpm_sCallbackData = rb_struct_define(NULL, "type", "key", "package",
rpm_sCallbackData = rb_struct_define(NULL, "type", "key", "package",
"amount", "total", NULL);

rb_define_const(rpm_mRPM, "CallbackData", rpm_sCallbackData);
Expand Down
23 changes: 21 additions & 2 deletions ext/rpm/rpm.c
Expand Up @@ -16,6 +16,10 @@ m_expand(VALUE m, VALUE name)
return rb_str_new2(rpmExpand(StringValueCStr(name), NULL));
}

/*
* @param [String] name Name of the macro
* @return [String] value of macro +name+
*/
static VALUE
m_aref(VALUE m, VALUE name)
{
Expand Down Expand Up @@ -46,6 +50,11 @@ rpm_macro_aref(VALUE name)
return m_aref(Qnil, name);
}

/*
* Setup a macro
* @param [String] name Name of the macro
* @param [String] value Value of the macro or +nil+ to delete it
*/
static VALUE
m_aset(VALUE m, VALUE name, VALUE val)
{
Expand All @@ -67,6 +76,9 @@ rpm_macro_aset(VALUE name, VALUE val)
return m_aset(Qnil, name, val);
}

/*
* Read configuration files
*/
static VALUE
m_readrc(int argc, VALUE* argv, VALUE m)
{
Expand Down Expand Up @@ -134,6 +146,9 @@ rpm_init_marcros(const char* path)

static int rpm_verbosity;

/*
* @return [Number] Verbosity level
*/
static VALUE
m_get_verbosity(VALUE m)
{
Expand All @@ -146,6 +161,10 @@ rpm_get_verbosity(void)
return INT2NUM(rpm_verbosity);
}

/*
* Sets the verbosity level
* @param [Number] verbosity Verbosity level
*/
static VALUE
m_set_verbosity(VALUE m, VALUE verbosity)
{
Expand Down Expand Up @@ -188,11 +207,11 @@ Init_rpm(void)
{
char *temp;
VALUE rbtmpdir;

rb_require("tmpdir");

rbtmpdir = rb_funcall(rb_const_get(rb_cObject,
rb_intern("Dir")),
rb_intern("Dir")),
rb_intern("tmpdir"), 0);
rpm_mRPM = rb_define_module("RPM");

Expand Down
21 changes: 21 additions & 0 deletions lib/rpm.rb
Expand Up @@ -12,6 +12,27 @@

module RPM

# @attr [Number] type Type of event
# @attr [Number] key Key transactions
# @attr [Package] package Package being processed
# @attr [Number] amount Progress
# @attr [Number] total Total size
class CallbackData
end

# @attr [Number] type Type of event
# @attr [Number] key Key in the transaction
# @attr [Package] package Package being processed
# @attr [Description] Description of the problem
class Problem
end

# @attr [Time] time Timestamp of the changelog entry
# @attr [String] name Name of the changelog entry
# @attr [Text] text description of the changelog entry
class Changelog
end

def vercmp(ver1, ver2)
unless String === ver1 and String === ver2 then
raise TypeError, 'illegal argument type'
Expand Down
113 changes: 0 additions & 113 deletions refm.rd.en
Expand Up @@ -301,93 +301,7 @@ Table of Contents ==
((<RPM::Transaction#commit>)) For the filter constant argument to the second problem
Number.

=== Module Functions

--- RPM. [] (Name)

To see the macro.

--- RPM .[]=( name, value)

To set up a macro. ((| Value |)) is (({nil})) if not delete the macro.

--- RPM.readrc (path, ...)

Read the configuration file.

--- RPM.verbosity
--- RPM.verbosity = (level)

achieve the level of messages output by the rpm, or set.

=== Superclass

* Struct

=== Method

--- RPM:: ChangeLog # time
--- RPM:: ChangeLog # name
--- RPM:: ChangeLog # text

== RPM:: DB

=== Superclass

* Data

=== Mix-in

* Enumerable

Specific methods ===

--- RPM:: DB.open (writable = false, root ='')
--- RPM:: DB.new (writable = false, root ='')

Opening the package database. ((| Writable |)) is (({false})) if,
Transaction processing is not (see ((<RPM::DB#transaction>))).
((| Writable |)) is (({false})) if the object is generated
(({Freeze})) that was.

The database (({"#{ root} / var / lib / rpm "})) and must reside in the
They do not.

--- RPM:: DB.init (root, writable = false)

Initialize the package database.

The database (({"#{ root} / var / lib / rpm "})) is created.

--- RPM:: DB.rebuild (root ='')

To rebuild the package database.

The database (({"#{ root} / var / lib / rpm "})) and must reside in the
They do not.

=== Method

--- RPM:: DB # root

Returns the root directory.

--- RPM:: DB # home

Return to the home directory of the database.

--- RPM:: DB # writable?

The database is writable if (({true})) is returned.

--- RPM:: DB # each {| pkg | ...}

To evaluate the block for each package contained in the database.

--- RPM:: DB # each_match (tag, val) {| pkg | ...}

Tags contained in the database ((| tag |)) the value of ((| val |)) to match each
To evaluate the block on the package.

--- RPM:: DB # transaction (root = nil) {| ts | ...}

Expand All @@ -410,31 +324,4 @@ Specific methods ===
((| Root |)) is (({nil})) if ((<RPM::DB#root>)) are used values.


== RPM:: CallbackData

=== Superclass

* Struct

=== Method

--- RPM:: CallbackData # type
--- RPM:: CallbackData # key
--- RPM:: CallbackData # package
--- RPM:: CallbackData # amount
--- RPM:: CallbackData # total

== RPM:: Problem

=== Superclass

* Struct

=== Method

--- RPM:: Problem # type
--- RPM:: Problem # key
--- RPM:: Problem # package
--- RPM:: Problem # description

= End

0 comments on commit 772e254

Please sign in to comment.