~singpolyma/jmp-pay

588b88b28333f4f455a2e313e73aea44634d9fe8 — Stephen Paul Weber 4 months ago c1071f4 guix
Build Guix package
2 files changed, 909 insertions(+), 0 deletions(-)

A .builds/guix.yml
A jmp-pay.scm
A .builds/guix.yml => .builds/guix.yml +45 -0
@@ 0,0 1,45 @@
image: debian/unstable
sources:
- https://git.singpolyma.net/jmp-pay
packages:
- guix
- xz-utils
environment:
  GUIX_PROFILE: /var/guix/profiles/per-user/root/guix-profile
  CID: QmRpV6qo68sC3ZCwdZT4qcARw5jUWM6ixSEyxv5ojkhVca
  TARNAME: 2kld8phgqyr21daa2j4aq3nv4zmmrm2y-guix-tarball-pack.tar.xz
secrets:
- 9ded4157-4cf9-42ae-b7d0-55eb6e52ea37
- fd52c9ce-04e8-4684-af6c-1ab78d2e124a
artifacts:
- jmp-pay.scm
- jmp-pay.nar.xz
tasks:
- pull: |
    curl -O https://cloudflare-ipfs.com/ipfs/$CID/$TARNAME
    sudo systemctl stop guix-daemon
    sudo tar -C / -xJf $TARNAME
    sudo /sbin/start-stop-daemon -Sbmp /tmp/guix-daemon.pid -a $GUIX_PROFILE/bin/guix-daemon -- --build-users-group=_guixbuild
- bake: |
    . $GUIX_PROFILE/etc/profile
    hash guix
    sed '/^;;;;$/q' jmp-pay/jmp-pay.scm > jmp-pay.scm
    printf "(define-public jmp-pay\n\t" >> jmp-pay.scm
    cd jmp-pay
    printf "(use-modules (jmp-pay))\n(write jmp-pay-baked)\n" | guix repl -L. /dev/stdin >> ../jmp-pay.scm
    cd -
    printf ")" >> jmp-pay.scm
    rm -rf jmp-pay
- build: |
    . "$GUIX_PROFILE/etc/profile"
    hash guix
    guix build --no-grafts -L. jmp-pay
- archive: |
    . "$GUIX_PROFILE/etc/profile"
    hash guix
    sudo mv signing-key.pub /etc/guix/
    sudo mv signing-key.sec /etc/guix/
    sudo chown root:root /etc/guix/signing-key.sec
    sudo chmod 0400 /etc/guix/signing-key.sec
    guix archive --export -r --no-grafts -L. jmp-pay > jmp-pay.nar
    xz jmp-pay.nar

A jmp-pay.scm => jmp-pay.scm +864 -0
@@ 0,0 1,864 @@
(define-module (jmp-pay)
  #:use-module ((guix licenses) #:prefix license:)
  #:use-module (guix packages)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module (guix build-system ruby)
  #:use-module (guix build-system copy)
  #:use-module (gnu packages ruby)
  #:use-module (gnu packages databases)
  #:use-module (ice-9 rdelim)
  #:use-module (ice-9 popen)
)

(define-public ruby-sucker-punch
  (package
    (name "ruby-sucker-punch")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sucker_punch" version))
        (sha256
          (base32
            "008vv7gpv2nm5n1njzvabd3aagbywc240y23vifvq6plir53ybay"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "sucker_punch.gemspec"
               (("1.0.0") "1.0"))
             #t)))))
    (propagated-inputs
      `(("ruby-concurrent" ,ruby-concurrent)))
    (native-inputs
     `(("ruby-pry" ,ruby-pry)))
    (synopsis
      "Asynchronous processing library for Ruby")
    (description
      "Asynchronous processing library for Ruby")
    (home-page
      "https://github.com/brandonhilkert/sucker_punch")
    (license license:expat)))

(define-public ruby-niceogiri
  (package
    (name "ruby-niceogiri")
    (version "1.1.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "niceogiri" version))
        (sha256
          (base32
            "1ha93211bc9cvh23s9w89zz7rq8irpf64ccd9arvg8v1sxg2798a"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "niceogiri.gemspec"
               (("2.7") "3.8")
               ((".*guard-rspec.*") "\n"))
             #t)))))
    (propagated-inputs
      `(("ruby-nokogiri" ,ruby-nokogiri)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-yard" ,ruby-yard)))
    (synopsis "Make dealing with XML less painful")
    (description
      "Make dealing with XML less painful")
    (home-page
      "https://github.com/benlangfeld/Niceogiri")
    (license license:expat)))

(define-public ruby-countdownlatch
  (package
    (name "ruby-countdownlatch")
    (version "1.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "countdownlatch" version))
        (sha256
          (base32
            "1v6pbay6z07fp7yvnba1hmyacbicvmjndd8rn2h1b5rmpcb5s0j3"))))
    (build-system ruby-build-system)
    (synopsis
      "A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes")
    (description
      "This package provides a synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes")
    (home-page
      "https://github.com/benlangfeld/countdownlatch")
    (license license:expat)))

(define-public ruby-blather
  (package
    (name "ruby-blather")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "blather" version))
        (sha256
          (base32
            "05ry2x835fj4pzk61282pcz86n018cr39zbgwbi213md74i90s7c"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "blather.gemspec"
               ((".*guard-rspec.*") "\n")
                ((".*bluecloth.*") "\n"))
             #t)))))
    (propagated-inputs
      `(("ruby-activesupport" ,ruby-activesupport)
        ("ruby-eventmachine" ,ruby-eventmachine)
        ("ruby-niceogiri" ,ruby-niceogiri)
        ("ruby-nokogiri" ,ruby-nokogiri)
        ("ruby-sucker-punch" ,ruby-sucker-punch)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-yard" ,ruby-yard)
       ("ruby-countdownlatch" ,ruby-countdownlatch)
       ("ruby-rb-fsevent" ,ruby-rb-fsevent)
       ("ruby-mocha" ,ruby-mocha)))
    (synopsis
      "An XMPP DSL for Ruby written on top of EventMachine and Nokogiri")
    (description
      "An XMPP DSL for Ruby written on top of EventMachine and Nokogiri")
    (home-page "http://adhearsion.com/blather")
    (license license:expat)))

(define-public ruby-braintree
  (package
    (name "ruby-braintree")
    (version "4.4.0")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; Rakefile.
       (uri (git-reference
             (url "https://github.com/braintree/braintree_ruby")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "0dzf26yhmlf65464nranvqg5rzhrc8gfaqbg3p4ld3abz8ccnw08"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "test:unit"
       #:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'less-strict-dependencies
           (lambda _
             (substitute* "Gemfile"
               (("gem \"libxml-ruby\", \"3.2.0\"") "gem \"libxml-ruby\", \"~> 3.0.0\"")
               (("gem \"rspec\", \"3.9.0\"") "gem \"rspec\", \"~> 3.8.0\"")
               (("gem \"rubocop\", \"~>1.12.0\"") "gem \"rubocop\", \"~> 1.10.0\""))
             #t)))))
    (propagated-inputs
      `(("ruby-builder" ,ruby-builder)
        ("ruby-rexml" ,ruby-rexml)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-libxml" ,ruby-libxml)
       ("ruby-pry" ,ruby-pry)
       ("ruby-rake" ,ruby-rake)
       ("ruby-webrick" ,ruby-webrick)
       ("ruby-rubocop" ,ruby-rubocop)))
    (synopsis
      "Resources and tools for developers to integrate Braintree's global payments platform.")
    (description
      "Resources and tools for developers to integrate Braintree's global payments platform.")
    (home-page "https://www.braintreepayments.com/")
    (license license:expat)))

(define-public ruby-value-semantics
  (package
    (name "ruby-value-semantics")
    (version "3.6.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "value_semantics" version))
        (sha256
          (base32
            "1vdwai8wf6r1fkvdpyz1vzxm89q7ghjvb3pqpg2kvwibwzd99dnx"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (replace 'check
           (lambda _
             (invoke "rspec")
             #t)))))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)))
    (synopsis
      "
    Generates modules that provide conventional value semantics for a given set of attributes.
    The behaviour is similar to an immutable `Struct` class,
    plus extensible, lightweight validation and coercion.
  ")
    (description
      "
    Generates modules that provide conventional value semantics for a given set of attributes.
    The behaviour is similar to an immutable `Struct` class,
    plus extensible, lightweight validation and coercion.
  ")
    (home-page
      "https://github.com/tomdalling/value_semantics")
    (license license:expat)))

(define-public ruby-promise.rb
  (package
    (name "ruby-promise.rb")
    (version "0.7.4")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "promise.rb" version))
        (sha256
          (base32
            "0a819sikcqvhi8hck1y10d1nv2qkjvmmm553626fmrh51h2i089d"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "spec"
       #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'less-strict-dependencies
           (lambda _
             (substitute* "Rakefile"
               (("if Gem.ruby_version.*") "if false\n"))
             (substitute* "spec/spec_helper.rb"
               ((".*devtools/spec_helper.*") "\n"))
             #t)))))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-rspec-its" ,ruby-rspec-its)
       ("ruby-awesome-print" ,ruby-awesome-print)
       ("ruby-fuubar" ,ruby-fuubar)))
    (synopsis "Promises/A+ for Ruby")
    (description "Promises/A+ for Ruby")
    (home-page "https://github.com/lgierth/promise")
    (license license:unlicense)))

(define-public ruby-multicodecs
  (package
    (name "ruby-multicodecs")
    (version "0.2.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "multicodecs" version))
        (sha256
          (base32
            "0drq267di57l9zqw6zvqqimilz42rbc8z7392dwkk8wslq30s7v8"))))
    (build-system ruby-build-system)
    (synopsis
      "This gem provides a PORO of the multicodec table for use with other
    multiformat ruby gems.")
    (description
      "This gem provides a PORO of the multicodec table for use with other
    multiformat ruby gems.")
    (home-page
      "https://github.com/SleeplessByte/ruby-multicodec")
    (license license:expat)))

(define-public ruby-multihashes
  (package
    (name "ruby-multihashes")
    (version "0.2.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "multihashes" version))
        (sha256
          (base32
            "17wiyy3fiv8rpgdv9ca01yncsmaaf8yg15bg18wc7m9frss1vgqg"))))
    (build-system ruby-build-system)
    (propagated-inputs
      `(("ruby-multicodecs" ,ruby-multicodecs)))
    (synopsis
      "A simple, low-level multihash (https://github.com/jbenet/multihash) implementation for ruby.")
    (description
      "This package provides a simple, low-level multihash (https://github.com/jbenet/multihash) implementation for ruby.")
    (home-page
      "https://github.com/neocities/ruby-multihashes")
    (license license:expat)))

(define-public ruby-lazy-object
  (package
    (name "ruby-lazy-object")
    (version "0.0.3")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "lazy_object" version))
        (sha256
          (base32
            "08px15lahc28ik9smvw1hgamf792gd6gq0s4k94yq1h7jq25wjn8"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (synopsis
      "It's an object wrapper that forwards all calls to the reference object. This object is not created until the first method dispatch.")
    (description
      "It's an object wrapper that forwards all calls to the reference object.  This object is not created until the first method dispatch.")
    (home-page "")
    (license license:expat)))

(define-public ruby-citrus
  (package
    (name "ruby-citrus")
    (version "3.0.2")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; files needed for tests
       (uri (git-reference
             (url "https://github.com/mjackson/citrus")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "197wrgqrddgm1xs3yvjvd8vkvil4h4mdrcp16jmd4b57rxrrr769"))))
    (build-system ruby-build-system)
    (synopsis "Parsing Expressions for Ruby")
    (description "Parsing Expressions for Ruby")
    (home-page "http://mjackson.github.io/citrus")
    (license license:expat)))

(define-public ruby-cbor
  (package
    (name "ruby-cbor")
    (version "0.5.9.6")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "cbor" version))
        (sha256
          (base32
            "0511idr8xps9625nh3kxr68sdy6l3xy2kcz7r57g47fxb1v18jj3"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-rake-compiler" ,ruby-rake-compiler)
       ("ruby-yard" ,ruby-yard)))
    (synopsis
      "CBOR is a library for the CBOR binary object representation format, based on Sadayuki Furuhashi's MessagePack library.")
    (description
      "CBOR is a library for the CBOR binary object representation format, based on Sadayuki Furuhashi's MessagePack library.")
    (home-page "http://cbor.io/")
    (license license:asl2.0)))

(define-public ruby-gem-release
  (package
    (name "ruby-gem-release")
    (version "2.2.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "gem-release" version))
        (sha256
          (base32
            "108rrfaiayi14zrqbb6z0cbwcxh8n15am5ry2a86v7c8c3niysq9"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (synopsis
      "Release your ruby gems with ease. (What a bold statement for such a tiny plugin ...)")
    (description
      "Release your ruby gems with ease. (What a bold statement for such a tiny plugin ...)")
    (home-page
    "https://github.com/svenfuchs/gem-release")
    (license license:expat)))

(define-public ruby-base32
  (package
    (name "ruby-base32")
    (version "0.3.4")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "base32" version))
        (sha256
          (base32
            "1fjs0l3c5g9qxwp43kcnhc45slx29yjb6m6jxbb2x1krgjmi166b"))))
    (build-system ruby-build-system)
    (native-inputs
     `(("ruby-gem-release" ,ruby-gem-release)))
    (synopsis
      "Ruby extension for base32 encoding and decoding")
    (description
      "Ruby extension for base32 encoding and decoding")
    (home-page "https://github.com/stesla/base32")
    (license license:expat)))

(define-public ruby-dhall
  (package
    (name "ruby-dhall")
    (version "0.5.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "dhall" version))
        (sha256
          (base32
            "09wcq8xc1ynld04r2f332bx8cn7rjc4afaq8hm1dr2fc35jlpn6m"))))
    (build-system ruby-build-system)
    (arguments
     ;; No test in gem archive
     `(#:tests? #f))
    (propagated-inputs
      `(("ruby-base32" ,ruby-base32)
        ("ruby-cbor" ,ruby-cbor)
        ("ruby-citrus" ,ruby-citrus)
        ("ruby-lazy-object" ,ruby-lazy-object)
        ("ruby-multihashes" ,ruby-multihashes)
        ("ruby-promise.rb" ,ruby-promise.rb)
        ("ruby-value-semantics" ,ruby-value-semantics)))
    (synopsis
      "This is a Ruby implementation of the Dhall configuration language. Dhall is a powerful, but safe and non-Turing-complete configuration language. For more information, see: https://dhall-lang.org")
    (description
      "This is a Ruby implementation of the Dhall configuration language.  Dhall is a powerful, but safe and non-Turing-complete configuration language.  For more information, see: https://dhall-lang.org")
    (home-page
      "https://git.singpolyma.net/dhall-ruby")
    (license license:gpl3)))

(define-public ruby-money
  (package
    (name "ruby-money")
    (version "6.16.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "money" version))
        (sha256
          (base32
            "0jkmsj5ymadik7bvl670bqwmvhsdyv7hjr8gq9z293hq35gnyiyg"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (propagated-inputs `(("ruby-i18n" ,ruby-i18n)))
    (synopsis
      "A Ruby Library for dealing with money and currency conversion.")
    (description
      "This package provides a Ruby Library for dealing with money and currency conversion.")
    (home-page "https://rubymoney.github.io/money")
    (license license:expat)))

(define-public ruby-monetize
  (package
    (name "ruby-monetize")
    (version "1.11.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "monetize" version))
        (sha256
          (base32
            "0cna2myxdbwfq0gn6k2hgrh368dq7wld3jklm96443ysykd0difn"))))
    (build-system ruby-build-system)
    (arguments
     '(#:test-target "spec"))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)))
    (propagated-inputs `(("ruby-money" ,ruby-money)))
    (synopsis
      "A library for converting various objects into `Money` objects.")
    (description
      "This package provides a library for converting various objects into `Money` objects.")
    (home-page
      "https://github.com/RubyMoney/monetize")
    (license license:expat)))

(define-public ruby-money-open-exchange-rates
  (package
    (name "ruby-money-open-exchange-rates")
    (version "1.4.0")
    (source
     (origin
       (method git-fetch)
       ;; Download from GitHub because the rubygems version does not contain
       ;; Rakefile.
       (uri (git-reference
             (url "https://github.com/spk/money-open-exchange-rates")
             (commit (string-append "v" version))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "11xwqli8snr19k48yh8h77sal5vxd4snzq9gxg08v61f0574m3gw"))))
    (build-system ruby-build-system)
    (propagated-inputs `(("ruby-money" ,ruby-money)))
    (native-inputs
     `(("ruby-minitest" ,ruby-minitest)
       ("ruby-mocha" ,ruby-mocha)
       ("ruby-timecop" ,ruby-timecop)
       ("ruby-webmock" ,ruby-webmock)
       ("ruby-monetize" ,ruby-monetize)
       ("ruby-rake" ,ruby-rake)
       ("ruby-rubocop" ,ruby-rubocop)))
    (synopsis
      "A gem that calculates the exchange rate using published rates from open-exchange-rates. Compatible with the money gem.")
    (description
      "This package provides a gem that calculates the exchange rate using published rates from open-exchange-rates.  Compatible with the money gem.")
    (home-page
      "http://github.com/spk/money-open-exchange-rates")
    (license license:expat)))

(define-public ruby-roda
  (package
    (name "ruby-roda")
    (version "3.47.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "roda" version))
        (sha256
          (base32
            "1g3zs4bk8hqii15ci1hsykcsya88vr2qv63gp1qbcx4bm14l8lkl"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (propagated-inputs `(("ruby-rack" ,ruby-rack)))
    (synopsis "Routing tree web toolkit")
    (description "Routing tree web toolkit")
    (home-page "http://roda.jeremyevans.net")
    (license license:expat)))

(define-public ruby-nori
  (package
    (name "ruby-nori")
    (version "2.6.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "nori" version))
        (sha256
          (base32
            "066wc774a2zp4vrq3k7k8p0fhv30ymqmxma1jj7yg5735zls8agn"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests require too old version of rspec
     `(#:tests? #f))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-rake" ,ruby-rake)
       ("ruby-nokogiri" ,ruby-nokogiri)))
    (synopsis "XML to Hash translator")
    (description "XML to Hash translator")
    (home-page "https://github.com/savonrb/nori")
    (license license:expat)))

(define-public ruby-faraday-middleware
  (package
    (name "ruby-faraday-middleware")
    (version "1.1.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "faraday_middleware" version))
        (sha256
          (base32
            "0kgcphf7n74l3wlcvxafcp6a4l18b1bf4qslvz5dqj6v3gc8h8j4"))))
    (build-system ruby-build-system)
    (arguments
     ;; No rakefile
     `(#:tests? #f))
    (propagated-inputs
      `(("ruby-faraday" ,ruby-faraday)))
    (synopsis "Various middleware for Faraday")
    (description "Various middleware for Faraday")
    (home-page
      "https://github.com/lostisland/faraday_middleware")
    (license license:expat)))

(define-public ruby-bandwidth-iris
  (package
    (name "ruby-bandwidth-iris")
    (version "4.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "ruby-bandwidth-iris" version))
        (sha256
          (base32
            "16bbx6y0ni3jl190ddr6xfbi2rbcikqfm2ghzr53445fpk6g12zc"))))
    (build-system ruby-build-system)
    (arguments
     ; Tests don't require helper for some reason, so all fail...
     '(#:tests? #f))
    (propagated-inputs
      `(("ruby-activesupport" ,ruby-activesupport)
        ("ruby-builder" ,ruby-builder)
        ("ruby-faraday" ,ruby-faraday)
        ("ruby-faraday-middleware"
         ,ruby-faraday-middleware)
        ("ruby-nori" ,ruby-nori)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-yard" ,ruby-yard)))
    (synopsis
      "Gem for integrating to Bandwidth's Iris API")
    (description
      "Gem for integrating to Bandwidth's Iris API")
    (home-page
      "https://github.com/bandwidthcom/ruby-bandwidth-iris")
    (license license:expat)))

(define-public ruby-sentry-core
  (package
    (name "ruby-sentry-core")
    (version "4.3.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sentry-ruby-core" version))
        (sha256
          (base32
            "13z35s9mflh3v775a0scsnqhscz9q46kaak38y7zmx32z7sg2a3a"))))
    (build-system ruby-build-system)
    (arguments
     ; No rakefile in gem
     '(#:tests? #f))
    (propagated-inputs
      `(("ruby-concurrent" ,ruby-concurrent)
        ("ruby-faraday" ,ruby-faraday)))
    (synopsis
      "A gem that provides a client interface for the Sentry error logger")
    (description
      "This package provides a gem that provides a client interface for the Sentry error logger")
    (home-page
      "https://github.com/getsentry/sentry-ruby")
    (license license:expat)))

(define-public ruby-sentry
  (package
    (name "ruby-sentry")
    (version "4.3.1")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "sentry-ruby" version))
        (sha256
          (base32
            "101q3141xfkmh7vi8h4sjqqmxcx90xhyq51lmfnhfiwgii7cn9k8"))))
    (build-system ruby-build-system)
    (arguments
     ; No rakefile in gem
     '(#:tests? #f))
    (propagated-inputs
      `(("ruby-concurrent" ,ruby-concurrent)
        ("ruby-faraday" ,ruby-faraday)
        ("ruby-sentry-core" ,ruby-sentry-core)))
    (synopsis
      "A gem that provides a client interface for the Sentry error logger")
    (description
      "This package provides a gem that provides a client interface for the Sentry error logger")
    (home-page
      "https://github.com/getsentry/sentry-ruby")
    (license license:expat)))

(define-public ruby-webrick
  (package
    (name "ruby-webrick")
    (version "1.7.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "webrick" version))
        (sha256
          (base32
            "1d4cvgmxhfczxiq5fr534lmizkhigd15bsx5719r5ds7k7ivisc7"))))
    (build-system ruby-build-system)
    (synopsis
      "WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.")
    (description
      "WEBrick is an HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.")
    (home-page "https://github.com/ruby/webrick")
    (license (list #f #f))))

(define-public ruby-interception
  (package
    (name "ruby-interception")
    (version "0.5")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "interception" version))
        (sha256
          (base32
            "01vrkn28psdx1ysh5js3hn17nfp1nvvv46wc1pwqsakm6vb1hf55"))))
    (build-system ruby-build-system)
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)))
    (synopsis
      "Provides a cross-platform ability to intercept all exceptions as they are raised.")
    (description
      "This package provides a cross-platform ability to intercept all exceptions as they are raised.")
    (home-page
      "http://github.com/ConradIrwin/interception")
    (license license:expat)))

(define-public ruby-pry-rescue
  (package
    (name "ruby-pry-rescue")
    (version "1.5.2")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "pry-rescue" version))
        (sha256
          (base32
            "1wn72y8y3d3g0ng350ld92nyjln012432q2z2iy9lhwzjc4dwi65"))))
    (build-system ruby-build-system)
    (arguments
     `(#:phases
       (modify-phases %standard-phases
         (add-after 'unpack 'nuke-bad-test
           (lambda _
             (substitute* "spec/source_location_spec.rb"
               (("time = Time.now") "skip"))
             #t)))))
    (propagated-inputs
      `(("ruby-interception" ,ruby-interception)
        ("ruby-pry" ,ruby-pry)))
    (native-inputs
     `(("ruby-rspec" ,ruby-rspec)
       ("ruby-pry-stack-explorer" ,ruby-pry-stack-explorer)))
    (synopsis
      "Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions")
    (description
      "Allows you to wrap code in Pry::rescue{ } to open a pry session at any unhandled exceptions")
    (home-page
      "https://github.com/ConradIrwin/pry-rescue")
    (license license:expat)))

(define-public ruby-rantly
  (package
    (name "ruby-rantly")
    (version "2.0.0")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "rantly" version))
        (sha256
          (base32
            "11407cg0dzz83jsschnrpi9cqwz8b04q6bj6qj3m70ay52y222ix"))))
    (build-system ruby-build-system)
    (native-inputs
     `(("ruby-rubocop" ,ruby-rubocop)
       ("ruby-simplecov" ,ruby-simplecov)))
    (synopsis
      "Ruby Imperative Random Data Generator and Quickcheck")
    (description
      "Ruby Imperative Random Data Generator and Quickcheck")
    (home-page "https://github.com/rantly-rb/rantly")
    (license license:expat)))

(define %source-dir (dirname (current-filename)))
(define %git-dir (string-append %source-dir "/.git"))

;;;;

; double-escaped template of the jmp-pay sexp
; This allows us to bake the expression without doing a full eval to a record,
; so it can be written
(define-public jmp-pay-template
  '(package
    (name "jmp-pay")
    (version (read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "describe" "--always" "--dirty")))
    (source
     `(origin
       (method git-fetch)
       (uri (git-reference
             (recursive? #t)
             (url "https://git.singpolyma.net/jmp-pay")
             (commit ,(read-line (open-pipe* OPEN_READ "git" "--git-dir" %git-dir "rev-parse" "HEAD")))))
       (file-name (git-file-name name version))
       (sha256
        (base32
         ,(read-line (open-pipe* OPEN_READ "guix" "hash" "-rx" %source-dir))))))
    (build-system 'copy-build-system)
    (arguments
     ''(#:install-plan '(("." "share/jmp-pay"))
       #:phases
       (modify-phases %standard-phases
         (add-after 'install 'wrap
           (lambda* (#:key outputs #:allow-other-keys)
             (use-modules (ice-9 ftw))
             (let* ((out (assoc-ref outputs "out"))
                    (appbindir (string-append out "/share/jmp-pay/bin/"))
                    (bindir (string-append out "/bin/")))
               (for-each (lambda (bin)
                 (mkdir-p bindir)
                 (let ((binstub (string-append bindir bin)))
                   (call-with-output-file binstub
                     (lambda (port)
                       (format port
                         "#!~a~%ENV['GEM_PATH'] = ['~a', ENV['GEM_PATH']].compact.join(':')~%Gem.clear_paths~%load '~a~a'~%"
                         (which "ruby")
                         (getenv "GEM_PATH")
                         appbindir
                         bin)))
                   (chmod binstub #o755)))
                 (scandir appbindir
                   (lambda (f) (eq? 'regular (stat:type (stat (string-append appbindir f))))))))
             #t))
         (add-before 'install 'check
           (lambda _
             (invoke "rake" "test")
             #t)))))
    (propagated-inputs
      '`(("ruby-blather" ,ruby-blather)
        ("ruby-braintree" ,ruby-braintree)
        ("ruby-dhall" ,ruby-dhall)
        ("ruby-money-open-exchange-rates" ,ruby-money-open-exchange-rates)
        ("ruby-pg" ,ruby-pg)
        ("ruby-redis" ,ruby-redis)
        ("ruby-roda" ,ruby-roda)
        ("ruby-bandwidth-iris" ,ruby-bandwidth-iris)
        ("ruby-sentry" ,ruby-sentry)
        ("ruby" ,ruby) ;; Normally ruby-build-system adds this for us
        ("ruby-slim" ,ruby-slim)))
    (native-inputs
     '`(("ruby-rantly" ,ruby-rantly)
       ("ruby-rake" ,ruby-rake)
       ("ruby-webmock" ,ruby-webmock)))
    (synopsis
      "Payment infrastructure for JMP.chat")
    (description
      "Web service and cronjobs for payment handling")
    (home-page
      "https://git.singpolyma.net/jmp-pay")
    (license 'license:agpl3)))

; Baked version of jmp-pay-template with leaves eval'd
(define-public jmp-pay-baked
 (cons
  (car jmp-pay-template)
  (map
   (lambda (x) (list (car x) (eval (cadr x) (current-module))))
   (cdr jmp-pay-template))))

; Build clean from git the version from a local clone
; To build whatever is sitting in local use:
; guix build --with-source="jmp-pay@$(git describe --always --dirty)=$(pwd)" -L . jmp-pay
(define-public jmp-pay
  (eval jmp-pay-baked (current-module)))