antiope-shell (empty) → 7.3.4
raw patch · 8 files changed
+156/−0 lines, 8 filesdep +aesondep +amazonkadep +amazonka-coresetup-changed
Dependencies added: aeson, amazonka, amazonka-core, amazonka-s3, antiope-core, antiope-messages, antiope-s3, antiope-shell, attoparsec, base, bytestring, conduit, conduit-extra, exceptions, generic-lens, hedgehog, hspec, http-types, hw-hspec-hedgehog, lens, mtl, network-uri, process, resourcet, text, time, unliftio-core
Files
- ChangeLog.md +3/−0
- LICENSE +21/−0
- README.md +1/−0
- Setup.hs +2/−0
- antiope-shell.cabal +87/−0
- src/Antiope/Shell/S3.hs +27/−0
- test/Antiope/Shell/S3Spec.hs +14/−0
- test/Spec.hs +1/−0
+ ChangeLog.md view
@@ -0,0 +1,3 @@+# Changelog for antiope-shell++## Unreleased changes
+ LICENSE view
@@ -0,0 +1,21 @@+The MIT License (MIT)++Copyright (c) 2018-2019 Arbor Networks++Permission is hereby granted, free of charge, to any person obtaining a copy+of this software and associated documentation files (the "Software"), to deal+in the Software without restriction, including without limitation the rights+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell+copies of the Software, and to permit persons to whom the Software is+furnished to do so, subject to the following conditions:++The above copyright notice and this permission notice shall be included in all+copies or substantial portions of the Software.++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE+SOFTWARE.
+ README.md view
@@ -0,0 +1,1 @@+# antiope-shell
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ antiope-shell.cabal view
@@ -0,0 +1,87 @@+cabal-version: 2.4++name: antiope-shell+version: 7.3.4+synopsis: Please see the README on Github at <https://github.com/arbor/antiope#readme>+description: Please see the README on Github at <https://github.com/arbor/antiope#readme>.+category: Services+homepage: https://github.com/arbor/antiope#readme+bug-reports: https://github.com/arbor/antiope/issues+author: Arbor Networks+maintainer: mayhem@arbor.net+copyright: Arbor Networks+license: MIT+license-file: LICENSE+build-type: Simple+extra-source-files: README.md+ ChangeLog.md++source-repository head+ type: git+ location: https://github.com/arbor/antiope++common base { build-depends: base >= 4.7 && < 5 }++common config+ default-language: Haskell2010+ ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wredundant-constraints++library+ import: base, config+ exposed-modules: Antiope.Shell.S3+ hs-source-dirs: src+ default-extensions: BangPatterns GeneralizedNewtypeDeriving OverloadedStrings TupleSections+ build-depends:+ aeson+ , amazonka >= 1.6.0+ , amazonka-core >= 1.6.0+ , amazonka-s3 >= 1.6.0+ , antiope-s3+ , antiope-core+ , antiope-messages+ , attoparsec+ , bytestring+ , exceptions+ , generic-lens+ , http-types+ , lens+ , mtl+ , network-uri+ , process >= 1.6.5.1+ , resourcet+ , text+ , time+ , unliftio-core++test-suite antiope-shell-test+ import: base, config+ type: exitcode-stdio-1.0+ main-is: Spec.hs+ hs-source-dirs: test+ other-modules: Antiope.Shell.S3Spec+ default-extensions: BangPatterns GeneralizedNewtypeDeriving OverloadedStrings TupleSections+ ghc-options: -threaded -rtsopts -with-rtsopts=-N+ build-tool-depends: hspec-discover:hspec-discover+ build-depends: aeson+ , amazonka >= 1.6.0+ , amazonka-core >= 1.6.0+ , amazonka-s3 >= 1.6.0+ , antiope-core+ , antiope-shell+ , attoparsec+ , bytestring+ , conduit+ , conduit-extra+ , exceptions+ , generic-lens+ , hedgehog >= 0.5 && < 1.1+ , hspec >= 2.4 && < 2.7+ , http-types+ , hw-hspec-hedgehog >= 0.1 && < 0.3+ , lens+ , mtl+ , network-uri+ , resourcet+ , text+ , time+ , unliftio-core
+ src/Antiope/Shell/S3.hs view
@@ -0,0 +1,27 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TupleSections #-}++module Antiope.Shell.S3+ ( putFile+ ) where++import Antiope.S3.Types (S3Uri)+import Control.Monad.Except+import Data.Monoid ((<>))+import Data.Text as T (Text, pack, unpack)+import Network.AWS.Data.Text (toText)++import qualified System.Exit as IO+import qualified System.Process as IO++-- | Puts file into a specified S3 bucket+putFile :: MonadIO m+ => S3Uri -- ^ File name on S3+ -> FilePath -- ^ Source file path+ -> ExceptT Text m () -- ^ Etag when the operation is successful+putFile s3Uri filePath = do+ exitCode <- liftIO $ IO.rawSystem "aws" ["s3", "cp", "--quiet", filePath, T.unpack (toText s3Uri)]+ case exitCode of+ IO.ExitSuccess -> return ()+ IO.ExitFailure n -> throwError $ "Command failed with exit code: " <> T.pack (show n)
+ test/Antiope/Shell/S3Spec.hs view
@@ -0,0 +1,14 @@+module Antiope.Shell.S3Spec where++import HaskellWorks.Hspec.Hedgehog+import Hedgehog+import Test.Hspec++{-# ANN module ("HLint: Ignore Redundant do" :: String) #-}++spec :: Spec+spec = describe "Antiope.S3.S3Spec" $ do+ it "Test stub" $ requireTest $ do+ True === True++
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}