mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-11-27 02:24:43 +03:00
Lint and grammar fixes (#237)
* Apply hlint suggestions * Fix spelling error * chore: Fix spelling error and update release identifier comments * Undo change not needed
This commit is contained in:
parent
e8ec435b2b
commit
b7fd5361b1
@ -152,7 +152,7 @@ spec = do
|
||||
it "creates the maintenance file in the given path" $ \(deployPath, _) -> do
|
||||
result <- runHap $ do
|
||||
writeMaintenanceFile deployPath $(mkRelDir "maintenance") $(mkRelFile "maintenance.html")
|
||||
liftIO $ System.Directory.doesFileExist ((fromAbsDir deployPath) <> "/maintenance/maintenance.html")
|
||||
liftIO $ System.Directory.doesFileExist (fromAbsDir deployPath <> "/maintenance/maintenance.html")
|
||||
result `shouldBe` True
|
||||
describe "deleteMaintenanceFile" $
|
||||
context "when the file exists" $
|
||||
@ -160,7 +160,7 @@ spec = do
|
||||
result <- runHap $ do
|
||||
writeMaintenanceFile deployPath $(mkRelDir "maintenance") $(mkRelFile "maintenance.html")
|
||||
deleteMaintenanceFile deployPath $(mkRelDir "maintenance") $(mkRelFile "maintenance.html")
|
||||
liftIO $ System.Directory.doesFileExist ((fromAbsDir deployPath) <> "/maintenance/maintenance.html")
|
||||
liftIO $ System.Directory.doesFileExist (fromAbsDir deployPath <> "/maintenance/maintenance.html")
|
||||
result `shouldBe` False
|
||||
describe "releasePath" $ do
|
||||
context "when the configWorkingDir is Nothing" $
|
||||
@ -273,7 +273,7 @@ spec = do
|
||||
True
|
||||
describe "playScriptLocally (error exit)" $
|
||||
it "check that deployment isn't done" $ \(deployPath, repoPath) ->
|
||||
(runHap $ do
|
||||
runHap (do
|
||||
let localCommands =
|
||||
mapMaybe Hap.mkGenericCommand ["pwd", "ls", "false"]
|
||||
task = mkTask deployPath repoPath
|
||||
@ -281,29 +281,29 @@ spec = do
|
||||
release <- Hap.pushRelease task
|
||||
Hap.createHapistranoDeployState deployPath release Success) `shouldThrow`
|
||||
anyException
|
||||
describe "rollback" $ do
|
||||
describe "rollback" $
|
||||
it "resets the ‘current’ symlink correctly" $ \(deployPath, repoPath) ->
|
||||
runHap $ do
|
||||
let task = mkTask deployPath repoPath
|
||||
noCmd = Nothing
|
||||
rs <- replicateM 5 (Hap.pushRelease task)
|
||||
Hap.rollback currentSystem deployPath 2 noCmd
|
||||
rpath <- Hap.releasePath deployPath (rs !! 2) Nothing
|
||||
let rc :: Hap.Readlink Dir
|
||||
rc =
|
||||
Hap.Readlink currentSystem (Hap.currentSymlinkPath deployPath)
|
||||
Hap.exec rc Nothing `shouldReturn` rpath
|
||||
Path.IO.doesFileExist (Hap.tempSymlinkPath deployPath) `shouldReturn` False
|
||||
describe "rollback to non-exist release" $ do
|
||||
runHap $ do
|
||||
let task = mkTask deployPath repoPath
|
||||
noCmd = Nothing
|
||||
rs <- replicateM 5 (Hap.pushRelease task)
|
||||
Hap.rollback currentSystem deployPath 2 noCmd
|
||||
rpath <- Hap.releasePath deployPath (rs !! 2) Nothing
|
||||
let rc :: Hap.Readlink Dir
|
||||
rc =
|
||||
Hap.Readlink currentSystem (Hap.currentSymlinkPath deployPath)
|
||||
Hap.exec rc Nothing `shouldReturn` rpath
|
||||
Path.IO.doesFileExist (Hap.tempSymlinkPath deployPath) `shouldReturn` False
|
||||
describe "rollback to non-exist release" $
|
||||
it "trying to rollback to a non-exist release, should throw exception" $ \(deployPath, repoPath) ->
|
||||
(runHap $ do
|
||||
let task = mkTask deployPath repoPath
|
||||
noCmd = Nothing
|
||||
replicateM_ 5 (Hap.pushRelease task)
|
||||
Hap.rollback currentSystem deployPath 6 noCmd) `shouldThrow`
|
||||
anyException
|
||||
runHap (do
|
||||
let task = mkTask deployPath repoPath
|
||||
noCmd = Nothing
|
||||
replicateM_ 5 (Hap.pushRelease task)
|
||||
Hap.rollback currentSystem deployPath 6 noCmd) `shouldThrow`
|
||||
anyException
|
||||
describe "dropOldReleases" $ do
|
||||
it "works" $ \(deployPath, repoPath) ->
|
||||
it "should not keep more than 5 releases by default after a successful release" $ \(deployPath, repoPath) ->
|
||||
runHap $ do
|
||||
rs <-
|
||||
replicateM 7 $ do
|
||||
@ -513,3 +513,4 @@ arbitraryReleaseFormat = elements [ReleaseShort, ReleaseLong]
|
||||
|
||||
arbitraryKeepReleases :: Gen Natural
|
||||
arbitraryKeepReleases = fromInteger . getPositive <$> arbitrary
|
||||
|
||||
|
@ -155,7 +155,7 @@ deploy
|
||||
:: HC.Config -- ^ Deploy configuration
|
||||
-> ReleaseFormat -- ^ Long or Short format
|
||||
-> Natural -- ^ Number of releases to keep
|
||||
-> Bool -- ^ Wheter we should keep one failed release or not
|
||||
-> Bool -- ^ Whether we should keep one failed release or not
|
||||
-> ExecutionMode -- ^ Is running on lead target
|
||||
-> Hapistrano ()
|
||||
deploy HC.Config{..} releaseFormat keepReleases keepOneFailed executionMode = do
|
||||
|
@ -158,7 +158,7 @@ data OutputDest
|
||||
| StderrDest
|
||||
deriving (Eq, Show, Read, Ord, Bounded, Enum)
|
||||
|
||||
-- | Release indentifier.
|
||||
-- | Release identifier.
|
||||
data Release =
|
||||
Release ReleaseFormat UTCTime
|
||||
deriving (Eq, Show, Ord)
|
||||
@ -201,7 +201,7 @@ data Command
|
||||
| Maintenance MaintenanceOptions
|
||||
| InitConfig -- ^ initialize configuration file
|
||||
|
||||
-- | Create a 'Release' indentifier.
|
||||
-- | Create a 'Release' identifier.
|
||||
mkRelease :: ReleaseFormat -> UTCTime -> Release
|
||||
mkRelease = Release
|
||||
|
||||
@ -209,7 +209,7 @@ mkRelease = Release
|
||||
releaseTime :: Release -> UTCTime
|
||||
releaseTime (Release _ time) = time
|
||||
|
||||
-- | Render 'Release' indentifier as a 'String'.
|
||||
-- | Render 'Release' identifier as a 'String'.
|
||||
renderRelease :: Release -> String
|
||||
renderRelease (Release rfmt time) = formatTime defaultTimeLocale fmt time
|
||||
where
|
||||
|
Loading…
Reference in New Issue
Block a user