The nemesis package

[Tags: bsd3, library]

smart per project code snippets


[Skip to ReadMe]

Properties

Versions2009.6.12, 2009.6.13, 2009.6.13.1, 2009.6.13.2, 2009.6.14, 2009.6.14.1, 2009.6.14.2, 2009.6.14.3, 2009.6.24, 2009.6.25, 2009.8.4, 2009.8.16, 2009.8.17, 2009.8.18, 2009.10.7, 2010.10.4, 2010.10.4.1.1, 2011.6.12, 2011.6.19, 2011.10.12, 2012.5.24, 2012.5.24.1, 2012.12.18, 2013.6.13, 2013.6.16, 2013.6.22, 2013.7.27, 2014.5.19, 2015.5.4
Change logchangelog.md
Dependenciesair (>=2011.6.19), base (>=4 && <100), containers, data-default, directory, dlist, filepath, mtl, old-time, process, time, transformers [details]
LicenseBSD3
AuthorJinjing Wang
MaintainerJinjing Wang <nfjinjing@gmail.com>
CategoryWeb
Home pagehttp://github.com/nfjinjing/nemesis
Executablesnemesis
UploadedThu May 24 09:13:34 UTC 2012 by JinjingWang
DistributionsNixOS:2015.5.4
Downloads3571 total (166 in last 30 days)
Votes
0 []
StatusDocs not available [build log]
All reported builds failed as of 2015-06-05 [all 2 reports]

Modules

Downloads

Maintainers' corner

For package maintainers and hackage trustees

Readme for nemesis-2012.5.24

Nemesis: a rake like task management tool for haskell

Demo

nemesis = do

  clean
    [ "**/*.hi"
    , "**/*.o"
    , "manifest"
    ]
    
  task "dist" - do
    sh "cabal clean"
    sh "cabal configure"
    sh "cabal sdist"

  task "i" (sh "ghci -isrc src/System/Nemesis.hs")

  task "manifest" - do
    sh "find . | grep 'hs$' > manifest"

Tutorial

Install

cabal update
cabal install nemesis

DSL

Put the following code into a file named Nemesis

nemesis = do

  -- desc is optional, it gives some description to the task that follows
  desc "Hunter attack macro"

  -- syntax: task "keyword: dependencies" io-action
  task "attack: pet-attack auto-attack" (putStrLn "attack macro done!")

  desc "Pet attack"
  task "pet-attack: mark" - do
    sh "echo 'pet attack'"

  desc "Hunter's mark"
  task "mark" - do
    sh "echo \"casting hunter's mark\""

  desc "Auto attack"
  task "auto-attack" - do
    sh "echo 'auto shoot'"

Run

run nemesis

attack          Hunter attack macro
auto-attack     Auto attack
mark            Hunter's mark
pet-attack      Pet attack

run nemesis attack

casting hunter's mark
pet attack
auto shoot
attack macro done!

Namespace

Suppose you have the following tasks

nemesis = do

  namespace "eat" - do

    task "bread: salad" - putStrLn "eating bread"
    task "salad: /drink/coke" - putStrLn "nice salad"


  namespace "drink" - do

    task "coke" - putStrLn "drinking coke"

then

nemesis bread =>
.nemesis: bread does not exist!

nemesis eat/bread =>
drinking coke
nice salad
eating bread

Hints

Advance usage

Use LANGUAGE pragma

Put a -- Nem line after the Langauge pragma

{-# LANGUAGE QuasiQuotes #-}

-- Nem

nemesis = do
  task "i" (sh "ghci -isrc src/System/Nemesis.hs")

currently the separator -- Nem is hard coded

Bypass preprocessing, i.e. run as EDSL

Define main, i.e. add main = run nemesis in the code. The preprocessor looks for the function main, if it's defined, preprocessing is skipped.

This turns Nemesis into an EDSL in Haskell, runnable by runghc.

For example:

import System.Nemesis.Env
import Air.Env ((-))
import Prelude hiding ((-))

main = run nemesis

nemesis = do
  task "hello" - do
    sh "echo 'hello world'"

Try:

runghc Nemesis hello
<br/>

mnemosyne

The goddess is watching you, you shall have your revenge.