packages feed

kit 0.6 → 0.6.1

raw patch · 8 files changed

+74/−83 lines, 8 filesdep −QuickCheck

Dependencies removed: QuickCheck

Files

Kit/Commands.hs view
@@ -3,7 +3,6 @@   Command,   liftKit,   mySpec,-  myKitSpec,   myRepository,   runCommand,   defaultLocalRepoPath,@@ -15,6 +14,8 @@ import Kit.Repository import Kit.Project +import System.Exit (exitFailure)+ import Control.Monad.Error import Control.Monad.Reader @@ -27,10 +28,10 @@ liftKit = Command . ReaderT . const  mySpec :: Command KitSpec-mySpec = Command $ ask >>= (return . fst) +mySpec = Command $ fmap fst ask  myRepository :: Command KitRepository-myRepository = Command $ ask >>= (return . snd)+myRepository = Command $ fmap snd ask  runCommand :: Command a -> IO () runCommand (Command cmd) = run $ do@@ -38,10 +39,7 @@   repository <- liftIO defaultLocalRepository   runReaderT cmd (spec, repository)   where run = (handleFails =<<) . runErrorT-        handleFails = either (putStrLn . ("kit error: " ++)) (const $ return ())--myKitSpec :: KitIO KitSpec-myKitSpec = readSpec "KitSpec"+        handleFails = either (\msg -> putStrLn ("kit error: " ++ msg) >> exitFailure) (const $ return ())  defaultLocalRepoPath :: IO FilePath defaultLocalRepoPath = getHomeDirectory >>= \h -> return $ h </> ".kit" </> "repository"
Kit/Contents.hs view
@@ -36,14 +36,14 @@       prefix = readHeader spec   in  KitContents (specKit spec) <$> headers <*> sources <*> libs <*> config <*> prefix --- Report missing file+-- TODO report missing file readHeader :: KitSpec -> IO (Maybe String) readHeader spec = do   let fp = packageFileName spec </> specPrefixFile spec   exists <- doesFileExist fp   T.sequence (fmap readFile $ justTrue exists fp) --- TODO make this report missing file+-- TODO report missing file readConfig :: KitSpec -> IO (Maybe XCConfig) readConfig spec = do   let fp = packageFileName spec </> specConfigFile spec
Kit/Main.hs view
@@ -34,7 +34,7 @@                             in do                               repo <- defaultLocalRepoPath                               let thisKitDir = repo </> "kits" </> packageName spec </> packageVersion spec-                              mkdir_p thisKitDir+                              mkdirP thisKitDir                               copyFile ("dist" </> pkg) (thisKitDir </> pkg)                               copyFile "KitSpec" (thisKitDir </> "KitSpec") @@ -73,7 +73,6 @@    kitMain :: IO ()   kitMain = do-      mkdir_p =<< defaultLocalRepoPath -      args <- KA.parseArgs-      runCommand $ handleArgs args +      mkdirP =<< defaultLocalRepoPath +      runCommand . handleArgs =<< KA.parseArgs 
Kit/Package.hs view
@@ -10,7 +10,7 @@   fileBelongsInPackage :: KitSpec -> FilePath -> Bool   fileBelongsInPackage config fp = let     isCore = elem fp [specSourceDirectory config, specTestDirectory config, specLibDirectory config, "KitSpec"]-    isProject = or $ map (`isSuffixOf` fp) ["xcodeproj", "xcconfig", ".pch"]+    isProject = any (`isSuffixOf` fp) ["xcodeproj", "xcconfig", ".pch"]       in isCore || isProject    package :: KitSpec -> IO ()@@ -21,9 +21,8 @@       cleanOrCreate kd       contents <- getDirectoryContents "."       mapM_ (copyAllTo kd) (filter (fileBelongsInPackage spec) contents)-      mkdir_p distDir-      inDirectory tempDir $ do-        sh $ "tar czf " ++ (distDir </> (kitPath ++ ".tar.gz")) ++ " " ++ kitPath+      mkdirP distDir+      inDirectory tempDir $ sh $ "tar czf " ++ (distDir </> (kitPath ++ ".tar.gz")) ++ " " ++ kitPath       return ()     where       kitPath = packageFileName spec
Kit/Project.hs view
@@ -62,7 +62,7 @@           let headers = cs >>= contentHeaders           let sources = cs >>= contentSources           let libs = cs >>= contentLibs-          mkdir_p projectDir+          mkdirP projectDir           writeFile projectFile $ renderXcodeProject headers sources libs "libKitDeps.a"         createHeader cs = do           let headers = mapMaybe namedPrefix cs@@ -94,7 +94,7 @@     let fp = tmpDir </> (packageFileName kit ++ ".tar.gz")     putStrLn $ " -> Installing " ++ packageFileName kit     fmap fromJust $ getKit kr kit fp-    mkdir_p kitDir +    mkdirP kitDir      inDirectory kitDir $ system ("tar zxf " ++ fp)     return () 
Kit/Util.hs view
@@ -47,14 +47,14 @@   maybeToKitIO :: String -> Maybe a -> KitIO a   maybeToKitIO msg = maybe (throwError msg) return -  mkdir_p :: MonadIO m => FilePath -> m ()-  mkdir_p = liftIO . createDirectoryIfMissing True+  mkdirP :: MonadIO m => FilePath -> m ()+  mkdirP = liftIO . createDirectoryIfMissing True    cleanOrCreate :: MonadIO m => FilePath -> m ()   cleanOrCreate directory = liftIO $ do     exists <- doesDirectoryExist directory     when exists $ removeDirectoryRecursive directory-    mkdir_p directory+    mkdirP directory    inDirectory :: MonadIO m => FilePath -> m a -> m a   inDirectory dir actions = do
Kit/Xcode/Common.hs view
@@ -1,71 +1,66 @@ module Kit.Xcode.Common where-  import Data.List-  import System.FilePath.Posix   -  import Text.PList+import Data.List+import System.FilePath.Posix+import Text.PList -  -  type UUID = String+type UUID = String   -  data FileType = Header | Source | Archive | Unknown+data FileType = Header | Source | Archive | Unknown   -  fileType :: String -> FileType-  fileType x | ".h" `isSuffixOf` x = Header-  fileType x | ".m" `isSuffixOf` x = Source-  fileType x | ".mm" `isSuffixOf` x = Source-  fileType x | ".c" `isSuffixOf` x = Source-  fileType x | ".a" `isSuffixOf` x = Archive-  fileType _ = Unknown--  fileTypeBit :: FileType -> String-  fileTypeBit Header = "sourcecode.c.h"-  fileTypeBit Source = "sourcecode.c.objc"-  fileTypeBit Unknown = "sourcecode.unknown"-  fileTypeBit Archive = "archive.ar"+fileType :: String -> String +fileType x | ".h" `isSuffixOf` x = "sourcecode.c.h"+fileType x | ".m" `isSuffixOf` x = "sourcecode.c.obj"+fileType x | ".mm" `isSuffixOf` x = "sourcecode.c.obj" +fileType x | ".c" `isSuffixOf` x = "sourcecode.c.obj"+fileType x | ".a" `isSuffixOf` x = "archive.ar" +fileType x | ".framework" `isSuffixOf` x = "wrapper.framework"+fileType x | ".xcconfig" `isSuffixOf` x = "text.xcconfig"+fileType _ = "sourcecode.unknown" -  data PBXBuildFile = PBXBuildFile {-    buildFileId :: UUID,-    buildFileReference :: PBXFileReference-  } deriving (Eq, Show)+data PBXBuildFile = PBXBuildFile {+  buildFileId :: UUID,+  buildFileReference :: PBXFileReference+} deriving (Eq, Show)   -  data PBXFileReference = PBXFileReference {-    fileReferenceId :: UUID,-    fileReferencePath :: String-  } deriving (Eq, Show)+data PBXFileReference = PBXFileReference {+  fileReferenceId :: UUID,+  fileReferencePath :: String+} deriving (Eq, Show)  -  group :: String -> [PListType] -> PListType -  group name children = obj [-      "isa" ~> val "PBXGroup",-      "name" ~> val name,-      "sourceTree" ~> val "<group>",-      "children" ~> arr children-    ]--  buildFile :: String -> PListType-  buildFile refUUID = obj [ "isa" ~> val "PBXBuildFile", "fileRef" ~> val refUUID ]+group :: String -> [PListType] -> PListType +group name children = obj [+    "isa" ~> val "PBXGroup",+    "name" ~> val name,+    "sourceTree" ~> val "<group>",+    "children" ~> arr children+  ] -  buildFileItem :: PBXBuildFile -> PListObjectItem -  buildFileItem bf = buildFileId bf ~> buildFile (fileReferenceId . buildFileReference $ bf) +buildFile :: String -> PListType+buildFile refUUID = obj [ "isa" ~> val "PBXBuildFile", "fileRef" ~> val refUUID ] -  fileReferenceItem :: PBXFileReference -> PListObjectItem-  fileReferenceItem fr = fileReferenceId fr ~> dict-    where-      fileName = fileReferenceName fr-      dict = obj [-          "isa" ~> val "PBXFileReference",-          "fileEncoding" ~> val "4",-          "lastKnownFileType" ~> val (fileTypeBit . fileType $ fileName),-          "name" ~> val fileName,-          "path" ~> val (fileReferencePath fr),-          "sourceTree" ~> val "<group>"-        ]+buildFileItem :: PBXBuildFile -> PListObjectItem +buildFileItem bf = buildFileId bf ~> buildFile (fileReferenceId . buildFileReference $ bf)  +fileReferenceItem :: PBXFileReference -> PListObjectItem+fileReferenceItem fr = fileReferenceId fr ~> dict+  where+    fileName = fileReferenceName fr+    dict = obj [+        "isa" ~> val "PBXFileReference",+        "fileEncoding" ~> val "4",+        "lastKnownFileType" ~> val (fileType fileName),+        "name" ~> val fileName,+        "path" ~> val (fileReferencePath fr),+        "sourceTree" ~> val "<group>"+      ] -  fileReferenceName :: PBXFileReference -> String-  fileReferenceName = takeFileName . fileReferencePath+fileReferenceName :: PBXFileReference -> String+fileReferenceName = takeFileName . fileReferencePath   -  uuid :: Integer -> UUID-  uuid i = let-       s = show i-       pad = 24 - length s-    in replicate pad '0' ++ s +uuid :: Integer -> UUID+uuid i = let+     s = show i+     pad = 24 - length s+  in replicate pad '0' ++ s +
kit.cabal view
@@ -1,11 +1,11 @@ name:           kit-version:        0.6+version:        0.6.1 cabal-version:  >=1.2 build-type:     Simple license:        BSD3 license-file:   LICENSE maintainer:     nkpart@gmail.com-+homepage:       http://github.com/nkpart/kit synopsis:       A dependency manager for Xcode (Objective-C) projects description:    A dependency manager for Xcode (Objective-C) projects category:       Development@@ -16,7 +16,7 @@   buildable:      True   build-depends:  process -any, network -any, mtl -any,                    filepath -any, directory -any, containers -any, cmdargs >=0.3,-                  bytestring -any, base >=3 && <5, QuickCheck -any,+                  bytestring -any, base >=3 && <5,                   HTTP >=4000.0.9, Glob >= 0.5, data-object -any, data-object-yaml -any    hs-source-dirs: .