[Catalyst-commits] r12530 - in trunk/examples/CatalystAdvent: lib/CatalystAdvent/Controller root script t

matthewt at dev.catalyst.perl.org matthewt at dev.catalyst.perl.org
Tue Jan 5 18:04:43 GMT 2010


Author: matthewt
Date: 2010-01-05 18:04:41 +0000 (Tue, 05 Jan 2010)
New Revision: 12530

Removed:
   trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Search.pm
   trunk/examples/CatalystAdvent/script/catalystadvent_indexer.pl
   trunk/examples/CatalystAdvent/t/controller_Search.t
Modified:
   trunk/examples/CatalystAdvent/root/year.tt
Log:
this is incomplete and trunk is live; reverting

Deleted: trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Search.pm
===================================================================
--- trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Search.pm	2010-01-05 00:28:35 UTC (rev 12529)
+++ trunk/examples/CatalystAdvent/lib/CatalystAdvent/Controller/Search.pm	2010-01-05 18:04:41 UTC (rev 12530)
@@ -1,42 +0,0 @@
-package CatalystAdvent::Controller::Search;
-
-use strict;
-use warnings;
-use parent 'Catalyst::Controller';
-
-=head1 NAME
-
-CatalystAdvent::Controller::Search - Catalyst Controller
-
-=head1 DESCRIPTION
-
-Catalyst Controller.
-
-=head1 METHODS
-
-=cut
-
-
-=head2 index
-
-=cut
-
-sub index :Path :Args(0) {
-    my ( $self, $c ) = @_;
-
-    $c->response->body('Matched CatalystAdvent::Controller::Search in Search.');
-}
-
-
-=head1 AUTHOR
-
-Devin Austin
-
-=head1 LICENSE
-
-This library is free software. You can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
-
-1;

Modified: trunk/examples/CatalystAdvent/root/year.tt
===================================================================
--- trunk/examples/CatalystAdvent/root/year.tt	2010-01-05 00:28:35 UTC (rev 12529)
+++ trunk/examples/CatalystAdvent/root/year.tt	2010-01-05 18:04:41 UTC (rev 12530)
@@ -42,4 +42,4 @@
 </div>
 [% CATCH %]
 [% END %]
-<p class="rss">[<a href="[% c.uri_for('/feed', year) %]">XML Feed</a>] | search:<input type="text" name="q" /></p>
+<p class="rss">[<a href="[% c.uri_for('/feed', year) %]">XML Feed</a>]</p>

Deleted: trunk/examples/CatalystAdvent/script/catalystadvent_indexer.pl
===================================================================
--- trunk/examples/CatalystAdvent/script/catalystadvent_indexer.pl	2010-01-05 00:28:35 UTC (rev 12529)
+++ trunk/examples/CatalystAdvent/script/catalystadvent_indexer.pl	2010-01-05 18:04:41 UTC (rev 12530)
@@ -1,81 +0,0 @@
-#!/usr/local/bin/perl
-use strict;
-use warnings;
-
-use FindBin qw/ $Bin /;
-my $path_to_index = "$Bin/../root/adventindex";
-my $articles      = "$Bin/../root";
-use lib "$Bin/../lib";
-use CatalystAdvent::Pod;
-use File::Spec::Functions qw( catfile );
-use Pod::Parser;
-use File::Where qw/ where /;
-use File::Find::Rule;
-use KinoSearch::Schema;
-use KinoSearch::FieldType::FullTextType;
-use KinoSearch::Analysis::PolyAnalyzer;
-use KinoSearch::Indexer;
-
-# Create Schema.
-my $schema = KinoSearch::Schema->new;
-my $polyanalyzer = KinoSearch::Analysis::PolyAnalyzer->new( language => 'en', );
-my $title_type =
-  KinoSearch::FieldType::FullTextType->new( analyzer => $polyanalyzer, );
-my $content_type = KinoSearch::FieldType::FullTextType->new(
-    analyzer      => $polyanalyzer,
-    highlightable => 1,
-);
-my $url_type = KinoSearch::FieldType::StringType->new( indexed => 0, );
-my $cat_type = KinoSearch::FieldType::StringType->new( stored  => 0, );
-$schema->spec_field( name => 'title',    type => $title_type );
-$schema->spec_field( name => 'content',  type => $content_type );
-$schema->spec_field( name => 'url',      type => $url_type );
-$schema->spec_field( name => 'category', type => $cat_type );
-
-# Create an Indexer object.
-my $indexer = KinoSearch::Indexer->new(
-    index    => $path_to_index,
-    schema   => $schema,
-    create   => 1,
-    truncate => 1,
-);
-
-# Collect names of source html files.
-my @subdirs = File::Find::Rule->directory->in($articles);
-my @filenames = File::Find::Rule->file()->name( '*.pod')->in(@subdirs);
-# Iterate over list of source files.
-for my $filename (@filenames) {
-    print "Indexing $filename\n";
-    my $doc = parse_file($filename);
-    $indexer->add_doc($doc);
-}
-
-# Finalize the index and print a confirmation message.
-$indexer->commit;
-print "Finished.\n";
-
-sub parse_file {
-    my ($filename) = @_;
-    my $parser = CatalystAdvent::Pod->new();
-    my $where = where($filename, '', 'nofile');
-	open my $fh, '<:utf8', $filename or die "Failed to open $filename: $!";
-	$parser->parse_from_filehandle($fh);
-	close $fh;
-
-	my @dirs = split('/', $where);
-	my $year = pop @dirs;
-
-	my $category =
-        $parser->title =~ /catalyst/i               ? 'catalyst'
-      : $parser->title =~ /template\:\:toolkit/i    ? 'template-toolkit'
-      : $parser->title =~ /dbix\:\:class/i          ? 'dbix-class'
-	  : $parser->title =~ /cache/i                  ? 'caching'
-      :                           "Catalyst";
-    
-	return {
-        title    => $parser->title,
-        content  => $parser->summary,
-        url      => "/$year/$filename",
-        category => $category,
-    };
-}

Deleted: trunk/examples/CatalystAdvent/t/controller_Search.t
===================================================================
--- trunk/examples/CatalystAdvent/t/controller_Search.t	2010-01-05 00:28:35 UTC (rev 12529)
+++ trunk/examples/CatalystAdvent/t/controller_Search.t	2010-01-05 18:04:41 UTC (rev 12530)
@@ -1,12 +0,0 @@
-use strict;
-use warnings;
-use Test::More tests => 3;
-
-BEGIN { use_ok 'Catalyst::Test', 'Search' }
-BEGIN { use_ok 'CatalystAdvent::Controller::Search' }
-
-ok( request('/search')->is_success, 'Request should succeed' );
-
-
-
-done_testing();




More information about the Catalyst-commits mailing list