| 1 | package Statocles::Deploy::File; | ||||||||||
| 2 | 45 | our $VERSION = '0.099'; | |||||||||
| 3 | # ABSTRACT: Deploy a site to a folder on the filesystem | ||||||||||
| 4 | |||||||||||
| 5 | 45 | ▶ | use Statocles::Base 'Class'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 45 | with 'Statocles::Deploy'; | |||||||||
| 7 | 45 | ▶ | use Statocles::Util qw( dircopy ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | #pod =attr path | ||||||||||
| 10 | #pod | ||||||||||
| 11 | #pod The path to deploy to. | ||||||||||
| 12 | #pod | ||||||||||
| 13 | #pod =cut | ||||||||||
| 14 | |||||||||||
| 15 | has path => ( | ||||||||||
| 16 | is => 'ro', | ||||||||||
| 17 | isa => Path, | ||||||||||
| 18 | coerce => Path->coercion, | ||||||||||
| 19 | 6 | ▶ | default => sub { Path::Tiny->new( '.' ) }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 20 | 45 | ); | |||||||||
| 21 | |||||||||||
| 22 | #pod =method deploy | ||||||||||
| 23 | #pod | ||||||||||
| 24 | #pod my @paths = $deploy->deploy( $source_path, %options ); | ||||||||||
| 25 | #pod | ||||||||||
| 26 | #pod Deploy the site, copying from the given source path. | ||||||||||
| 27 | #pod | ||||||||||
| 28 | #pod Possible options are: | ||||||||||
| 29 | #pod | ||||||||||
| 30 | #pod =over 4 | ||||||||||
| 31 | #pod | ||||||||||
| 32 | #pod =item clean | ||||||||||
| 33 | #pod | ||||||||||
| 34 | #pod Remove all the current contents of the deploy directory before copying the | ||||||||||
| 35 | #pod new content. | ||||||||||
| 36 | #pod | ||||||||||
| 37 | #pod =back | ||||||||||
| 38 | #pod | ||||||||||
| 39 | #pod =cut | ||||||||||
| 40 | |||||||||||
| 41 | 14 | ▶ | sub deploy { | ||||||||
|
Subroutine
deploy: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 42 | 14 | my ( $self, $source_path, %options ) = @_; | |||||||||
| 43 | |||||||||||
| 44 | 14 | ▶ | die sprintf 'Deploy directory "%s" does not exist (did you forget to make it?)', | ||||||||
|
Branch: 1 branch
| |||||||||||
| 45 | $self->path | ||||||||||
| 46 | if !$self->path->is_dir; | ||||||||||
| 47 | |||||||||||
| 48 | 13 | ▶ | if ( $options{ clean } ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 49 | 1 | $_->remove_tree for $self->path->children; | |||||||||
| 50 | } | ||||||||||
| 51 | |||||||||||
| 52 | 13 | my $src = Path->coercion->( $source_path ); | |||||||||
| 53 | 13 | dircopy $src, $self->path; | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 45 | 1; | |||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||