Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

docpad-plugin-cmds

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docpad-plugin-cmds

Adds support for shell script compilation to DocPad

  • 2.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Cmds Plugin for DocPad

Build Status NPM version Dependency Status Gittip donate button Analytics

Convention: .bash Convention: .sh Convention: .ps1 or .cmd (windows only)

The above can be rendered to any extension i.e. (.html.sh) or just run as a single extension process like a script.

.bash and .sh files are supported on windows if you have gnu\bash\sh\cygwyn tools installed and in the environment path.

Scripts can determined when to run, i.e. writeAfter or generateBefore etc...

##Example usage

echo 123
echo 456
echo "<script>"
echo "document.write("
curl http://www.servicestack.net/ServiceStack.Northwind/customers?format=json
echo ".Customers.length);"
echo "</script>"

Windows cmd multiple lines

echo 123 & echo 456

##Front matter options

NameDesc
printtrue or false. Specifies if you want to print output to the console
when used when wanting to run the script during a specific docpad event
(only works for scripts placed in the shell collection folder)
  • generateBefore
  • generateAfter
  • renderBefore
  • renderAfter
  • writeBefore
  • writeAfter
  • render (default)

Install

npm install --save docpad-plugin-cmds

Config

cmds:
	# shell collection folder (can be an array of folder names)
	shellPath: "shell"
	
	# default collection name
	collectionName: "shell"
	
	# powershell path for windows (will also work in bash on windows)
	psPath: 'C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell' # default

##Ordered Scripts

When using the "when" meta scripts are sorted by relativePath. This allows us to execute scripts in a specific order.

example:

# example script order with relative paths
task1.bash
task2.bash

task1\step1.bash
task1\step2.bash
task1\step3.bash

task2\step1.bash
task2\step2.bash
task2\step3.bash

##Env

Document attributes are added to the env (in full caps with an underscore seperator)

# bash
$DOCUMENT_TITLE, $DOCUMENT_FILENAME, etc..
$DOCPAD_CONFIG_ROOTPATH, $DOCPAD_CONFIG_OUTPATH, etc..
# ps1
$env:DOCUMENT_TITLE, $env:DOCUMENT_FILENAME, etc..
$env:DOCPAD_CONFIG_ROOTPATH, $env:DOCPAD_CONFIG_OUTPATH, etc..

powershell c# example

$source = @"
public class BasicTest
{
    public static int Add(int a, int b)
    {
        return (a + b);
    }

    public int Multiply(int a, int b)
    {
        return (a * b);
    }
}
"@

# load the source
Add-Type -TypeDefinition $source

# static ref
[BasicTest]::Add(4, 3)

# instance ref
$basicTestObject = New-Object BasicTest 
$basicTestObject.Multiply(5, 2)

History

You can discover the history inside the History.md file

Contributing

You can discover the contributing instructions inside the Contributing.md file

License

Licensed under the incredibly permissive MIT License
Copyright © 2013+ Stringz Solutions Ltd
Copyright © 2013+ Peter Flannery

Keywords

FAQs

Package last updated on 25 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc