doc: Include docs for initConfig (#231)

* doc: Include docs for initConfig

* doc: Update missing documentation

* ref: Increase boundaries for some dependencies

* doc: Modify documentation
This commit is contained in:
Cristhian Motoche 2024-01-16 07:46:48 -05:00 committed by GitHub
parent a2aa3dba43
commit 27511ae969
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 17 deletions

View File

@ -59,12 +59,12 @@ library
, gitrev >= 1.2 && < 1.4
, mtl >= 2.0 && < 3.0
, stm >= 2.0 && < 2.6
, path >= 0.5 && < 0.9
, path-io >= 1.2 && < 1.7
, path >= 0.5 && < 1.0
, path-io >= 1.2 && < 1.9
, process >= 1.4 && < 1.7
, text >= 1.2 && < 3
, typed-process >= 0.2 && < 0.3
, time >= 1.5 && < 1.11
, time >= 1.5 && < 1.13
, transformers >= 0.4 && < 0.6
, exceptions >= 0.10 && < 0.11
, yaml >= 0.11.7 && < 0.12
@ -110,8 +110,8 @@ test-suite test
, hapistrano
, hspec >= 2.0 && < 3.0
, mtl >= 2.0 && < 3.0
, path >= 0.5 && < 0.9
, path-io >= 1.2 && < 1.7
, path
, path-io
, process >= 1.4 && < 1.7
, QuickCheck >= 2.5.1 && < 3.0
, silently >= 1.2 && < 1.3

View File

@ -51,18 +51,16 @@ import qualified Data.Yaml as Yaml
import Numeric.Natural
import Path
import Path.IO
import System.Hapistrano.Commands
import System.Hapistrano.Config ( BuildCommand (..)
, CopyThing (..)
, ExecutionMode (..)
, deployStateFilename
)
import qualified System.Hapistrano.Config as HC
import System.Hapistrano.Core
import System.Hapistrano.Types
import qualified System.Directory as Directory
import System.Exit (exitFailure)
import qualified System.FilePath as FilePath
import System.Hapistrano.Commands
import qualified System.Hapistrano.Config as HC
import System.Hapistrano.Config (BuildCommand (..), CopyThing (..),
ExecutionMode (..),
deployStateFilename)
import System.Hapistrano.Core
import System.Hapistrano.Types
import System.IO (stderr)
import Text.Read (readMaybe)
@ -271,6 +269,8 @@ playScriptLocally cmds =
}) $
forM_ cmds $ flip execWithInheritStdout Nothing
-- | Create a file with an initial config file by getting information from the
-- user.
initConfig :: IO String -> IO ()
initConfig getLine' = do
configFilePath <- (FilePath.</> "hap.yml") <$> Directory.getCurrentDirectory

View File

@ -31,13 +31,13 @@ import Data.Aeson.Types (typeMismatch)
import Data.Function (on)
import Data.List (nubBy)
import Data.Maybe (maybeToList)
import Data.Yaml
import Data.Proxy
import Data.Yaml
import Numeric.Natural
import Path
import System.Hapistrano.Commands
import System.Hapistrano.Types (ReleaseFormat(..), Shell(..),
Source(..), TargetSystem(..))
import System.Hapistrano.Types (ReleaseFormat (..), Shell (..),
Source (..), TargetSystem (..))
-- | Hapistrano configuration typically loaded from @hap.yaml@ file.
@ -104,11 +104,14 @@ data Target =
, targetSshArgs :: [String]
} deriving (Eq, Ord, Show)
-- | Command and execution mode for build command.
data BuildCommand = BuildCommand
{ buildCommandCommand :: GenericCommand
, buildCommandExecutionMode :: ExecutionMode
} deriving (Eq, Ord, Show)
-- | The execution mode determines whether commands will be executed
-- on the lead target or on all targets.
data ExecutionMode = LeadTarget | AllTargets
deriving (Eq, Ord, Show)

View File

@ -228,6 +228,7 @@ data InitTemplateConfig = InitTemplateConfig
, restartCommand :: Maybe T.Text
}
-- | Default initial template for creating hapistrano file.
defaultInitTemplateConfig :: IO InitTemplateConfig
defaultInitTemplateConfig = do
let shellWithDefault d cmd = do