holy-project 0.1.0.1 → 0.1.1.0
raw patch · 5 files changed
+41/−29 lines, 5 filesdep +unixdep −lens-aesondep ~Cabaldep ~ansi-terminaldep ~base
Dependencies added: unix
Dependencies removed: lens-aeson
Dependency ranges changed: Cabal, ansi-terminal, base, bytestring, http-conduit, lens
Files
- holy-project.cabal +19/−15
- scaffold/auto-update +1/−1
- scaffold/project.cabal +6/−4
- src/HolyProject.hs +12/−6
- src/HolyProject/GithubAPI.hs +3/−3
holy-project.cabal view
@@ -2,13 +2,13 @@ -- see http://haskell.org/cabal/users-guide/ name: holy-project-version: 0.1.0.1+version: 0.1.1.0 synopsis: Start your Haskell project with cabal, git and tests. description: Holy Project is an application wich ask the user some questions and create files to help you starting a new Haskell project. There are example for tests using HUnit and SmallCheck- It initialize git, use cabal sandboxes, and provide+ It initializes git, use cabal sandboxes, and provide two useful scripts: \"auto-update\" and \"interact\". homepage: http://github.com/yogsototh/holy-project license: MIT@@ -43,20 +43,20 @@ main-is: Main.hs -- other-modules: -- other-extensions:- build-depends: base >=4.6 && <4.7- , ansi-terminal+ build-depends: base >= 4.6 && < 5+ , ansi-terminal >= 0.6.1.1 , split , hastache- , bytestring+ , bytestring >= 0.10.4.0 , syb , directory , time , filepath+ , unix >= 2.7.0.1 , process , random- , http-conduit- , lens- , lens-aeson+ , http-conduit >= 2.1.1+ , lens >= 4.1.2 , aeson , text -- from Tasty cabal with ansi-terminal@@ -73,8 +73,8 @@ , HolyProject.MontyPython -- other-modules: -- other-extensions:- build-depends: base >=4.6 && <4.7- , ansi-terminal+ build-depends: base >= 4.6 && < 5+ , ansi-terminal >= 0.6.1.1 , split , hastache , bytestring@@ -82,11 +82,11 @@ , directory , time , filepath+ , unix >= 2.7.0.1 , process , random- , http-conduit- , lens- , lens-aeson+ , http-conduit >= 2.1.1+ , lens >= 4.1.2 , aeson , text ghc-options: -Wall@@ -100,7 +100,9 @@ other-modules: HolyProject.GithubAPI.Test , HolyProject.StringUtils.Test default-language: Haskell2010- build-depends: base ==4.6.*, Cabal >= 1.16.0+ build-depends: base >=4.6 && < 5+ , Cabal >= 1.18.0+ , bytestring >= 0.10.4.0 , holy-project , HUnit , QuickCheck@@ -116,7 +118,9 @@ main-is: Test.hs Type: exitcode-stdio-1.0 default-language: Haskell2010- build-depends: base ==4.6.*, Cabal >= 1.16.0+ build-depends: base >= 4.6 && < 5+ , Cabal >= 1.18.0+ , bytestring >= 0.10.4.0 , holy-project , HUnit , QuickCheck
scaffold/auto-update view
@@ -19,7 +19,7 @@ } print "${BLUE}$line${RESET}" { cabal install && \- ./.cabal-sandbox/bin/test-holy-project } &+ ./.cabal-sandbox/bin/test-{{projectName}} } & latestThread=$! fi done
scaffold/project.cabal view
@@ -25,7 +25,7 @@ main-is: Main.hs -- other-modules: -- other-extensions:- build-depends: base >=4.6 && <4.7+ build-depends: base >=4.6 && <5 hs-source-dirs: src ghc-options: -Wall default-language: Haskell2010@@ -36,7 +36,7 @@ , {{moduleName}}.Coconut -- other-modules: -- other-extensions:- build-depends: base >=4.6 && <4.7+ build-depends: base >=4.6 && <5 ghc-options: -Wall hs-source-dirs: src default-language: Haskell2010@@ -46,7 +46,8 @@ ghc-options: -Wall main-is: Test.hs default-language: Haskell2010- build-depends: base ==4.6.*, Cabal >= 1.16.0+ build-depends: base >=4.6 && <5+ , Cabal >= 1.16.0 , {{projectName}} , HUnit , QuickCheck@@ -62,7 +63,8 @@ main-is: Test.hs Type: exitcode-stdio-1.0 default-language: Haskell2010- build-depends: base ==4.6.*, Cabal >= 1.16.0+ build-depends: base >=4.6 && <5+ , Cabal >= 1.16.0 , {{projectName}} , HUnit , QuickCheck
src/HolyProject.hs view
@@ -10,20 +10,23 @@ , ask ) +-- Read octal, easier for chmod+import Numeric (readOct) -- Get current year for the License import Data.Time.Clock import Data.Time.Calendar -- Hastache import Data.Data+import qualified Data.Text.Lazy as T+import qualified Data.Text.Lazy.IO as TIO import Text.Hastache import Text.Hastache.Context -- File and directory Handling-import qualified Data.ByteString as BS-import qualified Data.ByteString.Lazy.Char8 as LZ import System.Directory import System.FilePath.Posix (takeDirectory,(</>))+import System.Posix.Files (setFileMode) -- Execute external commands-import System.Cmd (system)+import System.Process (system) -- Random error message :) import System.Random -- Fork@@ -132,10 +135,10 @@ -> IO () genFile context filename outputFileName = do putStrLn $ '\t':outputFileName -- show the file name- template <- BS.readFile =<< getDataFileName ("scaffold/" ++ filename)- transformedFile <- hastacheStr defaultConfig template context+ template <- TIO.readFile =<< getDataFileName ("scaffold/" ++ filename)+ transformedFile <- hastacheStr defaultConfig (T.toStrict template) context createDirectoryIfMissing True (takeDirectory outputFileName)- LZ.writeFile outputFileName transformedFile+ TIO.writeFile outputFileName transformedFile -- | This function is where we create the project once the -- question are answered@@ -191,6 +194,9 @@ , "test" </> "Test.hs" ) ]+ -- Change some execution access+ _ <- setFileMode "auto-update" ((fst . head . readOct) "777")+ _ <- setFileMode "interact" ((fst . head . readOct) "777") -- Execute some commands -- We don't really need them to be succesful -- So we try them anyway
src/HolyProject/GithubAPI.hs view
@@ -7,8 +7,8 @@ -- HTTP request and JSON handling import Network.HTTP.Conduit import Control.Lens.Operators ((^?))-import Control.Lens.Aeson-import Data.Aeson.Encode (fromValue)+import Data.Aeson.Encode (encodeToTextBuilder)+import Data.Aeson.Lens (key,nth) import qualified Data.Text.Lazy as TLZ import qualified Data.Text.Lazy.Builder as TLB import Control.Monad ((<=<))@@ -30,4 +30,4 @@ let login = body ^? key "items" . nth 0 . key "login" return $ fmap jsonValueToString login where- jsonValueToString = TLZ.unpack . TLB.toLazyText . fromValue+ jsonValueToString = TLZ.unpack . TLB.toLazyText . encodeToTextBuilder