(use-modules
  ((guix licenses) #:prefix license:)
  (guix packages)
  (guix download)
  (guix gexp)
  (guix git-download)
  (guix build-system ruby)
  (guix build-system copy)
  (gnu packages rails)
  (gnu packages ruby)
  (gnu packages tls)
  (gnu packages databases)
  (ice-9 rdelim)
  (ice-9 popen))

(define-public ruby-addressable
  (package
    (name "ruby-addressable")
    (version "2.8.8")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "addressable" version))
       (sha256
        (base32 "0mxhjgihzsx45l9wh2n0ywl9w0c6k70igm5r0d63dxkcagwvh4vw"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-public-suffix))
    (synopsis
     "Addressable is an alternative implementation to the URI implementation that is
part of Ruby's standard library. It is flexible, offers heuristic parsing, and
additionally provides extensive support for IRIs and URI templates.
")
    (description
     "Addressable is an alternative implementation to the URI implementation that is
part of Ruby's standard library.  It is flexible, offers heuristic parsing, and
additionally provides extensive support for IRIs and URI templates.")
    (home-page "https://github.com/sporkmonger/addressable")
    (license #f)))

(define-public ruby-multipart-parser
  (package
    (name "ruby-multipart-parser")
    (version "0.1.1")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "multipart-parser" version))
              (sha256
               (base32
                "0xb4p475yrfm883h9kn80a021myn17dvs50wpa1djzcmlq7p0882"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases #~(modify-phases %standard-phases
                   (add-after 'unpack 'skip-failing-test
                     ;; One test fails for unknown reasons (see:
                     ;; https://github.com/danabr/multipart-parser/issues/7).
                     (lambda _
                       (substitute* "test/multipart_parser/reader_test.rb"
                         (("def test_long" all)
                          (string-append all "\n      return true"))))))))
    (synopsis "Parser for multipart MIME messages")
    (description "@code{multipart-parser} is a simple parser for multipart
MIME messages, written in Ruby, based on felixge/node-formidable's parser.  It
has the following characteristics:
@itemize
@item Pure Ruby
@item Event-driven API
@item Only supports one level of multipart parsing
@item Does not perform I/O
@item Does not depend on any other library.
@end itemize")
    (home-page "https://github.com/danabr/multipart-parser")
    (license license:expat)))

(define-public ruby-ruby2-keywords
  (package
    (name "ruby-ruby2-keywords")
    (version "0.0.5")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/ruby/ruby2_keywords")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "1jhqb152zfr2yrxj6j8rzakkwdkg5viggwnnqrrfxwwy63msdi97"))))
    (build-system ruby-build-system)
    (arguments
     (list
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'delete-extraneous-rake-files
            (lambda _
              (for-each delete-file '("rakelib/changelogs.rake"
                                      "rakelib/epoch.rake"
                                      "rakelib/version.rake"))))
          (add-after 'extract-gemspec 'adjust-files
            (lambda _
              (substitute* "ruby2_keywords.gemspec"
                ;; This file is not present in the git checkout.
                ((".*\"ChangeLog\",.*") "")))))))
    (synopsis "Shim library for Module#ruby2_keywords")
    (description "Provides empty @code{Module#ruby2_keywords} method, for the
forward source-level compatibility against @command{ruby2.7} and
@command{ruby3}.")
    (home-page "https://github.com/ruby/ruby2_keywords")
    (license license:bsd-2)))

(define-public ruby-faraday-multipart
  (package
    (name "ruby-faraday-multipart")
    (version "1.0.4")
    (source (origin
              (method git-fetch)
              (uri (git-reference
                    (url "https://github.com/lostisland/faraday-multipart")
                    (commit (string-append "v" version))))
              (file-name (git-file-name name version))
              (sha256
               (base32
                "0ywxhff40a688n50lxrn4d8y096l8sbrwp1jfz4zd3kdiiygclka"))))
    (build-system ruby-build-system)
    (arguments (list #:tests? #f #:test-target "spec"))
    (native-inputs (list ruby-multipart-parser ruby-rspec))
    (propagated-inputs (list ruby-multipart-post))
    (synopsis "Multipart-post requests extension for Faraday")
    (description "This Ruby gem extends Faraday to perform multipart-post
requests.")
    (home-page "https://github.com/lostisland/faraday-multipart")
    (license license:expat)))

(define-public ruby-eventmachine-openssl
  (package
    (inherit ruby-eventmachine)
    (inputs `(("openssl" ,openssl)))))

(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 "926da56cbb36ec63fe8fb74d1eafbb60a6c3cc91")
    (source
      (origin
      (method git-fetch)
      ;; Download from GitHub because the rubygems version requires old
      ;; version of bundler Rakefile.
      (uri (git-reference
          (url "https://github.com/singpolyma/blather")
          (commit version)))
      (file-name (git-file-name name version))
        (sha256
          (base32
            "0m3vvlhjaixi79fnp00jl7g69vd5kp40d3h83xvzamzdq1hfya03"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f #: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-rspec-junit-formatter
  (package
    (name "ruby-rspec-junit-formatter")
    (version "0.6.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec_junit_formatter" version))
              (sha256
               (base32
                "059bnq1gcwl9g93cqf13zpz38zk7jxaa43anzz06qkmfwrsfdpa0"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-rspec-core))
    (synopsis
     "RSpec results that your continuous integration service can read.")
    (description
     "RSpec results that your continuous integration service can read.")
    (home-page "https://github.com/sj26/rspec_junit_formatter")
    (license license:expat)))

(define-public ruby-braintree
  (package
    (name "ruby-braintree")
    (version "4.12.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
         "0gfgkymy3655drwgs42bj9ap9qib1l30sajxmypmp6s75m9w3gsh"))))
    (build-system ruby-build-system)
    (arguments
     `(#:test-target "test:unit"
		 #:tests? #f
       #: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 \"rubocop\".*") "")
               (("gem \"rake\", \"13.0.1\"") "gem \"rake\", \"~> 13.0.6\"")
               (("gem \"rspec\", \"3.9.0\"") "gem \"rspec\", \"~> 3.12.0\"")
               (("gem \"pry\", \"0.13.1\"") "gem \"pry\", \"~> 0.14.2\""))
             (substitute* "Rakefile"
               (("sh \"rubocop\"") "")))))))
    (propagated-inputs
      `(("ruby-builder" ,ruby-builder)
        ("ruby-rexml" ,ruby-rexml)))
    (native-inputs
	  (list
		ruby-rspec
		ruby-libxml
		ruby-pry
		ruby-rake
		ruby-webrick
		ruby-rspec-junit-formatter))
    (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 "a164e22449740775ed522c553999f7c04aa6ae85")
    (source
     (origin
       (method git-fetch)
       (uri (git-reference
             (url "https://github.com/singpolyma/value_semantics")
             (commit version)))
       (file-name (git-file-name name version))
       (sha256
        (base32
         "19fj4p6irmdiphp0z1r60b98d6j2gpfm84gawbc10bzm0zimlxns"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (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") ; move to 0.1.0 for ruby3
    (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.7")
    (source
      (origin
        (method url-fetch)
        (uri (rubygems-uri "dhall" version))
        (sha256
          (base32
            "1fmd4jfd66sdyihqigc2vgdjzjy7gi513gjmwz07rds7f7x70fsq"))))
    (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.sr.ht/~singpolyma/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 "v7.0.0")
    (source
      (origin
      (method git-fetch)
      (uri (git-reference
          (url "https://github.com/Bandwidth/ruby-bandwidth-iris")
          (commit version)))
        (sha256
          (base32
            "0w6plk7n807fw9w29c4za7hf0g01m06ldm553lg3fl6c10kydj7q"))))
    (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 #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-public ruby-em-promise.rb
  (package
    (name "ruby-em-promise.rb")
    (version "0.0.5")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "em_promise.rb" version))
              (sha256
               (base32
                "00rkmacyf6i2gq0giaxzwr24ygrwwzndrq7kkbpqcq9glk01w692"))))
    (build-system ruby-build-system)
   (arguments
    ;; No rakefile
    `(#:tests? #f))
    (propagated-inputs (list ruby-eventmachine ruby-promise.rb))
    (synopsis "A subclass of promise.rb Promise for EventMachine.")
    (description
     "This package provides a subclass of promise.rb Promise for EventMachine.")
    (home-page "https://git.singpolyma.net/em_promise.rb")
    (license #f)))

(define-public ruby-em-socksify
  (package
    (name "ruby-em-socksify")
    (version "0.3.2")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "em-socksify" version))
              (sha256
               (base32
                "0rk43ywaanfrd8180d98287xv2pxyl7llj291cwy87g1s735d5nk"))))
    (build-system ruby-build-system)
   (arguments
    ;; Tests are broken
    `(#:tests? #f))
    (propagated-inputs (list ruby-eventmachine))
    (synopsis "Transparent proxy support for any EventMachine protocol")
    (description "Transparent proxy support for any EventMachine protocol")
    (home-page "https://github.com/igrigorik/em-socksify")
    (license license:expat)))

(define-public ruby-rspec-collection-matchers
  (package
    (name "ruby-rspec-collection-matchers")
    (version "1.2.0")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "rspec-collection_matchers" version))
              (sha256
               (base32
                "1864xlxl7mi6mvjyp85a0gc10cyvpf6bj8lc86sf8737wlzn12ks"))))
    (build-system ruby-build-system)
   (arguments
    ;; No rakefile
    `(#:tests? #f))
    (propagated-inputs (list ruby-rspec-expectations))
    (synopsis
     "Collection cardinality matchers, extracted from rspec-expectations")
    (description
     "Collection cardinality matchers, extracted from rspec-expectations")
    (home-page "https://github.com/rspec/rspec-collection_matchers")
    (license license:expat)))

(define-public ruby-cookiejar
  (package
    (name "ruby-cookiejar")
    (version "0.3.3")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "cookiejar" version))
              (sha256
               (base32
                "0q0kmbks9l3hl0wdq744hzy97ssq9dvlzywyqv9k9y1p3qc9va2a"))))
    (build-system ruby-build-system)
   (native-inputs
    `(("ruby-rspec" ,ruby-rspec)
     ("ruby-rspec-collection-matchers" ,ruby-rspec-collection-matchers)
     ("ruby-yard" ,ruby-yard)))
    (synopsis
     "Allows for parsing and returning cookies in Ruby HTTP client code")
    (description
     "Allows for parsing and returning cookies in Ruby HTTP client code")
    (home-page "http://alkaline-solutions.com")
    (license #f)))

(define-public ruby-em-http-request
  (package
    (name "ruby-em-http-request")
    (version "b51f48fafa6443ad48c89930716c5c427561abd8")
    (source
      (origin
      (method git-fetch)
      (uri (git-reference
          (url "https://github.com/singpolyma/em-http-request")
          (commit version)))
      (file-name (git-file-name name version))
        (sha256
          (base32
            "1kbaghj1gqz1dpl2hikpa4xggfmavma2y442yzsgqk27gmfp9iqq"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests need a whole other set of dependencies
     `(#:tests? #f))
    (propagated-inputs (list ruby-addressable ruby-cookiejar ruby-em-socksify
                             ruby-eventmachine ruby-http-parser.rb))
    (synopsis "EventMachine based, async HTTP Request client")
    (description "EventMachine based, async HTTP Request client")
    (home-page "http://github.com/igrigorik/em-http-request")
    (license license:expat)))

(define-public ruby-em-synchrony
  (package
    (name "ruby-em-synchrony")
    (version "1.0.6")
    (source (origin
              (method url-fetch)
              (uri (rubygems-uri "em-synchrony" version))
              (sha256
               (base32
                "1jh6ygbcvapmarqiap79i6yl05bicldr2lnmc46w1fyrhjk70x3f"))))
    (build-system ruby-build-system)
    (arguments
     ;; Tests need a whole other set of dependencies
     `(#:tests? #f))
    (propagated-inputs (list ruby-eventmachine))
    (synopsis "Fiber aware EventMachine libraries")
    (description "Fiber aware EventMachine libraries")
    (home-page "http://github.com/igrigorik/em-synchrony")
    (license license:expat)))

(define-public ruby-amazing-print
  (package
    (name "ruby-amazing-print")
    (version "1.5.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "amazing_print" version))
       (sha256
        (base32 "0qik1igcs0ylw5b5dwx9npqac5r21d9fcv611h7klcspfari3x7r"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis
     "Great Ruby debugging companion: pretty print Ruby objects to visualize their structure. Supports custom object formatting via plugins")
    (description
     "Great Ruby debugging companion: pretty print Ruby objects to visualize their
structure.  Supports custom object formatting via plugins")
    (home-page "https://github.com/amazing-print/amazing_print")
    (license license:expat)))

(define-public ruby-little-plugger
  (package
    (name "ruby-little-plugger")
    (version "1.1.4")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "little-plugger" version))
       (sha256
        (base32 "1frilv82dyxnlg8k1jhrvyd73l6k17mxc5vwxx080r4x1p04gwym"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis
     "LittlePlugger is a module that provides Gem based plugin management.
By extending your own class or module with LittlePlugger you can easily
manage the loading and initializing of plugins provided by other gems.")
    (description
     "@code{LittlePlugger} is a module that provides Gem based plugin management.  By
extending your own class or module with @code{LittlePlugger} you can easily
manage the loading and initializing of plugins provided by other gems.")
    (home-page "http://gemcutter.org/gems/little-plugger")
    (license #f)))

(define-public ruby-logging
  (package
    (name "ruby-logging")
    (version "2.3.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "logging" version))
       (sha256
        (base32 "1zflchpx4g8c110gjdcs540bk5a336nq6nmx379rdg56xw0pjd02"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-little-plugger ruby-multi-json))
    (synopsis
     "**Logging** is a flexible logging library for use in Ruby programs based on the
design of Java's log4j library. It features a hierarchical logging system,
custom level names, multiple output destinations per log event, custom
formatting, and more.")
    (description
     "**Logging** is a flexible logging library for use in Ruby programs based on the
design of Java's log4j library.  It features a hierarchical logging system,
custom level names, multiple output destinations per log event, custom
formatting, and more.")
    (home-page "http://rubygems.org/gems/logging")
    (license #f)))

(define-public ruby-faraday-http-cache
  (package
    (name "ruby-faraday-http-cache")
    (version "2.5.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-http-cache" version))
       (sha256
        (base32 "10wld3vk3i8zsr3pa9zyjiyi2zlyyln872812f08bbg1hnd15z6b"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-faraday))
    (synopsis "Middleware to handle HTTP caching")
    (description "Middleware to handle HTTP caching")
    (home-page "https://github.com/sourcelevel/faraday-http-cache")
    (license #f)))

(define-public ruby-certifi
  (package
    (name "ruby-certifi")
    (version "2018.01.18")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "certifi" version))
       (sha256
        (base32 "1qz95jaw1c2n61dnfxx70hncrhadjxm4j8wqhaj5alh44x5g1bym"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "Rubygem for providing Mozilla's CA Bundle")
    (description "Rubygem for providing Mozilla's CA Bundle")
    (home-page "http://certifi.io/")
    (license #f)))

(define-public ruby-bandwidth-sdk
  (package
    (name "ruby-bandwidth-sdk")
    (version "6.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "bandwidth-sdk" version))
       (sha256
        (base32 "050dfpwx5hf02cja3kr1j4mqrqdl9cwwghbng0q82gg6dnh572ww"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-builder
                             ruby-certifi
                             ruby-faraday
                             ruby-faraday-http-cache
                             ruby-faraday-middleware
                             ruby-logging))
    (synopsis "Bandwidth's set of APIs")
    (description "Bandwidth's set of APIs")
    (home-page "https://github.com/Bandwidth/ruby-sdk")
    (license license:expat)))

(define-public ruby-unaccent
  (package
    (name "ruby-unaccent")
    (version "0.4.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "unaccent" version))
       (sha256
        (base32 "0cvk3vhs95123r4faa60vqknishx3r6fiy2kq0bm7p3f04q849yr"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "Replace accented characters with unaccented characters.")
    (description "Replace accented characters with unaccented characters.")
    (home-page "https://github.com/hardpixel/unaccent")
    (license license:expat)))

(define-public ruby-countries
  (package
    (name "ruby-countries")
    (version "5.7.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "countries" version))
       (sha256
        (base32 "0wwjvwfbfbkhablr45k7aaib7jx5j1k6ii3wi6p3x0fq9f903q88"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-unaccent))
    (synopsis
     "All sorts of useful information about every country packaged as pretty little country objects. It includes data from ISO 3166")
    (description
     "All sorts of useful information about every country packaged as pretty little
country objects.  It includes data from ISO 3166")
    (home-page "https://github.com/countries/countries")
    (license license:expat)))

(define-public ruby-em-hiredis
  (package
    (name "ruby-em-hiredis")
    (version "0.3.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "em-hiredis" version))
       (sha256
        (base32 "0lh276x6wngq9xy75fzzvciinmdlys93db7chy968i18japghk6z"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-eventmachine ruby-hiredis))
    (synopsis "Eventmachine redis client using hiredis native parser")
    (description "Eventmachine redis client using hiredis native parser")
    (home-page "http://github.com/mloughran/em-hiredis")
    (license #f)))

(define-public ruby-em-pg-client
  (package
    (name "ruby-em-pg-client")
    (version "a32daf9c25ac9c44e73e843e80125e0fb4c2a8f1")
    (source
      (origin
      (method git-fetch)
      (uri (git-reference
          (url "https://github.com/singpolyma/ruby-em-pg-client")
          (commit version)))
      (file-name (git-file-name name version))
        (sha256
          (base32
            "0c3vxy5cv5xiaxbbv9b1kdasbh6h865f6fl269fi327x0fdnyk15"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-eventmachine ruby-pg))
    (synopsis
     "PostgreSQL asynchronous EventMachine client, based on pg interface (PG::Connection)")
    (description
     "@code{PostgreSQL} asynchronous @code{EventMachine} client, based on pg interface
(PG::Connection)")
    (home-page "http://github.com/royaltm/ruby-em-pg-client")
    (license license:expat)))

(define-public ruby-faraday-em-http
  (package
    (name "ruby-faraday-em-http")
    (version "52104d59129fed5056a0aa8395a7c67506fc5b88")
    (source
      (origin
      (method git-fetch)
      (uri (git-reference
          (url "https://github.com/singpolyma/faraday-em_http")
          (commit version)))
      (file-name (git-file-name name version))
        (sha256
          (base32
            "1gs3hs0mpzl9b4z490zhsak4mwxc9mvhzq76kih16pvmzyjjwl27"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "Faraday adapter for Em::Http")
    (description "Faraday adapter for Em::Http")
    (home-page "https://github.com/lostisland/faraday-em_http")
    (license license:expat)))

(define-public ruby-faraday-retry
  (package
    (name "ruby-faraday-retry")
    (version "1.0.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-retry" version))
       (sha256
        (base32 "153i967yrwnswqgvnnajgwp981k9p50ys1h80yz3q94rygs59ldd"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis
     "Catches exceptions and retries each request a limited number of times.
")
    (description
     "Catches exceptions and retries each request a limited number of times.")
    (home-page "https://github.com/lostisland/faraday-retry")
    (license license:expat)))

(define-public ruby-faraday-rack
  (package
    (name "ruby-faraday-rack")
    (version "1.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-rack" version))
       (sha256
        (base32 "1h184g4vqql5jv9s9im6igy00jp6mrah2h14py6mpf9bkabfqq7g"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "Faraday adapter for Rack")
    (description "Faraday adapter for Rack")
    (home-page "https://github.com/lostisland/faraday-rack")
    (license license:expat)))

(define-public ruby-faraday-patron
  (package
    (name "ruby-faraday-patron")
    (version "1.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-patron" version))
       (sha256
        (base32 "19wgsgfq0xkski1g7m96snv39la3zxz6x7nbdgiwhg5v82rxfb6w"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-patron))
    (synopsis "Faraday adapter for Patron")
    (description "Faraday adapter for Patron")
    (home-page "https://github.com/lostisland/faraday-patron")
    (license license:expat)))

(define-public ruby-faraday-net-http
  (package
    (name "ruby-faraday-net-http")
    (version "1.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-net_http" version))
       (sha256
        (base32 "1fi8sda5hc54v1w3mqfl5yz09nhx35kglyx72w7b8xxvdr0cwi9j"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "Faraday adapter for Net::HTTP")
    (description "Faraday adapter for Net::HTTP")
    (home-page "https://github.com/lostisland/faraday-net_http")
    (license license:expat)))

(define-public ruby-faraday-net-http-persistent
  (package
    (name "ruby-faraday-net-http-persistent")
    (version "1.2.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-net_http_persistent" version))
       (sha256
        (base32 "0dc36ih95qw3rlccffcb0vgxjhmipsvxhn6cw71l7ffs0f7vq30b"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-net-http-persistent))
    (synopsis "Faraday adapter for NetHttpPersistent")
    (description "Faraday adapter for @code{NetHttpPersistent}")
    (home-page "https://github.com/lostisland/faraday-net_http_persistent")
    (license license:expat)))

(define-public ruby-faraday-httpclient
  (package
    (name "ruby-faraday-httpclient")
    (version "1.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-httpclient" version))
       (sha256
        (base32 "0fyk0jd3ks7fdn8nv3spnwjpzx2lmxmg2gh4inz3by1zjzqg33sc"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-httpclient))
    (synopsis "Faraday adapter for HTTPClient")
    (description "Faraday adapter for HTTPClient")
    (home-page "https://github.com/lostisland/faraday-httpclient")
    (license license:expat)))

(define-public ruby-excon
  (package
    (name "ruby-excon")
    (version "0.109.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "excon" version))
       (sha256
        (base32 "1kmmwgjzlrnc3nnrdnw1z67c95nbw0hv54a73yj8jw6pcvl9585x"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "EXtended http(s) CONnections")
    (description "EXtended http(s) CONnections")
    (home-page "https://github.com/excon/excon")
    (license license:expat)))

(define-public ruby-faraday-excon
  (package
    (name "ruby-faraday-excon")
    (version "1.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-excon" version))
       (sha256
        (base32 "0h09wkb0k0bhm6dqsd47ac601qiaah8qdzjh8gvxfd376x1chmdh"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-excon))
    (synopsis "Faraday adapter for Excon")
    (description "Faraday adapter for Excon")
    (home-page "https://github.com/lostisland/faraday-excon")
    (license license:expat)))

(define-public ruby-faraday-em-synchrony
  (package
    (name "ruby-faraday-em-synchrony")
    (version "1.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday-em_synchrony" version))
       (sha256
        (base32 "1vgrbhkp83sngv6k4mii9f2s9v5lmp693hylfxp2ssfc60fas3a6"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "Faraday adapter for EM::Synchrony")
    (description "Faraday adapter for EM::Synchrony")
    (home-page "https://github.com/lostisland/faraday-em_synchrony")
    (license license:expat)))

(define-public ruby-faraday
  (package
    (name "ruby-faraday")
    (version "1.10.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "faraday" version))
       (sha256
        (base32 "037w5kg3y9jrwgg7izfn1pmzngy0hdhcr7slmxwqa3mdb4rx9r9q"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-faraday-em-http
                             ruby-faraday-em-synchrony
                             ruby-faraday-excon
                             ruby-faraday-httpclient
                             ruby-faraday-multipart
                             ruby-faraday-net-http
                             ruby-faraday-net-http-persistent
                             ruby-faraday-patron
                             ruby-faraday-rack
                             ruby-faraday-retry
                             ruby-ruby2-keywords))
    (synopsis "HTTP/REST API client library.")
    (description "HTTP/REST API client library.")
    (home-page "https://lostisland.github.io/faraday")
    (license license:expat)))

(define-public ruby-link-header-parser
  (package
    (name "ruby-link-header-parser")
    (version "7.0.1")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "link-header-parser" version))
       (sha256
        (base32 "0ayfijl4804pcxikc2znfdyq4lhxga9rf0v2xhr3zynlgfciz66h"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis "Parse HTTP Link headers.")
    (description "Parse HTTP Link headers.")
    (home-page "https://github.com/jgarber623/link-header-parser-ruby")
    (license license:expat)))

(define-public ruby-multibases
  (package
    (name "ruby-multibases")
    (version "0.3.2")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "multibases" version))
       (sha256
        (base32 "0jsdwi3c3y9nnsivah0pxkbij8vkj949kb7bvrm161pawn6cvgzz"))))
    (build-system ruby-build-system)
    (synopsis
     "This is a low-level library, but high level implementations are provided.
    You can also bring your own encoder/decoder. This gem can be used _both_ for
    encoding into or decoding from multibase packed strings, as well as serve as
    a _general purpose_ library to do `BaseX` encoding and decoding _without_
    adding the prefix.")
    (description
     "This is a low-level library, but high level implementations are provided.  You
can also bring your own encoder/decoder.  This gem can be used _both_ for
encoding into or decoding from multibase packed strings, as well as serve as a
_general purpose_ library to do `@code{BaseX`} encoding and decoding _without_
adding the prefix.")
    (home-page "https://github.com/SleeplessByte/ruby-multibase")
    (license license:expat)))

(define-public ruby-ougai
  (package
    (name "ruby-ougai")
    (version "2.0.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "ougai" version))
       (sha256
        (base32 "0zmngsm3lrliscry7ljw7x5gnf3m4cn4kdgnxccaidhwj0mm539f"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (propagated-inputs (list ruby-oj))
    (synopsis
     "    A structured logging system is capable of handling a message, custom data or an exception easily.
    It has JSON formatters compatible with Bunyan or pino for Node.js and human readable formatter with Amazing Print for console.
")
    (description
     "This package provides a structured logging system is capable of handling a
message, custom data or an exception easily.  It has JSON formatters compatible
with Bunyan or pino for Node.js and human readable formatter with Amazing Print
for console.")
    (home-page "https://github.com/tilfin/ougai")
    (license license:expat)))

(define-public ruby-relative-time
  (package
    (name "ruby-relative-time")
    (version "1.1.0")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "relative_time" version))
       (sha256
        (base32 "0x520r0vgcwjyknmgllblp997qii73vzk4r411c4xbwnlxh5fl99"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis
     "Relative Time ago gem is used to calulate the relative time instead of using naive ruby time_ago_in_words helper method.
")
    (description
     "Relative Time ago gem is used to calulate the relative time instead of using
naive ruby time_ago_in_words helper method.")
    (home-page "https://github.com/lalithr95/Relative-Time-ago")
    (license license:expat)))

(define-public ruby-statsd-instrument
  (package
    (name "ruby-statsd-instrument")
    (version "09b5fe1c6e51704ec40221cd5fdb6bb688f0f40b")
    (source
      (origin
      (method git-fetch)
      (uri (git-reference
          (url "https://github.com/singpolyma/statsd-instrument")
          (commit version)))
      (file-name (git-file-name name version))
        (sha256
          (base32
            "1pj87difhx2vkdxv75q7yskla2wg4g0h2528xsxxd27qa4bscf40"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f))
    (synopsis
     "A StatsD client for Ruby apps. Provides metaprogramming methods to inject StatsD instrumentation into your code.")
    (description
     "This package provides a @code{StatsD} client for Ruby apps.  Provides
metaprogramming methods to inject @code{StatsD} instrumentation into your code.")
    (home-page "https://github.com/Shopify/statsd-instrument")
    (license license:expat)))

(define-public ruby-hiredis
  (package
    (name "ruby-hiredis")
    (version "0.6.3")
    (source
     (origin
       (method url-fetch)
       (uri (rubygems-uri "hiredis" version))
       (sha256
        (base32 "04jj8k7lxqxw24sp0jiravigdkgsyrpprxpxm71ba93x1wr2w1bz"))))
    (build-system ruby-build-system)
    (arguments
     `(#:tests? #f
		 #:phases
       (modify-phases %standard-phases
         (add-after 'extract-gemspec 'set-cc
           (lambda _
             (putenv "CC=gcc"))))))
	 (native-inputs (list ruby-rake-compiler))
    (synopsis
     "Ruby wrapper for hiredis (protocol serialization/deserialization and blocking I/O)")
    (description
     "Ruby wrapper for hiredis (protocol serialization/deserialization and blocking
I/O)")
    (home-page "http://github.com/redis/hiredis-rb")
    (license #f)))

;;;;

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

; Bake a template by eval'ing the leaves
(define-public (bake tmpl)
 (list
  (car tmpl)
  (cons (caadr tmpl) (map
   (lambda (x) (list (car x) (eval (cadr x) (current-module))))
   (cdadr tmpl)))))

; double-escaped template of the sgx-jmp sexp
; This allows us to bake the expression without doing a full eval to a record,
; so it can be written
(define-public sgx-jmp-template
  '((package-input-rewriting `((,ruby-eventmachine . ,ruby-eventmachine-openssl)))
  (package
    (name "sgx-jmp")
    (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/sgx-jmp")
             (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/sgx-jmp"))
       #: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/sgx-jmp/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"))))))
    (propagated-inputs
      '(list
		  ruby
		  ruby-amazing-print
		  ruby-bandwidth-sdk
		  ruby-blather
		  ruby-braintree
		  ruby-countries
		  ruby-dhall
		  ruby-em-hiredis
		  ruby-em-http-request
		  ruby-em-pg-client
		  ruby-em-promise.rb
		  ruby-em-synchrony
		  ruby-eventmachine
		  ruby-faraday-em-http
		  ruby-link-header-parser
		  ruby-money-open-exchange-rates
		  ruby-multibases
		  ruby-multihashes
		  ruby-ougai
		  ruby-relative-time
		  ruby-roda
		  ruby-bandwidth-iris
		  ruby-sentry
		  ruby-slim
		  ruby-statsd-instrument
		  ruby-thin
		  ruby-value-semantics))
    (native-inputs
      '(list
        ruby-rack-test
        ruby-rantly
        ruby-rubocop
        ruby-webmock))
    (synopsis
      "Main component for JMP.chat")
    (description
      "")
    (home-page
      "https://git.singpolyma.net/sgx-jmp")
    (license 'license:agpl3))))

; Baked version of jmp-pay-template with leaves eval'd
(define-public sgx-jmp-baked
	(bake sgx-jmp-template))

; Build clean from git the version from a local clone
; To build whatever is sitting in local use:
; guix build --with-source=$PWD -f guix.scm

(eval sgx-jmp-baked (current-module))
