API Docs for:
Show:

docpadUtil Class

The DocPad Util Class. Collection of DocPad utility methods

Constructor

docpadUtil

() static

Methods

action

(
  • action
  • opts
  • next
)

Perform an action next(err,...), ... = any special arguments from the action this should be it's own npm module as we also use the concept of actions in a few other packages. Important concept in DocPad.

Parameters:

  • action Object
  • opts Object
  • next Function

getBasename

(
  • filename
)
String

get a filename without the extension

Parameters:

  • filename String

Returns:

String:

base name

getDefaultLogLevel

() Number private

Get Default Log Level

Returns:

Number:

default log level

getDirPath

(
  • path
)
String

Get the directory path. Wrapper around the node.js path.dirname method

Parameters:

  • path String

Returns:

String:

getExtension

(
  • extensions
)
String

Get the extension from a bunch of extensions

Parameters:

  • extensions Array

Returns:

String:

the extension

getExtensions

(
  • filename
)
Array

Get the extensions of a filename

Parameters:

  • filename String

Returns:

Array:

array of string

getFilename

(
  • path
)
String

Get the file name. Wrapper around the node.js path.basename method

Parameters:

  • path String

Returns:

String:

getLocalDocPadExecutable

() String private

Get Local DocPad Installation Executable - ie not the global installation

Returns:

String:

the path to the local DocPad executable

getLocalDocPadExecutableExistance

() Boolean private

Does the local DocPad Installation Exist?

Returns:

Boolean:

getOutFilename

(
  • basename
  • extension
)
String

Get the DocPad out file name

Parameters:

  • basename String
  • extension String

Returns:

String:

getSlug

(
  • relativeBase
)
String

Get the post slug from the URL

Parameters:

  • relativeBase String

Returns:

String:

the slug

getUrl

(
  • relativePath
)
String

Get the URL

Parameters:

  • relativePath String

Returns:

String:

inspect

(
  • obj
  • opts
)
String

Wrapper for the node.js method util.inspect

Parameters:

  • obj Object
  • opts Object

Returns:

String:

isLocalDocPadExecutable

() Boolean private

Is Local DocPad Installation

Returns:

Boolean:

isStandalone

() Object private

Is Standadlone

Returns:

Object:

isStandardEncoding

(
  • encoding
)
Boolean private

Are we using standard encoding?

Parameters:

  • encoding String

Returns:

Boolean:

isTravis

() String private

Are we executing on Travis

Returns:

String:

The travis node version

isTTY

() Boolean private

Is this TTY

Returns:

Boolean:

isUser

() Boolean private

Is user

Returns:

Boolean:

startLocalDocPadExecutable

(
  • next
)
Object private

Spawn Local DocPad Executable

Parameters:

  • next Function

Returns:

Object:

don't know what

wait

(
  • time
  • fn
)
private

Wait. Wrapper for setTimeout

Parameters:

  • time Number
  • fn Function

writeError

(
  • err
)
private

Write an error

Parameters:

  • err Object

writeStderr

(
  • data
)
private

Write to stderr

Parameters:

  • data String