diff --git a/.all-contributorsrc b/.all-contributorsrc
index 960ebfd..9a16b8e 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -234,8 +234,18 @@
"contributions": [
"code"
]
+ },
+ {
+ "login": "blackheaven",
+ "name": "Gautier DI FOLCO",
+ "avatar_url": "https://avatars.githubusercontent.com/u/1362807?v=4",
+ "profile": "https://gautier.difolco.dev/",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7,
- "linkToUsage": true
+ "linkToUsage": true,
+ "commitType": "docs"
}
diff --git a/README.md b/README.md
index a5fef4a..3f4fea2 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
-[![Build](https://github.com/stackbuilders/hapistrano/actions/workflows/build.yml/badge.svg?branch=master)](https://github.com/stackbuilders/hapistrano/actions/workflows/build.yml)
+[![Build](https://github.com/stackbuilders/hapistrano/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/stackbuilders/hapistrano/actions/workflows/build.yml)
-[![All Contributors](https://img.shields.io/badge/all_contributors-25-orange.svg?style=flat-square)](#contributors-)
+[![All Contributors](https://img.shields.io/badge/all_contributors-26-orange.svg?style=flat-square)](#contributors-)
[![Draft](https://github.com/stackbuilders/hapistrano/actions/workflows/draft.yml/badge.svg)](https://github.com/stackbuilders/hapistrano/actions/workflows/draft.yml)
[![Release](https://github.com/stackbuilders/hapistrano/actions/workflows/release.yml/badge.svg)](https://github.com/stackbuilders/hapistrano/actions/workflows/release.yml)
@@ -46,7 +46,7 @@ host: user@myserver.com
port: 2222
# To perform version control operations
repo: 'https://github.com/stackbuilders/hapistrano.git'
-revision: origin/master
+revision: origin/main
# To copy the contents of the directory
local_directory: '/tmp/my-project'
build_script:
@@ -151,7 +151,7 @@ Configuration files are parsed using
therefore, variable substitution is supported. Considering the following configuration file:
```yaml
-revision: "_env:HAPISTRANO_REVISION:origin/master
+revision: "_env:HAPISTRANO_REVISION:origin/main
...
```
@@ -356,6 +356,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Nitin Gupta 💻 |
Omar GarcÃa 💻 |
wanderer163 💻 |
+ Gautier DI FOLCO 💻 |
diff --git a/example/hap.yaml b/example/hap.yaml
index 6808b1e..c5d9d34 100644
--- a/example/hap.yaml
+++ b/example/hap.yaml
@@ -1,6 +1,6 @@
deploy_path: "/tmp/hap-example"
repo: "https://github.com/stackbuilders/hapistrano.git"
-revision: "origin/master"
+revision: "origin/main"
host: vagrant@127.0.0.1
port: 2222
working_directory: example
diff --git a/hapistrano.cabal b/hapistrano.cabal
index e09ffbe..9179d30 100644
--- a/hapistrano.cabal
+++ b/hapistrano.cabal
@@ -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
diff --git a/spec/System/HapistranoSpec.hs b/spec/System/HapistranoSpec.hs
index 5c14723..f420c92 100644
--- a/spec/System/HapistranoSpec.hs
+++ b/spec/System/HapistranoSpec.hs
@@ -200,7 +200,7 @@ spec = do
-- let's check that the dir exists and contains the right files
(liftIO . readFile . fromAbsFile) (rpath > $(mkRelFile "foo.txt")) `shouldReturn`
"Foo!\n"
- it "deploys properly a branch other than master" $ \(deployPath, repoPath) ->
+ it "deploys properly a branch other than main" $ \(deployPath, repoPath) ->
runHap $ do
let task = mkTaskWithCustomRevision deployPath repoPath testBranchName
release <- Hap.pushRelease task
@@ -437,19 +437,19 @@ withSandbox action =
populateTestRepo :: Path Abs Dir -> IO ()
populateTestRepo path =
runHap $ do
- justExec path "git init -b master"
+ justExec path "git init -b main"
justExec path "git config --local --replace-all push.default simple"
justExec path "git config --local --replace-all user.email hap@hap"
justExec path "git config --local --replace-all user.name Hap"
justExec path "echo 'Foo!' > foo.txt"
justExec path "git add -A"
justExec path "git commit -m 'Initial commit'"
- -- Add dummy content to a branch that is not master
+ -- Add dummy content to a branch that is not main
justExec path ("git checkout -b " ++ testBranchName)
justExec path "echo 'Bar!' > bar.txt"
justExec path "git add bar.txt"
justExec path "git commit -m 'Added more bars to another branch'"
- justExec path "git checkout master"
+ justExec path "git checkout main"
-- | Execute arbitrary commands in the specified directory.
justExec :: Path Abs Dir -> String -> Hapistrano ()
@@ -480,7 +480,7 @@ runHapWithShell shell m = do
-- | Make a 'Task' given deploy path and path to the repo.
mkTask :: Path Abs Dir -> Path Abs Dir -> Task
mkTask deployPath repoPath =
- mkTaskWithCustomRevision deployPath repoPath "master"
+ mkTaskWithCustomRevision deployPath repoPath "main"
mkTaskWithCustomRevision :: Path Abs Dir -> Path Abs Dir -> String -> Task
mkTaskWithCustomRevision deployPath repoPath revision =
diff --git a/src/System/Hapistrano.hs b/src/System/Hapistrano.hs
index c3ab3e1..8fc6ff7 100644
--- a/src/System/Hapistrano.hs
+++ b/src/System/Hapistrano.hs
@@ -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
diff --git a/src/System/Hapistrano/Config.hs b/src/System/Hapistrano/Config.hs
index 5d92f51..2f89cc3 100644
--- a/src/System/Hapistrano/Config.hs
+++ b/src/System/Hapistrano/Config.hs
@@ -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)
diff --git a/src/System/Hapistrano/Types.hs b/src/System/Hapistrano/Types.hs
index 0fb9048..6a4cb7a 100644
--- a/src/System/Hapistrano/Types.hs
+++ b/src/System/Hapistrano/Types.hs
@@ -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