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
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
echo "First launch" | relaunchCompilation
|
||||||
case $(uname) in
|
case $(uname) in
|
||||||
Darwin)
|
Darwin)
|
||||||
# On mac OS X, use hobbes (cabal install hobbes)
|
# On mac OS X, use hobbes (cabal install hobbes)
|
||||||
|
|
|
@ -1,16 +1,51 @@
|
||||||
#!/usr/bin/env zsh
|
#!/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() {
|
relaunchCompilation() {
|
||||||
while read line; do
|
while read line; do
|
||||||
if (( $( print -- $line | grep '.cabal-sandbox' | wc -l) == 0 )); then
|
if (( $( print -- $line | grep '.cabal-sandbox' | wc -l) == 0 )); then
|
||||||
print "$line"
|
(($latestThread>0)) && \
|
||||||
cabal install
|
(( $(ps x | awk "\$1 == $latestThread" | wc -l)>0 )) && {
|
||||||
./.cabal-sandbox/bin/test-{{projectName}}
|
print -- "\n${RED}STOPPED${RESET}"
|
||||||
|
kill $latestThread
|
||||||
|
}
|
||||||
|
print "${BLUE}$line${RESET}"
|
||||||
|
{ cabal install && \
|
||||||
|
./.cabal-sandbox/bin/test-holy-project } &
|
||||||
|
latestThread=$!
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
# launch a cabal install and cabal test after each
|
echo "First launch" | relaunchCompilation
|
||||||
# small haskell file modification
|
case $(uname) in
|
||||||
{hobbes "*.hs" | relaunchCompilation } &
|
Darwin)
|
||||||
hobbes "*.cabal" | relaunchCompilation
|
# 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
|
, synopsis :: String
|
||||||
, year :: String } deriving (Data, Typeable)
|
, 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 :: String -> IO ()
|
||||||
holyError str = do
|
holyError str = do
|
||||||
r <- randomIO
|
r <- randomIO
|
||||||
|
|
|
@ -14,15 +14,14 @@ import qualified Data.Text.Lazy.Builder as TLB
|
||||||
import Control.Monad ((<=<))
|
import Control.Monad ((<=<))
|
||||||
|
|
||||||
-- | make a simple http request but add a user agent to the HTTP header
|
-- | 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 :: String -> IO LZ.ByteString
|
||||||
simpleHTTPWithUserAgent url = do
|
simpleHTTPWithUserAgent url = do
|
||||||
r <- parseUrl url
|
r <- parseUrl url
|
||||||
let request = r { requestHeaders = [ ("User-Agent","HTTP-Conduit") ] }
|
let request = r { requestHeaders = [ ("User-Agent","HTTP-Conduit") ] }
|
||||||
withManager $ (return.responseBody) <=< httpLbs request
|
withManager $ (return.responseBody) <=< httpLbs request
|
||||||
|
|
||||||
-- | Ask the github API
|
-- | Search a username using 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
|
|
||||||
searchGHUser :: String -> IO (Maybe String)
|
searchGHUser :: String -> IO (Maybe String)
|
||||||
searchGHUser "" = return Nothing
|
searchGHUser "" = return Nothing
|
||||||
searchGHUser email = do
|
searchGHUser email = do
|
||||||
|
|
|
@ -26,7 +26,7 @@ colorPutStr color str = do
|
||||||
setSGR []
|
setSGR []
|
||||||
|
|
||||||
-- | Ask for some info and returns it
|
-- | Ask for some info and returns it
|
||||||
ask :: String -- ^ What? "name" for example
|
ask :: String -- ^ What? \"name\" for example
|
||||||
-> Maybe String -- ^ Default value
|
-> Maybe String -- ^ Default value
|
||||||
-> IO String
|
-> IO String
|
||||||
ask info hint = do
|
ask info hint = do
|
||||||
|
|
Loading…
Reference in a new issue