Changeset 708

Show
Ignore:
Timestamp:
10/28/06 09:14:06 (2 years ago)
Author:
gboggs
Message:

Support multiple languages again.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/wheeljack/build/Build.pm

    r702 r708  
    6868      'deploy-uri=s'    => 'https://intranet.sixapart.com/mt-interest', 
    6969      'build!'          => 1,  # Build distribution files? 
    70       'email-bcc:s'     => undef, 
    71       'email-body=s'    => '',  # Constructed at run-time. 
    72       'email-cc:s'      => undef, 
    73       'email-from=s'    => ( $ENV{USER} || $ENV{USERNAME} ) .'@sixapart.com', 
    74       'email-host=s'    => 'mail.sixapart.com', 
    75       'email-subject=s' => '',  # Constructed at run-time. 
     70#      'email-bcc:s'     => undef, 
     71#      'email-body=s'    => '',  # Constructed at run-time. 
     72#      'email-cc:s'      => undef, 
     73#      'email-from=s'    => ( $ENV{USER} || $ENV{USERNAME} ) .'@sixapart.com', 
     74#      'email-host=s'    => 'mail.sixapart.com', 
     75#      'email-subject=s' => '',  # Constructed at run-time. 
    7676      'export!'         => 1,  # To export or not to export. That is the question. 
    7777      'export-dir=s'    => '',  # Constructed at run-time. 
     
    8383      'ldap'            => 0,  # Use LDAP (and don't initialize the database). 
    8484      'lang=s'          => $ENV{BUILD_LANGUAGE} || 'en_US',  # de,es,en_US,fr,ja,nl 
     85      'language=s@'     => undef,  # Constructed below. 
    8586      'local'           => 0,  # Command-line --option alias 
    8687      'make'            => 0,  # Command-line --option alias for simple legacy `make` 
     
    120121    } 
    121122 
    122     # XXX Can't figure out how to pre-define arrays yet. 
    123123    # Make sure we have an archive file type list. 
    124124    $self->{'arch=s@'} ||= [qw( .tar.gz .zip )]; 
    125125    # Make the plugins an empty list unless defined. 
    126126    $self->{'plugin=s@'} ||= []; 
     127    # Construct the list of languages to build. 
     128    $self->{'lang=s'} = 'de,en_US,es,fr,ja,nl' 
     129        if lc( $self->{'lang=s'} ) eq 'all'; 
     130    push @{ $self->{'language=s@'} }, split /,/, $self->{'lang=s'}; 
    127131} 
    128132 
    129133sub setup { 
    130134    my $self = shift; 
     135    my %args = @_; 
    131136 
    132137    # Do we have SSL support? 
     
    159164    $self->set_repo(); 
    160165 
    161     # Make ab_CD into just ab. 
     166    # Replace the current language if given one as an argument. 
     167    $self->{'lang=s'} = $args{language} if $args{language}; 
     168    # Strip the dialect portion of the language code (ab_CD into ab). 
    162169    ($self->{'short-lang=s'} = $self->{'lang=s'}) =~ s/([a-z]{2})_[A-Z]{2}$/$1/o; 
    163170 
     
    181188                '%04d%02d%02d', (localtime)[5]+1900, (localtime)[4]+1, (localtime)[3] 
    182189            ) if $self->{'date!'}; 
     190            # Add -ldap to distingush them from Melody Nelson builds. 
    183191            push @stamp, 'ldap' if $self->{'ldap'}; 
    184192        } 
     
    793801} 
    794802 
    795 sub debug { shift->{'debug'} } 
    796 sub help { shift->{'help|h'} } 
     803sub languages { return @{ shift->{'language=s@'} } } 
     804 
     805sub debug { return shift->{'debug'} } 
     806 
     807sub help { return shift->{'help|h'} } 
     808 
    797809sub usage { 
    798810    my $self = shift; 
  • branches/wheeljack/build/exportmt.pl

    r702 r708  
    1818$build->usage() if $build->help(); 
    1919 
    20 # Perform some preliminary contextual set-up. 
    21 $build->setup(); 
     20for( $build->languages() ) { 
     21    # Perform the preliminary contextual set-up. 
     22    $build->setup( language => $_ ); 
    2223 
    23 # Summarize what we are about to do. 
    24 $build->verbose( sprintf '* Debug mode is %s and system calls %s be made.', 
    25     $build->debug() ? 'ON' : 'OFF', $build->debug() ? "WON'T" : 'WILL' ); 
    26 $build->verbose( sprintf 'Run options: %s', Dumper $build ) if $build->debug(); 
     24    # Summarize what we are about to do. 
     25    $build->verbose( sprintf '* Debug mode is %s and system calls %s be made.', 
     26        $build->debug() ? 'ON' : 'OFF', $build->debug() ? "WON'T" : 'WILL' ); 
     27    $build->verbose( sprintf 'Run options: %s', Dumper $build ) if $build->debug(); 
    2728 
    28 # Get any existing distro with the same path name, out of the way. 
    29 $build->remove_copy(); 
     29    # Get any existing distro with the same path name, out of the way. 
     30    $build->remove_copy(); 
    3031 
    31 # Export the latest files. 
    32 $build->export(); 
     32    # Export the latest files. 
     33    $build->export(); 
    3334 
    34 # Export any plugins that are requested. 
    35 $build->plugin_export(); 
     35    # Export any plugins that are requested. 
     36    $build->plugin_export(); 
    3637 
    37 # Add a non-production footer. 
    38 $build->inject_footer(); 
     38    # Add a non-production footer. 
     39    $build->inject_footer(); 
    3940 
    40 # Actually build the distribution files with make
    41 $build->make(); 
     41    # Actually build the distribution files
     42    $build->make(); 
    4243 
    43 # Create lists of the distribution paths and uris. 
    44 my $distros = $build->create_distro_list(); 
     44    # Create lists of the distribution paths and uris. 
     45    my $distros = $build->create_distro_list(); 
    4546 
    46 # Deploy the distributions. 
    47 $build->deploy_distros( $distros ); 
     47    # Deploy the distributions. 
     48    $build->deploy_distros( $distros ); 
    4849 
    49 # Cleanup the exported files. 
    50 $build->cleanup(); 
     50    # Cleanup the exported files. 
     51    $build->cleanup(); 
    5152 
    52 # Send email notification. 
    53 $build->notify( $distros ); 
     53    # TODO Refactor the (rarely used) email notification. 
     54    $build->notify( $distros ); 
     55
    5456 
    55 exit; 
     57__END__ 
     58 
     59=head1 NAME 
     60 
     61exportmt - Movable Type Export Build Deployment and Notification 
     62 
     63=head1 SEE ALSO 
     64 
     65https://intranet.sixapart.com/wiki/index.php/Movable_Type:MT_Export-Deploy 
     66 
     67The L<Build> (F<build/Build.pm>) module. 
     68 
     69=cut