Skip to content
tricknik edited this page Sep 13, 2010 · 42 revisions

a sweetpotato is not a yam.

NOTE: This project is in a very early stage.

Overview

A sweetpotato is commonly called a yam in parts of North America, although they are only very distantly related to the other plant widely known as yams1

Sweetpotato is an extensible, nestable, YAML-powered batch processing framework, which looks like an ant-like build tool, but it is a minimal extensible framework, designed to automate tasks in a convenient and easy to maintain way. It is not especially suitable for configuring, linking and compiling software, although it can certainly be extended to do so.

As Martin Fowler might say it, “Sweetpotato is an external Domain Specific Language for Process Automation using an YAML based syntax” 2

I plan to use it to build web sites, integrate web services and distribute information.

Goals

The goal of sweetpotato is to create a simple, extensible and readable grammar for automating processes as an alternative to simple shell scripts written in a non domain-specific language.

The grammar is defined as “Tasks” which are discreet operations contained within “Targets.” Each task has a “type” which defines what it actually does, new types can be added to sweetpotato by adding python classes called “Task Adapters.”

Tasks can be nested within each other.

some YAML

An example is worth a million descriptive paragraphs.

Here is a simple example of a build file


# example sweetpotato build script

sweetpotato:
    example:
      - echo: this is an example target
      - db:
          type: sweetpotato
          path: build.yaml
          read:
              root: somedata
              target: echomood
              do:
                  - fields:
                      name: personName
                      mood: personMood

    echomood:
      - echo: '{{personName}} is feeling {{personMood}}'

somedata:
    - {'name':bob,'mood':happy}
    - {'name':ann,'mood':silly}
    - {'name':joe,'mood':sleepy}
    - {'name':tom,'mood':angry}
    - {'name':sue,'mood':mopey}
    - {'name':tim,'mood':curious}
    - {'name':ken,'mood':amorous}
    - {'name':don,'mood':coy}
    - {'name':mel,'mood':scared}

the root element of the build file must be “sweetpotato”, which contain a list of targets, the file can include additional data.

The “example” target performs the following process:

  1. look up some rows in a table
  2. set the fields as build tokens
  3. call the “echomood” target for each row in the table

The “echomood” target performs the following process:

  1. expand a string containing build tokens
  2. send the output to the default logging destination

A target can be executed from the command line as follows:


sp example

sp is called with the name of the target to execute


sp --help

call —help to see other options

Notes

1 from wikipedia
fn2. http://martinfowler.com/articles/rake.htmlf

Clone this wiki locally