packages feed

nemesis 2009.6.14.3 → 2009.6.24

raw patch · 7 files changed

+111/−45 lines, 7 filesdep +old-timedep +timePVP ok

version bump matches the API change (PVP)

Dependencies added: old-time, time

API changes (from Hackage documentation)

Files

Nemesis view
@@ -23,14 +23,42 @@    desc "start console"   task "i" (sh "ghci -isrc src/System/Nemesis/DSL.hs")+   -  namespace "eat" $ do+  task "runner" (sh "ghci -isrc src/System/Nemesis/Runner.hs")++  desc "show sloc"+  task "stat" $ do+    sh "cloc -match-f=hs$ --quiet ."++  -- test for readme++  -- desc is optional, it gives some description to the following task+  desc "Hunter attack macro"+  +  -- syntax: task "keyword: dependencies" io-action+  task "attack: pet-attack auto-attack" (putStrLn "attack macro done!")++  desc "Pet attack"+  task "pet-attack: mark" $ do+    sh "echo 'pet attack'"++  desc "Hunter's mark"+  task "mark" $ do+    sh "echo \"casting hunter's mark\""+  +  desc "Auto attack"+  task "auto-attack" $ do+    sh "echo 'auto shoot'"     +    +    +  namespace "eat" $ do+     task "bread: salad" $ putStrLn "eating bread"     task "salad: /drink/coke" $ putStrLn "nice salad"-    -  ++   namespace "drink" $ do-    +     task "coke" $ putStrLn "drinking coke"-    
changelog.md view
@@ -1,3 +1,10 @@+2009.6.24+---------++### Feature++* enrich `nemesis` to do task management too+ 2009.6.14.3 ----------- 
+ known-issues.md view
@@ -0,0 +1,1 @@+* does not detect cycles
− knownissue.md
@@ -1,1 +0,0 @@-* does not detect cycles
nemesis.cabal view
@@ -1,5 +1,5 @@ Name:                 nemesis-Version:              2009.6.14.3+Version:              2009.6.24 Build-type:           Simple Synopsis:             a rake like task management tool Description:@@ -14,11 +14,11 @@ Cabal-version:        >= 1.2 category:             Web homepage:             http://github.com/nfjinjing/nemesis-data-files:           readme.md, changelog.md, knownissue.md, Nemesis+data-files:           readme.md, changelog.md, known-issues.md, Nemesis  library   ghc-options: -Wall-  build-depends: base >= 4 && < 5, haskell98, mtl, process, containers, data-default, Glob >= 0.4+  build-depends: base >= 4 && < 5, old-time, time, haskell98, mtl, process, containers, data-default, Glob >= 0.4   hs-source-dirs: src/   exposed-modules:                         System.Nemesis
readme.md view
@@ -36,64 +36,66 @@     nemesis = do            -- desc is optional, it gives some description to the following task-      desc "learn Haskell"-      -      -- syntax: task "keyword: dependencies" io-action-      task "learn-haskell: learn-fp" (putStrLn "Haskell is awesome!")+      desc "Hunter attack macro" -      desc "learn Functional Programming"-      task "learn-fp: learn-lisp" $ do-        sh "echo 'into FP'"+      -- syntax: task "keyword: dependencies" io-action+      task "attack: pet-attack auto-attack" (putStrLn "attack macro done!") -      desc "learn LISP"-      task "learn-lisp" $ do-        sh "echo 'LISP is cool!'"+      desc "Pet attack"+      task "pet-attack: mark" $ do+        sh "echo 'pet attack'" -run `nemesis`+      desc "Hunter's mark"+      task "mark" $ do+        sh "echo \"casting hunter's mark\"" -It will generate a bin `.nemesis` inside your current folder.+      desc "Auto attack"+      task "auto-attack" $ do+        sh "echo 'auto shoot'"  ### Run -run `./.nemesis`+run `nemesis` -         learn-fp: learn Functional Programming-    learn-haskell: learn Haskell-       learn-lisp: learn LISP-    +    attack                            : Hunter attack macro+    auto-attack                       : Auto attack+    mark                              : Hunter's mark+    pet-attack                        : Pet attack -run `./.nemesis learn-haskell`+run `nemesis attack` -    LISP is cool!-    into FP-    Haskell is awesome!-    +    casting hunter's mark+    pet attack+    auto shoot+    attack macro done! + ### Namespace  Suppose you have the following tasks--    namespace "eat" $ do+    +    nemesis = do+    +      namespace "eat" $ do -      task "bread: salad" $ putStrLn "eating bread"-      task "salad: /drink/coke" $ putStrLn "nice salad"+        task "bread: salad" $ putStrLn "eating bread"+        task "salad: /drink/coke" $ putStrLn "nice salad"  -    namespace "drink" $ do+      namespace "drink" $ do -      task "coke" $ putStrLn "drinking coke"+        task "coke" $ putStrLn "drinking coke"  then -    ./.nemesis bread =>+    nemesis bread =>     .nemesis: bread does not exist!     -    ./.nemesis eat/bread =>+    nemesis eat/bread =>     drinking coke     nice salad     eating bread     -      Advance usage -------------@@ -125,9 +127,8 @@  The logic is that whenever `main` is defined in `Nemesis.hs`, `nemesis` will act as `ghc --make` wrapper, so you can get nice error messages. -Hint-----+### That's it! -Save typing by aliasing `./.nemesis` to `n`, i.e. inside `.your_shellrc`+![mnemosyne](http://github.com/nfjinjing/nemesis/raw/master/mnemosyne.jpg) -    alias n="./.nemesis"+OK, she's actually mnemosyne, a cool goddess none the less.
src/System/Nemesis/Runner.hs view
@@ -1,8 +1,12 @@+import Control.Monad hiding (join) import Data.List (find)+import Data.Time.Clock.POSIX import Prelude hiding ((.), (>), (^))+import System import System.Cmd+import System.Directory import System.Nemesis.Util-+import System.Time  start, end :: String start = start_nemesis ++ start_nemesis_dsl@@ -13,6 +17,32 @@  main :: IO () main = do+  recompile <- should_recompile+  when recompile compile+  +  args <- getArgs+  system $ "./.nemesis " ++ args.join " "+  return ()+  +  where+    bin = ".nemesis"+    src = "Nemesis"+    should_recompile = do+      bin_exists <- doesFileExist bin+      if bin_exists+        then do+          bin_stamp <- bin.file_mtime+          src_stamp <- src.file_mtime+          return $ bin_stamp < src_stamp+        else return True+    +    file_mtime path = +      getModificationTime path ^ seconds ^ posixSecondsToUTCTime+    +    seconds (TOD s _) = s.fromIntegral++compile :: IO ()+compile = do   dir <- ls "."   let src_name = dir.filter (belongs_to possible_source) .get_name       src_o  = src_base_name src_name ++ ".o"