packages feed

nemesis 2009.6.24 → 2009.6.25

raw patch · 4 files changed

+39/−77 lines, 4 filesdep +mpsPVP ok

version bump matches the API change (PVP)

Dependencies added: mps

API changes (from Hackage documentation)

Files

changelog.md view
@@ -1,3 +1,11 @@+2009.6.25+---------++### Fix++* fail when can not compile+* detect all possible nemesis name+ 2009.6.24 --------- 
nemesis.cabal view
@@ -1,5 +1,5 @@ Name:                 nemesis-Version:              2009.6.24+Version:              2009.6.25 Build-type:           Simple Synopsis:             a rake like task management tool Description:@@ -18,7 +18,7 @@  library   ghc-options: -Wall-  build-depends: base >= 4 && < 5, old-time, time, 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, mps >= 2009.6.25   hs-source-dirs: src/   exposed-modules:                         System.Nemesis@@ -32,3 +32,4 @@   hs-source-dirs:     src/   main-is:            System/Nemesis/Runner.hs   other-modules:      System.Nemesis.Util+                      System.Nemesis.DSL
src/System/Nemesis/Runner.hs view
@@ -7,7 +7,9 @@ import System.Directory import System.Nemesis.Util import System.Time+import System.Nemesis.DSL + start, end :: String start = start_nemesis ++ start_nemesis_dsl   where @@ -26,26 +28,33 @@      where     bin = ".nemesis"-    src = "Nemesis"     should_recompile = do       bin_exists <- doesFileExist bin-      if bin_exists-        then do+      if not bin_exists+        then return True+        else do           bin_stamp <- bin.file_mtime-          src_stamp <- src.file_mtime+          src_stamp <- get_src_name >>= file_mtime           return $ bin_stamp < src_stamp-        else return True          file_mtime path =        getModificationTime path ^ seconds ^ posixSecondsToUTCTime          seconds (TOD s _) = s.fromIntegral +get_src_name :: IO String+get_src_name = do+  dir <- ls "."+  return $ dir.filter (belongs_to possible_source) .get_name+  where+    possible_source = ["Nemesis", "nemesis", "Nemesis.hs", "nemesis.hs"]+    get_name []     = error "Nemesis does not exist!"+    get_name xs     = xs.first+ 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"+  src_name <- get_src_name+  let src_o  = src_base_name src_name ++ ".o"       src_hi = src_base_name src_name ++ ".hi"   src <- readFile src_name   @@ -56,14 +65,14 @@    if ((patch_end ++ patch_start).null && src_name.ends_with ".hs")     then do-      system $ "ghc --make -O1 " ++ src_name ++ " -o " ++ bin+      sh $ "ghc --make -O1 " ++ src_name ++ " -o " ++ bin       rm src_o       rm src_hi     else do       if t.null         then output_tmp $ patch_start ++ h ++ patch_end         else output_tmp $ h ++ patch_start ++ "\n" ++ t ++ patch_end-      system $ "ghc --make -O1 " ++ tmp_name ++ " -o " ++ bin+      sh $ "ghc --make -O1 " ++ tmp_name ++ " -o " ++ bin       rm tmp_name       rm tmp_o       rm tmp_hi@@ -71,9 +80,6 @@   where      main_src        = "main ="-    get_name []     = error "Nemesis does not exist!"-    get_name xs     = xs.first-    possible_source = ["Nemesis", "nemesis", "nemesis.hs", "Nemesis.hs"]     sep             = "-- nem"     output_tmp      = writeFile tmp_name     tmp_name        = "nemesis-tmp.hs"
src/System/Nemesis/Util.hs view
@@ -1,70 +1,17 @@ {-# LANGUAGE NoMonomorphismRestriction #-} -module System.Nemesis.Util where+module System.Nemesis.Util (+    module MPS.Light+  , ls+  , rm+  , rm_rf+) where -import Control.Arrow ((>>>))-import Control.Category (Category)-import Data.Char (toLower)-import Data.Function (on)-import Data.List (isPrefixOf, isSuffixOf, (\\))-import Prelude hiding ((>), (.), (^)) import System.Directory-import qualified Data.List as L---- utility functions from mps--(.) :: a -> (a -> b) -> b-a . f = f a-infixl 9 .--(^) :: (Functor f) => f a -> (a -> b) -> f b-(^) = flip fmap-infixl 8 ^--(>) :: (Category cat) => cat a b -> cat b c -> cat a c-(>) = (>>>)-infixl 8 >---join :: [a] -> [[a]] -> [a]-join    = L.intercalate--join' :: [[a]] -> [a]-join'   = concat--ljust, rjust :: Int -> a -> [a] -> [a]-ljust n x xs -  | n < xs.length = xs-  | otherwise     = ( n.times x ++ xs ).reverse.take n.reverse--rjust n x xs-  | n < xs.length = xs-  | otherwise     = ( xs ++ n.times x ).take n-    -compare_by :: (Ord b) => (a -> b) -> a -> a -> Ordering-compare_by = on compare--first :: [a] -> a-first = head--times :: b -> Int -> [b]-times = flip replicate--has :: (Eq a) => a -> [a] -> Bool-has = elem--belongs_to :: (Eq a) => [a] -> a -> Bool-belongs_to = flip elem---lower :: String -> String-lower = map toLower--starts_with :: String -> String -> Bool-starts_with = isPrefixOf+import MPS.Light+import Prelude hiding ((^), (.), (>))+import Data.List ((\\)) -ends_with :: String -> String -> Bool-ends_with = isSuffixOf  ls :: String -> IO [String] ls s = getDirectoryContents s ^ (\\ [".", ".."])