| Copyright | (c) Ingolf Wagner 2017 | 
|---|---|
| License | GPL-3 | 
| Maintainer | azubi@ingolf-wagner.de | 
| Stability | experimental | 
| Portability | POSIX | 
| Safe Haskell | Safe | 
| Language | Haskell2010 | 
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"])
       & link "/dev/shm/azubi.link" "/dev/shm/azubi"
- data State
- data Ebuild = Ebuild String
- data Git = Git RepoUrl Path [GitOption]
- data GitOption = Recursive
- data RunCommand
- installed :: Installable a => a -> State
- class Installable a where
- uptodate :: Updatable a => a -> State
- class Updatable a where
- run :: RunCommand -> State
- link :: Path -> Path -> State
- folderExists :: Path -> State
- content :: Path -> [String] -> State
- requires :: State -> State -> State
- submodule :: [State] -> State
- (&) :: [State] -> State -> [State]
- azubiMain :: [State] -> IO ()
- data Command- = Run String [Argument] (Maybe Comment)
- | FileContent Path [String]
- | CreateSymlink Path Target
- | CreateFolder Path
- | Remove Path
 
- data Check- = Check String [Argument] (Maybe Comment)
- | AlwaysYes
- | Not Check
- | HasFileContent Path [String]
- | SymlinkExists Path Target
- | FolderExists Path
- | DoesExist Path
 
Documentation
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.
data RunCommand Source #
The way a command should be run. See run
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
Methods
installed :: a -> State Source #
install a piece of software on the system. The piece of software should be typed of course.
Instances
class Updatable a where Source #
Same like Installable but will also
make sure there you have the newest
version.
Minimal complete definition
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.
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"
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 -> CommandResultConstructors
| Run String [Argument] (Maybe Comment) | |
| FileContent Path [String] | |
| CreateSymlink Path Target | |
| CreateFolder Path | |
| Remove Path | 
Gather information about a situation.
check -> success/failure check -> exit code -> success/failure
Constructors
| Check String [Argument] (Maybe Comment) | Check if command returns exit status 0 -> Yes _ -> No | 
| AlwaysYes | |
| Not Check | Opposite result of a  | 
| HasFileContent Path [String] | Check if  | 
| 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 |