2.1.1 • Published 10 years ago

docpad-plugin-cmds v2.1.1

Weekly downloads
34
License
-
Repository
-
Last release
10 years ago

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

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

2.1.1

10 years ago

2.1.0

10 years ago

2.0.7

10 years ago

2.0.6

10 years ago

2.0.5

10 years ago

2.0.4

11 years ago

2.0.3

11 years ago

2.0.2

11 years ago

2.0.1

11 years ago

2.0.0

11 years ago