-- SPDX-FileCopyrightText: 2026 Alexandra de Wit
--
-- SPDX-License-Identifier: MIT
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE TupleSections #-}

-- | Modern Bundler uses named metadata, compact specifications and gated archives.
module Ecluse.Core.Registry.RubyGems.Route (
    rubyGemsRouter,
    rubyGemsRouteSpecs,
    rubyGemsRoutes,
) where

import Data.List.NonEmpty qualified as NE
import Network.HTTP.Types (status403, status404, status405, status500)

import Ecluse.Core.Registry.RubyGems.Handlers.CompactIndex (serveDirectory, serveInfo)
import Ecluse.Core.Registry.RubyGems.Handlers.Coordinate (serveCompactSpec, serveGemArtifact)
import Ecluse.Core.Registry.RubyGems.Project (gemFileStem, projectName)
import Ecluse.Core.Registry.RubyGems.Route.Response (rubyContract, rubyReplies)
import Ecluse.Core.Server.Context (MountRouter, ResponseAction (..), RouteAction (RouteAction))
import Ecluse.Core.Server.Contract (BodySchema (SchemaOpaque), PassthroughBody (..), PassthroughResponse, RequestSpec (RequestSpec), ResponseChoice (..), ResponseContract, ResponseValue, chooseContract, emptyContract, passthroughContract, passthroughResponse, plainTextRefusal, responseValue)
import Ecluse.Core.Server.Path (Filename, mkFilename, unFilename)
import Ecluse.Core.Server.Pipeline.Packument (PackumentReplies (..))
import Ecluse.Core.Server.Pipeline.Publish (PublishReplies (..), servePublish)
import Ecluse.Core.Server.Pipeline.Tarball.Types (TarballReplies (..))
import Ecluse.Core.Server.Response (mkRefusal, renderRefusal)
import Ecluse.Core.Server.Route (Capture (..), MediaNegotiation (AcceptsAnything), MethodMatch (MethodPost, MethodRead), PatternSeg (..), Route (Route), RouteName (RouteName), routerOf)
import Ecluse.Core.Server.RouteDescription (RouteSpec, catchAllSpecs, specsOf, unsupportedPathParam)

-- | The same native route table drives dispatch and API documentation.
rubyGemsRouter :: MountRouter
rubyGemsRouter :: MountRouter
rubyGemsRouter = RouteAction -> [Route Filename] -> MountRouter
forall v. RouteAction -> [Route v] -> MountRouter
routerOf RouteAction
notFound [Route Filename]
rubyGemsRoutes

-- | Native discovery and per-gem reads share the admitted installation path.
rubyGemsRoutes :: [Route Filename]
rubyGemsRoutes :: [Route Filename]
rubyGemsRoutes =
    [ RouteName
-> MethodMatch
-> MediaNegotiation RubyResponse
-> [PatternSeg Filename]
-> (ByteString
    -> [Filename] -> Maybe (ResponseAction RubyResponse))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract RubyResponse
-> Route Filename
forall v response.
RouteName
-> MethodMatch
-> MediaNegotiation response
-> [PatternSeg v]
-> (ByteString -> [v] -> Maybe (ResponseAction response))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract response
-> Route v
Route
        (Text -> RouteName
RouteName Text
"versions")
        MethodMatch
MethodRead
        MediaNegotiation RubyResponse
forall response. MediaNegotiation response
AcceptsAnything
        [Text -> PatternSeg Filename
forall v. Text -> PatternSeg v
SegLit Text
"versions"]
        (\ByteString
_ [Filename]
captures -> RubyResponse
-> (Request
    -> (RubyResponse -> IO ResponseReceived)
    -> Handler ResponseReceived)
-> ResponseAction RubyResponse
forall response.
response
-> (Request
    -> (response -> IO ResponseReceived) -> Handler ResponseReceived)
-> ResponseAction response
RunPipeline RubyResponse
metadataFallback Request
-> (RubyResponse -> IO ResponseReceived)
-> Handler ResponseReceived
serveDirectory ResponseAction RubyResponse
-> Maybe () -> Maybe (ResponseAction RubyResponse)
forall a b. a -> Maybe b -> Maybe a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Bool -> Maybe ()
forall (f :: * -> *). Alternative f => Bool -> f ()
guard ([Filename] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Filename]
captures))
        Text
"Discover native gem names and versions"
        Text
"Combines bounded public discovery with the current caller-authorised private directory. Discovery does not grant admission."
        Maybe RequestSpec
forall a. Maybe a
Nothing
        (ByteString -> ResponseContract RubyResponse
rubyContract ByteString
"text/plain")
    , RouteName
-> MethodMatch
-> MediaNegotiation RubyResponse
-> [PatternSeg Filename]
-> (ByteString
    -> [Filename] -> Maybe (ResponseAction RubyResponse))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract RubyResponse
-> Route Filename
forall v response.
RouteName
-> MethodMatch
-> MediaNegotiation response
-> [PatternSeg v]
-> (ByteString -> [v] -> Maybe (ResponseAction response))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract response
-> Route v
Route
        (Text -> RouteName
RouteName Text
"info")
        MethodMatch
MethodRead
        MediaNegotiation RubyResponse
forall response. MediaNegotiation response
AcceptsAnything
        [Text -> PatternSeg Filename
forall v. Text -> PatternSeg v
SegLit Text
"info", Capture Filename -> PatternSeg Filename
forall v. Capture v -> PatternSeg v
SegCap Capture Filename
nameCapture]
        ( \ByteString
_ -> \case
            [Filename
file] -> do
                name <- Either ParseError PackageName -> Maybe PackageName
forall l r. Either l r -> Maybe r
rightToMaybe (Text -> Either ParseError PackageName
projectName (Filename -> Text
unFilename Filename
file))
                Just (RunPipeline metadataFallback (serveInfo name))
            [Filename]
_ -> Maybe (ResponseAction RubyResponse)
forall a. Maybe a
Nothing
        )
        Text
"Read admitted Compact Index metadata"
        Text
"Returns exact admitted native rows with the winning archive SHA-256 and current runtime requirements."
        Maybe RequestSpec
forall a. Maybe a
Nothing
        (ByteString -> ResponseContract RubyResponse
rubyContract ByteString
"text/plain")
    , RouteName
-> MethodMatch
-> MediaNegotiation RubyResponse
-> [PatternSeg Filename]
-> (ByteString
    -> [Filename] -> Maybe (ResponseAction RubyResponse))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract RubyResponse
-> Route Filename
forall v response.
RouteName
-> MethodMatch
-> MediaNegotiation response
-> [PatternSeg v]
-> (ByteString -> [v] -> Maybe (ResponseAction response))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract response
-> Route v
Route
        (Text -> RouteName
RouteName Text
"compactSpec")
        MethodMatch
MethodRead
        MediaNegotiation RubyResponse
forall response. MediaNegotiation response
AcceptsAnything
        ((Text -> PatternSeg Filename) -> [Text] -> [PatternSeg Filename]
forall a b. (a -> b) -> [a] -> [b]
map Text -> PatternSeg Filename
forall v. Text -> PatternSeg v
SegLit [Text
"quick", Text
"Marshal.4.8"] [PatternSeg Filename]
-> [PatternSeg Filename] -> [PatternSeg Filename]
forall a. Semigroup a => a -> a -> a
<> [Capture Filename -> Text -> PatternSeg Filename
forall v. Capture v -> Text -> PatternSeg v
SegCapSuffix Capture Filename
nativeCapture Text
".gemspec.rz"])
        (\ByteString
_ -> \case [Filename
file] -> ResponseAction RubyResponse -> Maybe (ResponseAction RubyResponse)
forall a. a -> Maybe a
Just (RubyResponse
-> (Request
    -> (RubyResponse -> IO ResponseReceived)
    -> Handler ResponseReceived)
-> ResponseAction RubyResponse
forall response.
response
-> (Request
    -> (response -> IO ResponseReceived) -> Handler ResponseReceived)
-> ResponseAction response
RunPipeline RubyResponse
metadataFallback (Filename
-> Request
-> (RubyResponse -> IO ResponseReceived)
-> Handler ResponseReceived
serveCompactSpec Filename
file)); [Filename]
_ -> Maybe (ResponseAction RubyResponse)
forall a. Maybe a
Nothing)
        Text
"Read an admitted compact specification"
        Text
"Relays original validated native bytes for the exact admitted package, raw version and platform."
        Maybe RequestSpec
forall a. Maybe a
Nothing
        (ByteString -> ResponseContract RubyResponse
rubyContract ByteString
"application/octet-stream")
    , RouteName
-> MethodMatch
-> MediaNegotiation
     (ResponseChoice RubyResponse PassthroughResponse)
-> [PatternSeg Filename]
-> (ByteString
    -> [Filename]
    -> Maybe
         (ResponseAction (ResponseChoice RubyResponse PassthroughResponse)))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract
     (ResponseChoice RubyResponse PassthroughResponse)
-> Route Filename
forall v response.
RouteName
-> MethodMatch
-> MediaNegotiation response
-> [PatternSeg v]
-> (ByteString -> [v] -> Maybe (ResponseAction response))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract response
-> Route v
Route
        (Text -> RouteName
RouteName Text
"artifact")
        MethodMatch
MethodRead
        MediaNegotiation (ResponseChoice RubyResponse PassthroughResponse)
forall response. MediaNegotiation response
AcceptsAnything
        [Text -> PatternSeg Filename
forall v. Text -> PatternSeg v
SegLit Text
"gems", Capture Filename -> Text -> PatternSeg Filename
forall v. Capture v -> Text -> PatternSeg v
SegCapSuffix Capture Filename
nativeCapture Text
".gem"]
        (\ByteString
method -> \case [Filename
file] -> ResponseAction (ResponseChoice RubyResponse PassthroughResponse)
-> Maybe
     (ResponseAction (ResponseChoice RubyResponse PassthroughResponse))
forall a. a -> Maybe a
Just (ResponseChoice RubyResponse PassthroughResponse
-> (Request
    -> (ResponseChoice RubyResponse PassthroughResponse
        -> IO ResponseReceived)
    -> Handler ResponseReceived)
-> ResponseAction (ResponseChoice RubyResponse PassthroughResponse)
forall response.
response
-> (Request
    -> (response -> IO ResponseReceived) -> Handler ResponseReceived)
-> ResponseAction response
RunPipeline (PassthroughResponse
-> ResponseChoice RubyResponse PassthroughResponse
forall a b. b -> ResponseChoice a b
SecondResponse (Status -> [Header] -> Text -> PassthroughResponse
plainTextRefusal Status
status500 [] Text
"internal server error")) (\Request
request ResponseChoice RubyResponse PassthroughResponse
-> IO ResponseReceived
respond -> TarballReplies PassthroughResponse
-> ByteString
-> Filename
-> Request
-> (PassthroughResponse -> IO ResponseReceived)
-> (RubyResponse -> IO ResponseReceived)
-> Handler ResponseReceived
forall response.
TarballReplies response
-> ByteString
-> Filename
-> Request
-> (response -> IO ResponseReceived)
-> (RubyResponse -> IO ResponseReceived)
-> Handler ResponseReceived
serveGemArtifact TarballReplies PassthroughResponse
artifactReplies ByteString
method Filename
file Request
request (ResponseChoice RubyResponse PassthroughResponse
-> IO ResponseReceived
respond (ResponseChoice RubyResponse PassthroughResponse
 -> IO ResponseReceived)
-> (PassthroughResponse
    -> ResponseChoice RubyResponse PassthroughResponse)
-> PassthroughResponse
-> IO ResponseReceived
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PassthroughResponse
-> ResponseChoice RubyResponse PassthroughResponse
forall a b. b -> ResponseChoice a b
SecondResponse) (ResponseChoice RubyResponse PassthroughResponse
-> IO ResponseReceived
respond (ResponseChoice RubyResponse PassthroughResponse
 -> IO ResponseReceived)
-> (RubyResponse
    -> ResponseChoice RubyResponse PassthroughResponse)
-> RubyResponse
-> IO ResponseReceived
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RubyResponse -> ResponseChoice RubyResponse PassthroughResponse
forall a b. a -> ResponseChoice a b
FirstResponse))); [Filename]
_ -> Maybe
  (ResponseAction (ResponseChoice RubyResponse PassthroughResponse))
forall a. Maybe a
Nothing)
        Text
"Read an admitted gem archive"
        Text
"Resolves the exact native coordinate before current artifact admission and caller-authorised relay."
        Maybe RequestSpec
forall a. Maybe a
Nothing
        (ResponseContract RubyResponse
-> ResponseContract PassthroughResponse
-> ResponseContract
     (ResponseChoice RubyResponse PassthroughResponse)
forall a b.
ResponseContract a
-> ResponseContract b -> ResponseContract (ResponseChoice a b)
chooseContract (ByteString -> ResponseContract RubyResponse
rubyContract ByteString
"application/octet-stream") ResponseContract PassthroughResponse
artifactContract)
    , RouteName
-> MethodMatch
-> MediaNegotiation PassthroughResponse
-> [PatternSeg Filename]
-> (ByteString
    -> [Filename] -> Maybe (ResponseAction PassthroughResponse))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract PassthroughResponse
-> Route Filename
forall v response.
RouteName
-> MethodMatch
-> MediaNegotiation response
-> [PatternSeg v]
-> (ByteString -> [v] -> Maybe (ResponseAction response))
-> Text
-> Text
-> Maybe RequestSpec
-> ResponseContract response
-> Route v
Route
        (Text -> RouteName
RouteName Text
"publish")
        MethodMatch
MethodPost
        MediaNegotiation PassthroughResponse
forall response. MediaNegotiation response
AcceptsAnything
        ((Text -> PatternSeg Filename) -> [Text] -> [PatternSeg Filename]
forall a b. (a -> b) -> [a] -> [b]
map Text -> PatternSeg Filename
forall v. Text -> PatternSeg v
SegLit [Text
"api", Text
"v1", Text
"gems"])
        (\ByteString
_ [Filename]
captures -> PassthroughResponse
-> (Request
    -> (PassthroughResponse -> IO ResponseReceived)
    -> Handler ResponseReceived)
-> ResponseAction PassthroughResponse
forall response.
response
-> (Request
    -> (response -> IO ResponseReceived) -> Handler ResponseReceived)
-> ResponseAction response
RunPipeline (Status -> [Header] -> Text -> PassthroughResponse
plainTextRefusal Status
status500 [] Text
"internal server error") (PublishReplies PassthroughResponse
-> Maybe PackageName
-> Request
-> (PassthroughResponse -> IO ResponseReceived)
-> Handler ResponseReceived
forall response.
PublishReplies response
-> Maybe PackageName
-> Request
-> (response -> IO ResponseReceived)
-> Handler ResponseReceived
servePublish PublishReplies PassthroughResponse
publishReplies Maybe PackageName
forall a. Maybe a
Nothing) ResponseAction PassthroughResponse
-> Maybe () -> Maybe (ResponseAction PassthroughResponse)
forall a b. a -> Maybe b -> Maybe a
forall (f :: * -> *) a b. Functor f => a -> f b -> f a
<$ Bool -> Maybe ()
forall (f :: * -> *). Alternative f => Bool -> f ()
guard ([Filename] -> Bool
forall a. [a] -> Bool
forall (t :: * -> *) a. Foldable t => t a -> Bool
null [Filename]
captures))
        Text
"Publish a first-party gem"
        Text
"Validates the complete native archive and package identity before relaying unchanged bytes under publication authority. Disabled publication returns 405."
        (RequestSpec -> Maybe RequestSpec
forall a. a -> Maybe a
Just (Text -> Bool -> BodySchema -> RequestSpec
RequestSpec Text
"The complete built .gem archive." Bool
True (ByteString -> BodySchema
SchemaOpaque ByteString
"application/octet-stream")))
        ResponseContract PassthroughResponse
publishContract
    ]
  where
    metadataFallback :: RubyResponse
metadataFallback = PackumentReplies RubyResponse
-> [Header] -> Refusal -> RubyResponse
forall response.
PackumentReplies response -> [Header] -> Refusal -> response
packumentInternal PackumentReplies RubyResponse
rubyReplies [] (Maybe HelpMessage -> Text -> Refusal
mkRefusal Maybe HelpMessage
forall a. Maybe a
Nothing Text
"internal server error")

nameCapture :: Capture Filename
nameCapture :: Capture Filename
nameCapture = Text
-> Text
-> ([Text] -> Maybe (Filename, [Text]))
-> (Filename -> [Text])
-> Capture Filename
forall v.
Text
-> Text
-> ([Text] -> Maybe (v, [Text]))
-> (v -> [Text])
-> Capture v
Capture Text
"gem" Text
"The native gem name." [Text] -> Maybe (Filename, [Text])
consume (\Filename
file -> [Filename -> Text
unFilename Filename
file])
  where
    consume :: [Text] -> Maybe (Filename, [Text])
consume = \case
        Text
name : [Text]
rest -> do
            _ <- Either ParseError PackageName -> Maybe PackageName
forall l r. Either l r -> Maybe r
rightToMaybe (Text -> Either ParseError PackageName
projectName Text
name)
            file <- mkFilename name
            pure (file, rest)
        [Text]
_ -> Maybe (Filename, [Text])
forall a. Maybe a
Nothing

nativeCapture :: Capture Filename
nativeCapture :: Capture Filename
nativeCapture = Text
-> Text
-> ([Text] -> Maybe (Filename, [Text]))
-> (Filename -> [Text])
-> Capture Filename
forall v.
Text
-> Text
-> ([Text] -> Maybe (v, [Text]))
-> (v -> [Text])
-> Capture v
Capture Text
"coordinate" Text
"The native package, raw version and platform filename stem." [Text] -> Maybe (Filename, [Text])
consume (Maybe Text -> [Text]
forall a. Maybe a -> [a]
maybeToList (Maybe Text -> [Text])
-> (Filename -> Maybe Text) -> Filename -> [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Text -> Maybe Text
gemFileStem (Text -> Maybe Text)
-> (Filename -> Text) -> Filename -> Maybe Text
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Filename -> Text
unFilename)
  where
    consume :: [Text] -> Maybe (Filename, [Text])
consume = \case
        Text
stem : [Text]
rest -> (,[Text]
rest) (Filename -> (Filename, [Text]))
-> Maybe Filename -> Maybe (Filename, [Text])
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> Text -> Maybe Filename
mkFilename (Text
stem Text -> Text -> Text
forall a. Semigroup a => a -> a -> a
<> Text
".gem")
        [Text]
_ -> Maybe (Filename, [Text])
forall a. Maybe a
Nothing

artifactContract :: ResponseContract PassthroughResponse
artifactContract :: ResponseContract PassthroughResponse
artifactContract = Text -> ResponseContract PassthroughResponse
passthroughContract Text
"Relays the selected gem archive and preserves upstream statuses. Local errors retain authentication, admission, integrity and availability failures. A private upstream reply that was invalid or unusable answers a local `502`."

artifactReplies :: TarballReplies PassthroughResponse
artifactReplies :: TarballReplies PassthroughResponse
artifactReplies =
    TarballReplies
        { tarballError :: Status -> [Header] -> Refusal -> PassthroughResponse
tarballError = \Status
status [Header]
headers -> Status -> [Header] -> Text -> PassthroughResponse
plainTextRefusal Status
status [Header]
headers (Text -> PassthroughResponse)
-> (Refusal -> Text) -> Refusal -> PassthroughResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Refusal -> Text
renderRefusal
        , tarballPrivateRefused :: Int -> [Header] -> Refusal -> PassthroughResponse
tarballPrivateRefused = \Int
_ -> TarballReplies PassthroughResponse
-> Status -> [Header] -> Refusal -> PassthroughResponse
forall response.
TarballReplies response
-> Status -> [Header] -> Refusal -> response
tarballError TarballReplies PassthroughResponse
artifactReplies Status
status403
        , tarballStream :: Status -> [Header] -> StreamingBody -> PassthroughResponse
tarballStream = \Status
status [Header]
headers -> Status -> [Header] -> PassthroughBody -> PassthroughResponse
passthroughResponse Status
status [Header]
headers (PassthroughBody -> PassthroughResponse)
-> (StreamingBody -> PassthroughBody)
-> StreamingBody
-> PassthroughResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
. StreamingBody -> PassthroughBody
PassthroughStream
        , tarballEmpty :: Status -> [Header] -> PassthroughResponse
tarballEmpty = \Status
status [Header]
headers -> Status -> [Header] -> PassthroughBody -> PassthroughResponse
passthroughResponse Status
status [Header]
headers PassthroughBody
PassthroughEmpty
        }

publishContract :: ResponseContract PassthroughResponse
publishContract :: ResponseContract PassthroughResponse
publishContract = Text -> ResponseContract PassthroughResponse
passthroughContract Text
"Relays the publication target status after body validation and first-party authorisation."

publishReplies :: PublishReplies PassthroughResponse
publishReplies :: PublishReplies PassthroughResponse
publishReplies =
    PublishReplies
        { publishAllowedMethods :: ByteString
publishAllowedMethods = ByteString
"POST"
        , publishDisabledReply :: [Header] -> Maybe HelpMessage -> PassthroughResponse
publishDisabledReply = \[Header]
headers Maybe HelpMessage
_ -> Status -> [Header] -> Text -> PassthroughResponse
plainTextRefusal Status
status405 [Header]
headers Text
"publishing is not enabled on this mount"
        , publishRelayed :: Status -> [Header] -> LByteString -> PassthroughResponse
publishRelayed = \Status
status [Header]
headers -> Status -> [Header] -> PassthroughBody -> PassthroughResponse
passthroughResponse Status
status [Header]
headers (PassthroughBody -> PassthroughResponse)
-> (LByteString -> PassthroughBody)
-> LByteString
-> PassthroughResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
. LByteString -> PassthroughBody
PassthroughBytes
        , publishError :: Status -> [Header] -> Text -> PassthroughResponse
publishError = Status -> [Header] -> Text -> PassthroughResponse
plainTextRefusal
        }

notFoundContract :: ResponseContract (ResponseValue ())
notFoundContract :: ResponseContract (ResponseValue ())
notFoundContract = Status -> Text -> ResponseContract (ResponseValue ())
emptyContract Status
status404 Text
"No native route claims this path."

notFound :: RouteAction
notFound :: RouteAction
notFound = ResponseContract (ResponseValue ())
-> ResponseAction (ResponseValue ()) -> RouteAction
forall response.
ResponseContract response -> ResponseAction response -> RouteAction
RouteAction ResponseContract (ResponseValue ())
notFoundContract (ResponseValue () -> ResponseAction (ResponseValue ())
forall response. response -> ResponseAction response
AnswerLocally ([Header] -> () -> ResponseValue ()
forall a. [Header] -> a -> ResponseValue a
responseValue [] ()))

-- | Publish the routes and structural fallback from the same contracts used at runtime.
rubyGemsRouteSpecs :: NonEmpty RouteSpec
rubyGemsRouteSpecs :: NonEmpty RouteSpec
rubyGemsRouteSpecs = ResponseContract (ResponseValue ())
-> ParamSpec -> NonEmpty RouteSpec
forall r. ResponseContract r -> ParamSpec -> NonEmpty RouteSpec
catchAllSpecs ResponseContract (ResponseValue ())
notFoundContract ParamSpec
unsupportedPathParam NonEmpty RouteSpec -> [RouteSpec] -> NonEmpty RouteSpec
forall a. NonEmpty a -> [a] -> NonEmpty a
`NE.appendList` (Route Filename -> [RouteSpec]) -> [Route Filename] -> [RouteSpec]
forall (t :: * -> *) a b. Foldable t => (a -> [b]) -> t a -> [b]
concatMap Route Filename -> [RouteSpec]
forall v. Route v -> [RouteSpec]
specsOf [Route Filename]
rubyGemsRoutes