nocopyto switch (closes #952)

This commit is contained in:
Michael Snoyman 2015-03-12 09:15:49 +02:00
parent f8847bd231
commit 70c51d29fc
4 changed files with 16 additions and 6 deletions

View File

@ -1,3 +1,7 @@
## 1.4.5
* add a switch to yesod to skip deploying a .keter with copy-to [#952](https://github.com/yesodweb/yesod/issues/952)
## 1.4.4
* Add and process Keter option 'extraFiles' [#947](https://github.com/yesodweb/yesod/pull/947)

View File

@ -27,8 +27,9 @@ run a b = do
keter :: String -- ^ cabal command
-> Bool -- ^ no build?
-> Bool -- ^ no copy to?
-> IO ()
keter cabal noBuild = do
keter cabal noBuild noCopyTo = do
ketercfg <- keterConfig
mvalue <- decodeFile ketercfg
value <-
@ -78,7 +79,7 @@ keter cabal noBuild = do
let fp = T.unpack project ++ ".keter"
L.writeFile fp $ compress $ Tar.write archive
case Map.lookup "copy-to" value of
unless noCopyTo $ case Map.lookup "copy-to" value of
Just (String s) ->
case parseMaybe (.: "copy-to-port") value of
Just i -> run "scp" ["-P" ++ show (i :: Int), fp, T.unpack s]

View File

@ -60,7 +60,10 @@ data Command = Init { _initBare :: Bool }
}
| Test
| AddHandler
| Keter { _keterNoRebuild :: Bool }
| Keter
{ _keterNoRebuild :: Bool
, _keterNoCopyTo :: Bool
}
| Version
deriving (Show, Eq)
@ -96,7 +99,7 @@ main = do
Configure -> cabal ["configure"]
Build es -> touch' >> cabal ("build":es)
Touch -> touch'
Keter noRebuild -> keter (cabalCommand o) noRebuild
Keter{..} -> keter (cabalCommand o) _keterNoRebuild _keterNoCopyTo
Version -> putStrLn ("yesod-bin version: " ++ showVersion Paths_yesod_bin.version)
AddHandler -> addHandler
Test -> cabalTest cabal
@ -144,7 +147,9 @@ optParser = Options
)
keterOptions :: Parser Command
keterOptions = Keter <$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" )
keterOptions = Keter
<$> switch ( long "nobuild" <> short 'n' <> help "Skip rebuilding" )
<*> switch ( long "nocopyto" <> help "Ignore copy-to directive in keter config file" )
defaultRescan :: Int
defaultRescan = 10

View File

@ -1,5 +1,5 @@
name: yesod-bin
version: 1.4.4
version: 1.4.5
license: MIT
license-file: LICENSE
author: Michael Snoyman <michael@snoyman.com>