packages feed

hapistrano 0.3.1.0 → 0.3.2.0

raw patch · 6 files changed

+42/−20 lines, 6 filesdep ~aesonPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aeson

API changes (from Hackage documentation)

+ System.Hapistrano: pushReleaseWithoutVc :: Task -> Hapistrano Release

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+## 0.3.2.0++* Fix `-v` switch for hap.+* Add `vc_action` to control version control related tasks.+ ## 0.3.1.0  * Fixed a bug with repos not being fetched properly.
README.md view
@@ -63,6 +63,9 @@ * `restart_command` — if you need to restart a remote web server after a   successful rollback, specify the command that you use in this variable. It   will be run after both deploy and rollback.+* `vc_action` - Controls if version control related activity should+  take place. It defaults to true. When you don't want activity like+  cloning, fetching etc. to take place, set this to `false`.  After creating a configuration file as above, deploying is as simple as: @@ -110,7 +113,7 @@ targets:   - host: myserver-a.com     port: 2222-  - host: myserver-b.cmo+  - host: myserver-b.com # the rest is the same… ``` @@ -124,7 +127,7 @@   interaction was unsuccessful, the `hap` tool will exit with non-zero exit   code. -* The log is printed is such a way that messages from several machines get+* The log is printed in such a way that messages from several machines get   intermixed, but it's guaranteed that they won't overlap (printing itself   is sequential) and the headers will tell you exactly which machine was   executing which command.
app/Config.hs view
@@ -34,6 +34,8 @@     -- ^ Collection of files to copy over to target machine before building   , configCopyDirs :: ![CopyThing]     -- ^ Collection of directories to copy over to target machine before building+  , configVcAction :: !Bool+  -- ^ Perform version control related actions. By default, it's assumed to be True.   } deriving (Eq, Ord, Show)  -- | Information about source and destination locations of a file\/directory@@ -62,6 +64,7 @@       maybe (return Nothing) (fmap Just . mapM mkCmd)     configCopyFiles  <- o .:? "copy_files" .!= []     configCopyDirs   <- o .:? "copy_dirs"  .!= []+    configVcAction    <- o .:? "vc_action" .!= True     return Config {..}  instance FromJSON CopyThing where
app/Main.hs view
@@ -33,7 +33,6 @@  data Opts = Opts   { optsCommand :: Command-  , optsVersion :: Bool   , optsConfigFile :: FilePath   } @@ -45,10 +44,17 @@   | Rollback Natural -- ^ Rollback to Nth previous release  parserInfo :: ParserInfo Opts-parserInfo = info (helper <*> optionParser)-  ( fullDesc <>-    progDesc "Deploy tool for Haskell applications" <>-    header "Hapistrano - A deployment library for Haskell applications" )+parserInfo =+  info+    (helper <*> versionOption <*> optionParser)+    (fullDesc <> progDesc "Deploy tool for Haskell applications" <>+     header "Hapistrano - A deployment library for Haskell applications")+  where+    versionOption :: Parser (a -> a)+    versionOption =+      infoOption+        (showVersion version)+        (long "version" <> short 'v' <> help "Show version of the program")  optionParser :: Parser Opts optionParser = Opts@@ -57,10 +63,6 @@     (info deployParser (progDesc "Deploy a new release")) <>     command "rollback"     (info rollbackParser (progDesc "Roll back to Nth previous release")) )-  <*> switch-  ( long "version"-  <> short 'v'-  <> help "Show version of the program" )   <*> strOption   ( long "config"   <> short 'c'@@ -113,9 +115,6 @@ main :: IO () main = do   Opts {..} <- execParser parserInfo-  when optsVersion $ do-    putStrLn $ "Hapistrano " ++ showVersion version-    exitSuccess   econfig <- Yaml.decodeFileEither optsConfigFile   case econfig of     Left err -> do@@ -123,17 +122,19 @@       exitFailure     Right C.Config {..} -> do       chan <- newTChanIO+      let task rf = Task { taskDeployPath    = configDeployPath+                         , taskRepository    = configRepo+                         , taskRevision      = configRevision+                         , taskReleaseFormat = rf }       let printFnc dest str = atomically $             writeTChan chan (PrintMsg dest str)           hap sshOpts =  do             r <- Hap.runHapistrano sshOpts printFnc $               case optsCommand of                 Deploy releaseFormat n -> do-                  release <- Hap.pushRelease Task-                    { taskDeployPath    = configDeployPath-                    , taskRepository    = configRepo-                    , taskRevision      = configRevision-                    , taskReleaseFormat = releaseFormat }+                  release <- case configVcAction of+                               True -> Hap.pushRelease (task releaseFormat)+                               False -> Hap.pushReleaseWithoutVc (task releaseFormat)                   rpath <- Hap.releasePath configDeployPath release                   forM_ configCopyFiles $ \(C.CopyThing src dest) -> do                     srcPath  <- resolveFile' src
hapistrano.cabal view
@@ -1,5 +1,5 @@ name:                hapistrano-version:             0.3.1.0+version:             0.3.2.0 synopsis:            A deployment library for Haskell applications description:   .
src/System/Hapistrano.hs view
@@ -16,6 +16,7 @@  module System.Hapistrano   ( pushRelease+  , pushReleaseWithoutVc   , registerReleaseAsComplete   , activateRelease   , rollback@@ -54,6 +55,15 @@   release <- newRelease taskReleaseFormat   cloneToRelease taskDeployPath release   setReleaseRevision taskDeployPath release taskRevision+  return release++-- | Same as 'pushRelease' but doesn't perform any version control+-- related operations.++pushReleaseWithoutVc :: Task -> Hapistrano Release+pushReleaseWithoutVc Task {..} = do+  setupDirs taskDeployPath+  release <- newRelease taskReleaseFormat   return release  -- | Create a file-token that will tell rollback function that this release