-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A project initialization library -- -- A project initialization library based on stache. See the project's -- README for more information. @package project-forge @version 0.2.0.0 -- | Functions needed for getting templates from remote git repositories module ProjectForge.Get.Git -- | A limited set of arguments for git clone that correspond to -- the following command: -- --
--   git clone 
--      --branch OptionalBranch
--      --depth OptionalDepth 
--      repository 
--      directory
--   
data GitCloneArgs MkGitCloneArgs :: !GitURL -> !FilePath -> !Maybe Branch -> !Maybe Integer -> GitCloneArgs -- | git clone repository [repository] :: GitCloneArgs -> !GitURL -- | git clone directory [directory] :: GitCloneArgs -> !FilePath -- | git clone branch [branch] :: GitCloneArgs -> !Maybe Branch -- | git clone depth [depth] :: GitCloneArgs -> !Maybe Integer -- | A git url as a String. type GitURL = String -- | A git branch as a String. type Branch = String -- | A ProcessConfig for: -- --
--   git clone  
--   
-- -- NOTE: According to the [`typed-process` -- documentaiton](https:/github.comfpco/typed-process#readme), -- "it's highly recommended that you compile any program using this -- library with the multi-threaded runtime, usually by adding -- ghc-options: -threaded to your executable stanza in your cabal or -- package.yaml file. The single-threaded runtime necessitates some -- inefficient polling to be used under the surface." gitClone :: GitCloneArgs -> ProcessConfig () () () instance GHC.Show.Show ProjectForge.Get.Git.GitCloneArgs instance GHC.Classes.Eq ProjectForge.Get.Git.GitCloneArgs -- | Defines the template types used internally in ProjectForge module ProjectForge.ProjectTemplate -- | A FileTemplate is a pair of Templates: one -- for a file's name and one for a file's contents. -- -- See compileFileTemplate for a utility to create a -- FileTemplate from text inputs. data FileTemplate MkFileTemplate :: !FilePath -> !Template -> !Template -> FileTemplate -- | name of the template file [originalFilename] :: FileTemplate -> !FilePath -- | template for a file's name [fileNameTemplate] :: FileTemplate -> !Template -- | template for contents of a file [fileContentsTemplate] :: FileTemplate -> !Template -- | A collection of FileTemplate corresponding to all the -- files to be produced by an initialization template. newtype ProjectTemplate MkProjectTemplate :: Set FileTemplate -> ProjectTemplate instance GHC.Classes.Ord ProjectForge.ProjectTemplate.FileTemplate instance GHC.Show.Show ProjectForge.ProjectTemplate.FileTemplate instance GHC.Classes.Eq ProjectForge.ProjectTemplate.FileTemplate instance GHC.Show.Show ProjectForge.ProjectTemplate.ProjectTemplate instance GHC.Classes.Eq ProjectForge.ProjectTemplate.ProjectTemplate instance GHC.Base.Semigroup ProjectForge.ProjectTemplate.ProjectTemplate -- | Functions for compiling Project and File Templates module ProjectForge.Compile -- | Create a FileTemplate from a (FilePath, Text) -- pair. Both the FilePath and Text may contain -- mustache variables. -- -- This function returns an error (within MonadIO) in the -- case that compileMustacheText fails to compile either -- the fileNameTemplate or fileContentsTemplate. -- -- For example, the following code: -- --
--   compileFileTemplate ("{{prjId}}.md",  "{{prjId}}")
--   
-- -- produces the following template: -- --
--   MkFileTemplate
--       { fileNameTemplate = Template
--           { templateActual = PName
--               { unPName = Filename }
--           , templateCache = fromList
--               [
--                   ( PName
--                       { unPName = Filename }
--                   ,
--                       [ EscapedVar
--                           ( Key
--                               { unKey = [ "prjId" ] }
--                           )
--                       , TextBlock ".md"
--                       ]
--                   )
--               ]
--           }
--       , fileContentsTemplate = Template
--           { templateActual = PName
--               { unPName = Contents }
--           , templateCache = fromList
--               [
--                   ( PName
--                       { unPName = Contents }
--                   ,
--                       [ EscapedVar
--                           ( Key
--                               { unKey = [ "prjId" ] }
--                           )
--                       ]
--                   )
--               ]
--           }
--       }
--   
compileFileTemplate :: MonadIO m => (FilePath, Text) -> m FileTemplate -- | Generate all FileTemplates for a -- ProjectTemplate. compileProjectTemplate :: MonadIO m => [(FilePath, Text)] -> m ProjectTemplate -- | Functions for marshalling Project and File Templates into a program. module ProjectForge.Get -- | Convert a directory to a ProjectTemplate. A -- GetProjectTemplateError exception is thrown if the input -- directory does not exist. -- --
--   >>> runSimpleLoggingT $ getProjectTemplateFromDir "foo"
--   NotADirectory
--   
getProjectTemplateFromDir :: (MonadLogger m, MonadIO m) => FilePath -> m ProjectTemplate -- | Convert a git repository to a ProjectTemplate. -- -- This action creates a shallow clone of the repo in a temporary -- directory before calling getProjectTemplateFromDir on -- the temporary directory. The temporary directory is removed when -- complete. -- -- This function requires that git be -- installed. getProjectTemplateFromGit :: (MonadLogger m, MonadIO m) => Maybe FilePath -> GitURL -> Maybe Branch -> m ProjectTemplate -- | Convert a file to a FileTemplate. A -- GetProjectTemplateError exception is thrown if the input file -- does not exist. -- --
--   >>> runSimpleLoggingT $ getFileTemplateFromFile "foo.txt"
--   FileNotFound
--   
getFileTemplateFromFile :: (MonadLogger m, MonadIO m) => FilePath -> m FileTemplate instance GHC.Generics.Generic ProjectForge.Get.GetProjectTemplateError instance GHC.Show.Show ProjectForge.Get.GetProjectTemplateError instance GHC.Exception.Type.Exception ProjectForge.Get.GetProjectTemplateError module ProjectForge.Reexports -- | A JSON value represented as a Haskell value. data Value data Text -- | Monads in which IO computations may be embedded. Any monad -- built by applying a sequence of monad transformers to the IO -- monad will be an instance of this class. -- -- Instances should satisfy the following laws, which state that -- liftIO is a transformer of monads: -- -- class Monad m => MonadIO (m :: Type -> Type) -- | Functions for rendering Project and File Templates. -- -- Rendering a Template interpolates the partial values -- in a Template with values from a Value. module ProjectForge.Render -- | Renders a FileTemplate using -- renderMustache. Values to be input into the template -- are presented via a Value representation. -- --
--   >>> import Data.Aeson (toJSON, object, (.=))
--   
--   >>> import ProjectForge.Compile
--   
--   >>> import Blammo.Logging.Simple
--   
--   >>> let settings = toJSON (object [ "prjId" .= "P0000"])
--   
--   >>> let exampleTemplate = compileFileTemplate ("{{prjId}}.md",  "This is {{prjId}}")
--   
--   >>> runSimpleLoggingT .  (\x -> renderFileTemplate defaultRenderTemplateOpts x settings) =<< exampleTemplate
--   ([],("P0000.md","This is P0000"))
--   
renderFileTemplate :: (MonadLogger m, MonadIO m) => RenderTemplateOpts -> FileTemplate -> Value -> m (FilePath, Text) -- | Renders a ProjectTemplate, returning a list of -- filepaths and file contents that may be written to files. renderProjectTemplate :: (MonadIO m, MonadLogger m) => RenderTemplateOpts -> ProjectTemplate -> Value -> m [(FilePath, Text)] -- | Utility for writing the results for -- renderProjectTemplate to files. writeTemplateResult :: (MonadLogger m, MonadIO m) => [(FilePath, Text)] -> m () -- | Options to control how renderFileTemplate is run. newtype RenderTemplateOpts MkRenderTemplateOpts :: RenderWarnHandling -> RenderTemplateOpts [handleWarnings] :: RenderTemplateOpts -> RenderWarnHandling -- | Flag for how to handle any -- 'Text.Stache.Type.MustacheWarning's that may result from -- renderFileTemplate. data RenderWarnHandling -- | lift mustache warnings to errors WarningAsError :: RenderWarnHandling -- | Ignore warnings Ignore :: RenderWarnHandling -- | New type wrapper for a list of -- 'Text.Stache.Type.MustacheWarning's so that it can be made an -- instance of Exception. data RenderException -- | Default RenderTemplateOpts defaultRenderTemplateOpts :: RenderTemplateOpts instance GHC.Show.Show ProjectForge.Render.RenderWarnHandling instance GHC.Classes.Eq ProjectForge.Render.RenderWarnHandling instance GHC.Show.Show ProjectForge.Render.RenderException instance GHC.Classes.Eq ProjectForge.Render.RenderException instance GHC.Show.Show ProjectForge.Render.RenderTemplateOpts instance GHC.Classes.Eq ProjectForge.Render.RenderTemplateOpts instance GHC.Exception.Type.Exception ProjectForge.Render.RenderException -- | Functions for creating project initialization applications module ProjectForge.Actions -- | Create an IO action that compiles, renders, and writes a -- ProjectTemplate. createProjectTemplateAction :: (MonadLogger m, MonadIO m, ToJSON a) => TemplateActionOpts -> TemplateLocation -> a -> m () -- | Default options defaultTemplateActionOpts :: TemplateActionOpts -- | Location of template directory data TemplateLocation Local :: FilePath -> TemplateLocation Git :: GitURL -> TemplateLocation -- | Options for compiling, rendering and writing a a -- ProjectTemplate. newtype TemplateActionOpts MkTemplateActionOpts :: RenderTemplateOpts -> TemplateActionOpts -- | The RenderTemplateOpts for the action [renderOpts] :: TemplateActionOpts -> RenderTemplateOpts instance GHC.Show.Show ProjectForge.Actions.TemplateLocation instance GHC.Classes.Eq ProjectForge.Actions.TemplateLocation -- | The main module for ProjectForge module ProjectForge