aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2013-05-08 20:00:24 -0400
committerDave Methvin <dave.methvin@gmail.com>2013-05-08 20:00:24 -0400
commit47f56f1612b907ec9eaa7111c7af66d335279fa2 (patch)
tree0c1b923161be37c14fc4839cb6c7f2f0607bdf29 /build
parent5e42df0517cefa6e81bdc5c3206740a5958b545c (diff)
downloadjquery-47f56f1612b907ec9eaa7111c7af66d335279fa2.tar.gz
jquery-47f56f1612b907ec9eaa7111c7af66d335279fa2.zip
Create CDN archives in the build script.
Diffstat (limited to 'build')
-rw-r--r--build/release.js52
1 files changed, 45 insertions, 7 deletions
diff --git a/build/release.js b/build/release.js
index 9cda180f1..f2e4cf560 100644
--- a/build/release.js
+++ b/build/release.js
@@ -13,7 +13,6 @@ var fs = require("fs"),
var releaseVersion,
nextVersion,
- CDNFiles,
isBeta,
pkg,
branch,
@@ -41,7 +40,18 @@ var releaseVersion,
// "jquery-latest.js": devFile,
// "jquery-latest.min.js": minFile,
// "jquery-latest.min.map": mapFile
- };
+ },
+
+ jQueryFilesCDN = [],
+
+ googleFilesCDN = [
+ "jquery.js", "jquery.min.js", "jquery.min.map"
+ ],
+
+ msFilesCDN = [
+ "jquery-VER.js", "jquery-VER.min.js", "jquery-VER.min.map"
+ ];
+
steps(
initialize,
@@ -50,7 +60,9 @@ steps(
gruntBuild,
makeReleaseCopies,
setNextVersion,
- uploadToCDN,
+ copyTojQueryCDN,
+ buildGoogleCDN,
+ buildMicrosoftCDN,
pushToGithub,
exit
);
@@ -133,7 +145,6 @@ function gruntBuild( next ) {
}
function makeReleaseCopies( next ) {
- CDNFiles = {};
Object.keys( releaseFiles ).forEach(function( key ) {
var text,
builtFile = releaseFiles[ key ],
@@ -158,7 +169,7 @@ function makeReleaseCopies( next ) {
copy( builtFile, releaseFile );
}
- CDNFiles[ releaseFile ] = builtFile;
+ jQueryFilesCDN.push( releaseFile );
}
});
next();
@@ -169,10 +180,10 @@ function setNextVersion( next ) {
git( [ "commit", "-a", "-m", "Updating the source version to " + nextVersion + "✓™" ], next, debug );
}
-function uploadToCDN( next ) {
+function copyTojQueryCDN( next ) {
var cmds = [];
- Object.keys( CDNFiles ).forEach(function( name ) {
+ jQueryFilesCDN.forEach(function( name ) {
cmds.push(function( nxt ){
exec( "scp", [ name, scpURL ], nxt, debug || skipRemote );
});
@@ -185,6 +196,14 @@ function uploadToCDN( next ) {
steps.apply( this, cmds );
}
+function buildGoogleCDN( next ) {
+ makeArchive( "googlecdn", googleFilesCDN, next );
+}
+
+function buildMicrosoftCDN( next ) {
+ makeArchive( "mscdn", msFilesCDN, next );
+}
+
function pushToGithub( next ) {
git( [ "push", "--tags", repoURL, branch ], next, debug || skipRemote );
}
@@ -209,6 +228,25 @@ function updatePackageVersion( ver ) {
}
}
+function makeArchive( cdn, files, fn ) {
+
+ if ( isBeta ) {
+ console.log( "Skipping archive creation for " + cdn + "; " + releaseVersion + " is beta" );
+ process.nextTick( fn );
+ return
+ }
+ console.log("Creating production archive for " + cdn );
+ files = files.map(function( item ) {
+ return "dist/" + item.replace( /VER/g, releaseVersion );
+ });
+ var md5file = "dist/" + cdn + "-md5.txt";
+ exec( "md5sum", files, function( err, stdout, stderr ) {
+ fs.writeFileSync( md5file, stdout );
+ files.push( md5file );
+ exec( "tar", [ "-czvf", "dist/" + cdn + "-jquery-" + releaseVersion + ".tar.gz" ].concat( files ), fn, false );
+ }, false );
+}
+
function copy( oldFile, newFile ) {
console.log( "Copying " + oldFile + " to " + newFile );
if ( !debug ) {
lor: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
--[[
Copyright (c) 2020, Vsevolod Stakhov <vsevolod@highsecure.ru>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]--

local lua_selectors = require "lua_selectors"

-- Controller selectors plugin

local function handle_list_transforms(_, conn)
  conn:send_ucl(lua_selectors.list_transforms())
end

local function handle_list_extractors(_, conn)
  conn:send_ucl(lua_selectors.list_extractors())
end

local function handle_check_selector(_, conn, req_params)
  if req_params.selector and req_params.selector ~= '' then
    local selector = lua_selectors.create_selector_closure(rspamd_config,
        req_params.selector, '', true)
      conn:send_ucl({success = selector and true})
  else
    conn:send_error(404, 'missing selector')
  end
end

local function handle_check_message(task, conn, req_params)
  if req_params.selector and req_params.selector ~= '' then
    local selector = lua_selectors.create_selector_closure(rspamd_config,
        req_params.selector, '', true)
    if not selector then
      conn:send_error(500, 'invalid selector')
    else
      task:process_message()
      local elts = selector(task)
      conn:send_ucl({success = true, data = elts})
    end
  else
    conn:send_error(404, 'missing selector')
  end
end

return {
  list_extractors = {
    handler = handle_list_extractors,
    enable = true,
  },
  list_transforms = {
    handler = handle_list_transforms,
    enable = true,
  },
  check_selector = {
    handler = handle_check_selector,
    enable = true,
  },
  check_message = {
    handler = handle_check_message,
    enable = true,
    need_task = true,
  }
}