Skip to content

Commit

Permalink
Revert "Merge remote branch 't0m/json' into json"
Browse files Browse the repository at this point in the history
This reverts commit 68943a8, reversing
changes made to 0fa199d.

Conflicts:

	Makefile.PL
	lib/Gitalist/Controller/Root.pm
	lib/Gitalist/Git/Repository.pm
	t/02git_Repository.t
	t/json_view.t
  • Loading branch information
Dan Brook committed Aug 1, 2010
1 parent 9c9f54f commit 3a6dd96
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 187 deletions.
10 changes: 3 additions & 7 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 65,19 @@ requires 'Catalyst::Action::REST' => '0.85';
requires 'Catalyst::View::Component::SubInclude' => '0.07';
requires 'Catalyst::View::TT' => '0.34';
requires 'Try::Tiny';
requires 'Template';
requires 'Template' => '2.22';
requires 'Template::Provider::Encoding';
requires 'Template::Plugin::Cycle';

requires 'Config::General';

requires 'Moose';
requires 'Moose::Autobox';
requires 'MooseX::Declare' => '0.33';
requires 'MooseX::Types::DateTime';
requires 'MooseX::Types::ISO8601';
requires 'MooseX::MultiMethods' => '0.10';
requires 'MooseX::Declare' => '0.32';
requires 'MooseX::Types::Common';
requires 'MooseX::Types::Path::Class';
requires 'MooseX::Types';
requires 'MooseX::Storage';
requires 'JSON::XS';
requires 'namespace::autoclean';

requires 'Git::PurePerl' => '0.46';
Expand All @@ -106,7 103,6 @@ requires_external_bin 'git';

test_requires 'Test::More' => '0.88';
test_requires 'Test::utf8' => '0.02';
test_requires 'HTTP::Request::Common';

resources bugtracker => 'http://rt.cpan.org/Public/Dist/Display.html?Name=Gitalist';
resources repository => 'git://git.shadowcat.co.uk/catagits/Gitalist.git';
Expand Down
12 changes: 0 additions & 12 deletions lib/Gitalist/Controller/Root.pm
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 76,6 @@ sub error_404 : Action {
$c->response->body('Page not found');
}

__PACKAGE__->config(
default => 'text/html',
map => {
'application/json' => [qw/ JSON /],
map { $_ => [qw/ View Default /] }
qw( text/css text/html text/plain
application/atom xml application/rss xml
application/rss application/xml )

}
);

__PACKAGE__->meta->make_immutable;

__END__
Expand Down
2 changes: 0 additions & 2 deletions lib/Gitalist/Git/CollectionOfRepositories.pm
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 6,6 @@ role Gitalist::Git::CollectionOfRepositories {
use Moose::Autobox;
use aliased 'Gitalist::Git::Repository';

with 'Gitalist::Serializeable';

has repositories => (
is => 'ro',
isa => ArrayRef['Gitalist::Git::Repository'],
Expand Down
2 changes: 0 additions & 2 deletions lib/Gitalist/Git/HasUtils.pm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 2,6 @@ use MooseX::Declare;

role Gitalist::Git::HasUtils {
use Gitalist::Git::Util;
use MooseX::Storage::Meta::Attribute::Trait::DoNotSerialize;

method BUILD {}
after BUILD {
Expand All @@ -22,7 21,6 @@ role Gitalist::Git::HasUtils {
get_gpp_object
gpp
/],
traits => [qw/ DoNotSerialize /],
);
method _build_util { confess(shift() . " cannot build _util") }
}
Expand Down
3 changes: 0 additions & 3 deletions lib/Gitalist/Git/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 5,6 @@ class Gitalist::Git::Object {
use MooseX::Types::Moose qw/Str Int Bool Maybe ArrayRef/;
use MooseX::Types::Common::String qw/NonEmptySimpleStr/;

with 'Gitalist::Serializeable';

# repository and sha1 are required initargs
has repository => ( isa => 'Gitalist::Git::Repository',
required => 1,
Expand Down Expand Up @@ -38,7 36,6 @@ class Gitalist::Git::Object {
is => 'ro',
lazy_build => 1,
handles => [ 'content' ],
traits => [qw/ DoNotSerialize /],
);

# objects can't determine their mode or filename
Expand Down
22 changes: 9 additions & 13 deletions lib/Gitalist/Git/Repository.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 3,18 @@ use MooseX::Declare;
class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
# FIXME, use Types::Path::Class and coerce
use MooseX::Types::Common::String qw/NonEmptySimpleStr/;
use MooseX::Types::Path::Class qw/Dir/;
use MooseX::Types::Moose qw/Str Maybe Bool HashRef ArrayRef/;
use Gitalist::Git::Types qw/SHA1 DateTime Dir/;
use Gitalist::Git::Types qw/SHA1/;
use Moose::Autobox;
use List::MoreUtils qw/any zip/;
use aliased 'DateTime' => 'DT';
use DateTime;
use Encode qw/decode/;
use I18N::Langinfo qw/langinfo CODESET/;
use Gitalist::Git::Object::Blob;
use Gitalist::Git::Object::Tree;
use Gitalist::Git::Object::Commit;
use Gitalist::Git::Object::Tag;

with 'Gitalist::Serializeable';

our $SHA1RE = qr/[0-9a-fA-F]{40}/;

Expand All @@ -35,8 34,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
is => 'ro', required => 1 );

has path => ( isa => Dir,
is => 'ro', required => 1,
traits => [qw/ DoNotSerialize /] );
is => 'ro', required => 1);

has description => ( isa => Str,
is => 'ro',
Expand All @@ -48,7 46,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
lazy_build => 1,
);

has last_change => ( isa => Maybe[DateTime],
has last_change => ( isa => Maybe['DateTime'],
is => 'ro',
lazy_build => 1,
);
Expand All @@ -63,9 61,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
);
has heads => ( isa => ArrayRef[HashRef],
is => 'ro',
lazy_build => 1,
traits => [qw/ DoNotSerialize /],
);
lazy_build => 1);
has tags => ( isa => ArrayRef[HashRef],
is => 'ro',
lazy_build => 1);
Expand Down Expand Up @@ -255,7 251,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {
--sort=-committerdate --count=1 refs/heads
});
if (my ($epoch, $tz) = $output =~ /\s(\d )\s ([ -]\d )$/) {
my $dt = DT->from_epoch(epoch => $epoch);
my $dt = DateTime->from_epoch(epoch => $epoch);
$dt->set_time_zone($tz);
$last_change = $dt;
}
Expand All @@ -273,7 269,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {

#FIXME: That isn't the time I'm looking for..
if (my ($epoch, $tz) = $line =~ /\s(\d )\s ([ -]\d )$/) {
my $dt = DT->from_epoch(epoch => $epoch);
my $dt = DateTime->from_epoch(epoch => $epoch);
$dt->set_time_zone($tz);
$ret[-1]->{last_change} = $dt;
}
Expand All @@ -299,7 295,7 @@ class Gitalist::Git::Repository with Gitalist::Git::HasUtils {

#FIXME: That isn't the time I'm looking for..
if($epoch and $tz) {
my $dt = DT->from_epoch(epoch => $epoch);
my $dt = DateTime->from_epoch(epoch => $epoch);
$dt->set_time_zone($tz);
$ret[-1]->{last_change} = $dt;
}
Expand Down
40 changes: 1 addition & 39 deletions lib/Gitalist/Git/Types.pm
Original file line number Diff line number Diff line change
@@ -1,16 1,8 @@
package Gitalist::Git::Types;

use MooseX::Types
-declare => [qw/
SHA1
DateTime
Dir
/];
-declare => [qw/SHA1/];

use MooseX::Types::Path::Class;
use MooseX::Types::ISO8601 qw/ISO8601DateTimeStr/;
use MooseX::Types::DateTime ();
use MooseX::Storage::Engine ();
use MooseX::Types::Common::String qw/NonEmptySimpleStr/;

subtype SHA1,
Expand All @@ -22,34 14,4 @@ coerce SHA1,
from NonEmptySimpleStr,
via { 1 };

subtype DateTime,
as 'MooseX::Types::DateTime::DateTime',
where { 1 };

MooseX::Storage::Engine->add_custom_type_handler(
DateTime,
expand => sub {
my $val = shift;
Carp::confess("Not implemented");
},
collapse => sub {
to_ISO8601DateTimeStr(shift);
},
);

subtype Dir,
as 'MooseX::Types::Path::Class::Dir',
where { 1 };

MooseX::Storage::Engine->add_custom_type_handler(
Dir,
expand => sub {
my $val = shift;
Carp::confess("Not implemented");
},
collapse => sub {
shift() . '';
},
);

1;
32 changes: 0 additions & 32 deletions lib/Gitalist/Serializeable.pm

This file was deleted.

18 changes: 0 additions & 18 deletions t/02git_Repository.t
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 39,6 @@ is($proj->name, qw/repo1/, 'repository name is set');
is($proj->description, qq/some test repository/, 'repository description loaded');
isa_ok($proj->last_change, 'DateTime', 'last_change');

is_deeply $proj->pack, {
'__CLASS__' => 'Gitalist::Git::Repository',
'is_bare' => 1,
'owner' => "T\x{e9}st",
'last_change' => '2009-11-12T19:00:34Z',
'name' => 'repo1',
'description' => 'some test repository'
};

is_deeply $proj->pack, {
'__CLASS__' => 'Gitalist::Git::Repository',
'is_bare' => 1,
'owner' => "T\x{e9}st",
'last_change' => '2009-11-12T19:00:34Z',
'name' => 'repo1',
'description' => 'some test repository'
};

my %references = %{$proj->references};
ok(keys %references >= 2, '->references hash has elements');
is($references{'36c6c6708b8360d7023e8a1649c45bcf9b3bd818'}->[0], 'heads/master', 'reference looks ok');
Expand Down
59 changes: 0 additions & 59 deletions t/json_view.t

This file was deleted.

0 comments on commit 3a6dd96

Please sign in to comment.