Changeset 412


Ignore:
Timestamp:
Sep 5, 2019, 11:37:15 PM (5 years ago)
Author:
g7moreau
Message:
  • Add multi-dataset support for publish and unpublish command
File:
1 edited

Legend:

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

    r411 r412  
    88use strict;
    99use warnings;
    10 use version; our $VERSION = version->declare('0.2.2');
     10use version; our $VERSION = version->declare('0.2.3');
    1111
    1212use File::Copy qw(copy);   
     
    146146 project-meta version
    147147 project-meta check
    148  project-meta dap-publish
    149  project-meta dap-unpublish
     148 project-meta dap-publish [--verbose|-v] [--dataset|-d dataset]
     149 project-meta dap-unpublish [--verbose|-v] [--dataset|-d dataset]
    150150 project-meta dataset-list
    151151 project-meta dataset-size [--verbose|-v] [--dataset|-d dataset]
     
    213213
    214214sub cmd_dap_publish {
     215   local @ARGV = @_;
     216   my ($verbose, $dataset_name);
     217
     218   Getopt::Long::GetOptions(
     219      'verbose'        => \$verbose,
     220      'dataset|d=s'    => \$dataset_name,
     221      );
     222
    215223   my $meta = load_metadata();
    216224   my $current_dir = Cwd::getcwd();
     
    218226   my $dap_folder  = $meta->{'public-dap'}{'dap-folder'};
    219227   my $data_set    = $meta->{'public-dap'}{'data-set'};
     228   if ($dataset_name) {
     229      if (exists $meta->{'public-dap'}{'data-set'}{$dataset_name}) {
     230         $data_set = $meta->{'public-dap'}{'data-set'}{$dataset_name};
     231         }
     232      else {
     233         die "Error, dataset $dataset_name does'nt exists\n";
     234         }
     235      }
    220236
    221237   push @{$data_set}, 'AUTHORS.txt', 'COPYRIGHT.txt', 'LICENSE.txt';
     
    234250   print "chmod o+rX,o-w '$current_dir'\n";
    235251   print "mkdir -p '$dap_folder/$acronym'\n" if not -d "$dap_folder/$acronym";
     252   if ($dataset_name) {
     253      $acronym .= "/$dataset_name";
     254      print "mkdir -p '$dap_folder/$acronym'\n" if not -d "$dap_folder/$acronym";
     255      }
    236256   for my $folder (sort keys %folders) {
    237257      print "chmod o+rX,o-w '$current_dir/$folder'\n";
     
    258278
    259279sub cmd_dap_unpublish {
     280   local @ARGV = @_;
     281   my ($verbose, $dataset_name);
     282
     283   Getopt::Long::GetOptions(
     284      'verbose'        => \$verbose,
     285      'dataset|d=s'    => \$dataset_name,
     286      );
     287
    260288   my $meta = load_metadata();
    261289   my $current_dir = Cwd::getcwd();
    262290   my $acronym     = $meta->{'project'}{'identifier'}{'acronym'};
    263291   my $dap_folder  = $meta->{'public-dap'}{'dap-folder'};
     292   my $data_set    = $meta->{'public-dap'}{'data-set'};
     293   if ($dataset_name) {
     294      if (exists $meta->{'public-dap'}{'data-set'}{$dataset_name}) {
     295         $data_set = $meta->{'public-dap'}{'data-set'}{$dataset_name};
     296         }
     297      else {
     298         die "Error, dataset $dataset_name does'nt exists\n";
     299         }
     300      }
    264301
    265302   die "Error: DAP folder match current folder" if $dap_folder =~ m{$current_dir} or $current_dir =~ m{$dap_folder};
    266303
     304   $acronym .= "/$dataset_name" if $dataset_name;
    267305   print "find '$dap_folder/$acronym/' -type l -o -type d -exec ls -l {} \+\n";
    268306   print "find '$dap_folder/$acronym/' -type l -delete\n";
     
    547585 project-meta version
    548586 project-meta check
    549  project-meta dap-publish
    550  project-meta dap-unpublish
     587 project-meta dap-publish [--verbose|-v] [--dataset|-d dataset]
     588 project-meta dap-unpublish [--verbose|-v] [--dataset|-d dataset]
    551589 project-meta dataset-list
    552590 project-meta dataset-size [--verbose|-v] [--dataset|-d dataset]
     
    587625=head2 dap-publish
    588626
    589  project-meta dap-publish
     627 project-meta dap-publish [--verbose|-v] [--dataset|-d dataset]
    590628
    591629Publish data on an OpeNDAP server.
     
    610648You have to verify ouput before eval it.
    611649
    612  project-meta dap-publish
    613  project-meta dap-publish | bash
     650  project-meta dap-publish
     651  project-meta dap-publish | bash
    614652
    615653=head2 dap-unpublish
    616654
    617  project-meta dap-unpublish
     655 project-meta dap-unpublish [--verbose|-v] [--dataset|-d dataset]
    618656
    619657Unpublish data from the OpeNDAP server.
Note: See TracChangeset for help on using the changeset viewer.