Merge branch 'upstream_master'
Foxtons Web Design [Fri, 16 Apr 2010 08:19:36 +0000 (09:19 +0100)]
Changes
Makefile.PL
README
lib/Gitalist.pm
lib/Gitalist/Controller/Fragment/Ref.pm
lib/Gitalist/Controller/Ref.pm
lib/Gitalist/Git/Repository.pm
lib/Gitalist/Utils.pm
root/inc/syntax_highlight_css.tt2
root/repository/atom.tt2
root/static/css/core.css

diff --git a/Changes b/Changes
index 7e5894a..2f00589 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,7 +1,17 @@
 This file documents the revision history for Perl extension Gitalist.
 
-0.000006 2010-04-10
+0.001001 2010-04-15
+    - Bumping version number to a format I understand, thanks to mst for
+         pointing me in the right direction and t0m for the new number.
+       - Cleaned up the search results - removed search from the homepage as
+         wasn't working (Foxtons).
+       - Provide a link for an atom entry. switch mode=xml to type=xhtml (Brian
+         Cassidy).
+
+0.000006.1 2010-04-14
+    - Documentation fixes for the --repo-dir flag (Dagfinn Ilmari MannsÃ¥ker).
 
+0.000006 2010-04-10
     - Major frontend redesign, thanks to ranguard and the web designers at
       Foxtons for making this happen.
     - Major URI overhaul, Gitalist has gone from old gitweb style CGI
index 6abc413..dea8818 100644 (file)
@@ -93,6 +93,9 @@ requires 'Path::Class' => '0.17';
 requires 'Sub::Exporter';
 requires 'Syntax::Highlight::Engine::Kate';
 requires 'Sys::Hostname';
+requires 'XML::OPML::SimpleGen';
+requires 'XML::Atom::Feed';
+requires 'XML::RSS';
 
 test_requires 'Test::More' => '0.88';
 test_requires 'Test::utf8' => '0.02';
diff --git a/README b/README
index dcdf72f..2de1bfa 100644 (file)
--- a/README
+++ b/README
@@ -73,7 +73,7 @@ INITIAL CONFIGURATION
 
       cp `perl -Ilib -MGitalist -e'print Gitalist->path_to("gitalist.conf")'` gitalist.conf
 
-    You can then edit this confg, adding a repos_dir path and customising
+    You can then edit this confg, adding a repo_dir path and customising
     other settings as desired.
 
     You can then start the Gitalist demo server by setting
@@ -83,15 +83,15 @@ INITIAL CONFIGURATION
 
     Alternatively, if you only want to set a repository directory and are
     otherwise happy with the default configuration, then you can set the
-    "GITALIST_REPO_DIR" environment variable, or pass the "--repos_dir" flag
+    "GITALIST_REPO_DIR" environment variable, or pass the "--repo_dir" flag
     to any of the scripts.
 
         GITALIST_REPO_DIR=/home/myuser/code/git gitalist_server.pl
-        gitalist_server.pl --repos_dir home/myuser/code/git
+        gitalist_server.pl --repo_dir home/myuser/code/git
 
     The "GITALIST_REPO_DIR" environment variable will override the
     repository directory set in configuration, and will itself be overridden
-    by he "--repos_dir" flag.
+    by he "--repo_dir" flag.
 
 RUNNING
     Once you have followed the instructions above to install and configure
index f213df2..e730524 100644 (file)
@@ -14,7 +14,7 @@ use Catalyst qw/
                 SubRequest
 /;
 
-our $VERSION = '0.000006';
+our $VERSION = '0.001001';
 $VERSION = eval $VERSION;
 
 __PACKAGE__->config(
@@ -139,7 +139,7 @@ by running:
 
   cp `perl -Ilib -MGitalist -e'print Gitalist->path_to("gitalist.conf")'` gitalist.conf
 
-You can then edit this confg, adding a repos_dir path and customising other settings as desired.
+You can then edit this confg, adding a repo_dir path and customising other settings as desired.
 
 You can then start the Gitalist demo server by setting C<< GITALIST_CONFIG >>. For example:
 
@@ -147,13 +147,13 @@ You can then start the Gitalist demo server by setting C<< GITALIST_CONFIG >>. F
 
 Alternatively, if you only want to set a repository directory and are otherwise happy with
 the default configuration, then you can set the C<< GITALIST_REPO_DIR >> environment
-variable, or pass the C<< --repos_dir >> flag to any of the scripts.
+variable, or pass the C<< --repo_dir >> flag to any of the scripts.
 
     GITALIST_REPO_DIR=/home/myuser/code/git gitalist_server.pl
-    gitalist_server.pl --repos_dir home/myuser/code/git
+    gitalist_server.pl --repo_dir home/myuser/code/git
 
 The C<< GITALIST_REPO_DIR >> environment variable will override the repository directory set
-in configuration, and will itself be overridden by he C<< --repos_dir >> flag.
+in configuration, and will itself be overridden by he C<< --repo_dir >> flag.
 
 =head1 RUNNING
 
index 2917616..65e4a61 100644 (file)
@@ -86,7 +86,7 @@ after blob => sub {
         # XXX Hack hack hack, see View::SyntaxHighlight
         language  => ($c->stash->{filename} =~ /\.p[lm]$/i ? 'Perl' : ''),
         is_image  => File::Type::WebImages::mime_type($c->stash->{blob}),
-        is_binary => -B $c->stash->{blob},
+        is_binary => Gitalist::Utils::is_binary($c->stash->{blob}),
     );
 
     $c->forward('View::SyntaxHighlight')
index b988d4d..207d4ca 100644 (file)
@@ -23,7 +23,7 @@ sub raw : Chained('find') Does('FilenameArgs') Args() {
     my ($self, $c) = @_;
     $c->forward('find_blob');
 
-    if(-T $c->stash->{blob}) {
+    if(!Gitalist::Utils::is_binary($c->stash->{blob})) {
         $c->response->content_type('text/plain; charset=utf-8');
     } else {
         my $ft = File::Type->new();
index 7e873cd..0d0c884 100644 (file)
@@ -135,7 +135,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
             if !$sha1 || $sha1 !~ $SHA1RE;
 
         my @search_opts;
-        if ($search) {
+        if ($search and exists $search->{text}) {
             $search->{type} = 'grep'
                 if $search->{type} eq 'commit';
             @search_opts = (
index 0df4973..c40d825 100644 (file)
@@ -45,6 +45,12 @@ sub age_string {
   return $age_str;
 }
 
+sub is_binary {
+  my($str) = @_;
+  open my $fh, '<', \$str or return;
+  return -B $fh;
+}
+
 1;
 
 __END__
@@ -57,7 +63,11 @@ Gitalist::Utils - trivial utils for Gitalist
 
 =head2 age_string
 
-Turns an integer number of seconds into a string..
+Turns an integer number of seconds into a string.
+
+=head2 is_binary
+
+Check whether a string is binary according to C<-B>.
 
 =head1 AUTHORS
 
index 5fc9dad..71a132f 100644 (file)
@@ -1 +1,2 @@
-[%- IF language %]<link rel="stylesheet" type="text/css" href="[% c.uri_for('/static/css/syntax/' _ language _ '.css') %]"/>[% END -%]
+[%- IF language == 'Diff' %]<link rel="stylesheet" type="text/css" href="[% c.uri_for('/static/css/syntax/Diff.css') %]"/>[% END -%]
+[%- IF language == 'Perl' %]<link rel="stylesheet" type="text/css" href="[% c.uri_for('/static/css/syntax/Perl.css') %]"/>[% END -%]
index bd143a1..9f721ab 100644 (file)
@@ -6,7 +6,8 @@
   <entry>
     <title>[% Commit.title | html_entity %]</title>
     <id>[% Commit.id %]</id>
-    <content mode="xml">
+    <link rel="alternate" type="text/html" href="[% Commit.id %]" />
+    <content type="xhtml">
       <div xmlns="http://www.w3.org/1999/xhtml">[% Commit.content | html_entity %]</div>
     </content>
   </entry>
index fca2565..c6d2967 100755 (executable)
@@ -16,7 +16,7 @@
 
 
 body{
-       background:#FAFAFA url(/static/i/bg.png) repeat-x left top;
+       background:#FAFAFA url([% c.uri_for('/static/i/bg.png') %]) repeat-x left top;
        padding:0;
        margin:0;
        font-family:Arial, Verdana, sans-serif;