From 266b98203878f91fdf18960e64d9f38d2a44003b Mon Sep 17 00:00:00 2001 From: "Yann Esposito (Yogsototh)" Date: Wed, 20 Nov 2013 22:08:22 +0100 Subject: [PATCH] added auto update with hobbes --- auto-update | 16 ++++++++++++++++ holy-project.cabal | 1 + scaffold/auto-update | 16 ++++++++++++++++ src/Main.hs | 1 + 4 files changed, 34 insertions(+) create mode 100755 auto-update create mode 100755 scaffold/auto-update diff --git a/auto-update b/auto-update new file mode 100755 index 0000000..dffd888 --- /dev/null +++ b/auto-update @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +relaunchCompilation() { + while read line; do + if (( $( print -- $line | grep '.cabal-sandbox' | wc -l) == 0 )); then + print "$line" + cabal install + ./.cabal-sandbox/bin/test-holy-project + fi + done +} + +# launch a cabal install and cabal test after each +# small haskell file modification +{hobbes "*.hs" | relaunchCompilation } & +hobbes "*.cabal" | relaunchCompilation diff --git a/holy-project.cabal b/holy-project.cabal index 2756111..774bcde 100644 --- a/holy-project.cabal +++ b/holy-project.cabal @@ -16,6 +16,7 @@ build-type: Simple -- extra-source-files: data-files: scaffold/LICENSE , scaffold/Setup.hs + , scaffold/auto-update , scaffold/gitignore , scaffold/project.cabal , scaffold/src/Main.hs diff --git a/scaffold/auto-update b/scaffold/auto-update new file mode 100755 index 0000000..88f37dc --- /dev/null +++ b/scaffold/auto-update @@ -0,0 +1,16 @@ +#!/usr/bin/env zsh + +relaunchCompilation() { + while read line; do + if (( $( print -- $line | grep '.cabal-sandbox' | wc -l) == 0 )); then + print "$line" + cabal install + ./.cabal-sandbox/bin/test-{{projectName}} + fi + done +} + +# launch a cabal install and cabal test after each +# small haskell file modification +{hobbes "*.hs" | relaunchCompilation } & +hobbes "*.cabal" | relaunchCompilation diff --git a/src/Main.hs b/src/Main.hs index 944f27a..4fcd9f2 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -170,6 +170,7 @@ createProject p = do createDirectory (projectName p) setCurrentDirectory (projectName p) genFile context "gitignore" $ ".gitignore" + genFile context "auto-update" $ "auto-update" genFile context "LICENSE" $ "LICENSE" genFile context "Setup.hs" $ "Setup.hs" genFile context "project.cabal" $ (projectName p) ++ ".cabal"