Skip to content
Snippets Groups Projects
Unverified Commit 1eee3efe authored by Eduardo Trujillo's avatar Eduardo Trujillo
Browse files

feat(Git): Add support for plain changelogs (No external hosting)

parent b7d6ae78
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ data ShiftOptions = ShiftOptions
data ShiftCommand = GenerateCommand deriving (Show, Eq, Enum)
data HostingType = GitHubType deriving (Show, Eq, Enum)
data HostingType = GitHubType | GitType deriving (Show, Eq, Enum)
shiftOptions :: Parser ShiftOptions
shiftOptions = ShiftOptions
......@@ -55,6 +55,7 @@ shiftCommand = subparser $
hostingType :: ReadM HostingType
hostingType = eitherReader $ \case
"github" -> Right GitHubType
"git" -> Right GitType
x -> Left $ "`" ++ x ++ "` is not a supported hosting type"
makeLenses ''ShiftOptions
......@@ -57,6 +57,9 @@ tempMain opts = withRepo ".git" $ \repo -> do
runReaderT
(void $ runStateT (mapM_ (renderDiff repo) pairedTags) state)
opts
GitType -> runReaderT
(void $ runStateT (mapM_ (renderDiff repo) pairedTags) GitClientState)
opts
where
initGitHubState = do
......
......@@ -18,11 +18,12 @@ import Control.Monad.State (MonadState, StateT, gets)
import Control.Monad.Trans (liftIO)
import Data.Default (Default, def)
import Data.Git (Commit, Person, Ref, RefName,
personEmail)
personEmail, personName)
import Data.HashMap.Strict (HashMap, insert, lookup)
import Data.HashSet (HashSet)
import Data.String.Conversions (cs)
import Data.Text (Text)
import qualified Data.Text as T
import qualified Data.Vector as V
import Data.Versions (Versioning)
import GitHub (executeRequestWithMgr)
......@@ -77,7 +78,6 @@ data BreakingChange = BreakingChange
, _bcBody :: Text
} deriving (Show)
data ConventionalCommit = ConventionalCommit
{ _ccType :: CommitType
, _ccScope :: Text
......@@ -145,6 +145,15 @@ instance Default RepositoryCache where
makeClassy ''RepositoryCache
data GitClientState = GitClientState
instance ClientState GitClientState where
getRefURL _ = pure Nothing
getAuthorInfo person = pure . Just $
( cs $ personName person
, mconcat ["mailto://", cs $ personEmail person]
)
data GitHubClientState = GitHubClientState
{ _gcsCache :: RepositoryCache
, _gcsAuth :: Auth
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment