:wip: PR support
This commit is contained in:
parent
f52312b731
commit
82dad71eca
7 changed files with 116 additions and 10 deletions
34
README.org
34
README.org
|
@ -161,4 +161,36 @@ could all work together.
|
||||||
- minimal web interface to navigate your project files, commits, branches, etc...
|
- minimal web interface to navigate your project files, commits, branches, etc...
|
||||||
- identity handling so hand in hand with hook handle and web interface provide
|
- identity handling so hand in hand with hook handle and web interface provide
|
||||||
the ability to manage how contributor can access your tool
|
the ability to manage how contributor can access your tool
|
||||||
-
|
|
||||||
|
** Identfy users, allow access and trust them
|
||||||
|
|
||||||
|
With this system it will be more about a pull from other than wait for them to push.
|
||||||
|
The identity system should be decentralized and based on GPG keys.
|
||||||
|
|
||||||
|
Mainly each user should sign their commit with their GPG key.
|
||||||
|
Each user could then keep serving their local repo (see instaweb).
|
||||||
|
|
||||||
|
And more importantly, there will be "known" repositories, known packages and libraries.
|
||||||
|
It will be enough to sign all those activities and to publish them on some page automatically.
|
||||||
|
Or to search for the fingerprint of the GPG on the web via a search engine.
|
||||||
|
You'll then see all the activities related to that key.
|
||||||
|
|
||||||
|
Typically:
|
||||||
|
- OSS contributions
|
||||||
|
- web blog articles
|
||||||
|
- micro blog messages
|
||||||
|
- comments
|
||||||
|
- etc...
|
||||||
|
|
||||||
|
One great advantage of that, is that each user will be able to manage different
|
||||||
|
GPG key pairs for dealing with different aspect of their lives.
|
||||||
|
|
||||||
|
This solution won't need common consensus network à la bitcoin, or any
|
||||||
|
decentralized smart contract system. And from my point of view, this is a lot
|
||||||
|
better. Because most of those decentralized system want you to adopt their
|
||||||
|
centralized system, their software, their ecosystem. While just providing a
|
||||||
|
website with a list of links where the user could simply grab them and check all
|
||||||
|
link correspond to a signed activies is clearly totally open source compliant
|
||||||
|
and does not require any software choice on any parties. This is yet again, just
|
||||||
|
a text file somewhere and a simple web service. With minimal tooling that could
|
||||||
|
be coded in any language in not much time.
|
||||||
|
|
|
@ -41,6 +41,7 @@ library
|
||||||
, protolude
|
, protolude
|
||||||
, text
|
, text
|
||||||
, turtle
|
, turtle
|
||||||
|
, directory
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
||||||
executable gpm
|
executable gpm
|
||||||
|
|
|
@ -7,13 +7,19 @@ License : Public Domain
|
||||||
Maintainer : yann.esposito@gmail.com
|
Maintainer : yann.esposito@gmail.com
|
||||||
-}
|
-}
|
||||||
module GPM.Helpers
|
module GPM.Helpers
|
||||||
(debug,debug_,inGPM,getCurrentGitBranch,getGitUser)
|
( debug
|
||||||
|
, debug_
|
||||||
|
, getCurrentGitBranch
|
||||||
|
, getGPMCacheDir
|
||||||
|
, getGitUser
|
||||||
|
, inGPM
|
||||||
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Protolude hiding (die)
|
|
||||||
import Turtle
|
|
||||||
|
|
||||||
import qualified Control.Foldl as Fold
|
import qualified Control.Foldl as Fold
|
||||||
|
import Protolude hiding (die)
|
||||||
|
import qualified System.Directory as Directory
|
||||||
|
import Turtle
|
||||||
|
|
||||||
-- | execute a shell script and return the last line as text
|
-- | execute a shell script and return the last line as text
|
||||||
-- but also log the command to the console to minimize surprise
|
-- but also log the command to the console to minimize surprise
|
||||||
|
@ -48,3 +54,8 @@ inGPM = bracket safeChangeBranch safeReturnBranch
|
||||||
safeReturnBranch oldbr = do
|
safeReturnBranch oldbr = do
|
||||||
debug_ ("git checkout " <> oldbr)
|
debug_ ("git checkout " <> oldbr)
|
||||||
debug_ "git stash pop"
|
debug_ "git stash pop"
|
||||||
|
|
||||||
|
-- | Retrieve the cache directory to save temporary files in gpm
|
||||||
|
getGPMCacheDir :: IO Turtle.FilePath
|
||||||
|
getGPMCacheDir = fromString <$> Directory.getXdgDirectory Directory.XdgCache "gpm"
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ module GPM.Issue
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Protolude hiding (ask,die)
|
import Protolude hiding (ask, die)
|
||||||
import Turtle
|
import Turtle
|
||||||
|
|
||||||
import Data.FileEmbed (embedStringFile)
|
import Data.FileEmbed (embedStringFile)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
{-# LANGUAGE NoImplicitPrelude #-}
|
{-# LANGUAGE NoImplicitPrelude #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
{-# LANGUAGE RecordWildCards #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
{-# LANGUAGE TemplateHaskell #-}
|
||||||
|
|
||||||
{-|
|
{-|
|
||||||
|
@ -16,11 +17,12 @@ module GPM.Review
|
||||||
)
|
)
|
||||||
where
|
where
|
||||||
|
|
||||||
import Protolude hiding (die, (%))
|
import Protolude hiding (ask, die, (%))
|
||||||
import Turtle
|
import Turtle
|
||||||
|
|
||||||
import Data.FileEmbed (embedStringFile)
|
import Data.FileEmbed (embedStringFile)
|
||||||
import GPM.Helpers (debug_)
|
import GPM.Helpers (getGPMCacheDir, debug_)
|
||||||
|
import Text.Mustache
|
||||||
|
|
||||||
data ReviewCommand = ReviewStart (Maybe Text)
|
data ReviewCommand = ReviewStart (Maybe Text)
|
||||||
| ReviewStop (Maybe Text)
|
| ReviewStop (Maybe Text)
|
||||||
|
@ -54,3 +56,58 @@ handleReview ReviewAccept _ = die "TODO"
|
||||||
handleReview ReviewFeedback _ = die "TODO"
|
handleReview ReviewFeedback _ = die "TODO"
|
||||||
handleReview ReviewQuestion _ = die "TODO"
|
handleReview ReviewQuestion _ = die "TODO"
|
||||||
handleReview ReviewReject _ = die "TODO"
|
handleReview ReviewReject _ = die "TODO"
|
||||||
|
|
||||||
|
data NewReview =
|
||||||
|
NewReview { status :: Text
|
||||||
|
, title :: Text
|
||||||
|
, user :: Maybe User
|
||||||
|
, branch :: Maybe Text
|
||||||
|
, reviewer :: Maybe User
|
||||||
|
, description :: Maybe Text
|
||||||
|
}
|
||||||
|
|
||||||
|
type User = Text
|
||||||
|
|
||||||
|
instance ToMustache NewReview where
|
||||||
|
toMustache NewReview{..} = object
|
||||||
|
[ "status" ~> status
|
||||||
|
, "title" ~> title
|
||||||
|
, "user" ~> user
|
||||||
|
, "branch" ~> branch
|
||||||
|
, "reviewer" ~> reviewer
|
||||||
|
, "description" ~> description
|
||||||
|
]
|
||||||
|
|
||||||
|
createTmpNewReview :: NewReview -> IO ()
|
||||||
|
createTmpNewReview nr = do
|
||||||
|
ecompiled <- automaticCompile ["./templates"] "new-review.org"
|
||||||
|
case ecompiled of
|
||||||
|
Left pe -> do
|
||||||
|
print pe
|
||||||
|
die "Parse ERROR, check your template ./templates/new-review.org"
|
||||||
|
Right compiled -> do
|
||||||
|
cacheDir <- getGPMCacheDir
|
||||||
|
let reviewName = cacheDir </> "review-feedback.org"
|
||||||
|
writeFile (toS (format fp reviewName)) (substitute compiled nr)
|
||||||
|
|
||||||
|
interactiveNewReview :: NewReview -> IO NewReview
|
||||||
|
interactiveNewReview nr =
|
||||||
|
NewReview
|
||||||
|
<$> (fromMaybe (status nr)
|
||||||
|
<$> ask "status" (status nr) identity)
|
||||||
|
<*> (fromMaybe (title nr)
|
||||||
|
<$> ask "title" (title nr) identity)
|
||||||
|
<*> (maybe (user nr) Just
|
||||||
|
<$>
|
||||||
|
ask "user" (fromMaybe "your name" (user nr)) identity)
|
||||||
|
<*> (maybe (branch nr) Just
|
||||||
|
<$> ask "branch" (fromMaybe "related branch" (branch nr)) identity)
|
||||||
|
<*> (maybe (reviewer nr) Just
|
||||||
|
<$> ask "reviewer" "a single nick" identity)
|
||||||
|
<*> (maybe (description nr) Just
|
||||||
|
<$> ask "description" "the long description" identity)
|
||||||
|
where
|
||||||
|
ask :: Text -> Text -> (Text -> a) -> IO (Maybe a)
|
||||||
|
ask field ex tr = do
|
||||||
|
putText $ "Please enter " <> field <> "("<> ex <>"): "
|
||||||
|
fmap (tr . lineToText) <$> readline
|
||||||
|
|
6
templates/new-review.org
Normal file
6
templates/new-review.org
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
**** {{status}} {{title}}
|
||||||
|
:PROPERTIES:
|
||||||
|
:REVIEWER: {{user}}
|
||||||
|
{{#branch}}:BRANCH: {{branch}}{{/branch}}
|
||||||
|
:END:
|
||||||
|
{{description}}
|
|
@ -1,5 +1,4 @@
|
||||||
* FEEDBACK
|
* FEEDBACK
|
||||||
|
|
||||||
[[file:~/y/gpm/gpm::initDocs]]
|
[[file:~/y/gpm/gpm::initDocs]]
|
||||||
* QUESTION What about creating a new branch for doc?
|
* QUESTION What about creating a new branch for doc?
|
||||||
[[file:~/y/gpm/gpm::initDocs]]
|
[[file:~/y/gpm/gpm::initDocs]]
|
||||||
|
|
Loading…
Reference in a new issue