Changeset 192


Ignore:
Timestamp:
Jan 21, 2018, 4:14:22 PM (3 years ago)
Author:
g7moreau
Message:
  • Add the remove-link command
File:
1 edited

Legend:

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

    r191 r192  
    2727   'check'           => \&cmd_check,
    2828   'make-link'       => \&cmd_make_link,
     29   'remove-link'     => \&cmd_remove_link
    2930   'make-zip'        => \&cmd_make_zip,
    3031   'make-author'     => \&cmd_make_author,
     
    8586 project-meta check
    8687 project-meta make-link
     88 project-meta remove-link
    8789 project-meta make-zip
    8890 project-meta make-author
     
    109111   my $dap_folder  = $meta->{'public-dap'}{'dap-folder'};
    110112
    111    print_ok 'project/acronym',                  $acronym =~ m{\d\d\w[\w\d_]+};
     113   print_ok 'project/acronym',                  $acronym =~ m{\d\d\w[\w\d_/]+};
    112114   print_ok 'public-dap/dap-folder',            $dap_folder ne '' and $dap_folder =~ m{^/};
    113115   print_ok 'dap-folder not match current_dir', $dap_folder !~ m{$current_dir};
     
    158160      }
    159161   print "chmod -R o+rX,o-w '$dap_folder/$acronym/'\n";
     162   }
     163
     164################################################################
     165
     166sub cmd_remove_link {
     167   my $meta = YAML::Syck::LoadFile("PROJECT-META.yml");
     168   my $current_dir = Cwd::getcwd();
     169   my $acronym     = $meta->{'project'}{'acronym'};
     170   my $dap_folder  = $meta->{'public-dap'}{'dap-folder'};
     171
     172   die "Error: DAP folder match current folder" if $dap_folder =~ m{$current_dir} or $current_dir =~ m{$dap_folder};
     173
     174   print "find '$dap_folder/$acronym/' -type l -o -type d\n";
     175   print "find '$dap_folder/$acronym/' -type l -o -type d -delete\n";
    160176   }
    161177
     
    350366 project-meta check
    351367 project-meta make-link
     368 project-meta remove-link
    352369 project-meta make-zip
    353370 project-meta make-author
     
    400417=back
    401418
     419Because this command could be dangerous, it does nothing!
     420It print on terminal shell command to be done.
     421You have to verify ouput before eval it.
     422
     423 project-meta make-link
     424 project-meta make-link | bash
     425
     426=head2 remove-link
     427
     428 project-meta remove-link
     429
     430Remove link in OpeNDAP folder for that projet.
     431Because command C<rm> is always dangerous,
     432we use here the command C<find> limited to folder and link.
     433
     434Please verify the returned values before excuted it with the C<-delete> option.
     435
    402436=head2 make-zip
    403437
Note: See TracChangeset for help on using the changeset viewer.