packages feed

hapistrano 0.4.5.0 → 0.4.6.0

raw patch · 7 files changed

+54/−17 lines, 7 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ System.Hapistrano.Commands: GitSetOrigin :: String -> GitSetOrigin
+ System.Hapistrano.Commands: newtype GitSetOrigin
+ System.Hapistrano.Commands.Internal: GitSetOrigin :: String -> GitSetOrigin
+ System.Hapistrano.Commands.Internal: instance System.Hapistrano.Commands.Internal.Command System.Hapistrano.Commands.Internal.GitSetOrigin
+ System.Hapistrano.Commands.Internal: newtype GitSetOrigin

Files

CHANGELOG.md view
@@ -1,3 +1,7 @@+## 0.4.6.0+### Modified+* It sets the origin repository (`git remote set-url origin <repo>`) on every pushed release.+ ## 0.4.5.0 ### Added * New commands that let you enable/disable a maintenance mode
README.md view
@@ -1,6 +1,6 @@-[![CI](https://github.com/stackbuilders/hapistrano/actions/workflows/ci.yml/badge.svg)](https://github.com/stackbuilders/hapistrano/actions/workflows/ci.yml)-[![Docker](https://github.com/stackbuilders/hapistrano/actions/workflows/docker.yml/badge.svg)](https://github.com/stackbuilders/hapistrano/actions/workflows/docker.yml)-[![Hackage version](https://img.shields.io/hackage/v/hapistrano.svg)](http://hackage.haskell.org/package/hapistrano)+[![Build](https://github.com/stackbuilders/hapistrano/actions/workflows/build.yml/badge.svg)](https://github.com/stackbuilders/hapistrano/actions/workflows/build.yml)+[![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)  # Hapistrano @@ -53,7 +53,7 @@  ```yaml deploy_path: '/var/projects/my-project'-host: myserver.com+host: user@myserver.com port: 2222 # To perform version control operations repo: 'https://github.com/stackbuilders/hapistrano.git'@@ -83,7 +83,8 @@ The following parameters are *optional*:  * `host` — the target host, if missing, `localhost` will be assumed (which-  is useful for testing and playing with `hap` locally).+  is useful for testing and playing with `hap` locally). You can specify the+  user that is going to connect to the server here. Example: `user@server.com`. * `port` — SSH port number to use. If missing, 22 will be used. * `shell` — Shell to use. Currently supported: `zsh` ans `bash`. If missing, `Bash` will be used. * `ssh_args` — Optional ssh arguments. Only `-p` is passed via the `port` variable.@@ -233,6 +234,10 @@ date**, newer versions are published to [GitHub's Docker Registry](https://github.com/stackbuilders/hapistrano/pkgs/container/hapistrano). +## GH Actions++Check the documentation [here](.github/workflows/README.md)+ ## Nix  If you want to use Nix for building Hapistrano, the required release.nix and default.nix are available.@@ -276,9 +281,8 @@  ## Contributing -Pull requests for modifications to this program are welcome. Fork and-open a PR. Feel free to [email me](mailto:justin@stackbuilders.com) if-you have questions about what may be accepted before working on a PR.+Do you want to contribute to this project? Please take a look at our [contributing guideline](/docs/CONTRIBUTING.md) to know how you can help us build it. -If you're looking for a place to start, you may want to check the-[open issue](https://github.com/stackbuilders/hapistrano/issues).+---+<img src="https://www.stackbuilders.com/media/images/Sb-supports.original.png" alt="Stack Builders" width="50%"></img>+[Check out our libraries](https://github.com/stackbuilders/) | [Join our team](https://www.stackbuilders.com/join-us/)
hapistrano.cabal view
@@ -1,6 +1,6 @@ cabal-version:       1.18 name:                hapistrano-version:             0.4.5.0+version:             0.4.6.0 synopsis:            A deployment library for Haskell applications description:   .
spec/System/HapistranoSpec.hs view
@@ -17,7 +17,8 @@   import Path.IO-import System.Directory (getCurrentDirectory, listDirectory)+import System.Directory+    ( doesFileExist, getCurrentDirectory, listDirectory ) import qualified System.Hapistrano as Hap import qualified System.Hapistrano.Commands as Hap import qualified System.Hapistrano.Core as Hap@@ -25,16 +26,13 @@ import System.IO import System.IO.Silently (capture_) import System.Info (os)-import Test.Hspec hiding (shouldBe, shouldReturn)+import Test.Hspec hiding (shouldBe, shouldContain, shouldReturn) import qualified Test.Hspec as Hspec import Test.Hspec.QuickCheck import Test.QuickCheck hiding (Success) import System.Hapistrano (releasePath) import System.Hapistrano.Config (deployStateFilename)-import System.Directory import System.Hapistrano.Maintenance-import Path-import Control.Monad.IO.Class  testBranchName :: String testBranchName = "another_branch"@@ -176,6 +174,19 @@             ("test `git rev-parse --abbrev-ref HEAD` = " ++ testBranchName)         -- This fails if there are unstaged changes           justExec rpath "git diff --exit-code"+      it "updates the origin url when it's changed" $ \(deployPath, repoPath) ->+        runHap $ do+          let tempDirPrefix = "hap-test-repotwo"+          withSystemTempDir tempDirPrefix $ \repoPathTwo -> do+            let task1 = mkTask deployPath repoPath+                task2 = mkTask deployPath repoPathTwo+                repoConfigFile = deployPath </> $(mkRelDir "repo") </> $(mkRelFile "config")+            liftIO $ populateTestRepo repoPathTwo+            void $ Hap.pushRelease task1+            void $ Hap.pushRelease task2++            repoFile <- (liftIO . readFile . fromAbsFile) repoConfigFile +            repoFile `shouldContain` tempDirPrefix     describe "createHapistranoDeployState" $ do       it ("creates the " <> deployStateFilename <> " file correctly") $ \(deployPath, repoPath) ->         runHap $ do@@ -259,7 +270,7 @@             (Hap.releasePath deployPath r Nothing >>= doesDirExist) `shouldReturn` True       context "when the --keep-one-failed flag is active" $         it "should delete failed releases other than the most recent" $ \(deployPath, repoPath) ->-          let successfulRelease = mkReleaseWithState deployPath repoPath Success +          let successfulRelease = mkReleaseWithState deployPath repoPath Success               failedRelease = mkReleaseWithState deployPath repoPath Fail in           runHap $ do             rs <- sequence [successfulRelease, successfulRelease, failedRelease, failedRelease, failedRelease]@@ -351,6 +362,10 @@ -- | Lifted 'Hspec.shouldBe'. shouldBe :: (MonadIO m, Show a, Eq a) => a -> a -> m () shouldBe x y = liftIO (x `Hspec.shouldBe` y)++-- | Lifted 'Hspec.shouldContain'.+shouldContain :: (MonadIO m, Show a, Eq a) => [a] -> [a] -> m ()+shouldContain x y = liftIO (x `Hspec.shouldContain` y)  -- | Lifted 'Hspec.shouldReturn'. shouldReturn :: (MonadIO m, Show a, Eq a) => m a -> a -> m ()
src/System/Hapistrano.hs view
@@ -216,6 +216,7 @@     `catchError` const (return False)   unless exists $     exec (GitClone True (Left repo) cpath) maybeRelease+  exec (Cd cpath (GitSetOrigin repo)) maybeRelease   exec (Cd cpath (GitFetch "origin")) maybeRelease -- TODO store this in task description?  -- | Create a new release identifier based on current timestamp.
src/System/Hapistrano/Commands.hs view
@@ -30,6 +30,7 @@   , BasicWrite(..)   , GitCheckout(..)   , GitClone(..)+  , GitSetOrigin(..)   , GitFetch(..)   , GitReset(..)   , GenericCommand
src/System/Hapistrano/Commands/Internal.hs view
@@ -281,6 +281,18 @@       [Just "fetch", Just remote, Just "+refs/heads/\\*:refs/heads/\\*"]   parseResult Proxy _ = () +-- | Git set origin+newtype GitSetOrigin =+  GitSetOrigin String++instance Command GitSetOrigin where+  type Result GitSetOrigin = ()+  renderCommand (GitSetOrigin remote) =+    formatCmd+      "git"+      [Just "remote", Just "set-url", Just "origin", Just remote]+  parseResult Proxy _ = ()+ -- | Git reset. newtype GitReset =   GitReset String