r71376 - in /trunk/libmojomojo-perl: ./ debian/ inc/File/ inc/Module/Install/ lib/ lib/MojoMojo/Controller/ lib/MojoMojo/Formatter/ t/ t/c/
jawnsy-guest at users.alioth.debian.org
jawnsy-guest at users.alioth.debian.org
Mon Mar 14 00:18:55 UTC 2011
Author: jawnsy-guest
Date: Mon Mar 14 00:13:42 2011
New Revision: 71376
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=71376
Log:
Add copyright information for bundled M::I::Catalyst and
File::Copy::Recursive
Added:
trunk/libmojomojo-perl/inc/File/
- copied from r71359, branches/upstream/libmojomojo-perl/current/inc/File/
trunk/libmojomojo-perl/lib/MojoMojo/Formatter/Gist.pm
- copied unchanged from r71359, branches/upstream/libmojomojo-perl/current/lib/MojoMojo/Formatter/Gist.pm
trunk/libmojomojo-perl/t/formatter_gist.t
- copied unchanged from r71359, branches/upstream/libmojomojo-perl/current/t/formatter_gist.t
Modified:
trunk/libmojomojo-perl/Changes
trunk/libmojomojo-perl/MANIFEST
trunk/libmojomojo-perl/META.yml
trunk/libmojomojo-perl/debian/changelog
trunk/libmojomojo-perl/debian/copyright
trunk/libmojomojo-perl/inc/Module/Install/Catalyst.pm
trunk/libmojomojo-perl/lib/MojoMojo.pm
trunk/libmojomojo-perl/lib/MojoMojo/Controller/PageAdmin.pm
trunk/libmojomojo-perl/lib/MojoMojo/Formatter/Amazon.pm
trunk/libmojomojo-perl/lib/MojoMojo/Formatter/GoogleCalendar.pm
trunk/libmojomojo-perl/lib/MojoMojo/Formatter/IDLink.pm
trunk/libmojomojo-perl/t/c/page_edit.t
trunk/libmojomojo-perl/t/formatter_amazon.t
Modified: trunk/libmojomojo-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/Changes?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/Changes (original)
+++ trunk/libmojomojo-perl/Changes Mon Mar 14 00:13:42 2011
@@ -1,3 +1,15 @@
+1.04 2011-02-12 10:24
+ Improvements:
+ - Don't save a page when there is no change even if we push the save button.
+ This prevents the revision number from being incremented.
+ - Added gist formatter (bayashi)
+
+ Fixes:
+ - Amazon requires a secret key now to access it's API.
+ Make the Amazon formatter aware of that.
+ - Google calendar formatter was setting precomple_off = 1 always
+ (even when it wasn't a calendar page).
+
1.03 2011-01-12 11:36
New features:
- Google Calendar formatter
Modified: trunk/libmojomojo-perl/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/MANIFEST?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/MANIFEST (original)
+++ trunk/libmojomojo-perl/MANIFEST Mon Mar 14 00:13:42 2011
@@ -1,4 +1,5 @@
Changes
+inc/File/Copy/Recursive.pm
inc/Module/AutoInstall.pm
inc/Module/Install.pm
inc/Module/Install/AutoInstall.pm
@@ -45,6 +46,7 @@
lib/MojoMojo/Formatter/File/Image.pm
lib/MojoMojo/Formatter/File/Pod.pm
lib/MojoMojo/Formatter/File/Text.pm
+lib/MojoMojo/Formatter/Gist.pm
lib/MojoMojo/Formatter/GoogleCalendar.pm
lib/MojoMojo/Formatter/GoogleSearch.pm
lib/MojoMojo/Formatter/IDLink.pm
@@ -478,6 +480,7 @@
t/formatter_dir.t
t/formatter_docbook.t
t/formatter_file.t
+t/formatter_gist.t
t/formatter_googlesearch.t
t/formatter_idlink.t
t/formatter_include.t
Modified: trunk/libmojomojo-perl/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/META.yml?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/META.yml (original)
+++ trunk/libmojomojo-perl/META.yml Mon Mar 14 00:13:42 2011
@@ -107,4 +107,4 @@
homepage: http://mojomojo.org
license: http://dev.perl.org/licenses/
repository: http://github.com/marcusramberg/mojomojo/
-version: 1.03
+version: 1.04
Modified: trunk/libmojomojo-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/debian/changelog?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/debian/changelog (original)
+++ trunk/libmojomojo-perl/debian/changelog Mon Mar 14 00:13:42 2011
@@ -1,4 +1,4 @@
-libmojomojo-perl (1.03+dfsg-1) UNRELEASED; urgency=low
+libmojomojo-perl (1.04+dfsg-1) UNRELEASED; urgency=low
QUESTION: should we worry about
@@ -20,13 +20,15 @@
* Update copyright clauses
* Standards-Version 3.9.1 (no changes)
* Add notes for the +dfsg tarball to d/copyright
+ * Add copyright information for bundled M::I::Catalyst and
+ File::Copy::Recursive
[ gregor herrmann ]
* Bump versioned (build) dependency on libcatalyst-modules-perl to >= 42 to
get a fixed CatalystX::Component::Traits.
* Switch to debhelper 8.
- -- Jonathan Yu <jawnsy at cpan.org> Wed, 16 Feb 2011 21:37:06 -0500
+ -- Jonathan Yu <jawnsy at cpan.org> Sun, 13 Mar 2011 17:41:33 -0400
libmojomojo-perl (1.01+dfsg-1) unstable; urgency=low
Modified: trunk/libmojomojo-perl/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/debian/copyright?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/debian/copyright (original)
+++ trunk/libmojomojo-perl/debian/copyright Mon Mar 14 00:13:42 2011
@@ -151,11 +151,22 @@
Copyright: 2010, Dan Dascalescu
License: Artistic or GPL-1+
+Files: inc/File/Copy/Recursive.pm
+Copyright: 2004, Daniel Muey <dmuey at cpan.org>
+License: Artistic or GPL-1+
+
Files: inc/Module/*
Copyright: 2002-2010, Adam Kennedy <adamk at cpan.org>
2002-2010, Audrey Tang <autrijus at autrijus.org>
2002-2010, Brian Ingerson <ingy at cpan.org>
License: Artistic or GPL-1+
+
+Files: inc/Module/Install/Catalyst.pm
+Copyright: 2006-2009, various contributors to the Catalyst project
+License: Artistic or GPL-1+
+X-Comment: this file is included with the libcatalyst-devel-perl
+ package. For a full list of copyright holders, please see copyright
+ information for the libcatalyst-perl package.
Files: debian/*
Copyright: 2009-2010, Jonathan Yu <jawnsy at cpan.org>
Modified: trunk/libmojomojo-perl/inc/Module/Install/Catalyst.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/inc/Module/Install/Catalyst.pm?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/inc/Module/Install/Catalyst.pm (original)
+++ trunk/libmojomojo-perl/inc/Module/Install/Catalyst.pm Mon Mar 14 00:13:42 2011
@@ -9,9 +9,9 @@
use File::Find;
use FindBin;
-use File::Copy::Recursive 'rcopy';
+use File::Copy::Recursive;
use File::Spec ();
-use Getopt::Long qw(GetOptionsFromString :config no_ignore_case);
+use Getopt::Long ();
use Data::Dumper;
my $SAFETY = 0;
@@ -30,6 +30,14 @@
sub catalyst {
my $self = shift;
+
+ if($Module::Install::AUTHOR) {
+ $self->admin->copy_package(
+ 'File::Copy::Recursive',
+ $INC{"File/Copy/Recursive.pm"},
+ );
+ }
+
print <<EOF;
*** Module::Install::Catalyst
EOF
@@ -40,7 +48,7 @@
EOF
}
-#line 77
+#line 85
sub catalyst_files {
my $self = shift;
@@ -60,25 +68,25 @@
my @path = split '-', $self->name;
for my $orig (@files) {
my $path = File::Spec->catdir( 'blib', 'lib', @path, $orig );
- rcopy( $orig, $path );
- }
-}
-
-#line 105
+ File::Copy::Recursive::rcopy( $orig, $path );
+ }
+}
+
+#line 113
sub catalyst_ignore_all {
my ( $self, $ignore ) = @_;
@IGNORE = @$ignore;
}
-#line 116
+#line 124
sub catalyst_ignore {
my ( $self, @ignore ) = @_;
push @IGNORE, @ignore;
}
-#line 125
+#line 133
# Workaround for a namespace conflict
sub catalyst_par {
@@ -104,57 +112,62 @@
EOF
}
-#line 153
+#line 161
sub catalyst_par_core {
my ( $self, $core ) = @_;
$core ? ( $PAROPTS{'B'} = $core ) : $PAROPTS{'B'}++;
}
-#line 162
+#line 170
sub catalyst_par_classes {
my ( $self, @classes ) = @_;
push @CLASSES, @classes;
}
-#line 171
+#line 179
sub catalyst_par_engine {
my ( $self, $engine ) = @_;
$ENGINE = $engine;
}
-#line 180
+#line 188
sub catalyst_par_multiarch {
my ( $self, $multiarch ) = @_;
$multiarch ? ( $PAROPTS{'m'} = $multiarch ) : $PAROPTS{'m'}++;
}
-#line 213
+#line 221
sub catalyst_par_options {
my ( $self, $optstring ) = @_;
- my %o = ();
eval "use PAR::Packer ()";
if ($@) {
warn "WARNING: catalyst_par_options ignored - you need PAR::Packer\n"
}
else {
- GetOptionsFromString($optstring, \%o, PAR::Packer->options);
+ my $p = Getopt::Long::Parser->new(config => ['no_ignore_case']);
+ my %o;
+ require Text::ParseWords;
+ {
+ local @ARGV = Text::ParseWords::shellwords($optstring);
+ $p->getoptions(\%o, PAR::Packer->options);
+ }
%PAROPTS = ( %PAROPTS, %o);
}
}
-#line 230
+#line 243
sub catalyst_par_script {
my ( $self, $script ) = @_;
$SCRIPT = $script;
}
-#line 239
+#line 252
sub catalyst_par_usage {
my ( $self, $usage ) = @_;
@@ -307,6 +320,6 @@
return 1;
}
-#line 401
+#line 414
1;
Modified: trunk/libmojomojo-perl/lib/MojoMojo.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/lib/MojoMojo.pm?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/lib/MojoMojo.pm (original)
+++ trunk/libmojomojo-perl/lib/MojoMojo.pm Mon Mar 14 00:13:42 2011
@@ -30,7 +30,7 @@
except => qr/^MojoMojo::Plugin::/,
require => 1;
-our $VERSION = '1.03';
+our $VERSION = '1.04';
use 5.008004;
MojoMojo->config->{authentication}{dbic} = {
Modified: trunk/libmojomojo-perl/lib/MojoMojo/Controller/PageAdmin.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/lib/MojoMojo/Controller/PageAdmin.pm?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/lib/MojoMojo/Controller/PageAdmin.pm (original)
+++ trunk/libmojomojo-perl/lib/MojoMojo/Controller/PageAdmin.pm Mon Mar 14 00:13:42 2011
@@ -154,10 +154,24 @@
$stash->{content} = $page->content;
$c->model("DBIC::Page")->set_paths(@$path_pages);
- # refetch page to have ->content available, else it will break in DBIC 0.08099_05 and later
- #$page = $c->model("DBIC::Page")->find( $page->id );
+ # setup redirect back to edits or view page mode.
+ my $redirect = $c->uri_for( $c->stash->{path} );
+ if ( $form->params->{submit} eq $c->localize('Save') ) {
+ $redirect .= '.edit';
+ }
+
+ # No need to update if we have no difference between browser and db.
+ if ( $c->stash->{content} && ($c->stash->{content}->body eq $form->params->{body}) ) {
+ $c->res->redirect($redirect);
+ return;
+ }
+
+ # If we get here it means we have some difference between wiki page in browser and db.
+ # TODO: Is the discard_changes necessary? Why are we discarding local changes?
+ # Are there even any local changes to $page?
$page->discard_changes;
+ # Check for changes made by another user to the same base revision.
if( $c->stash->{content} &&
$c->req->params->{version} != $c->stash->{content}->version ) {
$c->stash->{message}=$c->loc('Someone else changed the page while you edited. Your changes has been merged. Please review and save again');
@@ -175,6 +189,7 @@
$c->loc('END OF CONFLICT'));
return;
}
+
# Format content body and store the result in content.precompiled
# This speeds up MojoMojo page rendering on /.view actions
my $precompiled_body = $valid->{'body'};
@@ -191,11 +206,6 @@
unless $c->pref('disable_search');
$page->content->store_links();
- # Redirect back to edits or view page mode.
- my $redirect = $c->uri_for( $c->stash->{path} );
- if ( $form->params->{submit} eq $c->localize('Save') ) {
- $redirect .= '.edit';
- }
$c->res->redirect($redirect);
}
else {
Modified: trunk/libmojomojo-perl/lib/MojoMojo/Formatter/Amazon.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/lib/MojoMojo/Formatter/Amazon.pm?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/lib/MojoMojo/Formatter/Amazon.pm (original)
+++ trunk/libmojomojo-perl/lib/MojoMojo/Formatter/Amazon.pm Mon Mar 14 00:13:42 2011
@@ -78,9 +78,9 @@
=cut
sub get {
- my ($class,$id,$amazon_id)=@_;
+ my ($class,$id,$amazon_id,$secret_key)=@_;
#FIXME: devel token should be set in formatter config.
- my $amazon=Net::Amazon->new(token=>$amazon_id);
+ my $amazon=Net::Amazon->new(token=>$amazon_id,secret_key=>$secret_key);
my $response=$amazon->search(asin=>$id);
return "Unable to connect to amazon." unless $response->is_success;
($property)=$response->properties;
Modified: trunk/libmojomojo-perl/lib/MojoMojo/Formatter/GoogleCalendar.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/lib/MojoMojo/Formatter/GoogleCalendar.pm?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/lib/MojoMojo/Formatter/GoogleCalendar.pm (original)
+++ trunk/libmojomojo-perl/lib/MojoMojo/Formatter/GoogleCalendar.pm Mon Mar 14 00:13:42 2011
@@ -47,7 +47,6 @@
my @lines = split /\n/, $$content;
my $re = $class->gen_re(qr/gcal\s+(.*?)\s+(\d+),(\d+)\s+(\w+)/);
$$content = "";
- $c->stash->{precompile_off} = 1;
foreach my $line (@lines) {
if ( $line =~ m/$re/ ) {
Modified: trunk/libmojomojo-perl/lib/MojoMojo/Formatter/IDLink.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/lib/MojoMojo/Formatter/IDLink.pm?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/lib/MojoMojo/Formatter/IDLink.pm (original)
+++ trunk/libmojomojo-perl/lib/MojoMojo/Formatter/IDLink.pm Mon Mar 14 00:13:42 2011
@@ -93,7 +93,6 @@
my $url = sprintf($CONF->{$site}, $id);
$line =~ s!$re!<a href="$url">$id</a>!;
- $c->stash->{precompile_off} = 1;
return $line;
}
Modified: trunk/libmojomojo-perl/t/c/page_edit.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/t/c/page_edit.t?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/t/c/page_edit.t (original)
+++ trunk/libmojomojo-perl/t/c/page_edit.t Mon Mar 14 00:13:42 2011
@@ -16,7 +16,7 @@
eval "use WWW::Mechanize::TreeBuilder";
plan skip_all => 'need WWW::Mechanize::TreeBuilder' if $@;
- plan tests => 21;
+ plan tests => 31;
}
use_ok('MojoMojo::Controller::Page');
@@ -86,13 +86,31 @@
<p>It also links to <a class="existingWikiWord" href="/">the root page</a> and <a class="existingWikiWord" href="/help">help</a> as well as a <span class="newWikiWord"><a title="Not found. Click to create this page." href="/totally_new_page.edit">totally new page?</a></span>.</p>
RENDERED_CONTENT
-$mech->get_ok('/totally_new_page.edit', 'make the new page');
+my $page_name = 'totally_new_page';
+$mech->get_ok("/${page_name}.edit", 'make the new page');
ok $mech->form_with_fields('body'), 'find the edit form';
ok defined $mech->field(body => <<PAGE_CONTENT), 'Set page content';
# This is a test page
PAGE_CONTENT
+ok $mech->click_button(value => 'Save'), 'click the "Save" button';
+# This totally new page should start with revision 1.
+is($schema->resultset('Page')->single({ name => $page_name })->content_version, 1, 'first version of a page');
+
+# If we save the page with the same content, then the revision should not change.
+$mech->get_ok("/${page_name}.edit", 'save the new page with same content');
+ok $mech->form_with_fields('body'), 'find the edit form';
ok $mech->click_button(value => 'Save'), 'click the "Save" button';
+is($schema->resultset('Page')->single({ name => $page_name })->content_version, 1, 'no diff on save, no version incrementing');
+
+# If we save the page with the different content, then the revision increase by 1.
+$mech->get_ok("/${page_name}.edit", 'change content of the new page');
+ok $mech->form_with_fields('body'), 'find the edit form';
+ok defined $mech->field(body => <<PAGE_CONTENT), 'save the page with different content';
+# This is NOT THE SAME page that it was before
+PAGE_CONTENT
+ok $mech->click_button(value => 'Save'), 'click the "Save" button';
+is($schema->resultset('Page')->single({ name => $page_name })->content_version, 2, 'different content new version');
$mech->get_ok('/test');
$mech->content_contains('<a class="existingWikiWord" href="/totally_new_page">','Link was updated');
Modified: trunk/libmojomojo-perl/t/formatter_amazon.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/libmojomojo-perl/t/formatter_amazon.t?rev=71376&op=diff
==============================================================================
--- trunk/libmojomojo-perl/t/formatter_amazon.t (original)
+++ trunk/libmojomojo-perl/t/formatter_amazon.t Mon Mar 14 00:13:42 2011
@@ -2,32 +2,36 @@
use strict;
use warnings;
use Test::More;
+use Data::Dumper::Concise;
BEGIN {
use MojoMojo::Formatter::Amazon;
plan skip_all => 'Requirements not installed for Amazon Formatter'
unless MojoMojo::Formatter::Amazon->module_loaded;
- plan skip_all => 'Set AMAZON_TOKEN to your amazon API token to run Amazon tests'
+ plan skip_all => 'Set AMAZON_TOKEN to your amazon API token (access key, not the secret one) to run Amazon tests'
unless $ENV{AMAZON_TOKEN};
- plan tests => 7;
+ plan skip_all => 'Set AMAZON_SECRET_KEY to your amazon API secret access key to run Amazon tests'
+ unless $ENV{AMAZON_SECRET_KEY};
+ plan tests => 8;
};
# Formatter basics
can_ok('MojoMojo::Formatter::Amazon', qw/format_content format_content_order/);
-my $prop=MojoMojo::Formatter::Amazon->get(1558607013,$ENV{AMAZON_TOKEN});
+my $prop=MojoMojo::Formatter::Amazon->get(1558607013,$ENV{AMAZON_TOKEN}, $ENV{AMAZON_SECRET_KEY});
isa_ok($prop,'Net::Amazon::Property');
+is($prop->title, 'Higher-Order Perl: Transforming Programs with Programs', 'object title');
SKIP: {
eval { use Test::MockObject };
skip ('Test::MockObject not installed', 3) if $@;
my $o = Test::MockObject->new();
$o->set_true(qw/artists authors directors year/);
- is(MojoMojo::Formatter::Amazon->DVD($o), " -- ??1?? (1)\n\n");
- is(MojoMojo::Formatter::Amazon->Book($o), " -- ??1?? (1)\n\n");
- is(MojoMojo::Formatter::Amazon->Music($o)," -- ??1?? (1)\n\n");
+ is(MojoMojo::Formatter::Amazon->DVD($o), " -- ??1?? (1)\n\n", 'DVD formatter');
+ is(MojoMojo::Formatter::Amazon->Book($o), " -- ??1?? (1)\n\n", 'Book formatter');
+ is(MojoMojo::Formatter::Amazon->Music($o)," -- ??1?? (1)\n\n", 'Music formatter');
}
-like(MojoMojo::Formatter::Amazon->blurb($prop), qr/^\<div class="amazon"/ );
-like(MojoMojo::Formatter::Amazon->small($prop), qr/$\!.+jpg\!.+ASIN/ );
+like(MojoMojo::Formatter::Amazon->blurb($prop), qr/^\<div class="amazon"/, 'blurb format' );
+like(MojoMojo::Formatter::Amazon->small($prop), qr/^\!.+jpg\!.+ASIN/, 'small format' );
More information about the Pkg-perl-cvs-commits
mailing list