Permalink
Browse files

jake file nuget pack and nuspec generator

  • Loading branch information...
1 parent e78646a commit 58fa0597256060d90383cb8f65012bd93d02f3c5 @prabirshrestha prabirshrestha committed Apr 12, 2012
Showing with 72 additions and 1 deletion.
  1. +2 −1 .gitignore
  2. +48 −0 jakefile.js
  3. +19 −0 src/SimpleJson.nuspec
  4. +2 −0 src/SimpleJson/SimpleJson.cs
  5. +1 −0 src/simplejson.script.ps1
View
@@ -46,4 +46,5 @@ lint.db
Thumbs.db
!libs/*/[Bb]in/
working/
-src/TestResults/
+src/TestResults/
+dist/
View
@@ -165,6 +165,7 @@ desc('Clean')
task('clean', ['clean:all'], function () {
jake.rmRf('working/')
jake.rmRf('bin/')
+ jake.rmRf('dist/')
})
namespace('test-build', function () {
@@ -195,3 +196,50 @@ namespace('test', function () {
desc('test')
task('test', ['test:all'])
+
+directory('working/')
+
+namespace('generate', function () {
+
+ desc('Generate SimpleJson.cs.pp at working/SimpleJson.cs.pp')
+ task('csharp', ['working/'], function () {
+ console.log('Generating working/SimpleJson.cs');
+
+ var csFile = fs
+ .readFileSync('src/SimpleJson/SimpleJson.cs', 'utf-8')
+ .replace('// VERSION:', '// VERSION: ' + config.version)
+ .replace('namespace SimpleJson', 'namespace $rootnamespace$')
+ .replace('using SimpleJson.Reflection;', 'using $rootnamespace$.Reflection;')
+
+ fs.writeFileSync('working/SimpleJson.cs.pp', csFile);
+ })
+
+ desc('Generate SimpleJson.psm1 at working/SimpleJson.psm1')
+ task('powershell', ['working/'], function () {
+ console.log('Generating working/SimpleJson.psm1');
+
+ var psFile = fs
+ .readFileSync('src/simplejson.script.ps1', 'utf-8')
+ .replace('# Version:', '# Version: ' + config.version);
+
+ fs.writeFileSync('working/SimpleJson.psm1', psFile);
+ })
+
+ task('all', ['generate:csharp', 'generate:powershell'])
+
+})
+
+directory('dist/')
+
+namespace('nuget', function () {
+
+ desc('Create nuget package')
+ task('pack', ['generate:all', 'dist/'], function () {
+ nuget.pack({
+ nuspec: 'src/SimpleJson.nuspec',
+ version: config.version,
+ outputDirectory: 'dist/'
+ })
+ }, { async: true })
+
+})
View
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <metadata>
+ <id>SimpleJson</id>
+ <version>$version$</version>
+ <authors>Jim Zimmerman, Nathan Totten, Prabir Shrestha</authors>
+ <owners>Jim Zimmerman, Nathan Totten, Prabir Shrestha</owners>
+ <licenseUrl>https://raw.github.com/facebook-csharp-sdk/simple-json/master/LICENSE.txt</licenseUrl>
+ <projectUrl>https://raw.github.com/facebook-csharp-sdk/simple-json</projectUrl>
+ <requireLicenseAcceptance>false</requireLicenseAcceptance>
+ <description>Super lightweight Json library for .NET 2.0+/SL4+/WP7/WinRT along with dynamic and DataContract support</description>
+ <language>en-US</language>
+ <tags>json</tags>
+ </metadata>
+ <files>
+ <file src="..\working\SimpleJson.cs.pp" target="content\SimpleJson.cs.pp" />
+ <file src="..\working\SimpleJson.psm1" target="SimpleJson.psm1" />
+ </files>
+</package>
@@ -17,6 +17,8 @@
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
//-----------------------------------------------------------------------
+// VERSION:
+
// NOTE: uncomment the following line to make SimpleJson class internal.
//#define SIMPLE_JSON_INTERNAL
@@ -1,5 +1,6 @@
# SimpleJson https://github.com/facebook-csharp-sdk/simple-json
# License: MIT License
+# Version:
function ConvertFrom-Json
{

0 comments on commit 58fa059

Please sign in to comment.