Changeset 188 for trunk/project-meta


Ignore:
Timestamp:
Jan 21, 2018, 12:17:43 PM (6 years ago)
Author:
g7moreau
Message:
  • A very small refactoring
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/project-meta/project-meta

    r186 r188  
    11#!/usr/bin/env perl
    22#
    3 # 2018/01/17 Gabriel Moreau
     3# 2018/01/17 Gabriel Moreau <Gabriel.Moreau(A)univ-grenoble-alpes.fr>
    44#
    55# apt-get install yamllint libyaml-syck-perl libtemplate-perl libarchive-zip-perl
     
    1313use Cwd();
    1414use Template;
     15use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
    1516
    1617
     
    5354################################################################
    5455
     56sub print_ok {
     57   my ($key, $test) = @_;
     58   
     59   printf "%-35s : %s\n", $key, $test ? 'yes' : 'no';
     60   }
     61
     62################################################################
     63
     64sub addfolder2list {
     65   my ($folderdb, $folder) = @_;
     66   
     67   $folder =~ s{/[^/]+$}{};
     68   
     69   return if $folder !~ m{/};
     70
     71   $folderdb->{$folder}++;
     72   return addfolder2list($folderdb, $folder);
     73   }
     74
    5575################################################################
    5676# command
     
    82102################################################################
    83103
    84 sub print_ok {
    85    my ($key, $test) = @_;
    86    
    87    printf "%-35s : %s\n", $key, $test ? 'yes' : 'no';
    88    }
    89 
    90 ################################################################
    91 
    92104sub cmd_check {
    93105   my $meta = YAML::Syck::LoadFile("PROJECT-META.yml");
     
    102114
    103115   #print YAML::Syck::Dump($meta);
    104    }
    105 
    106 ################################################################
    107 
    108 sub addfolder2list {
    109    my ($folderdb, $folder) = @_;
    110    
    111    $folder =~ s{/[^/]+$}{};
    112    
    113    return if $folder !~ m{/};
    114 
    115    $folderdb->{$folder}++;
    116    return addfolder2list($folderdb, $folder);
    117116   }
    118117
     
    177176
    178177   # Create a Zip file
    179    use Archive::Zip qw( :ERROR_CODES :CONSTANTS );
    180 
    181178   my $zip = Archive::Zip->new();
    182179
     
    362359=head1 DESCRIPTION
    363360
    364 C<project-meta> is a small tool to maintain a set of open data files.
    365 In order to help you in this task, C<project-meta> has a set of subcommand
    366 to generated and maintain many files.
     361Project-Meta is a small tool to maintain a set of open data files.
     362In order to help you in this task, C<project-meta> command has a set of action
     363to generated and maintain many files in your dataset.
    367364
    368365Everything is declare in the metafile F<PROJECT-META.yml>.
    369366This YAML file must exist in your root projet folder.
    370 See L<METAFILE SPECIFICATION>.
     367See L</METAFILE SPECIFICATION>.
    371368
    372369=head1 COMMANDS
     
    375372Theses could be not well defined, not finished, not well tested...
    376373You can read the source code and use them at your own risk
    377 (like for all the Klask code).
     374(like for all the Project-Meta code).
    378375
    379376=head2 check
     
    392389
    393390The licence is defined in the PROJECT-META.yml specification under the key C<public-dap/data-licence>.
    394 The list of possible licence is given with the command L<list-licence>.
     391The list of possible licence is given with the command L</list-licence>.
    395392
    396393=head2 list-licence
     
    417414
    418415
    419 =head1 BUG
    420 
    421  - make-link: folder/folder
    422  - make-link: support multiple doi
    423  - metafile: remove prop publication/url
     416=head1 KNOWN BUGS
     417
     418 - not really check keys and tags before doing action!
    424419
    425420=head1 SEE ALSO
     
    436431The list of people below did not directly contribute to project-meta's source code
    437432but provided me with some data, returned bugs
    438 or helped me in another small task like having new ideas ...
     433or helped me in another small task like having new ideas, specifications...
    439434Maybe I forgot your contribution in recent years,
    440435please forgive me in advance and send me an e-mail to correct this.
Note: See TracChangeset for help on using the changeset viewer.