fixed some things
This commit is contained in:
parent
bae928835a
commit
bc7229007c
3 changed files with 21 additions and 13 deletions
|
@ -40,6 +40,7 @@ executable holy-project
|
|||
, directory
|
||||
, time
|
||||
, filepath
|
||||
, process
|
||||
-- from Tasty cabal with ansi-terminal
|
||||
cpp-options: -DCOLORS
|
||||
hs-source-dirs: src
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
-- Initial project.cabal generated by holy-project.
|
||||
-- For further documentation, see http://haskell.org/cabal/users-guide/
|
||||
|
||||
name: project
|
||||
name: {{projectName}}
|
||||
version: 0.1.0.0
|
||||
synopsis: {{synopsis}}
|
||||
-- description:
|
||||
|
@ -26,9 +26,9 @@ executable project
|
|||
default-language: Haskell2010
|
||||
|
||||
library
|
||||
exposed-modules: Project
|
||||
, Project.Swallow
|
||||
, Project.Coconut
|
||||
exposed-modules: {{moduleName}}
|
||||
, {{moduleName}}.Swallow
|
||||
, {{moduleName}}.Coconut
|
||||
-- other-modules:
|
||||
-- other-extensions:
|
||||
build-depends: base >=4.6 && <4.7
|
||||
|
@ -50,6 +50,7 @@ executable test-project
|
|||
, tasty-hunit
|
||||
, tasty-quickcheck
|
||||
, tasty-smallcheck
|
||||
|
||||
test-suite Tests
|
||||
hs-source-dirs: test
|
||||
ghc-options: -Wall
|
||||
|
|
24
src/Main.hs
24
src/Main.hs
|
@ -20,6 +20,8 @@ import qualified Data.ByteString as BS
|
|||
import qualified Data.ByteString.Lazy.Char8 as LZ
|
||||
import System.Directory
|
||||
import System.FilePath.Posix (takeDirectory,(</>))
|
||||
-- Execute external commands
|
||||
import System.Cmd (system)
|
||||
|
||||
-- Get external file of package
|
||||
import Paths_holy_project
|
||||
|
@ -135,7 +137,7 @@ capitalize str = concat (map capitalizeWord (splitOneOf " -" str))
|
|||
genFile :: MuContext IO -> FilePath -> FilePath -> IO ()
|
||||
genFile context filename outputFileName = do
|
||||
putStrLn $ '\t':outputFileName
|
||||
pkgfileName <- getDataFileName ("scaffold" </> filename)
|
||||
pkgfileName <- getDataFileName ("scaffold/" ++ filename)
|
||||
template <- BS.readFile pkgfileName
|
||||
transformedFile <- hastacheStr defaultConfig template context
|
||||
createDirectoryIfMissing True (takeDirectory outputFileName)
|
||||
|
@ -146,15 +148,19 @@ createProject p = do
|
|||
let context = mkGenericContext p
|
||||
createDirectory (projectName p)
|
||||
setCurrentDirectory (projectName p)
|
||||
putStrLn "I'm not a witch, I'm not a witch!"
|
||||
genFile context "gitignore" $ ".gitignore"
|
||||
genFile context "LICENSE" $ "LICENSE"
|
||||
genFile context "Setup.hs" $ "Setup.hs"
|
||||
genFile context "project.cabal" $ (projectName p) ++ ".cabal"
|
||||
genFile context ("src" </> "Main.hs" ) $ "src" </> "Main.hs"
|
||||
genFile context ("src" </> "ModuleName.hs" ) $ "src" </> ((moduleName p)++".hs")
|
||||
genFile context ("src" </> "ModuleName/Coconut.hs" ) $ "src" </> (moduleName p) </> "Coconut.hs"
|
||||
genFile context ("src" </> "ModuleName/Swallow.hs" ) $ "src" </> (moduleName p) </> "Swallow.hs"
|
||||
genFile context ("test" </> "ModuleName/Coconut/Test.hs") $ "test" </> (moduleName p) </> "Coconut" </> "Test.hs"
|
||||
genFile context ("test" </> "ModuleName/Swallow/Test.hs") $ "test" </> (moduleName p) </> "Swallow" </> "Test.hs"
|
||||
genFile context ("test" </> "Test.hs" ) $ "test" </> "Test.hs"
|
||||
genFile context "src/Main.hs" $ "src" </> "Main.hs"
|
||||
genFile context "src/ModuleName.hs" $ "src" </> ((moduleName p)++".hs")
|
||||
genFile context "src/ModuleName/Coconut.hs" $ "src" </> (moduleName p) </> "Coconut.hs"
|
||||
genFile context "src/ModuleName/Swallow.hs" $ "src" </> (moduleName p) </> "Swallow.hs"
|
||||
genFile context "test/ModuleName/Coconut/Test.hs" $ "test" </> (moduleName p) </> "Coconut" </> "Test.hs"
|
||||
genFile context "test/ModuleName/Swallow/Test.hs" $ "test" </> (moduleName p) </> "Swallow" </> "Test.hs"
|
||||
genFile context "test/Test.hs" $ "test" </> "Test.hs"
|
||||
_ <- system "git init ."
|
||||
_ <- system "cabal sandbox init"
|
||||
_ <- system "cabal install"
|
||||
_ <- system "cabal test"
|
||||
return ()
|
||||
|
|
Loading…
Reference in a new issue