[Bps-public-commit] SD branch, master, updated. 0.73-28-g0cf0f49
jesse
jesse at bestpractical.com
Wed Nov 18 12:02:44 EST 2009
The branch, master has been updated
via 0cf0f4946332eed4c8d275930826b7027c07464e (commit)
via d673e024d37c1e6f157bd60dee313d7ea4674025 (commit)
via 03a82b8fe04a8318966994fe756cc619e931d393 (commit)
via ec5c78d9b2b4f0e0aff59d62059a07d09241eccc (commit)
via 8a73b7eee07ad9d8ea44273960a67cebfdbe6e93 (commit)
from c6e4a12bbf134cd814bd170e429106793dc128b9 (commit)
Summary of changes:
lib/App/SD/CLI/Command/Publish.pm | 1 +
lib/App/SD/Replica/github.pm | 2 +-
lib/App/SD/Server/View.pm | 33 ++++++++++++++++++++++-----------
3 files changed, 24 insertions(+), 12 deletions(-)
- Log -----------------------------------------------------------------
commit 8a73b7eee07ad9d8ea44273960a67cebfdbe6e93
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Oct 16 18:11:26 2009 -0400
First pass at making all hyperlinks in SD relative.
diff --git a/lib/App/SD/Server/View.pm b/lib/App/SD/Server/View.pm
index 675447e..0f83952 100644
--- a/lib/App/SD/Server/View.pm
+++ b/lib/App/SD/Server/View.pm
@@ -3,7 +3,7 @@ use strict;
package App::SD::Server::View;
use base 'Prophet::Server::View';
-
+use File::Spec::Unix;
use Template::Declare::Tags;
use Prophet::Server::ViewHelpers;
@@ -90,7 +90,7 @@ template 'property_list' => sub {
};};
outs ( ($counts{$prop} ||'0') . " - ");
a {
- { href is '/' . $property_name . '/' . ($prop ||'') }
+ { href is link_to( '/' . $property_name . '/' . ($prop ||'')) }
( $prop ? $prop : 'None' )
}
@@ -464,10 +464,10 @@ content {
my $nav = sub {
div {{ class is 'nav'};
if ($end > 1 ) {
- a {{ class is 'prev', href is '/history/'.($end-1) }; 'Earlier' };
+ a {{ class is 'prev', href is link_to('/history/'.($end-1)) }; 'Earlier' };
}
if ($start < $latest) {
- a {{ class is 'next', href is '/history/'.(( $start+21 < $latest) ? ($start+21) : $latest) }; 'Later' };
+ a {{ class is 'next', href is link_to ( '/history/'.(( $start+21 < $latest) ? ($start+21) : $latest)) }; 'Later' };
}
}
};
@@ -489,8 +489,16 @@ content {
$ticket->load( uuid => $change->record_uuid );
h2 {
- a {{ href is '/ticket/' . $ticket->uuid; class is 'ticket-summary'; }; $ticket->prop('summary') };
- span { { class is 'ticket-id'}; ' (' . ($ticket->luid || '') . ')'};
+ a {
+ { href is link_to( '/ticket/' . $ticket->uuid );
+ class is 'ticket-summary';
+ };
+ $ticket->prop('summary');
+ };
+ span {
+ { class is 'ticket-id' };
+ ' (' . ( $ticket->luid || '' ) . ')';
+ };
}
} elsif ($change->record_type eq 'comment') {
my $ticket = App::SD::Model::Ticket->new(
@@ -509,7 +517,7 @@ content {
h2 {
outs('Comment on: ');
- a {{ href is '/ticket/' . $ticket->uuid; class is 'ticket-summary'; }; $ticket->prop('summary') };
+ a {{ href is link_to('/ticket/' . $ticket->uuid); class is 'ticket-summary' }; $ticket->prop('summary') };
span { { class is 'ticket-id'}; ' (' . ($ticket->luid ||''). ')'};
}
@@ -560,6 +568,8 @@ template 'show_ticket' => page {
$ticket->luid.": ".($ticket->prop('summary') ||'(No summary)');
} content {
+
+
my $self = shift;
my $id = shift;
my $ticket = App::SD::Model::Ticket->new(
@@ -583,9 +593,9 @@ sub ticket_page_actions {
my $ticket = shift;
ul { {class is 'actions'};
- li { a {{ href is '/ticket/'.$ticket->uuid.'/view'}; 'Show'}; };
- li { a {{ href is '/ticket/'.$ticket->uuid.'/edit'}; 'Update'}; } unless($self->server->static);
- li { a {{ href is '/ticket/'.$ticket->uuid.'/history'}; 'History'}; };
+ li { a {{ href is link_to('/ticket/'.$ticket->uuid.'/view')}; 'Show'}; };
+ li { a {{ href is link_to('/ticket/'.$ticket->uuid.'/edit')}; 'Update'}; } unless($self->server->static);
+ li { a {{ href is link_to('/ticket/'.$ticket->uuid.'/history')}; 'History'}; };
};
@@ -771,10 +781,30 @@ sub ticket_link {
a {
{
class is 'ticket';
- href is '/ticket/' . $ticket->uuid."/view";
+ href is link_to( '/ticket/' . $ticket->uuid."/view");
};
$label;
}
};
}
+
+=head2 link_to PATH
+
+This routine does its best to convert a URI path from absolute ( starts at / ) to
+relative. (Starts at .).
+
+I bet it needs work
+
+=cut
+
+sub link_to ($) {
+ my $href = shift;
+
+ my $base = $ENV{'REQUEST_URI'};
+ $base =~ s/[\#\?].*$//;
+ my $edited = File::Spec::Unix->abs2rel($href, $base);
+ $edited =~ s/^\.\.\///;
+ return $edited;
+}
+
1;
commit ec5c78d9b2b4f0e0aff59d62059a07d09241eccc
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Fri Oct 16 18:18:39 2009 -0400
Use URI::File instead of the awful hack
diff --git a/lib/App/SD/Server/View.pm b/lib/App/SD/Server/View.pm
index 0f83952..6f1d182 100644
--- a/lib/App/SD/Server/View.pm
+++ b/lib/App/SD/Server/View.pm
@@ -3,7 +3,7 @@ use strict;
package App::SD::Server::View;
use base 'Prophet::Server::View';
-use File::Spec::Unix;
+use URI::file;
use Template::Declare::Tags;
use Prophet::Server::ViewHelpers;
@@ -798,13 +798,9 @@ I bet it needs work
=cut
sub link_to ($) {
- my $href = shift;
+ my $link = shift;
+ return URI::file->new($link)->rel("file://".$ENV{REQUEST_URI});
- my $base = $ENV{'REQUEST_URI'};
- $base =~ s/[\#\?].*$//;
- my $edited = File::Spec::Unix->abs2rel($href, $base);
- $edited =~ s/^\.\.\///;
- return $edited;
}
1;
commit 03a82b8fe04a8318966994fe756cc619e931d393
Author: franck cuny <franck at lumberjaph.net>
Date: Tue Nov 17 15:13:18 2009 +0100
if there is a trailing slash at the end of the URI, the github api will fail to fetch the data we need
diff --git a/lib/App/SD/Replica/github.pm b/lib/App/SD/Replica/github.pm
index 19cfb68..346d013 100644
--- a/lib/App/SD/Replica/github.pm
+++ b/lib/App/SD/Replica/github.pm
@@ -27,7 +27,7 @@ sub BUILD {
my $self = shift;
my ( $server, $owner, $repo ) =
- $self->{url} =~ m{^github:(http://.*?github.com/)?(.*?)/(.*)}
+ $self->{url} =~ m{^github:(http://.*?github.com/)?(.*?)/([^/]+)/?}
or die
"Can't parse Github server spec. Expected github:owner/repository or\n"
."github:http://github.com/owner/repository.";
commit d673e024d37c1e6f157bd60dee313d7ea4674025
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Nov 18 11:06:01 2009 -0500
relativeize links for great publishing justice
diff --git a/lib/App/SD/CLI/Command/Publish.pm b/lib/App/SD/CLI/Command/Publish.pm
index c65a742..999444c 100644
--- a/lib/App/SD/CLI/Command/Publish.pm
+++ b/lib/App/SD/CLI/Command/Publish.pm
@@ -44,6 +44,7 @@ sub render_templates_into {
my $seen = {};
while ( my $file = shift @links ) {
next if $seen->{$file};
+ local $ENV{'REQUEST_URI'} = $file;
eval {
$cgi->path_info($file);
my $content = $server->handle_request($cgi);
diff --git a/lib/App/SD/Server/View.pm b/lib/App/SD/Server/View.pm
index 6f1d182..d485f50 100644
--- a/lib/App/SD/Server/View.pm
+++ b/lib/App/SD/Server/View.pm
@@ -90,7 +90,7 @@ template 'property_list' => sub {
};};
outs ( ($counts{$prop} ||'0') . " - ");
a {
- { href is link_to( '/' . $property_name . '/' . ($prop ||'')) }
+ { href is $self->server->make_link_relative( '/' . $property_name . '/' . ($prop ||'')) }
( $prop ? $prop : 'None' )
}
@@ -464,10 +464,10 @@ content {
my $nav = sub {
div {{ class is 'nav'};
if ($end > 1 ) {
- a {{ class is 'prev', href is link_to('/history/'.($end-1)) }; 'Earlier' };
+ a {{ class is 'prev', href is $self->server->make_link_relative('/history/'.($end-1)) }; 'Earlier' };
}
if ($start < $latest) {
- a {{ class is 'next', href is link_to ( '/history/'.(( $start+21 < $latest) ? ($start+21) : $latest)) }; 'Later' };
+ a {{ class is 'next', href is $self->server->make_link_relative ( '/history/'.(( $start+21 < $latest) ? ($start+21) : $latest)) }; 'Later' };
}
}
};
@@ -490,7 +490,7 @@ content {
h2 {
a {
- { href is link_to( '/ticket/' . $ticket->uuid );
+ { href is $self->server->make_link_relative( '/ticket/' . $ticket->uuid );
class is 'ticket-summary';
};
$ticket->prop('summary');
@@ -517,7 +517,7 @@ content {
h2 {
outs('Comment on: ');
- a {{ href is link_to('/ticket/' . $ticket->uuid); class is 'ticket-summary' }; $ticket->prop('summary') };
+ a {{ href is $self->server->make_link_relative('/ticket/' . $ticket->uuid); class is 'ticket-summary' }; $ticket->prop('summary') };
span { { class is 'ticket-id'}; ' (' . ($ticket->luid ||''). ')'};
}
@@ -593,9 +593,9 @@ sub ticket_page_actions {
my $ticket = shift;
ul { {class is 'actions'};
- li { a {{ href is link_to('/ticket/'.$ticket->uuid.'/view')}; 'Show'}; };
- li { a {{ href is link_to('/ticket/'.$ticket->uuid.'/edit')}; 'Update'}; } unless($self->server->static);
- li { a {{ href is link_to('/ticket/'.$ticket->uuid.'/history')}; 'History'}; };
+ li { a {{ href is $self->server->make_link_relative('/ticket/'.$ticket->uuid.'/view')}; 'Show'}; };
+ li { a {{ href is $self->server->make_link_relative('/ticket/'.$ticket->uuid.'/edit')}; 'Update'}; } unless($self->server->static);
+ li { a {{ href is $self->server->make_link_relative('/ticket/'.$ticket->uuid.'/history')}; 'History'}; };
};
@@ -781,26 +781,11 @@ sub ticket_link {
a {
{
class is 'ticket';
- href is link_to( '/ticket/' . $ticket->uuid."/view");
+ href is $self->server->make_link_relative( '/ticket/' . $ticket->uuid."/view");
};
$label;
}
};
}
-=head2 link_to PATH
-
-This routine does its best to convert a URI path from absolute ( starts at / ) to
-relative. (Starts at .).
-
-I bet it needs work
-
-=cut
-
-sub link_to ($) {
- my $link = shift;
- return URI::file->new($link)->rel("file://".$ENV{REQUEST_URI});
-
-}
-
1;
commit 0cf0f4946332eed4c8d275930826b7027c07464e
Merge: d673e02 c6e4a12
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Wed Nov 18 11:06:17 2009 -0500
Merge branch 'master' of fsck.com:/git/sd
* 'master' of fsck.com:/git/sd:
tiny update
case fix for gcode
redmine test: do require test inside BEGIN block
as long as there is no query stuff, we can try the ->updated_after method first
add query string support for gcode, also hack for the performance
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list