-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
105 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Mono Web Publish | ||
mwp is a small tool used to publish your Mono ASP.NET website after you've build it with xbuild. It mimics the behavior of | ||
Microsoft Web Deploy, and creates a deployable package under the obj dir in your project folder. | ||
|
||
<img src="http://blog.jetbrains.com/teamcity/files/2015/12/icon_TeamCity.png" height="25" width="25"> | ||
If you're using JetBrains TeamCity on a non-windows server like me, you can use this tool to package your website into an | ||
artifact almost the same way you would do it on a Microsoft Windows server using Microsoft Web Deploy. | ||
|
||
Normally you would have the following build-steps on a Microsoft Windows server(With Microsoft Web Deploy installed): | ||
<ol> | ||
<li>Build solution, using MSBuild</li> | ||
<li>Package website, using MSBuild on projectfile with Targets=Package</li> | ||
</ol> | ||
On a non-windows server using mwp: | ||
<ol> | ||
<li>Build solution, using Mono xbuild</li> | ||
<li>Package website, using a command-line where you run mwp like this: | ||
<pre><code> | ||
node ~/bin/mwp.js %system.Configuration% %teamcity.build.workingDir%/SolutionName/ProjectName.csproj | ||
</code></pre> | ||
</li> | ||
</ol> | ||
|
||
That way you can later add the website to your artifact same way you would add it on a TeamCity Server running on Microsoft Windows: | ||
<pre><code> | ||
ProjectName/obj/%system.Configuration%/Package/PackageTmp => SolutionName_%system.build.number%.zip!/ProjectName/ | ||
</code></pre> | ||
|
||
# License | ||
mwp is available under the [BSD license](https://opensource.org/licenses/BSD-3-Clause). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
Copyright (c) 2016, Peter Zinck Wulff | ||
All rights reserved. | ||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
* Neither the name of mwp nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
var args = process.argv.slice(2); | ||
var fs = require('fs-extra'); | ||
var xml2js = require('xml2js'); | ||
var version = '0.1.0'; | ||
|
||
if (args.length > 0) { | ||
var myPath = require('path').dirname(args[1]); | ||
var myPreFix = 'obj/' + args[0] + '/Package/PackageTmp/'; | ||
var parser = new xml2js.Parser(); | ||
fs.readFile(args[1], function (err, data) { | ||
parser.parseString(data, function (err, result) { | ||
for (var i = 0; i < result.Project.ItemGroup.length; i++) { | ||
var obj = result.Project.ItemGroup[i]; | ||
var items = Object.keys(obj); | ||
items.forEach(function (item) { | ||
if (item == 'Content') { | ||
for (var j = 0; j < obj[item].length; j++) { | ||
var myFile = obj[item][j].$.Include; | ||
myFile = myFile.replace(/\\/g, "/"); | ||
fs.copy(myPath + '/' + myFile, myPath + '/' + myPreFix + myFile); | ||
} | ||
} | ||
}); | ||
} | ||
}); | ||
}); | ||
fs.copySync(myPath + '/bin', myPath + '/' + myPreFix + 'bin'); | ||
} else { | ||
console.log('Mono Web Publish Version ' + version); | ||
console.log('Copyright (c) 2016, Peter Zinck Wulff All rights reserved.'); | ||
console.log('Usage: mwp <configuration> <projectfile>'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "mwp", | ||
"homepage": "https://github.com/PZWulff/mwp", | ||
"version": "0.1.0", | ||
"description": "Mono Web Publish is a small tool that packages an ASP.NET C# website for deployment like Microsoft Web Deploy", | ||
"main": "mwp.js", | ||
"author": { | ||
"name": "Peter Zinck Wulff" | ||
}, | ||
"dependencies": { | ||
"fs-extra": "^0.26.7", | ||
"xml2js": "^0.4.16" | ||
} | ||
} |