| 1 | package VIM::Packager::MetaReader; | ||||||||||||||||||||||||||||
| 2 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use YAML; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 42 | ▶ | sub trim_comment { | ||||||||||||||||||||||||||
|
Subroutine
trim_comment: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 8 | 42 | my $c = shift; | |||||||||||||||||||||||||||
| 9 | 42 | $c =~ s/#.*$//; # skip comment | |||||||||||||||||||||||||||
| 10 | 42 | return $c; | |||||||||||||||||||||||||||
| 11 | } | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 44 | ▶ | sub trim { | ||||||||||||||||||||||||||
|
Subroutine
trim: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 14 | 44 | my $c = shift; | |||||||||||||||||||||||||||
| 15 | 44 | $c =~ s/^\s*//; | |||||||||||||||||||||||||||
| 16 | 44 | $c =~ s/\s*$//; | |||||||||||||||||||||||||||
| 17 | 44 | return $c; | |||||||||||||||||||||||||||
| 18 | } | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | =head1 Synopsis | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | =head2 Generic VIM Meta file format | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | =name new_plugin | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | =abstract vim plugin blah blah blah | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | =author Cornelius (cornelius.howl@gmail.com) | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =version_from plugin/new_plugin.vim # extract version infomation from this file | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =type syntax | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | =script_id [script id on vim.org] # for uploading script to vim.org | ||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | =dependency | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | autocomplpop.vim > 0.3 | ||||||||||||||||||||||||||||
| 41 | rainbow.vim >= 1.2 | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | libperl.vim | ||||||||||||||||||||||||||||
| 44 | | autoload/libperl.vim | http://....../..././.../libperl.vim | ||||||||||||||||||||||||||||
| 45 | | autoload/std.vim | http://....../..././.../std.vim | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | cpan.vim > 0 | ||||||||||||||||||||||||||||
| 48 | git://github.com/c9s/cpan.vim.git # install from git repository | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | =libpath . | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | =script | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | bin/parser | ||||||||||||||||||||||||||||
| 55 | bin/template_generator | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | =repository git://....../ | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =head1 Description | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head1 Constant | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head2 META_FILES | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | available metafile names: F<VIMMETA>, F<META>, F<VIMMETA.yml> | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | 2 | ▶ | use constant META_FILES => [ 'VIMMETA','META','VIMMETA.yml']; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head1 Functions | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head2 new | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =cut | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||
| 77 | 1 | ▶ | sub new { bless {} , shift } | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | =head2 meta | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | =cut | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | 15 | ▶ | sub meta { my $self = shift; return $self->{meta} ||= {}; } | ||||||||||||||||||||||||||
|
Subroutine
meta: called CC=2 SCAR=6.9
Pod
documented
Condition100%2/2
$self->{"meta"} ||= {}
MC/DC100%1/1
$self->{"meta"} ||= {}
$self->{"meta"}
Truth table100%2/2
A
A= $self->{"meta"}
| |||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||
| 87 | =head2 read_metafile | ||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | read_metafile function tries to find available vim meta file | ||||||||||||||||||||||||||||
| 90 | and parse meta file into hashref. | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | return meta information in hashref. | ||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | =cut | ||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||
| 96 | 0 | ▶ | sub read_metafile { | ||||||||||||||||||||||||||
|
Subroutine
read_metafile: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 97 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 98 | # read meta_reader file | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | my $file = $self->find_meta_file(); | |||||||||||||||||||||||||||
| 101 | 0 | ▶ | die 'Can not found META file' unless -e $file; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | 0 | open my $fh , "<" , $file ; | |||||||||||||||||||||||||||
| 104 | 0 | $self->read( $fh ); | |||||||||||||||||||||||||||
| 105 | 0 | close $fh; | |||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 0 | return $self->meta; | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =head2 find_meta_file | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | find_meta_file function tries to find available vim meta file | ||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||
| 114 | return the filename of vim meta file (string) | ||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | =cut | ||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub find_meta_file { | ||||||||||||||||||||||||||
|
Subroutine
find_meta_file: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 119 | 0 | my $files = META_FILES; | |||||||||||||||||||||||||||
| 120 | 0 | for ( @$files ) { | |||||||||||||||||||||||||||
| 121 | 0 | ▶ | return $_ if -e $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||
| 127 | 1 | ▶ | sub read { | ||||||||||||||||||||||||||
|
Subroutine
read: called CC=7 SCAR=19.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 128 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||
| 130 | 1 | my $fh = shift; | |||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||
| 132 | 1 | my @lines = <$fh>; | |||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | 1 | my $cur_section; | |||||||||||||||||||||||||||
| 135 | 1 | my %sections = (); | |||||||||||||||||||||||||||
| 136 | 1 | for ( @lines ) { | |||||||||||||||||||||||||||
| 137 | 42 | chomp; | |||||||||||||||||||||||||||
| 138 | 42 | $_ = trim trim_comment($_); | |||||||||||||||||||||||||||
| 139 | 42 | ▶ | next if blank($_); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||
| 141 | 21 | ▶ | if( /^=(\w+)(?:\s+(.*?))?$/ ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 142 | 10 | $cur_section = $1; | |||||||||||||||||||||||||||
| 143 | 10 | ▶ | $sections{$cur_section} = $2 if $2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 10 | next; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | 11 | push @{ $sections{ $cur_section } } , $_; | |||||||||||||||||||||||||||
| 148 | } | ||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||
| 151 | 1 | for my $sec ( keys %sections ) { | |||||||||||||||||||||||||||
| 152 | 10 | my $lines = $sections{ $sec }; | |||||||||||||||||||||||||||
| 153 | 10 | my $dispatch = '__' . $sec; | |||||||||||||||||||||||||||
| 154 | 10 | ▶ | if( $self->can( $dispatch ) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 10 | $self->$dispatch( $lines ); | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | else { | ||||||||||||||||||||||||||||
| 158 | # print "Meta tag $sec is not supported. but we will still save to Makefile\n"; | ||||||||||||||||||||||||||||
| 159 | 0 | $self->{meta}->{ $sec } = $lines; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | =pod | ||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||
| 165 | # XXX: check for mandatory meta info | ||||||||||||||||||||||||||||
| 166 | my $fall; | ||||||||||||||||||||||||||||
| 167 | my $meta = $class->meta; | ||||||||||||||||||||||||||||
| 168 | for ( qw(name author version type vim_version) ) { | ||||||||||||||||||||||||||||
| 169 | if( ! defined $meta->{ $_ } ) { | ||||||||||||||||||||||||||||
| 170 | print STDOUT "META: column '$_' is required. "; | ||||||||||||||||||||||||||||
| 171 | $fall = 1; | ||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||
| 174 | die if $fall; | ||||||||||||||||||||||||||||
| 175 | =cut | ||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 2 | my $package_re = '[0-9a-zA-Z._-]+'; | |||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||
| 181 | |||||||||||||||||||||||||||||
| 182 | 42 | ▶ | sub blank { | ||||||||||||||||||||||||||
|
Subroutine
blank: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 183 | 42 | my $c = shift; | |||||||||||||||||||||||||||
| 184 | 42 | return $c =~ /^\s*$/; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub _get_value { | ||||||||||||||||||||||||||
|
Subroutine
_get_value: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 189 | 0 | my $cur = shift; | |||||||||||||||||||||||||||
| 190 | 0 | my ($v) = ( $cur =~ /^=\w+\s+(.*)$/ ) ; | |||||||||||||||||||||||||||
| 191 | 0 | return $v; | |||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||
| 194 | 1 | ▶ | sub __name { | ||||||||||||||||||||||||||
|
Subroutine
__name: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 195 | 1 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 196 | 1 | $self->meta->{name} =$value; | |||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | 0 | ▶ | sub __email { | ||||||||||||||||||||||||||
|
Subroutine
__email: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 200 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 201 | 0 | $self->meta->{email} =$value; | |||||||||||||||||||||||||||
| 202 | } | ||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||
| 204 | 1 | ▶ | sub __author { | ||||||||||||||||||||||||||
|
Subroutine
__author: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 205 | 1 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 206 | 1 | $self->meta->{author} =$value; | |||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||
| 209 | 1 | ▶ | sub __version { | ||||||||||||||||||||||||||
|
Subroutine
__version: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 210 | 1 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 211 | 1 | $self->meta->{version} = $value; | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub __abstract { | ||||||||||||||||||||||||||
|
Subroutine
__abstract: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 215 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 216 | 0 | $self->meta->{abstract} =$value; | |||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||
| 219 | 1 | ▶ | sub __type { | ||||||||||||||||||||||||||
|
Subroutine
__type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 220 | 1 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 221 | 1 | $self->meta->{type} =$value; | |||||||||||||||||||||||||||
| 222 | } | ||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||
| 224 | 0 | ▶ | sub __libpath { | ||||||||||||||||||||||||||
|
Subroutine
__libpath: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 225 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 226 | 0 | $self->meta->{libpath} =$value; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | 1 | ▶ | sub __version_from { | ||||||||||||||||||||||||||
|
Subroutine
__version_from: called CC=4 SCAR=14.4
| |||||||||||||||||||||||||||||
| 230 | 1 | my ($self,$version_file) = @_; | |||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | 1 | $self->meta->{version_from} = $version_file; | |||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | 1 | open FH, "<" , $version_file; | |||||||||||||||||||||||||||
| 235 | 1 | my @lines = <FH>; | |||||||||||||||||||||||||||
| 236 | 1 | close FH; | |||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||
| 238 | 1 | for ( @lines ) { | |||||||||||||||||||||||||||
| 239 | 2 | ▶ | if( /^"=VERSION ([0-9.]+)$/ or /^"\s*Version:\s*([0-9.]+)$/i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
/^"=VERSION ([0-9.]+)$/ or /^"\s*Version:\s*([0-9.]+)$/i
MC/DC50%1/2
/^"=VERSION ([0-9.]+)$/ or /^"\s*Version:\s*([0-9.]+)$/i
/^"=VERSION ([0-9.]+)$/
/^"\s*Version:\s*([0-9.]+)$/i
Truth table66%2/3
A or B
A= /^"=VERSION ([0-9.]+)$/B= /^"\s*Version:\s*([0-9.]+)$/i
| |||||||||||||||||||||||||||||
| 240 | 1 | $self->meta->{version} = $1; | |||||||||||||||||||||||||||
| 241 | 1 | return; | |||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | 0 | print "Warning: Can not found version, you should declare your version in your vim script.\n"; | |||||||||||||||||||||||||||
| 245 | 0 | print "For example \n"; | |||||||||||||||||||||||||||
| 246 | 0 | print " \" Version: 0.3 \n"; | |||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | =head2 __install_dirs | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | if you don't like F<vimlib/> | ||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||
| 253 | =cut | ||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||
| 255 | 1 | ▶ | sub __install_dirs { | ||||||||||||||||||||||||||
|
Subroutine
__install_dirs: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 256 | 1 | my ($self,$lines) = @_; | |||||||||||||||||||||||||||
| 257 | 1 | $self->meta->{install_dirs} = []; | |||||||||||||||||||||||||||
| 258 | 1 | for ( @$lines ) { | |||||||||||||||||||||||||||
| 259 | 2 | $_ = trim $_; | |||||||||||||||||||||||||||
| 260 | 2 | ▶ | push @{ $self->meta->{install_dirs} },$_ if $_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | |||||||||||||||||||||||||||||
| 264 | 1 | ▶ | sub __dependency { | ||||||||||||||||||||||||||
|
Subroutine
__dependency: called CC=6 SCAR=17.9
| |||||||||||||||||||||||||||||
| 265 | 1 | my ( $self, $lines ) = @_; | |||||||||||||||||||||||||||
| 266 | 1 | $self->meta->{dependency} = []; | |||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||
| 268 | 1 | my %pkgs = (); | |||||||||||||||||||||||||||
| 269 | 1 | my $cur_name; | |||||||||||||||||||||||||||
| 270 | 1 | for ( @$lines ) { | |||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | # for lines like: | ||||||||||||||||||||||||||||
| 273 | # plugin.vim > 1.0 | ||||||||||||||||||||||||||||
| 274 | 7 | ▶ | if( m{^ ($package_re) \s+ ([=<>]{1,2}) \s+ ([0-9.]+) }x ) { | ||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||
| 275 | 3 | my ( $name, $op, $version ) = ( $1, $2, $3 ); | |||||||||||||||||||||||||||
| 276 | 3 | $cur_name = $name; | |||||||||||||||||||||||||||
| 277 | 3 | $pkgs{ $name } = { | |||||||||||||||||||||||||||
| 278 | name => $name, | ||||||||||||||||||||||||||||
| 279 | op => $op, | ||||||||||||||||||||||||||||
| 280 | version => $version, | ||||||||||||||||||||||||||||
| 281 | }; | ||||||||||||||||||||||||||||
| 282 | 3 | next; | |||||||||||||||||||||||||||
| 283 | } | ||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||
| 285 | # for lines like: | ||||||||||||||||||||||||||||
| 286 | # plugin.vim | ||||||||||||||||||||||||||||
| 287 | # | plugin/plugin.vim | http://...../.../plugin.vim | ||||||||||||||||||||||||||||
| 288 | elsif( m{^($package_re)$} ) { | ||||||||||||||||||||||||||||
| 289 | 1 | $cur_name = $1; | |||||||||||||||||||||||||||
| 290 | 1 | $pkgs{ $cur_name } = []; | |||||||||||||||||||||||||||
| 291 | 1 | next; | |||||||||||||||||||||||||||
| 292 | } | ||||||||||||||||||||||||||||
| 293 | elsif( m{^\|\s*(.*?)\s*\|\s*(\S+)} ) { | ||||||||||||||||||||||||||||
| 294 | 2 | my ( $target, $from ) = ( $1, $2 ); | |||||||||||||||||||||||||||
| 295 | 2 | push @{ $pkgs{ $cur_name } } , { from => $from , target => $target }; | |||||||||||||||||||||||||||
| 296 | } | ||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | # from git repository | ||||||||||||||||||||||||||||
| 299 | elsif( m{^git://} ) { | ||||||||||||||||||||||||||||
| 300 | 1 | my $git_repo = $_; | |||||||||||||||||||||||||||
| 301 | 1 | $pkgs{ $cur_name }->{git_repo} = $git_repo; | |||||||||||||||||||||||||||
| 302 | } | ||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | $self->meta->{dependency} = [ | ||||||||||||||||||||||||||||
| 306 | 1 | map( { { name => $_, required_files => $pkgs{$_} } } grep { ref( $pkgs{$_} ) eq 'ARRAY' } keys %pkgs ), | |||||||||||||||||||||||||||
| 307 | 1 | map( { $pkgs{$_} } grep { ref( $pkgs{$_} ) ne 'ARRAY' } keys %pkgs ), | |||||||||||||||||||||||||||
| 308 | ]; | ||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||
| 310 | } | ||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||
| 312 | 1 | ▶ | sub __script { | ||||||||||||||||||||||||||
|
Subroutine
__script: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 313 | 1 | my ( $self, $lines ) = @_; | |||||||||||||||||||||||||||
| 314 | 1 | $self->meta->{script} = $lines; | |||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | 1 | ▶ | sub __repository { | ||||||||||||||||||||||||||
|
Subroutine
__repository: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 318 | 1 | my ( $self, $value ) = @_; | |||||||||||||||||||||||||||
| 319 | 1 | $self->meta->{repository} = $value; | |||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | 1 | ▶ | sub __vim_version { | ||||||||||||||||||||||||||
|
Subroutine
__vim_version: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 323 | 1 | my ( $self , $v ) = @_; | |||||||||||||||||||||||||||
| 324 | 1 | my ( $op , $version ) = $v =~ m/^([<=>]{1,2})\s+([0-9.-a-z]+)/; | |||||||||||||||||||||||||||
| 325 | $self->meta->{vim_version} = { | ||||||||||||||||||||||||||||
| 326 | 1 | op => $op, | |||||||||||||||||||||||||||
| 327 | version => $version, | ||||||||||||||||||||||||||||
| 328 | }; | ||||||||||||||||||||||||||||
| 329 | } | ||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||
| 331 | # some alias | ||||||||||||||||||||||||||||
| 332 | # .... | ||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | 2 | 1; | |||||||||||||||||||||||||||