Changeset 184
- Timestamp:
- 12/24/10 05:27:34 (13 years ago)
- Location:
- server/trunk/web
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
server/trunk/web/lib/Sophie/Controller/Distrib.pm
r148 r184 14 14 15 15 =head1 METHODS 16 17 =cut 18 19 =head2 distrib.list( [ DISTRIBUTION [, RELEASE [, ARCH ]]] 20 21 List content of distrib according arguments given. IE list availlable 22 C<distribution> if no argument is given, list C<release> if C<DISTRIBUTION> is 23 given, list C<arch> if both C<DISTRIBUTION> and C<RELEASE> are given. Etc... Up 24 to give C<MEDIA> if C<ARCH> is specified. 25 26 Results are given as C<ARRAY>. 16 27 17 28 =cut … … 133 144 } 134 145 146 =head2 distrib.exists( DISTRIB ) 147 148 Return true or false if disteibution C<DISTRIB> exists. 149 150 C<DISTRIB> is a structure with following key/value: 151 152 =over 4 153 154 =item distribution 155 156 The distribution name 157 158 =item release 159 160 The release name 161 162 =item arch 163 164 The arch name 165 166 =back 167 168 This function is usefull to check if a search have chance to suceed, eg if the 169 user is not searching a rpm on a not existing ditribution. 170 171 =cut 135 172 136 173 sub exists : XMLRPC { … … 150 187 =cut 151 188 189 =head2 Url: /distrib 190 191 Return the list of currently stored distributions. 192 193 =cut 194 152 195 sub index :Path :Chained :Args(0) { 153 196 my ( $self, $c ) = @_; … … 156 199 } 157 200 158 =head release 201 =head2 release 202 203 =cut 204 205 =head2 Url: /distrib/<DISTRIBUTION> 206 207 Return the list of availlaible release for given C<DISTRIBUTION>. 159 208 160 209 =cut … … 168 217 $c->forward('list', [ $c->stash->{dist} ] ); 169 218 } 219 220 =head2 Url: /distrib/<DISTRIBUTION>/<RELEASE> 221 222 Return the list of availlaible architecture for given C<DISTRIBUTION>, 223 C<RELEASE>. 224 225 =cut 170 226 171 227 sub list_arch :Path :Args(2) { … … 185 241 } 186 242 243 =head2 Url: /distrib/<DISTRIBUTION>/<RELEASE>/<ARCH> 244 245 Return the list of availlaible medias for given C<DISTRIBUTION>, 246 C<RELEASE>, C<ARCH>. 247 248 =cut 249 187 250 sub distrib :Chained('distrib_view') PathPart('') :Args(0) { 188 251 my ( $self, $c ) = @_; … … 197 260 } 198 261 262 =head2 distrib.anyrpms( DISTRIB ) 263 264 Return a list of packages availlable for C<DISTRIB>. 265 266 C<DISTRIB> is a struct with following keys/values: 267 268 =over 4 269 270 =item distribution 271 272 The distribution name 273 274 =item release 275 276 The release name 277 278 =item arch 279 280 The arch name 281 282 =back 283 284 =cut 285 199 286 sub anyrpms :XMLRPC { 200 287 my ( $self, $c, $distribution, $release, $arch ) = @_; … … 222 309 $c->stash->{xmlrpc} = $c->stash->{rpm}; 223 310 } 311 312 =head2 distrib.rpms( DISTRIB ) 313 314 Return a list of binary packages availlable for C<DISTRIB>. 315 316 C<DISTRIB> is a struct with following keys/values: 317 318 =over 4 319 320 =item distribution 321 322 The distribution name 323 324 =item release 325 326 The release name 327 328 =item arch 329 330 The arch name 331 332 =back 333 334 =cut 224 335 225 336 sub rpms :XMLRPC { … … 251 362 $c->stash->{xmlrpc} = $c->stash->{rpm}; 252 363 } 364 365 =head2 distrib.srpms( DISTRIB ) 366 367 Return a list of sources packages availlable for C<DISTRIB>. 368 369 C<DISTRIB> is a struct with following keys/values: 370 371 =over 4 372 373 =item distribution 374 375 The distribution name 376 377 =item release 378 379 The release name 380 381 =item arch 382 383 The arch name 384 385 =back 386 387 =cut 253 388 254 389 sub srpms :XMLRPC { … … 305 440 } 306 441 442 443 =head2 Url: /distrib/<DISTRIBUTION>/<RELEASE>/<ARCH>/RPMS 444 445 Return the list of availlaible rpms for given C<DISTRIBUTION>, 446 C<RELEASE>, C<ARCH>. 447 448 =cut 449 307 450 sub list_rpms :Chained('distrib_view') PathPart('rpms') Args(0) { 308 451 my ( $self, $c ) = @_; 309 $c->forward('rpms', $c->stash->{dist});452 $c->forward('rpms', [ $c->stash->{dist} ]); 310 453 } 311 454 312 455 sub list_srpms :Chained('distrib_view') PathPart('srpms') Args(0) { 313 456 my ( $self, $c ) = @_; 314 $c->forward('srpms', $c->stash->{dist});457 $c->forward('srpms', [ $c->stash->{dist} ]); 315 458 } 316 459 -
server/trunk/web/t/controller_Distrib.t
r158 r184 18 18 19 19 ok( request('/distrib')->is_success, 'Request should succeed' ); 20 ok( request("/distrib/$distribution")->is_success, 'Request should succeed' ); 20 ok( request('/distrib', { ajax => 1 })->is_success, 'Request ajax should succeed' ); 21 ok( request('/distrib', { json => 1 })->is_success, 'Request json should succeed' ); 22 ok( request("/distrib/$distribution")->is_success, 'Request distribution should succeed' ); 23 ok( request("/distrib/$distribution", { ajax => 1 })->is_success, 24 'Request distribution as ajax should succeed' ); 25 ok( request("/distrib/$distribution", { json => 1 })->is_success, 26 'Request distribution as ajax should succeed' ); 21 27 ok( xmlrequest_ok( 'distrib.list'), "XMLRPC"); 22 28 ok( xmlrequest_ok( 'distrib.list', $distribution), "XMLRPC"); … … 24 30 ok( request("/distrib/$distribution/$release/$arch")->is_success, 'Request should succeed' ); 25 31 ok( request("/distrib/$distribution/$release/$arch/media")->is_success, 'Request should succeed' ); 32 33 ok( request("/distrib/$distribution/$release/rpms")->is_success, 'Request should succeed' ); 34 26 35 ok( 27 36 request("/distrib/$distribution/$release/$arch/media/$media/by-pkgid/$pkgid")
Note: See TracChangeset
for help on using the changeset viewer.