Code Monkey home page Code Monkey logo

paprika's Introduction

Paprika - Sprinkle JavaScript tasks on your .NET build

Paprika is a JavaScript library of tasks commonly performed while building .NET applications. Take advantage of paprika as a node module or as a single self-contained paprika javascript file.

Tasks Included

At the moment there are a hand-full of tasks. Hopefully, this will fill out as more tasks are necessary!

ASP .NET Compiler Task

Pre-compile your ASP .NET applications using this task. Ideally, you should compile your Website project with a custom OutDir so MSBuild will generate a _PublishedWebsites directory.

var aspcompile = require('paprika').aspcompile;
aspcompile({
  virtualPath: '/myapp', // hard-coded into files generated by compilation
  physicalPath: 'build_temp/outdir/_PublishedWebsites/MyApp',
  targetPath: 'build_output/website',
  updatable: targetPathue, // false by default
  debug: true, // enables debug info and error stack information
  run_options: { stdout: false } // accepts same options as run task
});

MSBuild task

Execute MSBuild using this task by passing in the required parameters. You can also include a callback function as a second parameter

var msbuild = require('paprika').msbuild;
msbuild({
  file: '../MySolution.sln',
  version: 'net35',
  processor: 'x86',
  targets: ['Clean', 'Build'],
  properties: { Configuration: 'Release' },
  stdout: false, // prevent redirection to stdout
  stderr: false, // prevent redirection to stderr
  buildCommand: 'xbuild', // customize the location of MSBuild.exe (or xbuild)
  extraParameters: '/nologo /version' // add any additional parameters
}, function () { complete(); });

You can specify default values to prevent repeating yourself.

var msbuild = require('paprika').msbuild;
msbuild.setDefaults({
  properties: { Configuration: 'Release' },
  buildCommand: 'xbuild'
});

NUnit task

Execute NUnit tests and determine if they passed or failed.

nunit(['Project.Tests.dll'], {
	nunitDir: nunitDir, // path to nunit-console executable to use
	processor: 'x86', // can specify to use x86 or x64 bit version of runner
	subset: 'Project.Tests.UnitTests', // a namespace, fixture or test to run
	run_options: { stdout: false } // the options to pass to the Run task
}, function (err) { console.log(err ? 'Failed!' : 'Passed!'); });

Run task

The run task takes the effort out of calling out to other processes. It takes care of operating system specific idiosyncrasies (I'm looking at you node for Windows) and assumes you either want output redirected to the console (default) or not at all. Here is a simple example to get started:

run('pwd');

The run function requires one parameter: the filename (may include path) of the process to run. It has several optional parameters - here is the function signature along with some other examples:

// run(cmd [, args] [, options] [, callback])
var run = require('paprika').run;
run('node', '--version', {
  stdout: false, // by default, stdout is redirected to console
  stderr: false, // by default, stderr is redirected to console
  spawn_options: { cwd: '/' } // options to pass onto child_process.spawn
}, function () { complete(); });

run('mycmd', ['many', 'options']);

run('prevent_meltdown', function (code) {
  if (code !== 0) {
    runLikeHell();
  }
});

ZIP task

Run the zip command with the passed in command line arguments. This task determines what version of zip (www.info-zip.org) to use depending on the platform and architecture. The zip function accepts command line parameters as either a single string, or an array of strings.

var zip = require('paprika').zip;
zip('-r deploy_package ./package');
zip(['-r', 'deploy_package', './package']);

paprika's People

Contributors

mpareja avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

paprika's Issues

add nuget task

Here is a sample api I came up with.

var nuget = require('paprika').nuget;

nuget.setDefaults({
    nugetCommand: 'src/.nuget/NuGet.exe'
});

nuget.pack({
  file: '...'
});

nuget.publish({
  file: '..'
});

It would also be good to have the default nuget.org url and symbol source push urls so I don't need to always navigate to the symbol source website to check their push urls when I create a new jakefile with nuget.publish task.

var symbolSourceUrl = nuget.urls.symbolSource;
var nugetUrl = nuget.urls.nuget;
nuget.publish({
    file: '...',
    source: nuget.urls.symbolSource
});

it might also be a good idea to allow other to add urls. useful if you are pushing to your custom/private feeds.

nuget.urls.myCustomNugetFeed = 'https://nuget.example.com';

add nunit console runner support

We should support running tests in 1 or many assemblies. It would be if we could keep the single assembly API really clean as follows (assuming you accept or set defaults):
var nunit = require('paprika').nunit;
nunit('build_output/Tests.dll');

You should be able to pass in options:

var nunit = require('paprika').nunit;
nunit('build_output/Tests.dll', {   
    filter: 'Some.Namespace', // specific test case(s), fixture(s) or namespace(s) to run
    frameworkVersion: 'net35',
    nunitDir: 'tools/nunit', // where nunit-console executables live
    extraParameters: '/timeout=1000'
});

If you need more than one assembly, then it looks a bit nicer if an array of assemblies is passed in.

nunit({
    assemblies: [
        'build_output/Integration.Tests.dll',
        'build_output/Unit.Tests.dll'
    ],
    frameworkVersion: 'net40',
    nunitDir: 'lib/nunit' // the task 
});

We should probably throw if an array of assemblies is given in addition to a single assembly:

nunit('myAssembly.dll', {
    assemblies: [ ..., ... ]
});

json to xml task

allow to generate xml file from a json object.

if the property name start with _ it is an attribute. _xmlns

xml({
    file: path.join(root, 'Build/NuGet/Facebook/Facebook.nuspec'),
    xml: {
        'package': {
            _xmlns: 'http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd',
            metadata: {
                id: 'Facebook',
                version: version.full,
                authors: 'Jim Jimmerman, Nathan Totten, Prabir Shrestha',
                description: 'The Facebook C# SDK Core.',
                language: 'en-US',
                licenseUrl: 'http://facebooksdk.codeplex.com/license',
                projectUrl: 'http://facebooksdk.codeplex.com',
                iconUrl: 'http://bit.ly/facebooksdkicon',
                requireLicenseAcceptance: true,
                tags: 'Facebook',
                dependencies: [
                    { dependency: { _id: 'CodeContracts.Unofficial', _version: '1.0.0.2'} }
                ]
            },
            files: [
                { file: { _src: '../../Build/NuGet/Facebook/content/**/*.*', _target: 'content'} },
                { file: { _src: '../../Build/NuGet/Facebook/serializers/**/*.*', _target: 'serializers'} },
                { file: { _src: '../../Build/NuGet/Facebook/tools/**/*', _target: 'tools'} },
                { file: { _src: '../../Bin/Release/net40-client/**/*.dll', _target: 'lib/net40-client'} },
                { file: { _src: '../../Bin/Release/net40-client/**/*.xml', _target: 'lib/net40-client'} },
                { file: { _src: '../../Bin/Release/net35-client/**/*.dll', _target: 'lib/net35-client'} },
                { file: { _src: '../../Bin/Release/net35-client/**/*.xml', _target: 'lib/net35-client'} },
                { file: { _src: '../../Bin/Release/sl4/**/*.dll', _target: 'lib/sl4'} },
                { file: { _src: '../../Bin/Release/sl4/**/*.xml', _target: 'lib/sl4'} },
                { file: { _src: '../../Bin/Release/sl3-wp/**/*.dll', _target: 'lib/sl4'} },
                { file: { _src: '../../Bin/Release/sl3-wp/**/*.xml', _target: 'lib/sl3-wp'} },
            ]
        }
    }
});

Feature: allow specifying default configuration options

You'll often want to use the same configuration settings across similar tasks. We should support specifying those common values once and only specifying the specifics for each task.

Here is a suggestion from @prabirshrestha:

var msbuild = require('paprika').msbuild;
msbuild.config({ version: 'net35', processor: 'x86', properties: { Configuration: 'Release' } });

task('build', function () {
    msbuild({
        file: '../MySolution.sln'
      , targets: ['Clean', 'Build']
      , show_stdout: false
    });
};

Max cpu switch

Hi

I cannot pass /m or /m:4 switch to module.

Nice module!

Feature: support for customizing command and parameters

It would be useful to allow one to explicitly pass the command used to perform the build. This would enable building with mono, for instance. Being able to pass custom parameters would also make it easier for consumers to add additional command line options without having to modify paprika.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.