aur 0.0.1 → 0.1.0
raw patch · 4 files changed
+84/−21 lines, 4 filesdep +filepathdep ~lensPVP ok
version bump matches the API change (PVP)
Dependencies added: filepath
Dependency ranges changed: lens
API changes (from Hackage documentation)
+ Linux.Arch.Aur.Pkgbuild: pkgbuild :: MonadIO m => String -> m (Maybe Text)
+ Linux.Arch.Aur.Pkgbuild: pkgbuildUrl :: String -> String
Files
- Linux/Arch/Aur/Pkgbuild.hs +43/−0
- Linux/Arch/Aur/Rpc.hs +6/−0
- Linux/Arch/Aur/Types.hs +6/−0
- aur.cabal +29/−21
+ Linux/Arch/Aur/Pkgbuild.hs view
@@ -0,0 +1,43 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}++-- |+-- Module : Linux.Arch.Aur.Pkgbuild+-- Copyright : (c) Colin Woodbury, 2014+-- License : GPL3+-- Maintainer: Colin Woodbury <colingw@gmail.com>++module Linux.Arch.Aur.Pkgbuild+ ( pkgbuild+ , pkgbuildUrl ) where++import Control.Applicative ((<$>))+import Control.Lens ((^?))+import Control.Monad ((>=>))+import Control.Monad.Trans (MonadIO, liftIO)+import Data.Monoid ((<>))+import Data.Text hiding (take)+import Data.Text.Lazy.Encoding+import Network.Wreq+import System.FilePath ((</>))++import Control.Exception (SomeException, catch)+import qualified Data.Text.Lazy as TL++---++type E = SomeException++baseUrl :: String+baseUrl = "https://aur.archlinux.org/packages/"++-- | The location of a given package's PKGBUILD on the AUR servers.+pkgbuildUrl :: String -> String+pkgbuildUrl p = baseUrl </> take 2 p </> p </> "PKGBUILD"++-- | The PKGBUILD of a given package, retrieved from the AUR servers.+pkgbuild :: MonadIO m => String -> m (Maybe Text)+pkgbuild p = e $ (rb >=> txt) <$> get (pkgbuildUrl p)+ where rb = (^? responseBody)+ txt = Just . TL.toStrict . decodeUtf8+ e f = liftIO $ f `catch` (\(_ :: E) -> return Nothing)
Linux/Arch/Aur/Rpc.hs view
@@ -1,5 +1,11 @@ {-# LANGUAGE OverloadedStrings #-} +-- |+-- Module : Linux.Arch.Aur.Rpc+-- Copyright : (c) Colin Woodbury, 2014+-- License : GPL3+-- Maintainer: Colin Woodbury <colingw@gmail.com>+ module Linux.Arch.Aur.Rpc ( -- * Queries info
Linux/Arch/Aur/Types.hs view
@@ -1,5 +1,11 @@ {-# LANGUAGE OverloadedStrings #-} +-- |+-- Module : Linux.Arch.Aur.Types+-- Copyright : (c) Colin Woodbury, 2014+-- License : GPL3+-- Maintainer: Colin Woodbury <colingw@gmail.com>+ module Linux.Arch.Aur.Types ( AurInfo(..) ) where
aur.cabal view
@@ -4,22 +4,10 @@ -- The name of the package. name: aur -version: 0.0.1+version: 0.1.0 synopsis: Access metadata from the Arch Linux User Repository. -description: Access package information from Arch Linux's AUR via its- RPC interface. The main exposed functions reflect- those of the RPC:- - info: Get metadata for one package.- - multiinfo: Get metadata for many packages at once.- - search: Get limited metadata for packages that- match a given regex.- - msearch: Get metadata for all packages maintained- by a given user.- By default this library supports version 2 of the RPC,- and hence version 3.x of the AUR.- homepage: https://github.com/fosskers/haskell-aur license: GPL-3@@ -34,31 +22,51 @@ build-type: Simple --- Extra files to be distributed with the package, such as examples or a --- README.--- extra-source-files: - -- Constraint on the version of Cabal needed to build this package. cabal-version: >=1.10 +description: Access package information from Arch Linux's AUR via its+ RPC interface. The main exposed functions reflect+ those of the RPC:+ .+ * info: Get metadata for one package.+ .+ * multiinfo: Get metadata for many packages at once.+ .+ * search: Get limited metadata for packages that+ match a given regex.+ .+ * msearch: Get metadata for all packages maintained+ by a given user.+ .+ By default this library supports version 2 of the RPC,+ and hence version 3.x of the AUR.++-- Extra files to be distributed with the package, such as examples or a+-- README.+-- extra-source-files:+ library- exposed-modules: Linux.Arch.Aur.Rpc, Linux.Arch.Aur.Types+ exposed-modules: Linux.Arch.Aur.Pkgbuild,+ Linux.Arch.Aur.Rpc,+ Linux.Arch.Aur.Types -- Modules included in this library but not exported. -- other-modules: -- LANGUAGE extensions used by modules in this package.- other-extensions: OverloadedStrings+ other-extensions: OverloadedStrings, ScopedTypeVariables -- Other library packages from which modules are imported. build-depends: base >=4.7 && <4.8, mtl >=2.1 && <2.2,- lens >=4.1 && <4.2,+ lens >=4.2 && <4.3, aeson >=0.7 && <0.8, aeson-pretty >=0.7 && <0.8, text >=1.1 && <1.2, wreq >=0.1 && <0.2,- vector >=0.10 && <0.11+ vector >=0.10 && <0.11,+ filepath -- Directories containing source files. -- hs-source-dirs: