Ticket #1527: 1527_ckreleaser_2.patch

File 1527_ckreleaser_2.patch, 4.5 KB (added by Wiktor Walc, 15 years ago)
  • _source/ckreleaser.js

     
    6666CKRELEASER.sourceDir = arguments[1];
    6767CKRELEASER.targetDir = arguments[2];
    6868CKRELEASER.version = arguments[3];
    69 CKRELEASER.zipName = arguments[4];
    70 CKRELEASER.targzName = arguments[5];
     69CKRELEASER.fileName = arguments[4];
    7170
    72 if ( !CKRELEASER.releaseFile || !CKRELEASER.sourceDir || !CKRELEASER.targetDir || !CKRELEASER.version || !CKRELEASER.zipName
    73                 || !CKRELEASER.targzName )
     71if ( !CKRELEASER.releaseFile || !CKRELEASER.sourceDir || !CKRELEASER.targetDir || !CKRELEASER.version || !CKRELEASER.fileName )
    7472{
    75         error( '\nUsage: ' + command + ' release_file source_dir target_dir version zip_name targz_name [-v]' +
     73        error( '\nUsage: ' + command + ' release_file source_dir target_dir version file_name [-v]' +
    7674                        '\n' +
    7775                        '\n release_file    Path to CKReleaser configuration file.' +
    7876                        '\n source_dir      Path to the directory with code of application to be released.' +
    7977                        '\n target_dir      Path to the directory, where application will be build.' +
    8078                        '\n                 If directory already exists, CKReleaser will not start.' +
    8179                        '\n version         The version string used to replace the %VERSION% directive.' +
    82                         '\n zip_name        Name of the .zip file to create.' +
    83                         '\n targz_name      Name of the .tar.gz file to create.' +
     80                        '\n file_name       Name of the file to create (without the extension).' +
    8481                        '\n\n -v | --verbose  Enable verbose output.' +
    8582                        '\n                 Display detailed exception information when an error occurs.');
    8683}
  • _source/includes/releaser.js

     
    223223        var regexLib =
    224224        {
    225225                packagerRemove : Pattern.compile( '(?m-s:^.*?%REMOVE_START%).*?(?m-s:%REMOVE_END%.*?$)', Pattern.DOTALL ),
    226                 packagerRemoveLine : Pattern.compile( '.*%REMOVE_LINE%.*(?:\\r\\n|\\r|\\n)?' )
     226                packagerRemoveLine : Pattern.compile( '.*%REMOVE_LINE%.*(?:\\r\\n|\\r|\\n)?' ),
     227                packagerRev : Pattern.compile( '.*Revision: (\\d+).*', Pattern.DOTALL )
    227228        };
    228229
    229230        /*
    230231         * %VERSION%:
    231232         *     the "version" string passed to the CKReleaser execution command.
     233         * %REV%:
     234         *     the SVN revision number of the source directory.
    232235         * %TIMESTAMP%:
    233236         *     a four characters string containing the
    234237         *     concatenation of the "Base 36" value of each of the following components
     
    249252                        text = text.replace( /%VERSION%/g, CKRELEASER.version );
    250253                        replaced = true;
    251254                }
     255                if ( text.indexOf( "%REV%" ) != -1 )
     256                {
     257                        var o =
     258                        {
     259                                output : ""
     260                        };
     261
     262                        runCommand( "svn", "info", CKRELEASER.sourceDir, o );
     263
     264                        if ( o.output.indexOf( "Revision:" ) != -1 )
     265                        {
     266                                var rev = regexLib.packagerRev.matcher( o.output ).replaceAll( '$1' );
     267                                text = text.replace( /%REV%/g, rev );
     268                        }
     269                        else
     270                        {
     271                                if ( o.output.indexOf( "not a working" ) != -1 )
     272                                        print( "WARNING: Unable to fetch the revision number, source directory is not under version control: "
     273                                                        + CKRELEASER.sourceDir );
     274                                else
     275                                        print( "WARNING: Unable to fetch the revision number, make sure that Subversion’s bin directory is in your system path." );
     276                                text = text.replace( /%REV%/g, "UNKNOWN" );
     277                        }
     278
     279                        replaced = true;
     280                }
    252281                if ( text.indexOf( "%TIMESTAMP%" ) != -1 )
    253282                {
    254283                        text = text.replace( /%TIMESTAMP%/g, CKRELEASER.timestamp );
     
    492521
    493522                        print( "\nCreating compressed files...\n" );
    494523
    495                         var zipFile = new File( CKRELEASER.targetDir, CKRELEASER.zipName );
     524                        var zipFile = new File( CKRELEASER.targetDir, CKRELEASER.fileName + ".zip" );
    496525                        CKRELEASER.io.zipDirectory( CKRELEASER.releaseDir, zipFile, "ckeditor" );
    497526                        print( "    Created " + zipFile.getName() + "...: " + zipFile.length() + " bytes ("
    498527                                        + Math.round( zipFile.length() / info.size * 100 ) + "% of original)" );
    499528
    500                         var tarFile = new File( CKRELEASER.targetDir, CKRELEASER.targzName );
     529                        var tarFile = new File( CKRELEASER.targetDir, CKRELEASER.fileName + ".tar.gz" );
    501530                        CKRELEASER.io.targzDirectory( CKRELEASER.releaseDir, tarFile, "ckeditor" );
    502531                        print( "    Created " + tarFile.getName() + ": " + tarFile.length() + " bytes ("
    503532                                        + Math.round( tarFile.length() / info.size * 100 ) + "% of original)" );
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy