/build/buildApplication.js
http://story-steward.googlecode.com/ · JavaScript · 92 lines · 76 code · 4 blank · 12 comment · 4 complexity · bf85591ba448633e2d8890bac2b819d5 MD5 · raw file
- /*
- Copyright 2011 Neil M. Sheldon
- 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.
- */
- require("dojo", "fileUtil");
- require("my", "fixFileUtil")
- require("dojo", "logger");
- require("my", "info");
-
- (function() {
- var AppInfoText;
- var jsonSchema;
-
- if (params.targets.development || params.targets.release) {
- AppInfoText = "/* This file is automatically generated */\n" +
- "ApplicationInfo = {\n" +
- " Title: \"" +
- AppInfo.Title +
- "\",\n" +
- " Name: \"" +
- AppInfo.Name +
- "\",\n" +
- " ID: \"" +
- AppInfo.ID +
- "\",\n" +
- " Version: {\n" +
- " Major: \"" +
- AppInfo.Version.Major +
- "\",\n" +
- " Minor: \"" +
- AppInfo.Version.Minor +
- "\",\n" +
- " Revision: \"" +
- AppInfo.Version.Revision +
- "\"\n" +
- " }\n" +
- "}\n";
- jsonSchema = fileUtil.readFile(params.scriptPath + "../vendor/json-schema/validate.js");
- jsonSchema = jsonSchema.replace("module.exports", "JSON = window.JSON || {}; JSON.schema");
- }
-
- if (params.targets.development) {
-
- logger.info("Copying test to development");
- fileUtil.copyDir(params.scriptPath + "../test/", params.scriptPath + "../development/", /^(?:.*\.(?:html|js|htm|css|txt))|LICENSE|NOTICE$/g, true);
- logger.info("Copying source to development");
- fileUtil.copyDir(params.scriptPath + "../source/", params.scriptPath + "../development/",{
- include: /^(?:.*\.(?:html|js|htm|css|txt))|LICENSE|NOTICE$/g,
- exclude: /package-.*\.json$/g
- }, true);
- logger.info("Creating package file for development");
- fileUtil.copyFile(params.scriptPath + "../source/package-development.json", params.scriptPath + "../development/package.json");
- logger.info("Copying resources to development");
- fileUtil.copyFile(params.scriptPath + "../resources/icons/icons.png", params.scriptPath + "../development/resources/icons.png", true);
- fileUtil.copyFile(params.scriptPath + "../resources/icons/readme.txt", params.scriptPath + "../development/resources/readme.txt", true);
- fileUtil.copyFile(params.scriptPath + "../resources/quotes.js", params.scriptPath + "../development/resources/quotes.js", true);
- fileUtil.copyFile(params.scriptPath + "../resources/main-icon/wing-book-128.png", params.scriptPath + "../development/story-steward.png");
- logger.info("Copying non-dojo vendor to development");
- fileUtil.copyFile(params.scriptPath + "../vendor/Math.uuid.js", params.scriptPath + "../development/js/Math.uuid.js", true);
- fileUtil.saveFile(params.scriptPath + "../development/js/json-validate.js", jsonSchema);
- logger.info("Copying version to development");
- fileUtil.saveFile(params.scriptPath + "../development/js/appinfo.js", AppInfoText);
- }
- if (params.targets.release) {
- logger.info("Copying source to release");
- fileUtil.copyDir(params.scriptPath + "../source/", params.scriptPath + "../release/", {
- include: /^(?:.*\.(?:html|js|htm|css|txt))|LICENSE|NOTICE$/g,
- exclude: /^.*\/source\/js\/dojo\/my\/.*|package-.*\.json/g
- }, true);
- logger.info("Creating package file for release");
- fileUtil.copyFile(params.scriptPath + "../source/package-release.json", params.scriptPath + "../release/package.json");
- logger.info("Copying resources to release");
- fileUtil.copyFile(params.scriptPath + "../resources/icons/icons.png", params.scriptPath + "../release/resources/icons.png", true);
- fileUtil.copyFile(params.scriptPath + "../resources/icons/readme.txt", params.scriptPath + "../release/resources/readme.txt", true);
- fileUtil.copyFile(params.scriptPath + "../resources/quotes.js", params.scriptPath + "../release/resources/quotes.js", true);
- fileUtil.copyFile(params.scriptPath + "../resources/main-icon/wing-book-128.png", params.scriptPath + "../release/story-steward.png");
- logger.info("Copying non-dojo vendor to release");
- fileUtil.copyFile(params.scriptPath + "../vendor/Math.uuid.js", params.scriptPath + "../release/js/Math.uuid.js", true);
- fileUtil.saveFile(params.scriptPath + "../release/js/json-validate.js", jsonSchema);
- logger.info("Copying version to release");
- fileUtil.saveFile(params.scriptPath + "../release/js/appinfo.js", AppInfoText);
- }
- logger.info("Files copied.")
- })();