mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-12-27 22:12:30 +03:00
Added new Unknown
value to DeployState
enum
This commit is contained in:
parent
4676c3217c
commit
eb5d1071b8
@ -37,7 +37,7 @@ import Control.Monad
|
|||||||
import Control.Monad.Except
|
import Control.Monad.Except
|
||||||
import Control.Monad.Reader (local, runReaderT)
|
import Control.Monad.Reader (local, runReaderT)
|
||||||
import Data.List (dropWhileEnd, genericDrop, sortOn)
|
import Data.List (dropWhileEnd, genericDrop, sortOn)
|
||||||
import Data.Maybe (mapMaybe)
|
import Data.Maybe (mapMaybe, fromMaybe)
|
||||||
import Data.Ord (Down (..))
|
import Data.Ord (Down (..))
|
||||||
import Data.Time
|
import Data.Time
|
||||||
import Numeric.Natural
|
import Numeric.Natural
|
||||||
@ -273,8 +273,8 @@ releasesWithState selectedState deployPath = do
|
|||||||
. deployState deployPath Nothing
|
. deployState deployPath Nothing
|
||||||
) releases
|
) releases
|
||||||
where
|
where
|
||||||
stateToBool :: Maybe DeployState -> Bool
|
stateToBool :: DeployState -> Bool
|
||||||
stateToBool (Just Fail) = False
|
stateToBool Fail = False
|
||||||
stateToBool _ = True
|
stateToBool _ = True
|
||||||
|
|
||||||
----------------------------------------------------------------------------
|
----------------------------------------------------------------------------
|
||||||
@ -358,7 +358,7 @@ deployState
|
|||||||
:: Path Abs Dir -- ^ Deploy path
|
:: Path Abs Dir -- ^ Deploy path
|
||||||
-> Maybe (Path Rel Dir) -- ^ Working directory
|
-> Maybe (Path Rel Dir) -- ^ Working directory
|
||||||
-> Release -- ^ 'Release' identifier
|
-> Release -- ^ 'Release' identifier
|
||||||
-> Hapistrano (Maybe DeployState) -- ^ Whether the release was deployed successfully or not
|
-> Hapistrano DeployState -- ^ Whether the release was deployed successfully or not
|
||||||
deployState deployPath mWorkingDir release = do
|
deployState deployPath mWorkingDir release = do
|
||||||
parseStatePath <- parseRelFile deployStateFilename
|
parseStatePath <- parseRelFile deployStateFilename
|
||||||
actualReleasePath <- releasePath deployPath release mWorkingDir
|
actualReleasePath <- releasePath deployPath release mWorkingDir
|
||||||
@ -366,8 +366,8 @@ deployState deployPath mWorkingDir release = do
|
|||||||
doesExist <- exec (CheckExists stateFilePath) (Just release)
|
doesExist <- exec (CheckExists stateFilePath) (Just release)
|
||||||
if doesExist then do
|
if doesExist then do
|
||||||
deployStateContents <- exec (Cat stateFilePath) (Just release)
|
deployStateContents <- exec (Cat stateFilePath) (Just release)
|
||||||
return $ readMaybe deployStateContents
|
return $ (fromMaybe Unknown . readMaybe) deployStateContents
|
||||||
else return Nothing
|
else return Unknown
|
||||||
|
|
||||||
stripDirs :: Path Abs Dir -> [Path Abs t] -> Hapistrano [Path Rel t]
|
stripDirs :: Path Abs Dir -> [Path Abs t] -> Hapistrano [Path Rel t]
|
||||||
stripDirs path =
|
stripDirs path =
|
||||||
|
@ -143,9 +143,14 @@ data TargetSystem
|
|||||||
deriving (Eq, Show, Read, Ord, Bounded, Enum)
|
deriving (Eq, Show, Read, Ord, Bounded, Enum)
|
||||||
|
|
||||||
-- | State of the deployment after running @hap deploy@.
|
-- | State of the deployment after running @hap deploy@.
|
||||||
|
-- __note:__ the 'Unknown' value is not intended to be
|
||||||
|
-- written to the @.hapistrano_deploy_state@ file; instead,
|
||||||
|
-- it's intended to represent whenever Hapistrano couldn't
|
||||||
|
-- get the information on the deployment state (e.g. the file is not present).
|
||||||
data DeployState
|
data DeployState
|
||||||
= Fail
|
= Fail
|
||||||
| Success
|
| Success
|
||||||
|
| Unknown
|
||||||
deriving (Eq, Show, Read, Ord, Bounded, Enum)
|
deriving (Eq, Show, Read, Ord, Bounded, Enum)
|
||||||
|
|
||||||
-- Command line options
|
-- Command line options
|
||||||
|
Loading…
Reference in New Issue
Block a user