| 1 | package File::Find::Object::Rule::VCS; | ||||||||||
| 2 | 3 | $File::Find::Object::Rule::VCS::VERSION = '0.0.4'; | |||||||||
| 3 | |||||||||||
| 4 | 3 | ▶ | use 5.008; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | 3 | ▶ | use UNIVERSAL; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 3 | ▶ | use Carp (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | 3 | ▶ | use Text::Glob 0.08 (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 3 | ▶ | use File::Find::Object::Rule (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 3 | ▶ | use vars qw{@ISA @EXPORT}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 3 | ▶ | use parent 'File::Find::Object::Rule'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 3 | my $FFOR = 'File::Find::Object::Rule'; | |||||||||
| 18 | |||||||||||
| 19 | # In some Windows SVN implementations, it uses _svn instead of | ||||||||||
| 20 | # .svn, so use both on Win32. | ||||||||||
| 21 | 3 | ▶ | my @svn = ($^O eq 'MSWin32') ? ('.svn', '_svn') : ('.svn'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | |||||||||||
| 23 | ##################################################################### | ||||||||||
| 24 | # File::Find::Object::Rule Method Addition | ||||||||||
| 25 | |||||||||||
| 26 | |||||||||||
| 27 | sub File::Find::Object::Rule::ignore_vcs { | ||||||||||
| 28 | 4 | ▶ | my $find = $_[0]->_force_object; | ||||||||
|
Subroutine
ignore_vcs: called CC=10 SCAR=28.2
Pod
undocumented
| |||||||||||
| 29 | |||||||||||
| 30 | # Handle special cases | ||||||||||
| 31 | 4 | ▶ | unless ( @_ ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | # Logically combine all the ignores. This will be much | ||||||||||
| 33 | # faster than just calling them all one after the other. | ||||||||||
| 34 | 0 | return $find->or( | |||||||||
| 35 | $FFOR->name(@svn, '.bzr', '.git', 'CVS')->directory->prune->discard, | ||||||||||
| 36 | $FFOR->name(qr/^\.\#/)->file->discard, | ||||||||||
| 37 | $FFOR->new, | ||||||||||
| 38 | ); | ||||||||||
| 39 | } | ||||||||||
| 40 | 4 | ▶ | unless ( defined $_[1] ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | Carp::croak("->ignore_vcs: No version control system name provided"); | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | # As a convenience for higher-level APIs | ||||||||||
| 45 | # we treat a defined null string as a nullop | ||||||||||
| 46 | 4 | my $vcs = lc $_[1]; | |||||||||
| 47 | 4 | ▶ | return $find if $vcs eq ''; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 48 | |||||||||||
| 49 | # Hand off to the rules for each VCS | ||||||||||
| 50 | 3 | ▶ | return $find->ignore_cvs if $vcs eq 'cvs'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 2 | ▶ | return $find->ignore_svn if $vcs eq 'svn'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | 1 | ▶ | return $find->ignore_svn if $vcs eq 'subversion'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | 1 | ▶ | return $find->ignore_bzr if $vcs eq 'bzr'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 54 | 0 | ▶ | return $find->ignore_bzr if $vcs eq 'bazaar'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 55 | 0 | ▶ | return $find->ignore_git if $vcs eq 'git'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 56 | 0 | Carp::croak("->ignore_vcs: '$vcs' is not supported"); | |||||||||
| 57 | } | ||||||||||
| 58 | |||||||||||
| 59 | |||||||||||
| 60 | sub File::Find::Object::Rule::ignore_cvs { | ||||||||||
| 61 | 2 | ▶ | my $find = $_[0]->_force_object; | ||||||||
|
Subroutine
ignore_cvs: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 62 | 2 | return $find->or( | |||||||||
| 63 | $FFOR->name('CVS')->directory->prune->discard, | ||||||||||
| 64 | $FFOR->name(qr/^\.\#/)->file->discard, | ||||||||||
| 65 | $FFOR->new, | ||||||||||
| 66 | ); | ||||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | |||||||||||
| 70 | sub File::Find::Object::Rule::ignore_svn { | ||||||||||
| 71 | 2 | ▶ | my $find = $_[0]->_force_object; | ||||||||
|
Subroutine
ignore_svn: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 72 | 2 | return $find->or( | |||||||||
| 73 | $FFOR->name(@svn)->directory->prune->discard, | ||||||||||
| 74 | $FFOR->new, | ||||||||||
| 75 | ); | ||||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | |||||||||||
| 79 | sub File::Find::Object::Rule::ignore_bzr { | ||||||||||
| 80 | 2 | ▶ | my $find = $_[0]->_force_object; | ||||||||
|
Subroutine
ignore_bzr: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 81 | 2 | return $find->or( | |||||||||
| 82 | $FFOR->name('.bzr')->directory->prune->discard, | ||||||||||
| 83 | $FFOR->new, | ||||||||||
| 84 | ); | ||||||||||
| 85 | } | ||||||||||
| 86 | |||||||||||
| 87 | |||||||||||
| 88 | sub File::Find::Object::Rule::ignore_git { | ||||||||||
| 89 | 0 | ▶ | my $find = $_[0]->_force_object; | ||||||||
|
Subroutine
ignore_git: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 90 | 0 | return $find->or( | |||||||||
| 91 | $FFOR->name('.git')->directory->prune->discard, | ||||||||||
| 92 | $FFOR->new, | ||||||||||
| 93 | ); | ||||||||||
| 94 | } | ||||||||||
| 95 | |||||||||||
| 96 | 3 | 1; | |||||||||
| 97 | |||||||||||
| 98 | __END__ | ||||||||||