Skip to content

Commit

Permalink
Fixing merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
lostintangent committed Nov 17, 2015
2 parents 72f6b65 + 9327f2d commit 3dbf95f
Show file tree
Hide file tree
Showing 6 changed files with 194 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.vsix
.DS_Store
.DS_Store
node_modules
23 changes: 23 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Visual Studio Team Services Extension for CodePush
Copyright (c) Microsoft Corporation
All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
45 changes: 45 additions & 0 deletions bin/tfxupload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Copyright (c) Microsoft. All rights reserved.
Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/

var path = require("path"),
fs = require("fs"),
Q = require ("q"),
exec = Q.nfbind(require("child_process").exec);

function installTasks() {
var promise = Q();
var taskPath = path.join(process.cwd(), "code-push-vsts-task");
promise = promise.then(function() {
console.log("Uploading task code-push-vsts-task");
process.chdir(taskPath);
return npmInstall();
})
.then(tfxUpload);
return promise;
}

function npmInstall() {
console.log("Installing npm dependencies for task...");
return exec("npm install --only=prod").then(logExecReturn);
}

function tfxUpload() {
console.log("Transferring...")
return exec("tfx build tasks upload . --overwrite true").then(logExecReturn);
}

function logExecReturn(result) {
console.log(result[0]);
if (result[1] !== "") {
console.error(result[1]);
}
}

installTasks()
.done(function() {
console.log("Upload complete!");
}, function(input) {
console.log("Upload failed!");
});
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "code-push-vsts-extension",
"version": "1.0.0",
"description": "A VSTS extension for releasing app updates to the CodePush service",
"author": "Microsoft",
"license": "MIT",
"dependencies": {
"q": "^1.4.1"
}
}
56 changes: 56 additions & 0 deletions upload.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
@ECHO OFF
REM
REM Copyright (c) Microsoft. All rights reserved.
REM Licensed under the MIT license. See LICENSE file in the project root for full license information.
REM
ECHO code-push-vsts-extension upload
ECHO Copyright Microsoft Corporation
ECHO.
ECHO This script will acquire and install some dependant node modules. Each package
ECHO is licensed to you by its owner. Microsoft is not responsible for, nor does it
ECHO grant any licenses to, third-party packages. Some packages may include
ECHO dependencies which are governed by additional licenses. Follow the package
ECHO source URL (http://github.com/Microsoft/code-push-vsts-extension) to determine
ECHO any dependencies.
ECHO.
SET /p YN="Continue [Y/n]? "
IF /I '%YN%'=='n' EXIT /B 1
ECHO.

CALL npm --version 1>NUL 2>NUL
IF NOT %ERRORLEVEL%==0 GOTO INSTALLFAILED

CALL tfx version 1>NUL 2>NUL
IF NOT %ERRORLEVEL%==0 GOTO TFXINSTALL

:NPMINSTALL
ECHO Installing dependencies...
CALL npm install --only=prod
IF NOT %ERRORLEVEL%==0 GOTO INSTALLFAILED

:EXEC
CALL node bin/tfxupload.js
IF NOT %ERRORLEVEL%==0 GOTO UPLOADFAILED
EXIT /B 0

:TFXINSTALL
ECHO Installing tfx-cli...
CALL npm install -g tfx-cli
IF NOT %ERRORLEVEL%==0 GOTO INSTALLFAILED
ECHO Log in to the VSTS/TFS collection you wish to deploy the tasks.
CALL tfx login --authType basic
IF NOT %ERRORLEVEL%==0 GOTO LOGINFAILED
GOTO NPMINSTALL

:UPLOADFAILED
ECHO Failed to upload! Ensure Node.js is installed and in your path and you are logged into a VSTS/TFS collection where you have build administration privileges.
EXIT /B %ERRORLEVEL%

:INSTALLFAILED
ECHO Failed to install npm packages. Ensure Node.js is installed and node and npm are in your path.
EXIT /B %ERRORLEVEL%

:LOGINFAILED
ECHO Login failed. Type "tfx login" to log in and then re-run this script.
EXIT /B %ERRORLEVEL%

58 changes: 58 additions & 0 deletions upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#
# Copyright (c) Microsoft. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#

echo "code-push-vsts-extension upload"
echo "Copyright Microsoft Corporation"
echo
echo "This script will acquire and install some dependant node modules. Each package"
echo "is licensed to you by its owner. Microsoft is not responsible for, nor does it"
echo "grant any licenses to, third-party packages. Some packages may include"
echo "dependencies which are governed by additional licenses. Follow the package"
echo "source URL (http://github.com/Microsoft/code-push-vsts-extension) to determine any"
echo "dependencies."
echo
read -p "Continue [Y/n]? " yn
if [ -z "$yn" ]; then yn='y'; fi
if [ $yn = 'n' ] || [ $yn = 'N' ]
then
exit 1
fi

if ! type "npm" > /dev/null; then
echo Could not find npm. Be sure node.js is installed and both node and npm are in your path.
exit 1;
fi

if ! type "tfx" > /dev/null; then
echo Installing tfx-cli...
npm install -g tfx-cli
if [ $? -ne 0 ]
then
echo "Failed to install tfx-cli."
exit 1
fi
echo Log in to the VSTS/TFS collection you wish to deploy the tasks.
tfx login --authType basic
if [ $? -ne 0 ]
then
echo "Login failed. Type 'tfx login' to log in and then run this script again."
exit 1
fi
fi

echo Installing dependencies...
npm install --only=prod
if [ $? -ne 0 ]
then
echo "Failed to install dependencies."
exit 1
fi

node bin/tfxupload.js
if [ $? -ne 0 ]
then
echo "Upload failed!"
exit 1
fi

0 comments on commit 3dbf95f

Please sign in to comment.