Skip to content

Commit

Permalink
Merge branch 'release/0.57'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pedro Figueiredo committed Sep 16, 2012
2 parents d792114 + c5adb6c commit 1b68674
Show file tree
Hide file tree
Showing 21 changed files with 92 additions and 23 deletions.
12 changes: 7 additions & 5 deletions bin/s3cl
Original file line number Diff line number Diff line change
Expand Up @@ -393,14 +393,15 @@ s3cl sync_up [--acl_short=public-read] /path/ <bucket>:[prefix]
Upload all the files below /path/ to S3, with an optional
prefix at the start of the key name. The existing S3 files and
meta data are fetched from S3 and the md5 (etag) is compaired to what is
on the local disk, files are not upload if the content has not changed.
meta data are fetched from S3 and the md5 (etag) is compaired to
what is on the local disk, files are not upload if the content has
not changed.
Use --acl_short to set access control, options from
L<Net::Amazon::S3::Bucket#set_acl> this is only applied when the
Use --acl_short to set access control, options from
L<Net::Amazon::S3::Bucket#set_acl> this is only applied when the
file is uploaded.
Each files content-type is worked out using L<MIME::Types>,
Each files content-type is worked out using L<MIME::Types>,
if this does not match 'text/plain' is used for ASCII text files,
otherwise a warning is issued and the file is NOT uploaded.
Expand Down Expand Up @@ -436,3 +437,4 @@ following notice (which is also applicicable to this code):
Leo Lapworth <LLAP@cuckoo.org> - Part of the HinuHinu project
=cut
23 changes: 18 additions & 5 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,32 @@ version = 0.57

[@Filter]
-bundle = @Basic
-remove = MakeMaker
option = for_basic

[ModuleInstall]
[MetaJSON]
[MetaResources]
bugtracker.web = https://github.com/pfig/net-amazon-s3/issues
repository.url = https://github.com/pfig/net-amazon-s3.git
repository.web = https://github.com/pfig/net-amazon-s3
repository.type = git

[AutoPrereqs]
[CPANFile]

[CheckChangeLog]

[PodWeaver]
[ReadmeMarkdownFromPod]

[PkgVersion]
[NextRelease]
filename = CHANGES
format = %-4v %{ccc MMM dd HH:mm:ss vvv yyyy}d

[PodSyntaxTests]
[PodCoverageTests]
[Test::Perl::Critic]
[@TestingMania]
disable = Test::Kwalitee
disable = Test::Pod::LinkCheck
disable = PodCoverageTests

[@Git]
[Git::CommitBuild]
3 changes: 0 additions & 3 deletions lib/Net/Amazon/S3.pm
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ sub _send_request_expect_nothing {
# warn $http_request->as_string;

my $response = $self->_do_http($http_request);
my $content = $response->content;

return 1 if $response->code =~ /^2\d\d$/;

Expand Down Expand Up @@ -731,8 +730,6 @@ sub _send_request_expect_nothing_probed {
$response = $self->_do_http($http_request);
$self->ua->requests_redirectable($old_redirectable);

my $content = $response->content;

return 1 if $response->code =~ /^2\d\d$/;

# anything else is a failure, and we save the parsed result
Expand Down
5 changes: 4 additions & 1 deletion lib/Net/Amazon/S3/Bucket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ __PACKAGE__->meta->make_immutable;

# ABSTRACT: convenience object for working with Amazon S3 buckets

=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
use Net::Amazon::S3;
Expand All @@ -23,7 +26,7 @@ __PACKAGE__->meta->make_immutable;
ok($bucket->add_key("key", "data", {
content_type => "text/html",
'x-amz-meta-colour' => 'orange',
});
}));
# the err and errstr methods just proxy up to the Net::Amazon::S3's
# objects err/errstr methods.
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Client.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ sub _send_request_xpc {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $s3 = Net::Amazon::S3->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Client/Bucket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ sub object {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
# return the bucket name
Expand Down
15 changes: 12 additions & 3 deletions lib/Net/Amazon/S3/Client/Object.pm
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ sub put {
if ( $self->content_encoding ) {
$conf->{'Content-Encoding'} = $self->content_encoding;
}
if ( $self->content_disposition ) {
if ( $self->content_disposition ) {
$conf->{'Content-Disposition'} = $self->content_disposition;
}

Expand Down Expand Up @@ -176,6 +176,10 @@ sub put_filename {
if ( $self->content_encoding ) {
$conf->{'Content-Encoding'} = $self->content_encoding;
}
if ( $self->content_disposition ) {
$conf->{'Content-Disposition'} = $self->content_disposition;
}


my $http_request = Net::Amazon::S3::Request::PutObject->new(
s3 => $self->client->s3,
Expand Down Expand Up @@ -283,6 +287,9 @@ sub _etag {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
# show the key
Expand Down Expand Up @@ -402,7 +409,8 @@ This module represents objects in buckets.
);
$object->put('this is the public value');
You may also set Content-Encoding using content_encoding.
You may also set Content-Encoding using content_encoding, and
Content-Disposition using content_disposition.
=head2 put_filename
Expand All @@ -422,7 +430,8 @@ You may also set Content-Encoding using content_encoding.
);
$object->put_filename('hat.jpg');
You may also set Content-Encoding using content_encoding.
You may also set Content-Encoding using content_encoding, and
Content-Disposition using content_disposition.
=head2 query_string_authentication_uri
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/HTTPRequest.pm
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ sub _urlencode {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::HTTPRequest->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/CreateBucket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::CreateBucket->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/DeleteBucket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::DeleteBucket->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/DeleteObject.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::DeleteObject->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/GetBucketAccessControl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::GetBucketAccessControl->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/GetBucketLocationConstraint.pm
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::GetBucketLocationConstraint->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/GetObject.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ sub query_string_authentication_uri {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::GetObject->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/GetObjectAccessControl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::GetObjectAccessControl->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/ListAllMyBuckets.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/ListBucket.pm
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ sub _urlencode {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::ListBucket->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/PutObject.pm
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::PutObject->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/SetBucketAccessControl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::SetBucketAccessControl->new(
Expand Down
3 changes: 3 additions & 0 deletions lib/Net/Amazon/S3/Request/SetObjectAccessControl.pm
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ sub http_request {

__END__
=for test_synopsis
no strict 'vars'
=head1 SYNOPSIS
my $http_request = Net::Amazon::S3::Request::SetObjectAccessControl->new(
Expand Down
12 changes: 6 additions & 6 deletions t/02client.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ my $client = Net::Amazon::S3::Client->new( s3 => $s3 );
my @buckets = $client->buckets;

TODO: {
local $TODO = "These tests only work if you're leon";
local $TODO = "These tests only work if you're pedro";
my $first_bucket = $buckets[0];
like( $first_bucket->owner_id, qr/^46a801915a1711f/, 'have owner id' );
is( $first_bucket->owner_display_name, '_acme_', 'have display name' );
is( scalar @buckets, 10, 'have a bunch of buckets' );
like( $first_bucket->owner_id, qr/^c7483d612ac7f0c0/, 'have owner id' );
is( $first_bucket->owner_display_name, 'pedro_figueiredo', 'have display name' );
is( scalar @buckets, 6, 'have a bunch of buckets' );
}

my $bucket_name = 'net-amazon-s3-test-' . lc $aws_access_key_id;

my $bucket = $client->create_bucket(
name => $bucket_name,
acl_short => 'public-read',
location_constraint => 'US',
location_constraint => 'EU',
);

is( $bucket->name, $bucket_name, 'newly created bucket has correct name' );
Expand All @@ -56,7 +56,7 @@ like(
'newly created bucket is public-readable'
);

is( $bucket->location_constraint, 'US', 'newly created bucket is in the US' );
is( $bucket->location_constraint, 'EU', 'newly created bucket is in the EU' );

my $stream = $bucket->list;
until ( $stream->is_done ) {
Expand Down

0 comments on commit 1b68674

Please sign in to comment.