packages feed

nix-deploy 1.0.5 → 1.0.6

raw patch · 4 files changed

+48/−37 lines, 4 filesdep ~neat-interpolationdep ~optparse-applicativedep ~optparse-genericsetup-changed

Dependency ranges changed: neat-interpolation, optparse-applicative, optparse-generic

Files

CHANGELOG.md view
@@ -1,3 +1,10 @@+# 1.0.6++## Changed++- Build against `optparse-generic-1.4`+- Increase timeout for `reboot`+ # 1.0.5  - Support Nix 2
− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
nix-deploy.cabal view
@@ -1,5 +1,5 @@ name:                nix-deploy-version:             1.0.5+version:             1.0.6 synopsis:            Deploy Nix-built software to a NixOS machine homepage:            https://github.com/awakesecurity/nix-deploy#readme license:             Apache-2.0@@ -32,9 +32,9 @@   build-depends:                 base                 >= 4.9.0.0  && < 5               , bytestring           >= 0.10.8.1 && < 1.0-              , optparse-generic     >= 1.2.0    && < 1.4-              , optparse-applicative >= 0.13.0.0 && < 0.15-              , neat-interpolation                  < 0.4+              , optparse-generic     >= 1.4.0    && < 1.5+              , optparse-applicative+              , neat-interpolation                  < 0.6               , text                 >= 0.7      && < 1.3               , turtle               >= 1.3.6    && < 1.6   default-language:    Haskell2010
src/Main.hs view
@@ -17,27 +17,37 @@  module Main where -import           Control.Applicative    (empty, (<|>))-import           Control.Exception      (SomeException)+import Control.Applicative (empty, (<|>))+import Control.Exception (SomeException)+import Control.Monad+import Control.Monad.IO.Class (MonadIO)+import Data.Maybe+import Data.Text (Text)+import GHC.Generics (Generic)+import NeatInterpolation (text)+import Prelude hiding (FilePath)+import Turtle (ExitCode (..), FilePath, fp, liftIO, s, (%), (</>))+import Turtle.Line++import Options.Generic+    ( ParseField(..)+    , ParseFields+    , ParseRecord(..)+    , Unwrapped+    , Wrapped+    , (:::)+    , type (<?>)+    )+ import qualified Control.Exception-import           Control.Monad-import           Control.Monad.IO.Class (MonadIO) import qualified Data.ByteString.Lazy   as BL import qualified Data.List.NonEmpty     as NonEmpty-import           Data.Maybe-import           Data.Monoid            ((<>))-import           Data.Text              (Text) import qualified Data.Text              as Text import qualified Data.Text.IO           as Text.IO-import           NeatInterpolation import qualified Options.Applicative    as Options-import           Options.Generic-import           Prelude                hiding (FilePath)+import qualified Options.Generic import qualified System.IO-import           Turtle                 (ExitCode (..), FilePath, fp, liftIO, s,-                                         (%), (</>)) import qualified Turtle-import           Turtle.Line  data Options w     = Path@@ -73,7 +83,7 @@  instance ParseField SwitchMethod where   readField = Options.readerError "Internal, fatal error: unexpected use of readField"-  parseField _ _ _ =+  parseField _ _ _ _ =         Options.flag' Switch      (Options.long "switch")     <|> Options.flag' Boot        (Options.long "boot")     <|> Options.flag' Test        (Options.long "test")@@ -95,7 +105,7 @@  instance ParseField Direction where   readField = Options.readerError "Internal, fatal error: unexpected use of readField"-  parseField _ _ _ = (To <$> parseTo) <|> (From <$> parseFrom)+  parseField _ _ _ _ = (To <$> parseTo) <|> (From <$> parseFrom)     where       parseTo    = parser "to" "Deploy software to this address (ex: user@192.168.0.1)"       parseFrom  = parser "from" "Deploy software from this address (ex: user@192.168.0.1)"@@ -118,21 +128,17 @@  instance ParseField Line where   readField = Options.maybeReader (textToLine . Text.pack)-  parseField h m c = do-    let metavar = "LINE"-    let line    = Options.maybeReader (textToLine . Text.pack)-    case m of-      Nothing ->-        (Options.argument line-         (  Options.metavar metavar-         <> foldMap (Options.help . Text.unpack) h))-      Just name ->-        (Options.option line-         (  Options.metavar metavar-         <> foldMap Options.short c-         <> Options.long (Text.unpack name)-         <> foldMap (Options.help . Text.unpack) h))+  parseField help long short _value = do+    let metavar_ = "LINE"+    let line     = Options.maybeReader (textToLine . Text.pack) +    Options.option line+      (  Options.metavar metavar_+      <> foldMap Options.short short+      <> foldMap (Options.long . Text.unpack) long+      <> foldMap (Options.help . Text.unpack) help+      )+ renderDirection :: Direction -> (Text, Line) renderDirection (To target)   = ("to",   target) renderDirection (From target) = ("from", target)@@ -142,7 +148,7 @@  main :: IO () main =-  unwrapRecord progSummary >>= \case+  Options.Generic.unwrapRecord progSummary >>= \case     Path{..}   -> do       pathText <-         case path of@@ -305,7 +311,7 @@   rebootCmd :: MonadIO io => Text -> io Turtle.ExitCode-rebootCmd target = Turtle.shell [text|ssh -o 'ServerAliveInterval=1' $target sudo reboot|] empty+rebootCmd target = Turtle.shell [text|ssh -o 'ServerAliveInterval=1' -o 'ServerAliveCountMax=7' $target sudo reboot|] empty  pathFromStdin :: IO Text pathFromStdin = do