Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Rouchon committed Nov 9, 2016
0 parents commit a22f9f7
Show file tree
Hide file tree
Showing 41 changed files with 3,364 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# default behavior to automatically normalize line endings
* text=auto
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
*.vsix
_build/
_packages/
_test-results/
21 changes: 21 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2016 Guillaume Rouchon

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.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[![Donate](https://raw.githubusercontent.com/qetza/vsts-xdttransform-task/master/images/donate.png)](https://www.paypal.me/grouchon/5)

# XDT transform task for Visual Studio Team Services
This extension contains a build/release task for VS Team Services to apply XDT transforms on XML files.

# How to use the build/release task
1. After installing the extension, upload your project to VSTS.
2. Go to your VSTS project, click on the **Release** tab, and create a new release definition.
3. Click **Add tasks** and select **XDT Transform** from the **Utility** category.
4. Configure the step.

# Release notes
**New in 1.0.0**
- Initial release
119 changes: 119 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
var gulp = require('gulp');
var gutil = require('gulp-util');
var debug = require('gulp-debug');
var del = require('del');
var merge = require('merge-stream');
var path = require('path');
var shell = require('shelljs');
var minimist = require('minimist');
var semver = require('semver');
var fs = require('fs');

var _buildRoot = path.join(__dirname, '_build');
var _packagesRoot = path.join(__dirname, '_packages');

gulp.task('default', ['build']);

gulp.task('build', ['clean'], function () {
var extension = gulp.src(['README.md', 'LICENSE.txt', 'images/**/*', '!images/**/*.pdn', 'vss-extension.json'], { base: '.' })
.pipe(debug({title: 'extension:'}))
.pipe(gulp.dest(_buildRoot));
var task = gulp.src('task/**/*', { base: '.' })
.pipe(debug({title: 'task:'}))
.pipe(gulp.dest(_buildRoot));

return merge(extension, task);
});

gulp.task('clean', function() {
return del([_buildRoot]);
});

gulp.task('test', ['build'], function() {
});

gulp.task('package', ['build'], function() {
var args = minimist(process.argv.slice(2), {});
var options = {
version: args.version,
stage: args.stage,
public: args.public,
private: args.private,
taskId: args.taskId
}

if (options.version) {
if (options.version === 'auto') {
var ref = new Date(2000, 1, 1);
var now = new Date();
var major = 0
var minor = Math.floor((now - ref) / 86400000);
var patch = Math.floor(Math.floor(now.getSeconds() + (60 * (now.getMinutes() + (60 * now.getHours())))) * 0.5)
options.version = major + '.' + minor + '.' + patch
}

if (!semver.valid(options.version)) {
throw new gutil.PluginError('package', 'Invalid semver version: ' + options.version);
}
}

switch (options.stage) {
case 'dev':
options.taskId = 'BC5D1625-874F-4ABF-AC07-4A55EC6DCC76';
options.public = false;
options.private = false;
break;
}

updateExtensionManifest(options);
updateTaskManifest(options);

shell.exec('tfx extension create --root "' + _buildRoot + '" --output-path "' + _packagesRoot +'"')
});

updateExtensionManifest = function(options) {
var manifestPath = path.join(_buildRoot, 'vss-extension.json')
var manifest = JSON.parse(fs.readFileSync(manifestPath));

if (options.version) {
manifest.version = options.version;
}

if (options.stage) {
manifest.id = manifest.id + '-' + options.stage
manifest.name = manifest.name + ' (' + options.stage + ')'
}

manifest.public = options.public;

fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 4));
}

updateTaskManifest = function(options) {
var manifestPath = path.join(_buildRoot, 'task', 'task.json')
var manifest = JSON.parse(fs.readFileSync(manifestPath));

if (options.version) {
manifest.version.Major = semver.major(options.version);
manifest.version.Minor = semver.minor(options.version);
manifest.version.Patch = semver.patch(options.version);
}

manifest.helpMarkDown = 'v' + manifest.version.Major + '.' + manifest.version.Minor + '.' + manifest.version.Patch + ', ' + manifest.helpMarkDown

if (options.stage) {
manifest.friendlyName = manifest.friendlyName + ' (' + options.stage

if (options.version) {
manifest.friendlyName = manifest.friendlyName + ' ' + options.version
}

manifest.friendlyName = manifest.friendlyName + ')'
}

if (options.taskId) {
manifest.id = options.taskId
}

fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, 4));
}
Binary file added images/donate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/extension-icon.pdn
Binary file not shown.
Binary file added images/extension-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/screenshot-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/screenshot-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 33 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"name": "qetza.vsts-xdttransform-task",
"version": "0.1.0",
"description": "Build task for VS Team Services that can run XDT transforms on XML files.",
"author": "Guillaume Rouchon",
"license": "MIT",
"homepage": "https://github.com/qetza/vsts-xdttransform-task#readme",
"bugs": {
"url": "https://github.com/qetza/vsts-xdttransform-task/issues"
},
"keywords": [
"VSTS",
"release",
"build",
"xdt",
"transform",
"configuration"
],
"repository": {
"type": "git",
"url": "git+https://github.com/qetza/vsts-xdttransform-task.git"
},
"devDependencies": {
"del": "^2.0.0",
"gulp": "^3.9.1",
"gulp-debug": "^2.1.2",
"gulp-util": "^3.0.0",
"merge-stream": "^1.0.0",
"shelljs": "^0.3.0",
"minimist": "1.1.1",
"semver": "4.3.3"
}
}
Binary file added task/Microsoft.Web.XmlTransform.dll
Binary file not shown.
Binary file added task/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit a22f9f7

Please sign in to comment.