mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-12-27 14:02:54 +03:00
Decoupled functions from using .hapistrano_deploy_state
filename directly
This commit is contained in:
parent
b55d5bb9fc
commit
fd4fdc68d3
@ -157,11 +157,11 @@ spec = do
|
||||
-- This fails if there are unstaged changes
|
||||
justExec rpath "git diff --exit-code"
|
||||
describe "createHapistranoDeployState" $ do
|
||||
it "creates the .hapistrano_deploy_state file correctly" $ \(deployPath, repoPath) ->
|
||||
it ("creates the " <> deployStateFilename <> " file correctly") $ \(deployPath, repoPath) ->
|
||||
runHap $ do
|
||||
let task = mkTask deployPath repoPath
|
||||
release <- Hap.pushRelease task
|
||||
parseStatePath <- parseRelFile ".hapistrano_deploy_state"
|
||||
parseStatePath <- parseRelFile deployStateFilename
|
||||
actualReleasePath <- releasePath deployPath release Nothing
|
||||
let stateFilePath = actualReleasePath </> parseStatePath
|
||||
Hap.createHapistranoDeployState deployPath release Success
|
||||
@ -194,7 +194,7 @@ spec = do
|
||||
task = mkTask deployPath repoPath
|
||||
Hap.playScriptLocally localCommands
|
||||
release <- Hap.pushRelease task
|
||||
parseStatePath <- parseRelFile ".hapistrano_deploy_state"
|
||||
parseStatePath <- parseRelFile deployStateFilename
|
||||
actualReleasePath <- releasePath deployPath release Nothing
|
||||
let stateFilePath = actualReleasePath </> parseStatePath
|
||||
Hap.createHapistranoDeployState deployPath release Success
|
||||
|
@ -45,6 +45,7 @@ import Path
|
||||
import System.Hapistrano.Commands
|
||||
import System.Hapistrano.Core
|
||||
import System.Hapistrano.Types
|
||||
import System.Hapistrano.Config (deployStateFilename)
|
||||
import Text.Read (readMaybe)
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
@ -127,7 +128,7 @@ createHapistranoDeployState
|
||||
-> DeployState -- ^ Indicates how the deployment went
|
||||
-> Hapistrano ()
|
||||
createHapistranoDeployState deployPath release state = do
|
||||
parseStatePath <- parseRelFile ".hapistrano_deploy_state"
|
||||
parseStatePath <- parseRelFile deployStateFilename
|
||||
actualReleasePath <- releasePath deployPath release Nothing
|
||||
let stateFilePath = actualReleasePath </> parseStatePath
|
||||
exec (Touch stateFilePath) (Just release) -- creates '.hapistrano_deploy_state'
|
||||
@ -361,7 +362,7 @@ deployState
|
||||
-> Release -- ^ 'Release' identifier
|
||||
-> Hapistrano (Maybe DeployState) -- ^ Whether the release was deployed successfully or not
|
||||
deployState deployPath mWorkingDir release = do
|
||||
parseStatePath <- parseRelFile ".hapistrano_deploy_state"
|
||||
parseStatePath <- parseRelFile deployStateFilename
|
||||
actualReleasePath <- releasePath deployPath release mWorkingDir
|
||||
let stateFilePath = actualReleasePath </> parseStatePath
|
||||
doesExist <- exec (CheckExists stateFilePath) (Just release)
|
||||
|
@ -7,7 +7,8 @@
|
||||
module System.Hapistrano.Config
|
||||
( Config (..)
|
||||
, CopyThing (..)
|
||||
, Target (..))
|
||||
, Target (..)
|
||||
, deployStateFilename)
|
||||
where
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
@ -141,3 +142,6 @@ mkCmd raw =
|
||||
case mkGenericCommand raw of
|
||||
Nothing -> fail "invalid restart command"
|
||||
Just cmd -> return cmd
|
||||
|
||||
deployStateFilename :: String
|
||||
deployStateFilename = ".hapistrano_deploy_state"
|
Loading…
Reference in New Issue
Block a user