Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
ProjectForge.Get
Contents
Description
Functions for marshalling Project and File Templates into a program.
Synopsis
- getProjectTemplateFromDir :: (MonadLogger m, MonadIO m) => FilePath -> m ProjectTemplate
- getProjectTemplateFromGit :: (MonadLogger m, MonadIO m) => Maybe FilePath -> GitURL -> Maybe Branch -> m ProjectTemplate
- getFileTemplateFromFile :: (MonadLogger m, MonadIO m) => FilePath -> m FileTemplate
- directoryListToTemplate :: MonadIO m => [(FilePath, ByteString)] -> m ProjectTemplate
Get Templates
Utilities for converting a directory into a
.ProjectTemplate
getProjectTemplateFromDir Source #
Arguments
:: (MonadLogger m, MonadIO m) | |
=> FilePath | name of the directory containing template files |
-> m ProjectTemplate |
Convert a directory to a
.
A ProjectTemplate
GetProjectTemplateError
exception is thrown if the input directory
does not exist.
>>>
runSimpleLoggingT $ getProjectTemplateFromDir "foo"
NotADirectory
getProjectTemplateFromGit Source #
Arguments
:: (MonadLogger m, MonadIO m) | |
=> Maybe FilePath | Optional parent directory in which to clone the repo in. Defaults to current directory. |
-> GitURL | The Git URL of the template directory. |
-> Maybe Branch | Optional name of git branch.
If |
-> m ProjectTemplate |
Convert a git repository to a ProjectTemplate
.
This action creates a shallow clone of the repo in a temporary directory
before calling
on the temporary directory.
The temporary directory is removed when complete.getProjectTemplateFromDir
This function requires that
git
be installed.
getFileTemplateFromFile Source #
Arguments
:: (MonadLogger m, MonadIO m) | |
=> FilePath | name of the file |
-> m FileTemplate |
Convert a file to a
.
A FileTemplate
GetProjectTemplateError
exception is thrown if the input file
does not exist.
>>>
runSimpleLoggingT $ getFileTemplateFromFile "foo.txt"
FileNotFound
directoryListToTemplate Source #
Arguments
:: MonadIO m | |
=> [(FilePath, ByteString)] | list of ( |
-> m ProjectTemplate |
Converts a list of FilePath
and ByteString
pairs to a
.ProjectTemplate
The ByteString
are decoded into
by
Text
.
If decoding results in a decodeUtf8
Data.Text.Encoding.Error.UnicodeException
for any value,
then this is thrown as an exception.