| Copyright | © 2015-Present Stack Builders |
|---|---|
| License | MIT |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
System.Hapistrano.Commands
Description
Collection of type safe shell commands that can be fed into
runCommand.
Synopsis
- class Command a where
- type Result a :: Type
- renderCommand :: a -> String
- parseResult :: Proxy a -> String -> Result a
- data Whoami = Whoami
- data Cd cmd = Cd (Path Abs Dir) cmd
- newtype MkDir = MkDir (Path Abs Dir)
- data Rm where
- data Mv t = Mv TargetSystem (Path Abs t) (Path Abs t)
- data Ln where
- newtype Ls = Ls (Path Abs Dir)
- data Readlink t = Readlink TargetSystem (Path Abs File)
- data Find t = Find Natural (Path Abs Dir)
- newtype Touch = Touch (Path Abs File)
- newtype Cat = Cat (Path Abs File)
- newtype CheckExists = CheckExists (Path Abs File)
- data BasicWrite = BasicWrite (Path Abs File) String
- newtype GitCheckout = GitCheckout String
- data GitClone = GitClone Bool (Either String (Path Abs Dir)) (Path Abs Dir)
- newtype GitSetOrigin = GitSetOrigin String
- newtype GitFetch = GitFetch String
- newtype GitReset = GitReset String
- data GenericCommand
- mkGenericCommand :: String -> Maybe GenericCommand
- unGenericCommand :: GenericCommand -> String
- readScript :: MonadIO m => Path Abs File -> m [GenericCommand]
Documentation
class Command a where Source #
Class for data types that represent shell commands in typed way.
Methods
renderCommand :: a -> String Source #
How to render the command before feeding it into shell (possibly via SSH).
parseResult :: Proxy a -> String -> Result a Source #
How to parse the result from stdout.
Instances
Unix whoami.
Constructors
| Whoami |
Specify directory in which to perform another command.
Create a directory. Does not fail if the directory already exists.
Delete file or directory.
Instances
Move or rename files or directories.
Create symlinks.
Instances
ls, so far used only to check existence of directories, so it's not
very functional right now.
Instances
Read link.
Constructors
| Readlink TargetSystem (Path Abs File) |
Find (a very limited version).
touch.
Command used to read the contents of a particular file in the host.
newtype CheckExists Source #
Command that checks for the existance of a particular file in the host.
Constructors
| CheckExists (Path Abs File) | The absolute path to the file you want to check for existence |
Instances
| Command CheckExists Source # | |
Defined in System.Hapistrano.Commands.Internal Associated Types type Result CheckExists Source # Methods renderCommand :: CheckExists -> String Source # parseResult :: Proxy CheckExists -> String -> Result CheckExists Source # | |
| type Result CheckExists Source # | |
Defined in System.Hapistrano.Commands.Internal | |
data BasicWrite Source #
Basic command that writes to a file some contents.
It uses the file > contents shell syntax and the contents is
represented as a String, so it shouldn't be used for
bigger writing operations. Currently used to write fail or success
to the .hapistrano_deploy_state file.
Constructors
| BasicWrite | |
Instances
| Command BasicWrite Source # | |
Defined in System.Hapistrano.Commands.Internal Associated Types type Result BasicWrite Source # Methods renderCommand :: BasicWrite -> String Source # parseResult :: Proxy BasicWrite -> String -> Result BasicWrite Source # | |
| type Result BasicWrite Source # | |
Defined in System.Hapistrano.Commands.Internal | |
newtype GitCheckout Source #
Git checkout.
Constructors
| GitCheckout String |
Instances
| Command GitCheckout Source # | |
Defined in System.Hapistrano.Commands.Internal Associated Types type Result GitCheckout Source # Methods renderCommand :: GitCheckout -> String Source # parseResult :: Proxy GitCheckout -> String -> Result GitCheckout Source # | |
| type Result GitCheckout Source # | |
Defined in System.Hapistrano.Commands.Internal | |
Git clone.
newtype GitSetOrigin Source #
Git set origin
Constructors
| GitSetOrigin String |
Instances
| Command GitSetOrigin Source # | |
Defined in System.Hapistrano.Commands.Internal Associated Types type Result GitSetOrigin Source # Methods renderCommand :: GitSetOrigin -> String Source # parseResult :: Proxy GitSetOrigin -> String -> Result GitSetOrigin Source # | |
| type Result GitSetOrigin Source # | |
Defined in System.Hapistrano.Commands.Internal | |
Git fetch (simplified).
Git reset.
data GenericCommand Source #
Weakly-typed generic command, avoid using it directly.
Instances
mkGenericCommand :: String -> Maybe GenericCommand Source #
Smart constructor that allows to create GenericCommands. Just a
little bit more safety.
unGenericCommand :: GenericCommand -> String Source #
Get the raw command back from GenericCommand.
readScript :: MonadIO m => Path Abs File -> m [GenericCommand] Source #
Read commands from a file.