azubi-0.2.0.2: A simple DevOps tool which will never "reach" enterprice level.

Azubi

Description

Example:

import Azubi

main :: IO ()
main = azubiMain \$ []
& installed (Ebuild "vim")
& uptodate (Git "gitgithub.com:mrVanDalo/azubi.git" "/dev/shm/azubi")
& installed (Git "gitgithub.com:mrVanDalo/azubi-config.git" "/dev/shm/azubi-config")
& run (Always "touch" ["devshm/run.test"])


Synopsis

# Documentation

data State Source #

The low level element to formulate a state on a machine. If the check returns No the Commands will run. So the author should make sure the Command will result in a Yes the next time this state will run.

All Checks have to return Yes to avoid the Commands to be run.

If a Command returns a Failure the following commands will not be called. Same holdes for States if one of the states fail, the following States will not be run.

Constructors

 State [Check] [Command] (Maybe Comment) State contains checks and commands if one command failed the following commands will not be executed. States [Check] [State] (Maybe Comment) To create depended states which should stop being executed when a previous state fails

Instances

 Source # Methods(==) :: State -> State -> Bool #(/=) :: State -> State -> Bool # Source # MethodsshowsPrec :: Int -> State -> ShowS #show :: State -> String #showList :: [State] -> ShowS #

data Ebuild Source #

Ebuild is a Portage package (used by Gentoo and Funtoo).

http://gentoo.org

See installed.

Constructors

 Ebuild String

Instances

 Source # Methods Source # Methods

data Git Source #

Git is a version control system.

http://git.scm.com

See installed.

Constructors

 Git RepoUrl Path [GitOption]

Instances

 Source # Methods Source # Methods

data GitOption Source #

Constructors

 Recursive

The way a command should be run. See run

Constructors

 Always String [Argument] run command every time Once String [Argument] Path run command and creates a file to prevent to run again

installed :: Installable a => a -> State Source #

install a piece of software on the system. The piece of software should be typed of course.

class Installable a where Source #

To install Software you have to instance the Installable class.

Minimal complete definition

installed

Methods

installed :: a -> State Source #

install a piece of software on the system. The piece of software should be typed of course.

Instances

 Source # Methods Source # Methods

uptodate :: Updatable a => a -> State Source #

make sure something is installed and up to date.

class Updatable a where Source #

Same like Installable but will also make sure there you have the newest version.

Minimal complete definition

uptodate

Methods

uptodate :: a -> State Source #

make sure something is installed and up to date.

Instances

 Source # Methods Source # Methods

creates a State that will run a command of your choice.

link :: Path -> Path -> State Source #

ensure there is a link file -> target

example:

link "~/file" "~/target"


will create a link at ~/file/ pointing to ~/target/

folderExists :: Path -> State Source #

make sure a folder exists

content :: Path -> [String] -> State Source #

Create a state that ensures that a file in Path will have the content of the String List.

Every String in the List will be a Line in the File.

Creates a state out of two states. When the first State fails the second State will not be checked nor enforced.

This can also be achieved using submodule:

stateA requires stateB == submodule [stateB, stateA]


submodule :: [State] -> State Source #

Create a state containing of sub-states, which have to be fulfilled in order.

If one state is not fulfilled, the following will be ignored.

(&) :: [State] -> State -> [State] Source #

State combinator.

[]
& folderExists "/tmp/foo"
& folderExists "/tmp/bar"


azubiMain :: [State] -> IO () Source #

The function you should use to get you commands running.

data Command Source #

A command is something that will be run. In a normal case you put a Check before using a State

When a Command get executed, it will create a CommandResult.

 command -> exit code -> CommandResult

Constructors

 Run String [Argument] (Maybe Comment) FileContent Path [String] CreateSymlink Path Target CreateFolder Path Remove Path

Instances

 Source # Methods(==) :: Command -> Command -> Bool #(/=) :: Command -> Command -> Bool # Source # MethodsshowList :: [Command] -> ShowS #

data Check Source #

check -> success/failure

 Check String [Argument] (Maybe Comment) Check if command returns exit status0 -> Yes _ -> No  AlwaysYes Not Check Opposite result of a Check HasFileContent Path [String] Check if Path has content SymlinkExists Path Target Check if a Symbolic link exists to a specific target FolderExists Path Check if a folder exists DoesExist Path Check if something exists at path