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