git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Merge pull request #1752 from codedmart/1549

allow git@github.com in extractGithub. Fixes #1549

commit08aeed2a609ee43a3304d7f0e1dc6e84e457238f authorPhil Freeman <paf31@cantab.net> dateWed 30 Dec 2015, 09:31 (11 years ago) parent3bec40cc099eee
2 files changed+7−1
CONTRIBUTORS.md+1 src/Language/PureScript/Publish.hs+6−1
CONTRIBUTORS.md+1
@@ -60,6 +60,7 @@ This file lists the contributors to the PureScript compiler project, and the ter
6060<http://opensource.org/licenses/MIT>.
6161- [@soupi](https://github.com/soupi) (Gil Mizrahi) My existing contributions and all future contributions until further notice are Copyright Gil Mizrahi, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
6262- [@tfausak](https://github.com/tfausak) (Taylor Fausak) My existing contributions and all future contributions until further notice are Copyright Taylor Fausak, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
63+- [@codedmart](https://github.com/codedmart) (Brandon Martin) My existing contributions and all future contributions until further notice are Copyright Brandon Martin, and are licensed to the owners and users of the PureScript compiler project under the terms of the [MIT license](http://opensource.org/licenses/MIT).
6364
6465### Companies
6566
src/Language/PureScript/Publish.hs+6−1
@@ -41,6 +41,7 @@ import qualified Data.Text.Lazy.Encoding as TL
4141
4242import Control.Category ((>>>))
4343import Control.Arrow ((***))
44+import Control.Applicative ((<|>))
4445import Control.Exception (catch, try)
4546import Control.Monad.Trans.Maybe (MaybeT(..), runMaybeT)
4647import Control.Monad.Trans.Except
@@ -197,7 +198,7 @@ getBowerInfo = either (userError . BadRepositoryField) return . tryExtract
197198
198199extractGithub :: String -> Maybe (D.GithubUser, D.GithubRepo)
199200extractGithub =
200− stripPrefix "git://github.com/"
201+ matchUrl
201202 >>> fmap (splitOn "/")
202203 >=> takeTwo
203204 >>> fmap (D.GithubUser *** (D.GithubRepo . dropDotGit))
@@ -212,6 +213,10 @@ extractGithub =
212213 | ".git" `isSuffixOf` str = take (length str - 4) str
213214 | otherwise = str
214215
216+ matchUrl :: String -> Maybe String
217+ matchUrl str =
218+ stripPrefix "git@github.com:" str <|> stripPrefix "git://github.com/" str
219+
215220readProcess' :: String -> [String] -> String -> PrepareM String
216221readProcess' prog args stdin = do
217222 out <- liftIO (catch (Right <$> readProcess prog args stdin)