mirror of
https://github.com/stackbuilders/hapistrano.git
synced 2024-12-26 13:01:29 +03:00
Clean up (Cabal) package
This commit is contained in:
parent
fc662b46d8
commit
c6fb4becfc
@ -7,7 +7,7 @@ import System.Environment.Compat (lookupEnv)
|
|||||||
import System.IO (hPutStrLn, stderr)
|
import System.IO (hPutStrLn, stderr)
|
||||||
import System.Exit (exitFailure)
|
import System.Exit (exitFailure)
|
||||||
|
|
||||||
import System.Hapistrano.Types (ReleaseFormat(..))
|
import System.Hapistrano (ReleaseFormat(..))
|
||||||
|
|
||||||
-- | Rolls back to previous release.
|
-- | Rolls back to previous release.
|
||||||
rollback :: Hap.Config -> IO ()
|
rollback :: Hap.Config -> IO ()
|
@ -24,68 +24,51 @@ author: Justin Leitgeb
|
|||||||
maintainer: justin@stackbuilders.com
|
maintainer: justin@stackbuilders.com
|
||||||
copyright: 2015 Stack Builders Inc.
|
copyright: 2015 Stack Builders Inc.
|
||||||
category: System
|
category: System
|
||||||
Homepage: https://github.com/stackbuilders/hapistrano
|
homepage: https://github.com/stackbuilders/hapistrano
|
||||||
Bug-reports: https://github.com/stackbuilders/hapistrano/issues
|
bug-reports: https://github.com/stackbuilders/hapistrano/issues
|
||||||
build-type: Simple
|
build-type: Simple
|
||||||
cabal-version: >=1.10
|
cabal-version: >=1.10
|
||||||
|
|
||||||
executable hap
|
|
||||||
main-is: Main.hs
|
|
||||||
hs-source-dirs: src
|
|
||||||
build-depends: base >=4.5 && <4.9
|
|
||||||
, time-locale-compat
|
|
||||||
, time
|
|
||||||
, old-locale
|
|
||||||
, process
|
|
||||||
, either
|
|
||||||
, transformers
|
|
||||||
, mtl
|
|
||||||
, filepath
|
|
||||||
, base-compat
|
|
||||||
|
|
||||||
default-language: Haskell2010
|
|
||||||
ghc-options: -Wall
|
|
||||||
|
|
||||||
library
|
library
|
||||||
|
hs-source-dirs: src
|
||||||
exposed-modules: System.Hapistrano
|
exposed-modules: System.Hapistrano
|
||||||
other-modules: System.Hapistrano.Types
|
other-modules: System.Hapistrano.Types
|
||||||
|
build-depends: base >=4.5 && <4.9
|
||||||
build-depends: base >=4.5 && <4.9
|
, either
|
||||||
, time-locale-compat
|
, filepath
|
||||||
, time
|
, mtl
|
||||||
, old-locale
|
, process
|
||||||
, process
|
, time-locale-compat
|
||||||
, either
|
, time
|
||||||
, transformers
|
, transformers
|
||||||
, mtl
|
|
||||||
, filepath
|
|
||||||
, base-compat
|
|
||||||
|
|
||||||
hs-source-dirs: src
|
|
||||||
default-language: Haskell2010
|
|
||||||
ghc-options: -Wall
|
ghc-options: -Wall
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
|
executable hap
|
||||||
|
hs-source-dirs: app
|
||||||
|
main-is: Main.hs
|
||||||
|
build-depends: base
|
||||||
|
, hapistrano
|
||||||
|
, base-compat
|
||||||
|
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
|
||||||
|
default-language: Haskell2010
|
||||||
|
|
||||||
test-suite hapistrano-test
|
test-suite hapistrano-test
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
hs-source-dirs: spec, src
|
hs-source-dirs: spec
|
||||||
main-is: Spec.hs
|
main-is: Spec.hs
|
||||||
other-modules: System.HapistranoSpec
|
other-modules: System.HapistranoSpec
|
||||||
build-depends: base >=4.5 && <4.9
|
build-depends: base
|
||||||
, time-locale-compat
|
, hapistrano
|
||||||
, time
|
, directory
|
||||||
, old-locale
|
, either
|
||||||
, process
|
, filepath
|
||||||
, either
|
, hspec
|
||||||
, transformers
|
, mtl
|
||||||
, mtl
|
, process
|
||||||
, filepath
|
, temporary
|
||||||
, base-compat
|
ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N
|
||||||
, hspec
|
|
||||||
, temporary
|
|
||||||
, directory
|
|
||||||
|
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -Wall
|
|
||||||
|
|
||||||
source-repository head
|
source-repository head
|
||||||
type: git
|
type: git
|
||||||
|
@ -13,7 +13,6 @@ import Control.Monad.Reader (ReaderT(..))
|
|||||||
import System.FilePath.Posix (joinPath)
|
import System.FilePath.Posix (joinPath)
|
||||||
|
|
||||||
import qualified System.Hapistrano as Hap
|
import qualified System.Hapistrano as Hap
|
||||||
import System.Hapistrano.Types
|
|
||||||
import Data.List (sort)
|
import Data.List (sort)
|
||||||
import System.Process (readProcessWithExitCode)
|
import System.Process (readProcessWithExitCode)
|
||||||
|
|
||||||
@ -87,7 +86,7 @@ defaultState tmpDir testRepo =
|
|||||||
Hap.Config { Hap.deployPath = tmpDir
|
Hap.Config { Hap.deployPath = tmpDir
|
||||||
, Hap.host = Nothing
|
, Hap.host = Nothing
|
||||||
, Hap.repository = testRepo
|
, Hap.repository = testRepo
|
||||||
, Hap.releaseFormat = Long
|
, Hap.releaseFormat = Hap.Long
|
||||||
, Hap.revision = "master"
|
, Hap.revision = "master"
|
||||||
, Hap.buildScript = Nothing
|
, Hap.buildScript = Nothing
|
||||||
, Hap.restartCommand = Nothing
|
, Hap.restartCommand = Nothing
|
||||||
@ -124,7 +123,7 @@ spec = describe "hapistrano" $ do
|
|||||||
deployOnly $ defaultState tmpDir testRepoPath
|
deployOnly $ defaultState tmpDir testRepoPath
|
||||||
|
|
||||||
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
||||||
length (filter (Hap.isReleaseString Long) contents) `shouldBe` 1
|
length (filter (Hap.isReleaseString Hap.Long) contents) `shouldBe` 1
|
||||||
|
|
||||||
it "activates the release" $
|
it "activates the release" $
|
||||||
withSystemTempDirectory "hapistranoDeployTest" $ \tmpDir -> do
|
withSystemTempDirectory "hapistranoDeployTest" $ \tmpDir -> do
|
||||||
@ -134,7 +133,7 @@ spec = describe "hapistrano" $ do
|
|||||||
deployAndActivate $ defaultState tmpDir testRepoPath
|
deployAndActivate $ defaultState tmpDir testRepoPath
|
||||||
|
|
||||||
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
||||||
length (filter (Hap.isReleaseString Long) contents) `shouldBe` 1
|
length (filter (Hap.isReleaseString Hap.Long) contents) `shouldBe` 1
|
||||||
|
|
||||||
it "cleans up old releases" $
|
it "cleans up old releases" $
|
||||||
withSystemTempDirectory "hapistranoDeployTest" $ \tmpDir -> do
|
withSystemTempDirectory "hapistranoDeployTest" $ \tmpDir -> do
|
||||||
@ -143,7 +142,7 @@ spec = describe "hapistrano" $ do
|
|||||||
replicateM_ 7 $ deployAndActivate $ defaultState tmpDir testRepoPath
|
replicateM_ 7 $ deployAndActivate $ defaultState tmpDir testRepoPath
|
||||||
|
|
||||||
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
||||||
length (filter (Hap.isReleaseString Long) contents) `shouldBe` 5
|
length (filter (Hap.isReleaseString Hap.Long) contents) `shouldBe` 5
|
||||||
|
|
||||||
describe "rollback" $
|
describe "rollback" $
|
||||||
it "rolls back to the previous release" $
|
it "rolls back to the previous release" $
|
||||||
@ -157,7 +156,7 @@ spec = describe "hapistrano" $ do
|
|||||||
-- current symlink should point to the last release directory
|
-- current symlink should point to the last release directory
|
||||||
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
contents <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
||||||
|
|
||||||
let firstRelease = head $ filter (Hap.isReleaseString Long) contents
|
let firstRelease = head $ filter (Hap.isReleaseString Hap.Long) contents
|
||||||
|
|
||||||
firstReleaseLinkTarget <-
|
firstReleaseLinkTarget <-
|
||||||
runReaderT (runEitherT Hap.readCurrentLink) deployState
|
runReaderT (runEitherT Hap.readCurrentLink) deployState
|
||||||
@ -172,7 +171,7 @@ spec = describe "hapistrano" $ do
|
|||||||
conts <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
conts <- getDirectoryContents (joinPath [tmpDir, "releases"])
|
||||||
|
|
||||||
let secondRelease =
|
let secondRelease =
|
||||||
sort (filter (Hap.isReleaseString Long) conts) !! 1
|
sort (filter (Hap.isReleaseString Hap.Long) conts) !! 1
|
||||||
|
|
||||||
secondReleaseLinkTarget <-
|
secondReleaseLinkTarget <-
|
||||||
runReaderT (runEitherT Hap.readCurrentLink) deployState
|
runReaderT (runEitherT Hap.readCurrentLink) deployState
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
-- applications.
|
-- applications.
|
||||||
module System.Hapistrano
|
module System.Hapistrano
|
||||||
( Config(..)
|
( Config(..)
|
||||||
|
, ReleaseFormat(..)
|
||||||
|
|
||||||
, activateRelease
|
, activateRelease
|
||||||
, currentPath
|
, currentPath
|
||||||
|
Loading…
Reference in New Issue
Block a user