language-docker 5.0.0 → 5.0.1
raw patch · 4 files changed
+14/−11 lines, 4 files
Files
- language-docker.cabal +3/−3
- src/Language/Docker/EDSL.hs +1/−1
- src/Language/Docker/PrettyPrint.hs +5/−4
- test/Language/Docker/EDSLSpec.hs +5/−3
language-docker.cabal view
@@ -2,10 +2,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: dd6c2b3624c04b2f48ffc3844fe2df02d25b1034408fc2221f6b572647e653bc+-- hash: d0f11ab2ffb465c506d226c3df99c060577332cb17f835976ff64a00b41eac02 name: language-docker-version: 5.0.0+version: 5.0.1 synopsis: Dockerfile parser, pretty-printer and embedded DSL description: All functions for parsing, printing and writting Dockerfiles are exported through @Language.Docker@. For more fine-grained operations look for specific modules that implement a certain functionality. See the <https://github.com/hadolint/language-docker GitHub project> for the source-code and examples.@@ -47,7 +47,7 @@ Paths_language_docker hs-source-dirs: src- ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-orphans+ ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints -fno-warn-unused-do-bind -fno-warn-orphans build-depends: base >=4.8 && <5 , bytestring >=0.10
src/Language/Docker/EDSL.hs view
@@ -36,7 +36,7 @@ runDockerWriter = iterM runD runDockerWriterIO ::- (Monad m, MonadTrans t, Monad (t m), MonadWriter [Syntax.Instruction] (t m), MonadIO (t m))+ (Monad m, MonadTrans t, MonadWriter [Syntax.Instruction] (t m)) => EDockerfileTM m a -> t m a runDockerWriterIO = iterTM runD
src/Language/Docker/PrettyPrint.hs view
@@ -73,12 +73,13 @@ helper a = a prettyPrintJSON :: Arguments -> Doc-prettyPrintJSON (Arguments as) = brackets $ hsep $ intersperse comma $ map (doubleQuotes . text) as+prettyPrintJSON (Arguments as) = brackets $ hcat $ intersperse (comma <> space) $ map (doubleQuotes . text) as prettyPrintPort :: Port -> Doc prettyPrintPort (PortStr str) = text str prettyPrintPort (PortRange start stop TCP) = integer start <> text "-" <> integer stop-prettyPrintPort (PortRange start stop UDP) = integer start <> text "-" <> integer stop <> char '/' <> text "udp"+prettyPrintPort (PortRange start stop UDP) =+ integer start <> text "-" <> integer stop <> char '/' <> text "udp" prettyPrintPort (Port num TCP) = integer num <> char '/' <> text "tcp" prettyPrintPort (Port num UDP) = integer num <> char '/' <> text "udp" @@ -127,7 +128,7 @@ text k <> text "=" <> text v Entrypoint e -> do text "ENTRYPOINT"- prettyPrintArguments e+ prettyPrintJSON e Stopsignal s -> do text "STOPSIGNAL" text s@@ -150,7 +151,7 @@ prettyPrintFileList sourcePaths targetPath Cmd c -> do text "CMD"- prettyPrintArguments c+ prettyPrintJSON c Label l -> do text "LABEL" prettyPrintPairs l
test/Language/Docker/EDSLSpec.hs view
@@ -28,11 +28,13 @@ let r = prettyPrint $ toDockerfile (do from "node" shell ["cmd", "/S"]+ entrypoint ["/tini", "--"] cmdArgs ["node", "-e", "'console.log(\'hey\')'"] healthcheck $ check "curl -f http://localhost/ || exit 1" `interval` 300) r `shouldBe` unlines [ "FROM node"- , "SHELL [\"cmd\" , \"/S\"]"- , "CMD node -e 'console.log(\'hey\')'"+ , "SHELL [\"cmd\", \"/S\"]"+ , "ENTRYPOINT [\"/tini\", \"--\"]"+ , "CMD [\"node\", \"-e\", \"'console.log(\'hey\')'\"]" , "HEALTHCHECK --interval=300s CMD curl -f http://localhost/ || exit 1" ] it "print expose instructions correctly" $ do@@ -55,7 +57,7 @@ run "echo \"hello world\"" run "echo \"hello world2\"" r `shouldBe` unlines [ "FROM node"- , "CMD node -e 'console.log(\'hey\')'"+ , "CMD [\"node\", \"-e\", \"'console.log(\'hey\')'\"]" , "ONBUILD RUN echo \"hello world\"" , "ONBUILD RUN echo \"hello world2\"" ]