Changeset 184


Ignore:
Timestamp:
12/24/10 05:27:34 (13 years ago)
Author:
nanardon
Message:
  • document functions/urls
  • ensure it works
Location:
server/trunk/web
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Distrib.pm

    r148 r184  
    1414 
    1515=head1 METHODS 
     16 
     17=cut 
     18 
     19=head2 distrib.list( [ DISTRIBUTION [, RELEASE [, ARCH ]]] 
     20 
     21List content of distrib according arguments given. IE list availlable 
     22C<distribution> if no argument is given, list C<release> if C<DISTRIBUTION> is 
     23given, list C<arch> if both C<DISTRIBUTION> and C<RELEASE> are given. Etc... Up 
     24to give C<MEDIA> if C<ARCH> is specified. 
     25 
     26Results are given as C<ARRAY>. 
    1627 
    1728=cut 
     
    133144} 
    134145 
     146=head2 distrib.exists( DISTRIB ) 
     147 
     148Return true or false if disteibution C<DISTRIB> exists. 
     149 
     150C<DISTRIB> is a structure with following key/value: 
     151 
     152=over 4 
     153 
     154=item distribution 
     155 
     156The distribution name 
     157 
     158=item release 
     159 
     160The release name 
     161 
     162=item arch 
     163 
     164The arch name 
     165 
     166=back 
     167 
     168This function is usefull to check if a search have chance to suceed, eg if the 
     169user is not searching a rpm on a not existing ditribution. 
     170 
     171=cut 
    135172 
    136173sub exists : XMLRPC { 
     
    150187=cut 
    151188 
     189=head2 Url: /distrib 
     190 
     191Return the list of currently stored distributions. 
     192 
     193=cut 
     194 
    152195sub index :Path :Chained :Args(0)  { 
    153196    my ( $self, $c ) = @_; 
     
    156199} 
    157200 
    158 =head release 
     201=head2 release 
     202 
     203=cut 
     204 
     205=head2 Url: /distrib/<DISTRIBUTION> 
     206 
     207Return the list of availlaible release for given C<DISTRIBUTION>. 
    159208 
    160209=cut 
     
    168217    $c->forward('list', [ $c->stash->{dist} ] ); 
    169218} 
     219 
     220=head2 Url: /distrib/<DISTRIBUTION>/<RELEASE> 
     221 
     222Return the list of availlaible architecture for given C<DISTRIBUTION>, 
     223C<RELEASE>. 
     224 
     225=cut 
    170226 
    171227sub list_arch :Path :Args(2) { 
     
    185241} 
    186242 
     243=head2 Url: /distrib/<DISTRIBUTION>/<RELEASE>/<ARCH> 
     244 
     245Return the list of availlaible medias for given C<DISTRIBUTION>, 
     246C<RELEASE>, C<ARCH>. 
     247 
     248=cut 
     249 
    187250sub distrib :Chained('distrib_view') PathPart('') :Args(0) { 
    188251    my ( $self, $c ) = @_; 
     
    197260} 
    198261 
     262=head2 distrib.anyrpms( DISTRIB ) 
     263 
     264Return a list of packages availlable for C<DISTRIB>. 
     265 
     266C<DISTRIB> is a struct with following keys/values: 
     267 
     268=over 4 
     269 
     270=item distribution 
     271 
     272The distribution name 
     273 
     274=item release 
     275 
     276The release name 
     277 
     278=item arch 
     279 
     280The arch name 
     281 
     282=back 
     283 
     284=cut 
     285 
    199286sub anyrpms :XMLRPC { 
    200287    my ( $self, $c, $distribution, $release, $arch ) = @_; 
     
    222309    $c->stash->{xmlrpc} = $c->stash->{rpm}; 
    223310} 
     311 
     312=head2 distrib.rpms( DISTRIB ) 
     313 
     314Return a list of binary packages availlable for C<DISTRIB>. 
     315 
     316C<DISTRIB> is a struct with following keys/values: 
     317 
     318=over 4 
     319 
     320=item distribution 
     321 
     322The distribution name 
     323 
     324=item release 
     325 
     326The release name 
     327 
     328=item arch 
     329 
     330The arch name 
     331 
     332=back 
     333 
     334=cut 
    224335 
    225336sub rpms :XMLRPC { 
     
    251362    $c->stash->{xmlrpc} = $c->stash->{rpm}; 
    252363} 
     364 
     365=head2 distrib.srpms( DISTRIB ) 
     366 
     367Return a list of sources packages availlable for C<DISTRIB>. 
     368 
     369C<DISTRIB> is a struct with following keys/values: 
     370 
     371=over 4 
     372 
     373=item distribution 
     374 
     375The distribution name 
     376 
     377=item release 
     378 
     379The release name 
     380 
     381=item arch 
     382 
     383The arch name 
     384 
     385=back 
     386 
     387=cut 
    253388 
    254389sub srpms :XMLRPC { 
     
    305440} 
    306441 
     442 
     443=head2 Url: /distrib/<DISTRIBUTION>/<RELEASE>/<ARCH>/RPMS 
     444 
     445Return the list of availlaible rpms for given C<DISTRIBUTION>, 
     446C<RELEASE>, C<ARCH>. 
     447 
     448=cut 
     449 
    307450sub list_rpms :Chained('distrib_view') PathPart('rpms') Args(0) { 
    308451    my ( $self, $c ) = @_; 
    309     $c->forward('rpms', $c->stash->{dist}); 
     452    $c->forward('rpms', [ $c->stash->{dist} ]); 
    310453} 
    311454 
    312455sub list_srpms :Chained('distrib_view') PathPart('srpms') Args(0) { 
    313456    my ( $self, $c ) = @_; 
    314     $c->forward('srpms', $c->stash->{dist}); 
     457    $c->forward('srpms', [ $c->stash->{dist} ]); 
    315458} 
    316459 
  • server/trunk/web/t/controller_Distrib.t

    r158 r184  
    1818 
    1919ok( request('/distrib')->is_success, 'Request should succeed' ); 
    20 ok( request("/distrib/$distribution")->is_success, 'Request should succeed' ); 
     20ok( request('/distrib', { ajax => 1 })->is_success, 'Request ajax should succeed' ); 
     21ok( request('/distrib', { json => 1 })->is_success, 'Request json should succeed' ); 
     22ok( request("/distrib/$distribution")->is_success, 'Request distribution should succeed' ); 
     23ok( request("/distrib/$distribution", { ajax => 1 })->is_success, 
     24    'Request distribution as ajax should succeed' ); 
     25ok( request("/distrib/$distribution", { json => 1 })->is_success, 
     26    'Request distribution as ajax should succeed' ); 
    2127ok( xmlrequest_ok( 'distrib.list'), "XMLRPC"); 
    2228ok( xmlrequest_ok( 'distrib.list', $distribution), "XMLRPC"); 
     
    2430ok( request("/distrib/$distribution/$release/$arch")->is_success, 'Request should succeed' ); 
    2531ok( request("/distrib/$distribution/$release/$arch/media")->is_success, 'Request should succeed' ); 
     32 
     33ok( request("/distrib/$distribution/$release/rpms")->is_success, 'Request should succeed' ); 
     34 
    2635ok( 
    2736    request("/distrib/$distribution/$release/$arch/media/$media/by-pkgid/$pkgid") 
Note: See TracChangeset for help on using the changeset viewer.