packages feed

yesod-static-remote 0.0.0.0 → 0.0.0.1

raw patch · API changes only · 6 files changed · hide whitespace changes · browse yesod-static-remote-0.0.0.1

+45/−53 lines, 6 filesdep −yesod-static-remotesetup-changed

Dependencies removed: yesod-static-remote

API changes (from Hackage documentation)

No API comparison: Hackage has no documentation for yesod-static-remote-0.0.0.1.

Files

LICENSE view
@@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019 Tom Sydney Kerckhove+Copyright (c) 2019-2022 Tom Sydney Kerckhove  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
README.md view
@@ -1,1 +1,8 @@-# remote-static+# yesod-remote-static++[![NixCI](https://staging.nix-ci.com/badge/gh:NorfairKing:yesod-static-remote)](https://staging.nix-ci.com/gh:NorfairKing:yesod-static-remote)++Embed static files from remote sources.++See this blogpost for more info:+https://cs-syd.eu/posts/2019-07-14-yesod-static-remote
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
src/Yesod/EmbeddedStatic/Remote.hs view
@@ -1,10 +1,9 @@-{-# LANGUAGE QuasiQuotes #-}-{-# LANGUAGE TemplateHaskell #-}- module Yesod.EmbeddedStatic.Remote-  ( embedRemoteFileAt-  , ensureFile-  ) where+  ( embedRemoteFile,+    embedRemoteFileAt,+    ensureFile,+  )+where  import Control.Monad import qualified Data.ByteString.Lazy as LB@@ -17,21 +16,36 @@ import Yesod.EmbeddedStatic.Types  -- | Embed a file after downloading it (once, and caching it locally)-embedRemoteFileAt ::-     FilePath -- ^ The path to put it (relative)-  -> String -- ^ The url to download it from-  -> Generator-embedRemoteFileAt fp url = do-  runIO $ ensureFile fp url+embedRemoteFile ::+  -- | The path to put it (relative)+  FilePath ->+  -- | The url to download it from+  String ->+  Generator+embedRemoteFile fp url = do+  runIO $ ensureFile fp fp url   embedFile fp -ensureFile :: FilePath -> String -> IO ()-ensureFile rp url = do+-- | Embed a file after downloading it (once, and caching it locally)+embedRemoteFileAt ::+  -- | The path to generate for it (for the yesod naming) (relative)+  String ->+  -- | The path to put it (relative)+  FilePath ->+  -- | The url to download it from+  String ->+  Generator+embedRemoteFileAt fp' fp url = do+  runIO $ ensureFile fp' fp url+  embedFileAt fp' fp++ensureFile :: String -> FilePath -> String -> IO ()+ensureFile rp' rp url = do   createDirectoryIfMissing True $ takeDirectory rp   exists <- doesFileExist rp   unless exists $ do     man <- newManager tlsManagerSettings-    putStrLn $ unwords ["Downloading", url, "to put it at", rp]+    putStrLn $ unwords ["Downloading", url, "to put it at", rp, "and embed it at", rp']     req <- parseUrlThrow url     resp <- httpLbs req man     LB.writeFile rp $ responseBody resp
− test/Spec.hs
@@ -1,17 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}--module Main where--import Yesod.EmbeddedStatic-import Yesod.EmbeddedStatic.Remote--mkEmbeddedStatic-  False-  "myStatic"-  [ embedRemoteFileAt-      "tmp/test/deep/README.md"-      "https://raw.githubusercontent.com/NorfairKing/yesod-static-remote/master/README.md"-  ]--main :: IO ()-main = pure ()
yesod-static-remote.cabal view
@@ -1,19 +1,19 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.38.3. -- -- see: https://github.com/sol/hpack ----- hash: 1fa979e2ae3a67d8c5387c3970bda5bfe431c85f03fe6dbbd5498ff32d46b908+-- hash: a891c43bfe4f0c6c075ef27c41ebddad80dee32d3bf44ce62fcf975f6ac87462  name:           yesod-static-remote-version:        0.0.0.0-description:    Please see the README on GitHub at <https://github.com/NorfairKing/remote-static#readme>+version:        0.0.0.1+synopsis:       Embed static files from remote sources homepage:       https://github.com/NorfairKing/yesod-static-remote#readme bug-reports:    https://github.com/NorfairKing/yesod-static-remote/issues author:         Tom Sydney Kerckhove maintainer:     syd@cs-syd.eu-copyright:      Copyright: (c) 2019 Tom Sydney Kerckhove+copyright:      Copyright: (c) 2019-2022 Tom Sydney Kerckhove license:        MIT license-file:   LICENSE build-type:     Simple@@ -40,18 +40,4 @@     , http-client-tls     , template-haskell     , yesod-static-  default-language: Haskell2010--test-suite remote-static-test-  type: exitcode-stdio-1.0-  main-is: Spec.hs-  other-modules:-      Paths_yesod_static_remote-  hs-source-dirs:-      test-  ghc-options: -threaded -rtsopts -with-rtsopts=-N-  build-depends:-      base >=4.7 && <5-    , yesod-static-    , yesod-static-remote   default-language: Haskell2010