view release on metacpan or search on metacpan
use Module::Build 0.28;
my %module_build_args = (
"build_requires" => {
"Module::Build" => "0.28"
},
"configure_requires" => {
"Module::Build" => "0.28"
},
"dist_abstract" => "wrapper to rsync/etc. to upload files to a remote server and give download links.",
"dist_author" => [
"Shlomi Fish <shlomif\@cpan.org>"
],
"dist_name" => "App-Sky",
"dist_version" => "0.8.0",
"license" => "mit",
"module_name" => "App::Sky",
"recursive_test_files" => 1,
"requires" => {
"Carp" => 0,
Revision history for App-Sky
0.8.0 2025-07-30
- Add the files' sections "overrides" feature
- override dest_upload_prefix and dest_upload_url_prefix
0.6.0 2024-12-23
- Populate an initial configuration file if it does not exist.
0.4.3 2024-04-04
- Code::TidyAll fixes and add Test::NoTabs
- Add tag-release script.
0.4.2 2020-08-14
- More fixes to use of Clipboard.pm .
- Allow -x / -- copy to be used after "up" or "up-r".
- Code cleanup.
0.4.1 2019-01-31
- Fix the --copy functionality.
0.4.0 2019-01-31
- Add the --copy / -x flag to copy the upload URL to the clipboard.
v0.2.1 2014-10-17
- Document the "up-r" command.
v0.2.0 2014-10-16
- Add the "up-r" sub-command to upload sub-dirs.
v0.0.7 2014-02-02
- Fix the =encoding directives globally.
- Single UTF-8 one.
v0.0.6 2013-06-04
- Made minimal version of perl 5.010 due to use of defined-or.
- it failed on perl-5.8.9.
v0.0.5 2013-06-02
{
"abstract" : "wrapper to rsync/etc. to upload files to a remote server and give download links.",
"author" : [
"Shlomi Fish <shlomif@cpan.org>"
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.033, CPAN::Meta::Converter version 2.150010",
"license" : [
"mit"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : "v0.8.0"
},
"App::Sky::Results" : {
"file" : "lib/App/Sky/Results.pm",
"version" : "v0.8.0"
}
},
"release_status" : "stable",
"resources" : {
"bugtracker" : {
"web" : "https://github.com/shlomif/Sky-uploader/issues"
},
"homepage" : "http://www.shlomifish.org/open-source/projects/sky/",
"repository" : {
"type" : "git",
"url" : "git://github.com/shlomif/Sky-uploader.git",
"web" : "https://github.com/shlomif/Sky-uploader"
}
},
"version" : "0.8.0",
"x_Dist_Zilla" : {
"perl" : {
"version" : "5.040002"
},
"plugins" : [
{
"class" : "Dist::Zilla::Plugin::Prereqs",
---
abstract: 'wrapper to rsync/etc. to upload files to a remote server and give download links.'
author:
- 'Shlomi Fish <shlomif@cpan.org>'
build_requires:
File::Spec: '0'
IO::Handle: '0'
IPC::Open3: '0'
Module::Build: '0.28'
Test::Differences: '0'
Test::More: '0.88'
configure_requires:
MooX: '0'
MooX::late: '0.010'
Scalar::Util: '0'
URI: '0'
YAML::XS: '0'
perl: '5.020'
strict: '0'
utf8: '0'
warnings: '0'
resources:
bugtracker: https://github.com/shlomif/Sky-uploader/issues
homepage: http://www.shlomifish.org/open-source/projects/sky/
repository: git://github.com/shlomif/Sky-uploader.git
version: 0.8.0
x_Dist_Zilla:
perl:
version: '5.040002'
plugins:
-
class: Dist::Zilla::Plugin::Prereqs
config:
Dist::Zilla::Plugin::Prereqs:
phase: test
This archive contains the distribution App-Sky,
version 0.8.0:
wrapper to rsync/etc. to upload files to a remote server and give download links.
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
The MIT (X11) License
This README file was generated by Dist::Zilla::Plugin::Readme v6.033.
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
author = Shlomi Fish <shlomif@cpan.org>
license = MIT
copyright_holder = Shlomi Fish
copyright_year = 2013
version = 0.8.0
[@Filter]
-bundle = @SHLOMIF
-remove = MakeMaker
dist = App-Sky
github_name = Sky-uploader
homepage = http://www.shlomifish.org/open-source/projects/sky/
[ExecDir]
dir = bin
[Prereqs / Runtime]
-phase = runtime
MooX::late = 0.010
[Test::Kwalitee]
[Test::TidyAll]
; authordep Code::TidyAll::Plugin::TestCount
; authordep Pod::Weaver::PluginBundle::SHLOMIF
lib/App/Sky.pm view on Meta::CPAN
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
App::Sky - wrapper to rsync/etc. to upload files to a remote server and give
download links.
=head1 VERSION
version 0.8.0
=head1 SYNOPSIS
Put something like this in F<~/.config/Perl/App-Sky/app_sky_conf.yml> :
---
default_site: homepage
sites:
homepage:
base_upload_cmd:
- 'rsync'
- '-a'
- '-v'
- '--progress'
- '--inplace'
dest_upload_prefix: 'hostgator:public_html/'
dest_upload_url_prefix: 'http://www.shlomifish.org/'
sections:
code:
basename_re: '\.(?:pl|pm|c|py)\z'
target_dir: 'Files/files/code/'
music:
basename_re: '\.(?:mp3|ogg|wav|aac|m4a)\z'
target_dir: 'Files/files/music/mp3-ogg/'
video:
basename_re: '\.(?:webm|flv|avi|mpeg|mpg|mp4|ogv)\z'
target_dir: 'Files/files/video/'
Then you can use commands such as:
$ sky up /path/to/my-music-file.mp3
And get in return a URL to where it was uploaded.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
lib/App/Sky.pm view on Meta::CPAN
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
lib/App/Sky.pm view on Meta::CPAN
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
lib/App/Sky/CmdLine.pm view on Meta::CPAN
use Scalar::Util qw(reftype);
has 'argv' => ( isa => 'ArrayRef[Str]', is => 'rw', required => 1, );
# Better than DATA , IMHO
my $INIT_YAML_CONFIG_CONTENTS = <<"ENDFILE";
---
default_site: homepage
sites:
homepage:
base_upload_cmd:
- 'rsync'
- '-a'
- '-v'
- '--progress'
- '--inplace'
dest_upload_prefix: 'hostgator:public_html/'
dest_upload_url_prefix: 'https://www.destsite.tld/'
dirs_section: 'dirs'
sections:
archives:
basename_re: '\\.(?:7z|AppImage\\.xz|ova(?:\\.xz)?|tar|tar\\.bz2|tar\\.gz|tar\\.xz|tar\\.zst|zip|exe|rpm)(?:\\.zsync)?\\z'
target_dir: 'Files/files/arcs/'
code:
basename_re: '\\.(?:bash|c|cpp|diff|hs|js|json|log|p6|patch|pl|pm|py|rb|rs|s|scm|spec|ts|vim|yaml|yml)(?:\\.bz2|\\.gz|\\.xz\\|\\.zst)?\\z'
target_dir: 'Files/files/code/'
dirs:
basename_re: '\\.(MYDIR)\\z'
lib/App/Sky/CmdLine.pm view on Meta::CPAN
basename_re: '\\.(?:avi|flv|mkv|mp4|mpeg|mpg|ogv|srt|webm)\\z'
target_dir: 'Files/files/video/'
ENDFILE
sub _basic_help
{
my ($self) = @_;
print <<'EOF';
sky upload /path/to/myfile.txt
sky up-r /path/to/directory
Specifying --copy or -x will copy the URL to the clipboard.
EOF
exit(0);
}
sub _basic_usage
{
my ($self) = @_;
print "Usage: sky [up|upload] /path/to/myfile.txt\n";
exit(-1);
}
sub _is_copy_to_clipboard
{
my ( $self, $flag ) = @_;
return ( $flag =~ /\A(--copy|-x)\z/ );
}
lib/App/Sky/CmdLine.pm view on Meta::CPAN
return App::Sky::Manager->new(
{
config => $config,
}
);
};
my $_handle_results = sub {
my ($results) = @_;
my $upload_cmd = $results->upload_cmd();
my $urls = $results->urls();
if ( ( system { $upload_cmd->[0] } @$upload_cmd ) != 0 )
{
die "Upload cmd <<@$upload_cmd>> failed with $!";
}
my $URL = $urls->[0]->as_string();
print "Got URL:\n", $URL, "\n";
if ($copy)
{
require Clipboard;
Clipboard->VERSION('0.19');
Clipboard->import('');
Clipboard->copy_to_all_selections($URL);
}
exit(0);
};
my $op;
if ( ( ( $verb eq 'up' ) || ( $verb eq 'upload' ) ) )
{
$op = 'upload';
}
elsif ( ( $verb eq 'up-r' ) || ( $verb eq 'upload-recursive' ) )
{
$op = "up-r";
}
else
{
return $self->_basic_usage();
}
# GetOptionsFromArray(
# $self->argv(),
lib/App/Sky/CmdLine.pm view on Meta::CPAN
{
$filename = $self->_shift();
last ARGS_LOOP;
}
else
{
die qq#Unrecognized argument "$filename"!#;
}
}
if ( not( ( $op eq 'upload' ) ? ( -f $filename ) : ( -d $filename ) ) )
{
if ( $op eq 'upload' )
{
die qq#"up" can only upload files. '$filename' is not a file!#;
}
die
"Can only upload directories. '$filename' is not a valid directory name.";
}
my $meth =
$op eq 'upload' ? 'get_upload_results' : 'get_recursive_upload_results';
$_handle_results->(
scalar(
$_calc_manager->()->$meth(
{
filenames => [$filename],
}
)
)
);
lib/App/Sky/CmdLine.pm view on Meta::CPAN
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
lib/App/Sky/CmdLine.pm view on Meta::CPAN
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
lib/App/Sky/Config/Validate.pm view on Meta::CPAN
die
"Section '$sect_name' at site '$site_name' must contain a non-empty $string_key";
}
}
OVER:
foreach my $string_key (qw( overrides ))
{
my $v = $sect_conf->{$string_key};
next OVER if !defined($v);
foreach my $kk (qw(dest_upload_prefix dest_upload_url_prefix))
{
my $s = $v->{$kk};
if (
not(
defined($s) ? ( ( ref($s) eq '' ) && ( $s =~ m/\S/ ) ) : 1 )
)
{
die "$kk for section '$sect_name' is not a string.";
}
}
}
return;
}
sub _validate_site
{
my ( $self, $site_name, $site_conf ) = @_;
my $base_upload_cmd = $site_conf->{base_upload_cmd};
if ( ref($base_upload_cmd) ne 'ARRAY' )
{
die "base_upload_cmd for site '$site_name' is not an array.";
}
if ( notall { defined($_) && ref($_) eq '' } @$base_upload_cmd )
{
die "base_upload_cmd for site '$site_name' must contain only strings.";
}
foreach my $kk (qw(dest_upload_prefix dest_upload_url_prefix))
{
my $s = $site_conf->{$kk};
if ( not( defined($s) && ( ref($s) eq '' ) && ( $s =~ m/\S/ ) ) )
{
die "$kk for site '$site_name' is not a string.";
}
}
my $sections = $site_conf->{sections};
if ( ref($sections) ne 'HASH' )
lib/App/Sky/Config/Validate.pm view on Meta::CPAN
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
lib/App/Sky/Config/Validate.pm view on Meta::CPAN
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
lib/App/Sky/Exception.pm view on Meta::CPAN
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
lib/App/Sky/Exception.pm view on Meta::CPAN
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
lib/App/Sky/Manager.pm view on Meta::CPAN
{
my ( $self, $args ) = @_;
my $sections = $self->_calc_site_conf($args)->{sections};
my $sect_name = $self->_calc_sect_name( $args, $sections );
return ( $sections->{$sect_name}->{overrides} || +{} );
}
sub _perform_upload_generic
{
my ( $self, $is_dir, $args ) = @_;
my $filenames = $args->{filenames}
or Carp::confess("Missing argument 'filenames'");
if ( @$filenames != 1 )
{
Carp::confess("More than one file passed to 'filenames'");
}
my $site_conf = $self->_calc_site_conf($args);
my $backend = App::Sky::Module->new(
{
base_upload_cmd => $site_conf->{base_upload_cmd},
dest_upload_prefix => $site_conf->{dest_upload_prefix},
dest_upload_url_prefix => $site_conf->{dest_upload_url_prefix},
}
);
my $fn = $filenames->[0];
my $bn = basename($fn);
my @dir = ( $is_dir ? ( is_dir => 1 ) : () );
my $fileargs = {
%$args,
basename => $bn,
@dir,
};
return $backend->get_upload_results(
{
overrides => $self->_calc_overrides( $fileargs, ),
filenames => (
$is_dir
? [ map { my $s = $_; $s =~ s#/+\z##ms; $s } @$filenames ]
: $filenames,
),
target_dir => $self->_calc_target_dir( $fileargs, ),
@dir,
}
);
}
sub get_upload_results
{
my ( $self, $args ) = @_;
return $self->_perform_upload_generic( 0, $args );
}
sub get_recursive_upload_results
{
my ( $self, $args ) = @_;
return $self->_perform_upload_generic( 1, $args );
}
1;
__END__
=pod
=encoding UTF-8
lib/App/Sky/Manager.pm view on Meta::CPAN
=head1 VERSION
version 0.8.0
=head1 METHODS
=head2 config
The configuration of the app as passed through the configuration file.
=head2 my $results = $sky->get_upload_results({ filenames => ["Shine4U.webm"], });
Gives the recipe to execute for the upload commands.
Accepts one argument that is a hash reference with these keys:
=over 4
=item * 'filenames'
An array reference containing strings to upload. Currently only supports
one filename.
=item * 'section'
An optional section that will override the target section. If not specified,
the uploader will try to guess based on the fileâs basename and the manager
configuration.
=item * 'target_dir'
Overrides the target directory for the upload, to ignore that dictated by
the sections. Should point to a string.
=back
Returns a L<App::Sky::Results> reference containing:
=over 4
=item * upload_cmd
The upload command to execute (as an array reference of strings).
=back
=head2 my $results = $sky->get_recursive_upload_results({ filenames => ['/home/music/Music/mp3s/Basic Desire/'], });
Gives the recipe to execute for the recursive upload commands.
Accepts one argument that is a hash reference with these keys:
=over 4
=item * 'filenames'
An array reference containing paths to directories. Currently only supports
one filename.
=item * 'section'
An optional section that will override the target section. If not specified,
the uploader will try to use the 'dirs_section' section.
=item * 'target_dir'
Overrides the target directory for the upload, to ignore that dictated by
the sections. Should point to a string.
=back
Returns a L<App::Sky::Results> reference containing:
=over 4
=item * upload_cmd
The upload command to execute (as an array reference of strings).
=back
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
lib/App/Sky/Manager.pm view on Meta::CPAN
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
lib/App/Sky/Manager.pm view on Meta::CPAN
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
lib/App/Sky/Module.pm view on Meta::CPAN
use MooX 'late';
use URI ();
use File::Basename qw(basename);
use List::MoreUtils qw( uniq );
use App::Sky::Results ();
use App::Sky::Exception ();
has base_upload_cmd => ( isa => 'ArrayRef[Str]', is => 'ro', );
has dest_upload_prefix => ( isa => 'Str', is => 'ro', );
has dest_upload_url_prefix => ( isa => 'Str', is => 'ro', );
sub get_upload_results
{
my ( $self, $args ) = @_;
my $overrides = $args->{overrides} // {};
my $is_dir = ( $args->{is_dir} // 0 );
my $filenames = $args->{filenames}
or Carp::confess("Missing argument 'filenames'");
lib/App/Sky/Module.pm view on Meta::CPAN
( map { split( //, $_ ) } map { /($invalid_chars_re)/g } @$filenames );
if (@invalid_chars)
{
App::Sky::Exception::Upload::Filename::InvalidChars->throw(
invalid_chars => [ sort { $a cmp $b } uniq(@invalid_chars) ], );
}
return App::Sky::Results->new(
{
upload_cmd => [
@{ $self->base_upload_cmd() },
@$filenames,
(
(
$overrides->{dest_upload_prefix}
// $self->dest_upload_prefix()
)
. $target_dir
),
],
urls => [
URI->new(
(
$overrides->{dest_upload_url_prefix}
// $self->dest_upload_url_prefix()
)
. $target_dir
. basename( $filenames->[0] )
. ( $is_dir ? '/' : '' )
),
],
}
);
}
lib/App/Sky/Module.pm view on Meta::CPAN
=head1 NAME
App::Sky::Module - class that does the heavy lifting.
=head1 VERSION
version 0.8.0
=head1 METHODS
=head2 $sky->base_upload_cmd()
Returns an array reference of strings of the upload command.
=head2 $sky->dest_upload_prefix
The upload prefix to upload to. So:
my $m = App::Sky::Module->new(
{
base_upload_cmd => [qw(rsync -a -v --progress --inplace)],
dest_upload_prefix => 'hostgator:public_html/',
dest_upload_url_prefix => 'http://www.shlomifish.org/',
}
);
=head2 $sky->dest_upload_url_prefix
The base URL where the uploads will be found.
=head2 my $results = $sky->get_upload_results({ filenames => ["Shine4U.webm"], target_dir => "Files/files/video/" });
Gives the recipe to execute for the upload commands.
Returns a L<App::Sky::Results> reference containing:
=over 4
=item * upload_cmd
The upload command to execute (as an array reference of strings).
=back
Accepts an 'overrides' named parameter.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
lib/App/Sky/Module.pm view on Meta::CPAN
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
lib/App/Sky/Module.pm view on Meta::CPAN
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
lib/App/Sky/Results.pm view on Meta::CPAN
use warnings;
use Carp ();
use URI ();
use Moo;
use MooX 'late';
has upload_cmd => ( isa => 'ArrayRef[Str]', is => 'ro', );
has urls => ( isa => 'ArrayRef[URI]', is => 'ro', );
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
App::Sky::Results - results of an upload.
=head1 VERSION
version 0.8.0
=head1 METHODS
=head2 $results->upload_cmd()
The upload command to execute.
=head2 $results->urls()
An array reference of L<URI> objects where the files were uploaded to.
=for :stopwords cpan testmatrix url bugtracker rt cpants kwalitee diff irc mailto metadata placeholders metacpan
=head1 SUPPORT
=head2 Websites
The following websites have more information about this module, and may be of help to you. As always,
in addition to those websites please use your favorite search engine to discover more resources.
lib/App/Sky/Results.pm view on Meta::CPAN
CPANTS
The CPANTS is a website that analyzes the Kwalitee ( code metrics ) of a distribution.
L<http://cpants.cpanauthors.org/dist/App-Sky>
=item *
CPAN Testers
The CPAN Testers is a network of smoke testers who run automated tests on uploaded CPAN distributions.
L<http://www.cpantesters.org/distro/A/App-Sky>
=item *
CPAN Testers Matrix
The CPAN Testers Matrix is a website that provides a visual overview of the test results for a distribution on various Perls/platforms.
L<http://matrix.cpantesters.org/?dist=App-Sky>
lib/App/Sky/Results.pm view on Meta::CPAN
Please report any bugs or feature requests by email to C<bug-app-sky at rt.cpan.org>, or through
the web interface at L<https://rt.cpan.org/Public/Bug/Report.html?Queue=App-Sky>. You will be automatically notified of any
progress on the request by the system.
=head2 Source Code
The code is open to the world, and available for you to hack on. Please feel free to browse it and play
with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull
from your repository :)
L<https://github.com/shlomif/Sky-uploader>
git clone git://github.com/shlomif/Sky-uploader.git
=head1 AUTHOR
Shlomi Fish <shlomif@cpan.org>
=head1 BUGS
Please report any bugs or feature requests on the bugtracker website
L<https://github.com/shlomif/Sky-uploader/issues>
When submitting a bug or request, please include a test-file or a
patch to an existing test-file that illustrates the bug or desired
feature.
=head1 COPYRIGHT AND LICENSE
This software is Copyright (c) 2013 by Shlomi Fish.
This is free software, licensed under:
t/data/sample-configs/shlomif1/config.yaml view on Meta::CPAN
---
default_site: homepage
sites:
homepage:
base_upload_cmd:
- 'rsync'
- '-a'
- '-v'
- '--progress'
- '--inplace'
dest_upload_prefix: 'hostgator:public_html/'
dest_upload_url_prefix: 'http://www.shlomifish.org/'
sections:
code:
basename_re: '\.(?:pl|pm|c|py|js)\z'
target_dir: 'Files/files/code/'
music:
basename_re: '\.(?:mp3|ogg|wav|aac|m4a)\z'
target_dir: 'Files/files/music/mp3-ogg/'
video:
basename_re: '\.(?:webm|flv|avi|mpeg|mpg|mp4|ogv)\z'
target_dir: 'Files/files/video/'
t/manager.t view on Meta::CPAN
use MooX qw/late/;
use Test::More;
use Test::Differences (qw( eq_or_diff ));
has 'manager' => ( isa => 'App::Sky::Manager', is => 'ro' );
# TEST:$c=0;
sub test_upload_results
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ( $self, $args, $blurb_base ) = @_;
my $results = $self->manager->get_upload_results( $args->{input} );
# TEST:$c++
ok( $results, "$blurb_base - Results were returned." );
# TEST:$c++
eq_or_diff(
$results->upload_cmd(),
$args->{upload_cmd}, "$blurb_base - results->upload_cmd() is correct.",
);
# TEST:$c++
eq_or_diff(
[ map { $_->as_string() } @{ $results->urls() } ],
$args->{urls}, "$blurb_base - the result URLs are correct.",
);
return;
}
# TEST:$test_upload_results=$c;
# TEST:$c=0;
sub test_recursive_upload_results
{
local $Test::Builder::Level = $Test::Builder::Level + 1;
my ( $self, $args, $blurb_base ) = @_;
my $results =
$self->manager->get_recursive_upload_results( $args->{input} );
# TEST:$c++
ok( $results, "$blurb_base - Results were returned." );
# TEST:$c++
eq_or_diff(
$results->upload_cmd(),
$args->{upload_cmd}, "$blurb_base - results->upload_cmd() is correct.",
);
# TEST:$c++
eq_or_diff(
[ map { $_->as_string() } @{ $results->urls() } ],
$args->{urls}, "$blurb_base - the result URLs are correct.",
);
return;
}
# TEST:$test_recursive_upload_results=$c;
package main;
{
my $manager = App::Sky::Manager->new(
{
config => {
default_site => "shlomif",
sites => {
shlomif => {
base_upload_cmd =>
[qw(rsync -a -v --progress --inplace)],
dest_upload_prefix => 'hostgator:public_html/',
dest_upload_url_prefix => 'http://www.shlomifish.org/',
sections => {
code => {
basename_re => q/\.(?:pl|pm|c|py)\z/,
target_dir => "Files/files/code/",
},
fedora => {
basename_re => q/\.(?:spec|src\.rpm)\z/,
overrides => {
dest_upload_prefix =>
"fedorapeople.org:public_html/",
dest_upload_url_prefix =>
"https://fedorapeople.org/~shlomif/",
},
target_dir => "fedora/packages/",
},
music => {
basename_re => q/\.(?:mp3|ogg|wav|aac|m4a)\z/,
target_dir => "Files/files/music/mp3-ogg/",
},
video => {
basename_re =>
t/manager.t view on Meta::CPAN
},
},
},
);
# TEST
ok( $manager, 'Module App::Sky::Manager was created.' );
my $tester = ManagerTester->new( { manager => $manager } );
# TEST*$test_upload_results
$tester->test_upload_results(
{
input => {
'filenames' => [
'/home/music/Music/mp3s/Shine 4U - Carmen and Camille-B8ehY5tutHs.mp4',
],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'/home/music/Music/mp3s/Shine 4U - Carmen and Camille-B8ehY5tutHs.mp4',
'hostgator:public_html/Files/files/video/'
],
urls => [
'http://www.shlomifish.org/Files/files/video/Shine%204U%20-%20Carmen%20and%20Camille-B8ehY5tutHs.mp4',
],
},
'[mp4 file]',
);
# TEST*$test_upload_results
$tester->test_upload_results(
{
input => {
'filenames' => ['./foobar/MyModule.pm'],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'./foobar/MyModule.pm',
'hostgator:public_html/Files/files/code/'
],
urls =>
[ 'http://www.shlomifish.org/Files/files/code/MyModule.pm', ],
},
'MyModule.pm',
);
# TEST*$test_upload_results
$tester->test_upload_results(
{
input => {
'filenames' => ['/var/tmp/test-code.c'],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'/var/tmp/test-code.c',
'hostgator:public_html/Files/files/code/'
],
urls =>
[ 'http://www.shlomifish.org/Files/files/code/test-code.c', ],
},
'test-code.c',
);
# TEST*$test_upload_results
$tester->test_upload_results(
{
input => {
'section' => 'music',
'filenames' => [
'/home/music/Music/mp3s/Shine 4U - Carmen and Camille-B8ehY5tutHs.mp4',
],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'/home/music/Music/mp3s/Shine 4U - Carmen and Camille-B8ehY5tutHs.mp4',
'hostgator:public_html/Files/files/music/mp3-ogg/',
],
urls => [
'http://www.shlomifish.org/Files/files/music/mp3-ogg/Shine%204U%20-%20Carmen%20and%20Camille-B8ehY5tutHs.mp4',
],
},
'.mp4 file to music section.',
);
# TEST*$test_upload_results
$tester->test_upload_results(
{
input => {
'target_dir' => 'secret-music/',
'filenames' => [
'/home/music/Music/mp3s/Shine 4U - Carmen and Camille-B8ehY5tutHs.mp4',
],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'/home/music/Music/mp3s/Shine 4U - Carmen and Camille-B8ehY5tutHs.mp4',
'hostgator:public_html/secret-music/',
],
urls => [
'http://www.shlomifish.org/secret-music/Shine%204U%20-%20Carmen%20and%20Camille-B8ehY5tutHs.mp4',
],
},
'target_dir',
);
# TEST*$test_upload_results
$tester->test_upload_results(
{
input => {
'filenames' => ['./foobar/docmake.spec'],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'./foobar/docmake.spec',
'fedorapeople.org:public_html/fedora/packages/'
],
urls => [
"https://fedorapeople.org/~shlomif/"
. "fedora/packages/"
. "docmake.spec",
],
},
t/manager.t view on Meta::CPAN
);
}
{
my $manager = App::Sky::Manager->new(
{
config => {
default_site => "shlomif",
sites => {
shlomif => {
base_upload_cmd =>
[qw(rsync -a -v --progress --inplace)],
dest_upload_prefix => 'hostgator:public_html/',
dest_upload_url_prefix => 'http://www.shlomifish.org/',
dirs_section => 'dirs',
sections => {
code => {
basename_re => q/\.(?:pl|pm|c|py)\z/,
target_dir => "Files/files/code/",
},
dirs => {
basename_re => q/\.(?:MYDIR)\z/,
target_dir => "Files/files/dirs/",
},
t/manager.t view on Meta::CPAN
},
},
},
);
# TEST
ok( $manager, 'Directories App::Sky::Manager was created.' );
my $tester = ManagerTester->new( { manager => $manager } );
# TEST*$test_recursive_upload_results
$tester->test_recursive_upload_results(
{
input => {
'filenames' => [ '/home/shlomif/progs/perl/cpan/App-Sky', ],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'/home/shlomif/progs/perl/cpan/App-Sky',
'hostgator:public_html/Files/files/dirs/',
],
urls => [ 'http://www.shlomifish.org/Files/files/dirs/App-Sky/', ],
},
'upload directory',
);
# TEST*$test_recursive_upload_results
$tester->test_recursive_upload_results(
{
input => {
'filenames' => [ '/home/shlomif/progs/perl/cpan/App-Sky/', ],
},
upload_cmd => [
qw(rsync -a -v --progress --inplace),
'/home/shlomif/progs/perl/cpan/App-Sky',
'hostgator:public_html/Files/files/dirs/',
],
urls => [ 'http://www.shlomifish.org/Files/files/dirs/App-Sky/', ],
},
'trailing slash is removed on upload directory',
);
}
use Test::More tests => 14;
use Test::Differences (qw( eq_or_diff ));
use App::Sky::Module ();
use App::Sky::Exception ();
{
my $m = App::Sky::Module->new(
{
base_upload_cmd => [qw(rsync -a -v --progress --inplace)],
dest_upload_prefix => 'hostgator:public_html/',
dest_upload_url_prefix => 'http://www.shlomifish.org/',
}
);
# TEST
ok( $m, 'Module App::Sky::Module was created.' );
# TEST
eq_or_diff(
$m->base_upload_cmd(),
[qw(rsync -a -v --progress --inplace)],
"base_upload_cmd was set.",
);
{
my $results = $m->get_upload_results(
{
'filenames' => ['Shine4U.webm'],
'target_dir' => 'Files/files/video/',
}
);
# TEST
ok( $results, "Results were returned." );
# TEST
eq_or_diff(
$results->upload_cmd(),
[
qw(rsync -a -v --progress --inplace Shine4U.webm hostgator:public_html/Files/files/video/)
],
"results->upload_cmd() is correct.",
);
# TEST
eq_or_diff(
[ map { $_->as_string() } @{ $results->urls() } ],
[ 'http://www.shlomifish.org/Files/files/video/Shine4U.webm', ],
'The result URLs are correct.',
);
}
{
my $results = $m->get_upload_results(
{
'filenames' => ['../../My-Lemon.webm'],
'target_dir' => 'Files/files/video/',
}
);
# TEST
ok( $results, "../../ Results were returned." );
# TEST
eq_or_diff(
$results->upload_cmd(),
[
qw(rsync -a -v --progress --inplace ../../My-Lemon.webm hostgator:public_html/Files/files/video/)
],
"../../ results->upload_cmd() is correct.",
);
# TEST
eq_or_diff(
[ map { $_->as_string() } @{ $results->urls() } ],
[ 'http://www.shlomifish.org/Files/files/video/My-Lemon.webm', ],
'URLs for using basename.',
);
}
{
my $results = $m->get_upload_results(
{
'filenames' => ['/home/shlomif/progs/perl/MetaData.pm'],
'target_dir' => 'share-dir/code/',
}
);
# TEST
ok( $results, "Absolute URL - results obj was returned." );
# TEST
eq_or_diff(
$results->upload_cmd(),
[
qw(rsync -a -v --progress --inplace /home/shlomif/progs/perl/MetaData.pm hostgator:public_html/share-dir/code/)
],
"Absolute URL - results->upload_cmd() is correct.",
);
# TEST
eq_or_diff(
[ map { $_->as_string() } @{ $results->urls() } ],
[ 'http://www.shlomifish.org/share-dir/code/MetaData.pm', ],
'Absolute URL - URLs for using basename.',
);
}
}
{
my $m = App::Sky::Module->new(
{
base_upload_cmd => [qw(rsync -a -v --progress --inplace)],
dest_upload_prefix => 'shlomif@perl-begin.org:sites/perl-begin',
dest_upload_url_prefix => 'http://perl-begin.org/',
}
);
{
eval {
my $results = $m->get_upload_results(
{
'filenames' => ['/home/shlomif/progs/foo:bar.pm'],
'target_dir' => 'Files/files/code/',
}
);
};
my $E = $@;
# TEST