embed files in the bin

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

View file

@ -2,12 +2,13 @@
-- --
-- see: https://github.com/sol/hpack -- see: https://github.com/sol/hpack
-- --
-- hash: a686a36064ef8ecb9b6b995eff90b19c3c02223326995cc6f0ae33c7f7d699f5 -- hash: 33fb8dc1910b29dc2948850dc3ab52f6a6c420a93c0113d1fc81076fcd555c3a
name: gpm name: gpm
version: 0.1.0.0 version: 0.1.0.0
category: Test category: Test
stability: alpha (experimental) stability: alpha (experimental)
homepage: https://gitlab.esy.fun/yogsototh/gpm
author: Yann Esposito author: Yann Esposito
maintainer: yann.esposito@gmail.com maintainer: yann.esposito@gmail.com
copyright: © 2017 Yann Esposito copyright: © 2017 Yann Esposito
@ -30,6 +31,7 @@ library
ghc-options: -O2 -Werror -Wall -Wcompat -Wincomplete-uni-patterns -Wredundant-constraints -Wnoncanonical-monad-instances ghc-options: -O2 -Werror -Wall -Wcompat -Wincomplete-uni-patterns -Wredundant-constraints -Wnoncanonical-monad-instances
build-depends: build-depends:
base >=4.8 && <5 base >=4.8 && <5
, file-embed
, protolude , protolude
, turtle , turtle
default-language: Haskell2010 default-language: Haskell2010
@ -44,6 +46,7 @@ executable gpm
ghc-options: -O2 -Werror -Wall -Wcompat -Wincomplete-uni-patterns -Wredundant-constraints -Wnoncanonical-monad-instances -threaded -rtsopts -with-rtsopts=-N -optP-Wno-nonportable-include-path 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: build-depends:
base >=4.8 && <5 base >=4.8 && <5
, file-embed
, gpm , gpm
, protolude , protolude
, turtle , turtle

View file

@ -5,7 +5,7 @@ author: Yann Esposito
maintainer: yann.esposito@gmail.com maintainer: yann.esposito@gmail.com
copyright: © 2017 Yann Esposito copyright: © 2017 Yann Esposito
license: ISC license: ISC
url: https://gitlab.esy.fun/yogsototh/gpm homepage: https://gitlab.esy.fun/yogsototh/gpm
default-extensions: default-extensions:
- OverloadedStrings - OverloadedStrings
- NoImplicitPrelude - NoImplicitPrelude
@ -26,6 +26,7 @@ dependencies:
- base >=4.8 && <5 - base >=4.8 && <5
- protolude - protolude
- turtle - turtle
- file-embed
library: library:
source-dirs: src source-dirs: src
executables: executables:

View file

@ -1,19 +1,22 @@
{-# LANGUAGE NoImplicitPrelude #-} {-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TemplateHaskell #-}
module GPM module GPM
where where
import Protolude hiding (stdout,(%),die) import Data.FileEmbed (embedStringFile)
import Turtle import Protolude hiding (die, stdout, (%))
import Turtle
import GPM.Review (handleReview,ReviewCommand(..),parseReviewCmd) import GPM.Review (ReviewCommand (..), handleReview,
parseReviewCmd)
gpm :: IO () gpm :: IO ()
gpm = do gpm = do
subcmd <- options "Git Project Manager" parser subcmd <- options "Git Project Manager" parser
case subcmd of case subcmd of
Init -> init Init -> init
NewIssue -> newIssue NewIssue -> newIssue
Review reviewCmd -> handleReview reviewCmd Review reviewCmd -> handleReview reviewCmd
data Command = Init data Command = Init
@ -55,15 +58,13 @@ debug cmd = do
initIssues :: IO () initIssues :: IO ()
initIssues = do initIssues = do
echo "* issue.org" echo "* issue.org"
input ("templates" </> "issues.org") output "issues.org" $(embedStringFile "templates/issues.org")
& output "issues.org"
debug "git add issues.org" debug "git add issues.org"
initDocs :: IO () initDocs :: IO ()
initDocs = do initDocs = do
echo "* wiki.org" echo "* wiki.org"
input ("templates" </> "wiki.org") output "wiki.org" $(embedStringFile "templates/wiki.org")
& output "wiki.org"
debug "git add wiki.org" debug "git add wiki.org"
initReview :: IO () initReview :: IO ()
@ -71,6 +72,5 @@ initReview = do
let fic = "reviews" </> "write-contributing-yogsototh.org" let fic = "reviews" </> "write-contributing-yogsototh.org"
mktree "reviews" mktree "reviews"
putText $ format ("* "%fp) fic putText $ format ("* "%fp) fic
input ("templates" </> "review.org") output fic $(embedStringFile "templates/review.org")
& output fic
debug "git add reviews" debug "git add reviews"