You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/11/08 01:56:40 UTC
git commit: CB-5234: added update scripts for ffos
Updated Branches:
refs/heads/master a0fe15558 -> 6c4848a0e
CB-5234: added update scripts for ffos
Project: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/commit/6c4848a0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/tree/6c4848a0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/diff/6c4848a0
Branch: refs/heads/master
Commit: 6c4848a0e42ff6c8475f1c743b43ddde7cfa55e3
Parents: a0fe155
Author: Steven Gill <st...@gmail.com>
Authored: Thu Nov 7 16:56:31 2013 -0800
Committer: Steven Gill <st...@gmail.com>
Committed: Thu Nov 7 16:56:31 2013 -0800
----------------------------------------------------------------------
bin/lib/update.js | 73 ++++++++++++++++++++++++++++++++++++++++++++++++++
bin/update | 28 +++++++++++++++++++
bin/update.bat | 21 +++++++++++++++
3 files changed, 122 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/6c4848a0/bin/lib/update.js
----------------------------------------------------------------------
diff --git a/bin/lib/update.js b/bin/lib/update.js
new file mode 100755
index 0000000..0eccfe3
--- /dev/null
+++ b/bin/lib/update.js
@@ -0,0 +1,73 @@
+#!/usr/bin/env node
+
+/*
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+*/
+
+var shell = require('shelljs'),
+ path = require('path'),
+ fs = require('fs'),
+ ROOT = path.join(__dirname, '..');
+
+function setShellFatal(value, func) {
+ var oldVal = shell.config.fatal;
+ shell.config.fatal = value;
+ func();
+ shell.config.fatal = oldVal;
+}
+
+function copyJs(projectPath) {
+ shell.cp('-f', path.join(ROOT, 'cordova-lib', 'cordova.js'), path.join(projectPath, 'www'));
+}
+
+function copyScripts(projectPath) {
+ var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'scripts', 'cordova');
+ var destScriptsDir = path.join(projectPath, 'cordova');
+ // Delete old scripts directory.
+ shell.rm('-rf', destScriptsDir);
+ // Copy in the new ones.
+ shell.cp('-r', srcScriptsDir, projectPath);
+ /*
+ shell.cp(path.join(ROOT, 'bin', 'check_reqs'), path.join(destScriptsDir, 'check_reqs'));
+ // Make sure they are executable.
+ shell.find(destScriptsDir).forEach(function(entry) {
+ shell.chmod(755, entry);
+ });*/
+}
+
+exports.updateProject = function(projectPath) {
+ var version = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8').trim();
+ setShellFatal(true, function() {
+ copyJs(projectPath);
+ copyScripts(projectPath);
+ console.log('FirefoxOS project is now at version ' + version);
+ });
+};
+
+if (require.main === module) {
+ (function() {
+ var args = process.argv;
+ if (args.length < 3 || (args[2] == '--help' || args[2] == '-h')) {
+ console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'update')) + ' <path_to_project>');
+ process.exit(1);
+ } else {
+ exports.updateProject(args[2]);
+ }
+ })();
+}
+
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/6c4848a0/bin/update
----------------------------------------------------------------------
diff --git a/bin/update b/bin/update
new file mode 100755
index 0000000..26e3393
--- /dev/null
+++ b/bin/update
@@ -0,0 +1,28 @@
+#! /bin/sh
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you 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.
+#
+# update a cordova/firefoxos project
+#
+# USAGE
+# ./update [projectpath]
+#
+#!/bin/sh
+
+BIN_DIR=$(dirname "$0")
+source "$BIN_DIR/init"
+"$CORDOVA_NODE/node" "$BIN_DIR/lib/update.js" "$@"
http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/6c4848a0/bin/update.bat
----------------------------------------------------------------------
diff --git a/bin/update.bat b/bin/update.bat
new file mode 100755
index 0000000..02bd6c7
--- /dev/null
+++ b/bin/update.bat
@@ -0,0 +1,21 @@
+@ECHO OFF
+goto comment
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you 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.
+:comment
+call "%~dps0init"
+"%CORDOVA_NODE%\node.exe" "%~dps0\lib\update.js" %*