make a real project structure

This commit is contained in:
Yann Esposito (Yogsototh) 2018-08-31 11:19:20 +02:00
parent 3d9f0acc57
commit 2dbfb4bbd7
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646
7 changed files with 210 additions and 22 deletions

2
.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
.stack-work
.dir-locals.el

50
gpm.cabal Normal file
View file

@ -0,0 +1,50 @@
-- This file has been generated from package.yaml by hpack version 0.28.2.
--
-- see: https://github.com/sol/hpack
--
-- hash: a686a36064ef8ecb9b6b995eff90b19c3c02223326995cc6f0ae33c7f7d699f5
name: gpm
version: 0.1.0.0
category: Test
stability: alpha (experimental)
author: Yann Esposito
maintainer: yann.esposito@gmail.com
copyright: © 2017 Yann Esposito
license: ISC
build-type: Simple
cabal-version: >= 1.10
extra-source-files:
README.org
stack.yaml
library
exposed-modules:
GPM
GPM.Review
other-modules:
Paths_gpm
hs-source-dirs:
src
default-extensions: OverloadedStrings NoImplicitPrelude ScopedTypeVariables Strict
ghc-options: -O2 -Werror -Wall -Wcompat -Wincomplete-uni-patterns -Wredundant-constraints -Wnoncanonical-monad-instances
build-depends:
base >=4.8 && <5
, protolude
, turtle
default-language: Haskell2010
executable gpm
main-is: Main.hs
other-modules:
Paths_gpm
hs-source-dirs:
src-exe
default-extensions: OverloadedStrings NoImplicitPrelude ScopedTypeVariables Strict
ghc-options: -O2 -Werror -Wall -Wcompat -Wincomplete-uni-patterns -Wredundant-constraints -Wnoncanonical-monad-instances -threaded -rtsopts -with-rtsopts=-N -optP-Wno-nonportable-include-path
build-depends:
base >=4.8 && <5
, gpm
, protolude
, turtle
default-language: Haskell2010

42
package.yaml Normal file
View file

@ -0,0 +1,42 @@
name: gpm
version: '0.1.0.0'
category: Test
author: Yann Esposito
maintainer: yann.esposito@gmail.com
copyright: © 2017 Yann Esposito
license: ISC
url: https://gitlab.esy.fun/yogsototh/gpm
default-extensions:
- OverloadedStrings
- NoImplicitPrelude
- ScopedTypeVariables
- Strict
extra-source-files:
- README.org
- stack.yaml
ghc-options:
- -O2
- -Werror
- -Wall
- -Wcompat
- -Wincomplete-uni-patterns
- -Wredundant-constraints
- -Wnoncanonical-monad-instances
dependencies:
- base >=4.8 && <5
- protolude
- turtle
library:
source-dirs: src
executables:
gpm:
main: Main.hs
source-dirs: src-exe
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
- -optP-Wno-nonportable-include-path
dependencies:
- gpm
stability: alpha (experimental)

9
src-exe/Main.hs Normal file
View file

@ -0,0 +1,9 @@
module Main
where
import Protolude
import GPM (gpm)
main :: IO ()
main = gpm

View file

@ -1,44 +1,36 @@
#! /usr/bin/env nix-shell
#! nix-shell -i runghc
#! nix-shell -p "ghc.withPackages (ps: [ ps.protolude ps.turtle ])"
#! nix-shell -I nixpkgs="https://github.com/NixOS/nixpkgs/archive/16d475334409f7fa632929b2838421b4ffe34927.tar.gz"
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module GPM
where
import Protolude hiding (stdout,(%),die) import Protolude hiding (stdout,(%),die)
import Turtle import Turtle
main :: IO () import GPM.Review (handleReview,ReviewCommand(..),parseReviewCmd)
main = do
x <- options "Git Project Manager" parser gpm :: IO ()
case x of gpm = do
subcmd <- options "Git Project Manager" parser
case subcmd of
Init -> init Init -> init
NewIssue -> newIssue NewIssue -> newIssue
StartReview br -> startReview br Review reviewCmd -> handleReview reviewCmd
EndReview br -> endReview br
data Command = Init data Command = Init
| NewIssue | NewIssue
| StartReview (Maybe Text) | Review ReviewCommand
| EndReview (Maybe Text)
deriving (Eq) deriving (Eq)
parser :: Parser Command parser :: Parser Command
parser = subcommand "init" "Initialize gpm" (pure Init) parser = subcommand "init" "Initialize gpm" (pure Init)
<|> subcommand "new-issue" "Create a new Issue" (pure NewIssue) <|> subcommand "new-issue" "Create a new Issue" (pure NewIssue)
<|> StartReview <$> subcommand "start-review" "Start review (use current branch by default)" <|> Review <$> subcommand "review"
(optional (argText "branch" "The git branch to review")) "Review (use current branch by default)"
<|> EndReview <$> subcommand "end-review" "End review (use current branch by default)" parseReviewCmd
(optional (argText "branch" "The git branch to end review"))
newIssue :: IO () newIssue :: IO ()
newIssue = die "TODO" newIssue = die "TODO"
startReview :: Maybe Text -> IO ()
startReview br = die "TODO"
endReview :: Maybe Text -> IO ()
endReview br = die "TODO"
init :: IO () init :: IO ()
init = do init = do
echo "# <GPM> -- Git Project Manager" echo "# <GPM> -- Git Project Manager"

28
src/GPM/Review.hs Normal file
View file

@ -0,0 +1,28 @@
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
module GPM.Review where
import Protolude hiding (stdout,die)
import Turtle
data ReviewCommand = ReviewStart (Maybe Text)
| ReviewStop (Maybe Text)
| ReviewAccept
| ReviewFeedback
| ReviewQuestion
| ReviewReject
deriving (Eq)
parseReviewCmd :: Parser ReviewCommand
parseReviewCmd = subcommand "accept" "Accept the merge" (pure ReviewAccept)
<|> subcommand "feedback" "Provide a feedback" (pure ReviewFeedback)
<|> subcommand "question" "Ask a question" (pure ReviewQuestion)
<|> subcommand "reject" "Ask a question" (pure ReviewReject)
handleReview :: ReviewCommand -> IO ()
handleReview (ReviewStart _br) = die "TODO"
handleReview (ReviewStop _br ) = die "TODO"
handleReview ReviewAccept = die "TODO"
handleReview ReviewFeedback = die "TODO"
handleReview ReviewQuestion = die "TODO"
handleReview ReviewReject = die "TODO"

65
stack.yaml Normal file
View file

@ -0,0 +1,65 @@
# This file was automatically generated by 'stack init'
#
# Some commonly used options have been documented as comments in this file.
# For advanced use and comprehensive documentation of the format, please see:
# https://docs.haskellstack.org/en/stable/yaml_configuration/
# Resolver to choose a 'specific' stackage snapshot or a compiler version.
# A snapshot resolver dictates the compiler version and the set of packages
# to be used for project dependencies. For example:
#
# resolver: lts-3.5
# resolver: nightly-2015-09-21
# resolver: ghc-7.10.2
# resolver: ghcjs-0.1.0_ghc-7.10.2
#
# The location of a snapshot can be provided as a file or url. Stack assumes
# a snapshot provided as a file might change, whereas a url resource does not.
#
# resolver: ./custom-snapshot.yaml
# resolver: https://example.com/snapshots/2018-01-01.yaml
resolver: lts-12.8
# User packages to be built.
# Various formats can be used as shown in the example below.
#
# packages:
# - some-directory
# - https://example.com/foo/bar/baz-0.0.2.tar.gz
# - location:
# git: https://github.com/commercialhaskell/stack.git
# commit: e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# - location: https://github.com/commercialhaskell/stack/commit/e7b331f14bcffb8367cd58fbfc8b40ec7642100a
# subdirs:
# - auto-update
# - wai
packages:
- .
# Dependency packages to be pulled from upstream that are not in the resolver
# using the same syntax as the packages field.
# (e.g., acme-missiles-0.3)
# extra-deps: []
# Override default flag values for local packages and extra-deps
# flags: {}
# Extra package databases containing global packages
# extra-package-dbs: []
# Control whether we use the GHC we find on the path
# system-ghc: true
#
# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: ">=1.7"
#
# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64
#
# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
#
# Allow a newer minor version of GHC than the snapshot specifies
# compiler-check: newer-minor