biegunka-0.2: DSL definitions, interpreters, templating, git support

Safe HaskellNone

Control.Biegunka.Primitive

Contents

Description

Language primitives

Containts Actions layer primitive and modifiers. Sources layer primitives are found in * modules

All concrete primitives docs assume you have default settings

Synopsis

Actions layer primitives

link :: FilePath -> FilePath -> Script Actions ()Source

Links given file to specified filepath

 git "https://example.com/source.git" "git/source" $
   link "some-file" "anywhere"

Links ~/git/source/some-file to ~/anywhere.

register :: FilePath -> Script Actions ()Source

Links source to specified filepath

 git "https://example.com/source.git" "git/source" $
   register "somewhere"

Links ~/git/source to ~/somewhere.

copy :: FilePath -> FilePath -> Script Actions ()Source

Copies file or directory to specified filepath

 git "https://example.com/source.git" "git/source" $
   copy "some-file" "anywhere"

Copies ~/git/source/some-file to ~/anywhere.

copyFile :: FilePath -> FilePath -> Script Actions ()Source

Copies only single file to specified filepath

 git "https://example.com/source.git" "git/source" $
   copy "some-file" "anywhere"

Copies ~/git/source/some-file to ~/anywhere.

copyDirectory :: FilePath -> FilePath -> Script Actions ()Source

Copies file or directory to specified filepath

 git "https://example.com/source.git" "git/source" $
   copy "some-file" "anywhere"

Copies ~/git/source/some-file to ~/anywhere.

substitute :: FilePath -> FilePath -> Script Actions ()Source

Substitutes templates in HStringTemplate syntax in given file and writes result to specified filepath

 git "https://example.com/source.git" "git/source" $
   substitute "some-file.template" "anywhere"

Copies ~/git/source/some-file.template to ~/anywhere.

Substitutes templates in ~/anywhere with values from templates part of Controls

patch :: FilePath -> FilePath -> PatchSpec -> Script Actions ()Source

Applies the patch given the PatchSpec

 git "https://example.com/source.git" "git/source" $
   patch "some-patch.patch" "anywhere" (def { reversely = True })

Applies ~/git/source/some-patch.patch to ~/anywhere reversely.

raw :: FilePath -> [String] -> Script Actions ()Source

Monomorphised interface to sh quasiquoter for those who do not like -XTemplateHaskell (or -XQuasiQuotes)

 git "https://example.com/source.git" "git/source" $
   raw "/bin/echo" ["-n", "hello"]

Prints "hello" to stdout

Modifiers

profile :: String -> Script Sources a -> Script Sources aSource

Provides convenient Sources grouping. May be nested

Information about sources and files related to a particular profile profile could be found in ~/.biegunka/profiles/.

Example usage:

 profile "dotfiles" $ do
   group "mine" $
     git "https://github.com/supki/.dotfiles"
       ...
   group "not-mine" $
     git "https://github.com/dmalikov/dotfiles"
       ...
 profile "experimental" $ do
   git "https://github.com/ekmett/lens"
     ...

group :: String -> Script Sources a -> Script Sources aSource

Alias for profile. May be useful for nested grouping

role :: String -> Script Sources a -> Script Sources aSource

Alias for profile. Everyone uses roles for something

sudo :: User u -> Script s a -> Script s aSource

Change effective user id for wrapped commands

retries :: Int -> Script s a -> Script s aSource

Change maximum retries count

reacting :: React -> Script s a -> Script s aSource

Change reaction pattern when retries are all failed

prerequisiteOf :: Script Sources a -> Script Sources b -> Script Sources bSource

Execute scripts sequentially Connects two scripts which forces them to run sequentially one after another.