Skip to content

Commit

Permalink
doc: Include docs for initConfig (#231)
Browse files Browse the repository at this point in the history
* doc: Include docs for initConfig

* doc: Update missing documentation

* ref: Increase boundaries for some dependencies

* doc: Modify documentation
  • Loading branch information
CristhianMotoche authored Jan 16, 2024
1 parent a2aa3db commit 27511ae
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
10 changes: 5 additions & 5 deletions hapistrano.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
16 changes: 8 additions & 8 deletions src/System/Hapistrano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,16 @@ import qualified Data.Yaml as Yaml
import Numeric.Natural
import Path
import Path.IO
import qualified System.Directory as Directory
import System.Exit (exitFailure)
import qualified System.FilePath as FilePath
import System.Hapistrano.Commands
import System.Hapistrano.Config ( BuildCommand (..)
, CopyThing (..)
, ExecutionMode (..)
, deployStateFilename
)
import qualified System.Hapistrano.Config as HC
import System.Hapistrano.Config (BuildCommand (..), CopyThing (..),
ExecutionMode (..),
deployStateFilename)
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.IO (stderr)
import Text.Read (readMaybe)

Expand Down Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions src/System/Hapistrano/Config.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions src/System/Hapistrano/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 27511ae

Please sign in to comment.