| 1 | package Statocles::Command; | ||||||||||
| 2 | 15 | our $VERSION = '0.099'; | |||||||||
| 3 | # ABSTRACT: The base class for command modules | ||||||||||
| 4 | |||||||||||
| 5 | #pod =head1 SYNOPSIS | ||||||||||
| 6 | #pod | ||||||||||
| 7 | #pod use Statocles::Base 'Command'; | ||||||||||
| 8 | #pod sub run { | ||||||||||
| 9 | #pod my ( $self, @argv ) = @_; | ||||||||||
| 10 | #pod ...; | ||||||||||
| 11 | #pod } | ||||||||||
| 12 | #pod | ||||||||||
| 13 | #pod =head1 DESCRIPTION | ||||||||||
| 14 | #pod | ||||||||||
| 15 | #pod This module is a base class for command modules. | ||||||||||
| 16 | #pod | ||||||||||
| 17 | #pod =head1 SEE ALSO | ||||||||||
| 18 | #pod | ||||||||||
| 19 | #pod =over 4 | ||||||||||
| 20 | #pod | ||||||||||
| 21 | #pod =item L<statocles> | ||||||||||
| 22 | #pod | ||||||||||
| 23 | #pod The documentation for the command-line application. | ||||||||||
| 24 | #pod | ||||||||||
| 25 | #pod =back | ||||||||||
| 26 | #pod | ||||||||||
| 27 | #pod =cut | ||||||||||
| 28 | |||||||||||
| 29 | 15 | ▶ | use Statocles::Base 'Class'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 30 | 15 | ▶ | use YAML; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 31 | 15 | ▶ | use Path::Tiny; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 32 | |||||||||||
| 33 | #pod =attr site | ||||||||||
| 34 | #pod | ||||||||||
| 35 | #pod The L<Statocles::Site> object for the current site. | ||||||||||
| 36 | #pod | ||||||||||
| 37 | #pod =cut | ||||||||||
| 38 | |||||||||||
| 39 | 15 | has site => ( | |||||||||
| 40 | is => 'ro', | ||||||||||
| 41 | isa => InstanceOf['Statocles::Site'], | ||||||||||
| 42 | ); | ||||||||||
| 43 | |||||||||||
| 44 | 0 | ▶ | sub _get_status { | ||||||||
|
Subroutine
_get_status: not called CC=2 SCAR=17.9
| |||||||||||
| 45 | 0 | my ( $self, $status ) = @_; | |||||||||
| 46 | 0 | my $path = Path::Tiny->new( '.statocles', 'status.yml' ); | |||||||||
| 47 | 0 | ▶ | return {} unless $path->exists; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | 0 | YAML::Load( $path->slurp_utf8 ); | |||||||||
| 49 | } | ||||||||||
| 50 | |||||||||||
| 51 | 0 | ▶ | sub _write_status { | ||||||||
|
Subroutine
_write_status: not called CC=1 SCAR=6.9
| |||||||||||
| 52 | 0 | my ( $self, $status ) = @_; | |||||||||
| 53 | 0 | Path::Tiny->new( '.statocles', 'status.yml' )->touchpath->spew_utf8( YAML::Dump( $status ) ); | |||||||||
| 54 | } | ||||||||||
| 55 | |||||||||||
| 56 | 15 | 1; | |||||||||
| 57 | |||||||||||
| 58 | __END__ | ||||||||||