on master help sign in
Provide replacement Github names #226
commitceac2c4a98e9c413b6d673d99a59e5e8b0974b31 authorMichael Snoyman <michael@snoyman.com> dateWed 11 Jun 2014, 08:03 (12 years ago) parent684bf6d
2 files changed+20−1
Stackage/Config.hs+18 Stackage/LoadDatabase.hs+2−1
Stackage/Config.hs+18
@@ -3,7 +3,9 @@ module Stackage.Config where
33
44import Control.Monad (when)
55import Control.Monad.Trans.Writer (execWriter, tell)
6+import Data.Char (toLower)
67import qualified Data.Map as Map
8+import Data.Maybe (fromMaybe)
79import Data.Set (fromList, singleton)
810import Distribution.Text (simpleParse)
911import Stackage.Types
@@ -452,3 +454,19 @@ defaultStablePackages ghcVer requireHP = unPackageMap $ execWriter $ do
452454 case simpleParse range of
453455 Nothing -> error $ "Invalid range " ++ show range ++ " for " ++ package
454456 Just range' -> tell $ PackageMap $ Map.singleton (PackageName package) (range', Maintainer maintainer)
457+
458+-- | Replacement Github users. This is useful when a project is owned by an
459+-- organization, and you'd like to ping either an individual or a team in that
460+-- organization. See:
461+--
462+-- https://github.com/fpco/stackage/issues/226#issuecomment-45644142
463+convertGithubUser :: String -> String
464+convertGithubUser x =
465+ fromMaybe x $ Map.lookup (map toLower x) pairs
466+ where
467+ pairs = Map.fromList
468+ [ ("diagrams", "byorgey")
469+ , ("yesodweb", "snoyberg")
470+ , ("fpco", "snoyberg")
471+ , ("faylang", "bergmark")
472+ ]
Stackage/LoadDatabase.hs+2−1
@@ -43,6 +43,7 @@ import Distribution.Text (simpleParse)
4343import Distribution.Version (Version (Version),
4444 unionVersionRanges,
4545 withinRange)
46+import Stackage.Config (convertGithubUser)
4647import Stackage.Types
4748import Stackage.Util
4849import System.Directory (doesFileExist, getDirectoryContents)
@@ -184,7 +185,7 @@ loadPackageDB settings coreMap core deps = do
184185 , Set.fromList $ map depName $ testBenchBuildInfo gpd
185186 , Just gpd
186187 , Set.fromList $ map (Executable . fst) $ condExecutables gpd
187− , listToMaybe $ catMaybes
188+ , fmap convertGithubUser $ listToMaybe $ catMaybes
188189 $ parseGithubUserHP (homepage $ packageDescription gpd)
189190 : map parseGithubUserSR (sourceRepos $ packageDescription gpd)
190191 )