small corrections
This commit is contained in:
parent
aaebeecce1
commit
9abaf53abe
5 changed files with 47 additions and 12 deletions
|
@ -25,6 +25,7 @@ relaunchCompilation() {
|
|||
done
|
||||
}
|
||||
|
||||
echo "First launch" | relaunchCompilation
|
||||
case $(uname) in
|
||||
Darwin)
|
||||
# On mac OS X, use hobbes (cabal install hobbes)
|
||||
|
|
|
@ -1,16 +1,51 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
autoload colors
|
||||
colors
|
||||
for COLOR in RED GREEN YELLOW BLUE MAGENTA CYAN BLACK WHITE; do
|
||||
eval $COLOR='$fg_no_bold[${(L)COLOR}]'
|
||||
eval BOLD_$COLOR='$fg_bold[${(L)COLOR}]'
|
||||
done
|
||||
eval RESET='$reset_color'
|
||||
|
||||
latestThread=0
|
||||
relaunchCompilation() {
|
||||
while read line; do
|
||||
if (( $( print -- $line | grep '.cabal-sandbox' | wc -l) == 0 )); then
|
||||
print "$line"
|
||||
cabal install
|
||||
./.cabal-sandbox/bin/test-{{projectName}}
|
||||
(($latestThread>0)) && \
|
||||
(( $(ps x | awk "\$1 == $latestThread" | wc -l)>0 )) && {
|
||||
print -- "\n${RED}STOPPED${RESET}"
|
||||
kill $latestThread
|
||||
}
|
||||
print "${BLUE}$line${RESET}"
|
||||
{ cabal install && \
|
||||
./.cabal-sandbox/bin/test-holy-project } &
|
||||
latestThread=$!
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
echo "First launch" | relaunchCompilation
|
||||
case $(uname) in
|
||||
Darwin)
|
||||
# On mac OS X, use hobbes (cabal install hobbes)
|
||||
# launch a cabal install and cabal test after each
|
||||
# small haskell file modification
|
||||
{hobbes "*.hs" | relaunchCompilation } &
|
||||
hobbes "*.cabal" | relaunchCompilation
|
||||
;;
|
||||
*) # On other Unixes
|
||||
tmp=$(date +"%s")
|
||||
t=$tmp
|
||||
while true; do
|
||||
tmp=$(( $t - 1 ))
|
||||
t=$(date +"%s")
|
||||
for fic in {src,test}/**/*.hs(.) *.cabal; do
|
||||
# note to use on OS X, use "stat -f %m $checkfile" instead
|
||||
modtime=$(stat --printf %Y $fic)
|
||||
(( $modtime > $tmp )) && print $fic
|
||||
done
|
||||
sleep 1
|
||||
done | relaunchCompilation
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -44,7 +44,7 @@ data Project = Project {
|
|||
, synopsis :: String
|
||||
, year :: String } deriving (Data, Typeable)
|
||||
|
||||
-- | Randomly choose an end scenario and then show a "serious" error message
|
||||
-- | Randomly choose an end scenario and then show a \"serious\" error message
|
||||
holyError :: String -> IO ()
|
||||
holyError str = do
|
||||
r <- randomIO
|
||||
|
|
|
@ -14,15 +14,14 @@ import qualified Data.Text.Lazy.Builder as TLB
|
|||
import Control.Monad ((<=<))
|
||||
|
||||
-- | make a simple http request but add a user agent to the HTTP header
|
||||
-- You HAVE TO add a User-Agent in your header to use the github API.
|
||||
simpleHTTPWithUserAgent :: String -> IO LZ.ByteString
|
||||
simpleHTTPWithUserAgent url = do
|
||||
r <- parseUrl url
|
||||
let request = r { requestHeaders = [ ("User-Agent","HTTP-Conduit") ] }
|
||||
withManager $ (return.responseBody) <=< httpLbs request
|
||||
|
||||
-- | Ask the github API
|
||||
-- A strange behaviour you HAVE TO add a User-Agent in your header.
|
||||
-- It took me way too long to get this error
|
||||
-- | Search a username using the github API
|
||||
searchGHUser :: String -> IO (Maybe String)
|
||||
searchGHUser "" = return Nothing
|
||||
searchGHUser email = do
|
||||
|
|
|
@ -26,7 +26,7 @@ colorPutStr color str = do
|
|||
setSGR []
|
||||
|
||||
-- | Ask for some info and returns it
|
||||
ask :: String -- ^ What? "name" for example
|
||||
ask :: String -- ^ What? \"name\" for example
|
||||
-> Maybe String -- ^ Default value
|
||||
-> IO String
|
||||
ask info hint = do
|
||||
|
|
Loading…
Reference in a new issue