Merge pull request #234 from stackbuilders/master

chore:  Bring last changes to main
This commit is contained in:
Cristhian Motoche 2024-01-23 13:17:31 -05:00 committed by GitHub
commit e8ec435b2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 43 additions and 28 deletions

View File

@ -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"
}

View File

@ -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-BADGE:START - Do not remove or modify this section -->
[![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-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
[![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
<td align="center" valign="top" width="14.28%"><a href="https://www.linkedin.com/in/ng2906/"><img src="https://avatars.githubusercontent.com/u/26463272?v=4?s=100" width="100px;" alt="Nitin Gupta"/><br /><sub><b>Nitin Gupta</b></sub></a><br /><a href="https://github.com/stackbuilders/hapistrano/commits?author=ng29" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="http://nebtrx.github.com/"><img src="https://avatars.githubusercontent.com/u/1876959?v=4?s=100" width="100px;" alt="Omar García"/><br /><sub><b>Omar García</b></sub></a><br /><a href="https://github.com/stackbuilders/hapistrano/commits?author=nebtrx" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://github.com/wanderer163"><img src="https://avatars.githubusercontent.com/u/93438190?v=4?s=100" width="100px;" alt="wanderer163"/><br /><sub><b>wanderer163</b></sub></a><br /><a href="https://github.com/stackbuilders/hapistrano/commits?author=wanderer163" title="Code">💻</a></td>
<td align="center" valign="top" width="14.28%"><a href="https://gautier.difolco.dev/"><img src="https://avatars.githubusercontent.com/u/1362807?v=4?s=100" width="100px;" alt="Gautier DI FOLCO"/><br /><sub><b>Gautier DI FOLCO</b></sub></a><br /><a href="https://github.com/stackbuilders/hapistrano/commits?author=blackheaven" title="Code">💻</a></td>
</tr>
</tbody>
<tfoot>

View File

@ -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

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

@ -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 =

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