lackey 2.0.0.7 → 2.0.0.8
raw patch · 8 files changed
+90/−92 lines, 8 filesdep ~basedep ~hspecdep ~servantPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: base, hspec, servant, servant-foreign, text
API changes (from Hackage documentation)
Files
- CHANGELOG.markdown +0/−4
- CHANGELOG.md +4/−0
- LICENSE.markdown +0/−21
- LICENSE.txt +21/−0
- README.markdown +0/−39
- README.md +38/−0
- lackey.cabal +14/−15
- source/library/Lackey.hs +13/−13
− CHANGELOG.markdown
@@ -1,4 +0,0 @@-# Change log--Lackey follows the [Package Versioning Policy](https://pvp.haskell.org).-You can find release notes [on GitHub](https://github.com/tfausak/lackey/releases).
+ CHANGELOG.md view
@@ -0,0 +1,4 @@+# Change log++Lackey follows the [Package Versioning Policy](https://pvp.haskell.org).+You can find release notes [on GitHub](https://github.com/tfausak/lackey/releases).
− LICENSE.markdown
@@ -1,21 +0,0 @@-MIT License--Copyright (c) 2023 Taylor Fausak--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.
+ LICENSE.txt view
@@ -0,0 +1,21 @@+MIT License++Copyright (c) 2024 Taylor Fausak++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.markdown
@@ -1,39 +0,0 @@-# [Lackey][]--[](https://github.com/tfausak/lackey/actions/workflows/workflow.yaml)-[](https://hackage.haskell.org/package/lackey)-[](https://www.stackage.org/package/lackey)--Lackey is a Haskell library for generating Ruby consumers of [Servant][] APIs.--Use `Lackey.rubyForAPI` to generate a string of Ruby source code for consuming-a Servant API. For example:--``` hs-{-# LANGUAGE DataKinds #-}-{-# LANGUAGE TypeOperators #-}--import qualified Data.Proxy as Proxy-import qualified Data.Text as Text-import qualified Data.Text.IO as Text-import qualified Lackey-import Servant.API--type API = "words" :> Get '[JSON] [String]--api :: Proxy.Proxy API-api = Proxy.Proxy--ruby :: Text.Text-ruby = Lackey.rubyForAPI api--main :: IO ()-main = Text.putStrLn ruby--- def get_words(excon)excon.request(:method=>:get,:path=>"/words",:headers=>{},:body=>nil)end-```--The generated functions require [Excon][].--[Lackey]: https://github.com/tfausak/lackey-[Servant]: https://haskell-servant.readthedocs.org/en/stable/-[Excon]: https://rubygems.org/gems/excon
+ README.md view
@@ -0,0 +1,38 @@+# [Lackey][]++[](https://github.com/tfausak/lackey/actions/workflows/ci.yml)+[](https://hackage.haskell.org/package/lackey)++Lackey is a Haskell library for generating Ruby consumers of [Servant][] APIs.++Use `Lackey.rubyForAPI` to generate a string of Ruby source code for consuming+a Servant API. For example:++``` hs+{-# LANGUAGE DataKinds #-}+{-# LANGUAGE TypeOperators #-}++import qualified Data.Proxy as Proxy+import qualified Data.Text as Text+import qualified Data.Text.IO as Text+import qualified Lackey+import Servant.API++type API = "words" :> Get '[JSON] [String]++api :: Proxy.Proxy API+api = Proxy.Proxy++ruby :: Text.Text+ruby = Lackey.rubyForAPI api++main :: IO ()+main = Text.putStrLn ruby+-- def get_words(excon)excon.request(:method=>:get,:path=>"/words",:headers=>{},:body=>nil)end+```++The generated functions require [Excon][].++[Lackey]: https://github.com/tfausak/lackey+[Servant]: https://haskell-servant.readthedocs.org/en/stable/+[Excon]: https://rubygems.org/gems/excon
lackey.cabal view
@@ -1,17 +1,17 @@ cabal-version: 2.2- name: lackey-version: 2.0.0.7-+version: 2.0.0.8 synopsis: Generate Ruby clients from Servant APIs. description: Lackey generates Ruby clients from Servant APIs.- bug-reports: https://github.com/tfausak/lackey/issues build-type: Simple category: Web-extra-source-files: CHANGELOG.markdown README.markdown+extra-doc-files:+ CHANGELOG.md+ README.md+ homepage: https://github.com/tfausak/lackey#readme-license-file: LICENSE.markdown+license-file: LICENSE.txt license: MIT maintainer: Taylor Fausak @@ -25,10 +25,7 @@ manual: True common library- build-depends:- , base >= 4.16.0 && < 4.20- , servant-foreign >= 0.15.4 && < 0.17- , text >= 1.2.5 && < 1.3 || >= 2.0 && < 2.2+ build-depends: base ^>=4.18.0.0 || ^>=4.19.0.0 || ^>=4.20.0.0 default-language: Haskell2010 ghc-options: -Weverything@@ -45,25 +42,27 @@ common executable import: library- build-depends: lackey ghc-options: -rtsopts -threaded- -Wno-unused-packages library import: library+ build-depends:+ servant-foreign ^>=0.16,+ text ^>=2.0.2 || ^>=2.1, exposed-modules: Lackey hs-source-dirs: source/library test-suite lackey-test-suite import: executable- build-depends:- , hspec >= 2.9.7 && < 2.12- , servant >= 0.19.1 && < 0.21+ hspec ^>=2.11.8,+ servant ^>=0.20.1,+ text,+ hs-source-dirs: source/test-suite main-is: Main.hs type: exitcode-stdio-1.0
source/library/Lackey.hs view
@@ -78,19 +78,19 @@ functionArguments request = Text.concat [ "(",- [ [Just "excon"],- request- & getURLPieces- & fmap- ( \piece -> Just $ case piece of- Left capture -> underscore capture- Right param -> underscore param <> ": nil"- ),- request & getHeaders & fmap (Just . (<> ": nil") . underscore),- [if hasBody request then Just bodyArgument else Nothing]- ]- & concat- & Maybe.catMaybes+ concatMap+ Maybe.catMaybes+ [ [Just "excon"],+ request+ & getURLPieces+ & fmap+ ( \piece -> Just $ case piece of+ Left capture -> underscore capture+ Right param -> underscore param <> ": nil"+ ),+ request & getHeaders & fmap (Just . (<> ": nil") . underscore),+ [if hasBody request then Just bodyArgument else Nothing]+ ] & Text.intercalate ",", ")" ]