packages feed

kit 0.6.7 → 0.6.8

raw patch · 7 files changed

+40/−13 lines, 7 files

Files

Kit/CmdArgs.hs view
@@ -10,7 +10,9 @@                   | Package                   | PublishLocal { tag :: Maybe String }                    | Verify { sdk :: String }-                  | CreateSpec { name :: String, version :: String } deriving (Show, Data, Typeable)+                  | CreateSpec { name :: String, version :: String } +                  | ShowTree+                  deriving (Show, Data, Typeable)    parseMode :: KitCmdArgs   parseMode = modes [@@ -26,6 +28,7 @@                     help "Package this kit, then deploy it to the local repository (~/.kit/repository)"       , Verify { sdk = "iphonesimulator4.0" &= typ "SDK" &= help "iphoneos, iphonesimulator4.0, etc."} &=                     help "Package this kit, then attempt to use it as a dependency in an empty project. This will assert that the kit and all its dependencies can be compiled together."+      , ShowTree &= help "Print out the dependency tree for this spec"     ]    parseArgs :: IO KitCmdArgs
Kit/Contents.hs view
@@ -1,7 +1,8 @@ module Kit.Contents (   KitContents(..),   readKitContents,-  namedPrefix+  namedPrefix,+  makeContentsRelative    ) where  import Kit.Spec@@ -20,14 +21,24 @@   contentPrefix :: Maybe String     -- ^ Contents of the prefix header } +makeContentsRelative :: FilePath -> KitContents -> KitContents+makeContentsRelative base kc = let f p = map (makeRelative base) (p kc)+                                in kc { contentHeaders = f contentHeaders,+                                        contentSources = f contentSources,+                                        contentLibs = f contentLibs+                                      } + namedPrefix :: KitContents -> Maybe String namedPrefix kc = fmap (\s -> "//" ++ (packageFileName . contentKit $ kc) ++ "\n" ++ s) $ contentPrefix kc --- | Determine the contents for a Kit, assumes that we're in a projects 'Kits' folder.+-- | Determine the contents for a Kit, assumes that we're in a +-- folder containing exploded kits readKitContents :: KitSpec -> IO KitContents readKitContents spec  =   let kitDir = packageFileName spec-      find dir tpe = glob ((kitDir </> dir </> "**/*") ++ tpe)+      find dir tpe = do+        files <- glob ((kitDir </> dir </> "**/*") ++ tpe)+        mapM canonicalizePath files       findSrc = find $ specSourceDirectory spec       headers = findSrc ".h"       sources = join <$> mapM findSrc [".m", ".mm", ".c"]
Kit/Main.hs view
@@ -9,6 +9,7 @@   import Kit.Util   import System.Cmd   import System.Exit+  import Data.Tree (drawTree)    import System.Console.ANSI   @@ -31,6 +32,13 @@               liftKit $ generateKitProjectFromSpecs deps (specKitDepsXcodeFlags spec)               say Green "\n\tKit complete. You may need to restart Xcode for it to pick up any changes.\n" +  doShowTree :: Command ()+  doShowTree = do+    repo <- myRepository+    spec <- mySpec+    tree <- liftKit $ dependencyTree repo spec+    liftIO $ putStrLn $ drawTree $ fmap packageFileName $ tree+   doPackageKit :: Command ()   doPackageKit = mySpec >>= liftIO . package  @@ -85,6 +93,7 @@   handleArgs (KA.PublishLocal versionTag) = doPublishLocal versionTag    handleArgs (KA.Verify sdkName) = doVerify sdkName   handleArgs (KA.CreateSpec name version) = doCreateSpec name version+  handleArgs KA.ShowTree = doShowTree    kitMain :: IO ()   kitMain = let f = do
Kit/Project.hs view
@@ -2,7 +2,8 @@ module Kit.Project (   totalSpecDependencies,   unpackKit,-  generateKitProjectFromSpecs+  generateKitProjectFromSpecs,+  dependencyTree   )     where @@ -71,7 +72,8 @@ generateXcodeProject :: [KitSpec] -> Maybe String -> KitIO KitProject  generateXcodeProject specs depsOnlyConfig = do   liftIO $ inDirectory kitDir $ do-    kitsContents <- mapM readKitContents specs+    currentDir <- getCurrentDirectory+    kitsContents <- mapM (fmap (makeContentsRelative currentDir) . readKitContents) specs     let pf = createProjectFile kitsContents     let header = createHeader kitsContents     let config = createConfig kitsContents@@ -113,6 +115,9 @@ -- todo: check for version ranges :) totalSpecDependencies :: KitRepository -> KitSpec -> KitIO [KitSpec] totalSpecDependencies kr spec = refineDeps <$> unfoldTreeM (unfoldDeps kr) spec++dependencyTree :: KitRepository -> KitSpec -> KitIO (Tree KitSpec)+dependencyTree kr spec = unfoldTreeM (unfoldDeps kr) spec  unfoldDeps :: KitRepository -> KitSpec -> KitIO (KitSpec, [KitSpec]) unfoldDeps kr ks = (ks,) <$> mapM (readKitSpec kr) (specDependencies ks) -- s/mapM/traverse ?
Kit/Spec.hs view
@@ -80,8 +80,7 @@   instance ReadObject Kit where     readObject x = fromMapping x >>= \obj -> (Kit <$> obj #> "name" <*> obj #> "version") <|> case obj of                                                                                                     [(key, Scalar value)] -> Just $ Kit key value-                                                                                                    _ -> Nothing -+  -- TODO this + ReadObject should be identity   instance ShowObject KitSpec where     showObject spec = Mapping [          "name" ~> (val $ kitName . specKit),
Kit/Util.hs view
@@ -3,9 +3,9 @@ module Kit.Util(   module Kit.Util,   module Control.Applicative,-  module System.FilePath.Posix,+  module Control.Monad,   module System.Directory,-  module Control.Monad+  module System.FilePath.Posix   ) where   import System.Directory   import System.FilePath.Posix@@ -17,9 +17,9 @@    import Control.Applicative   import Control.Monad-  import "mtl" Control.Monad.Error+  import Control.Monad.Error -  import qualified "mtl" Control.Monad.State as S+  import qualified Control.Monad.State as S    popS :: S.State [a] a   popS = do
kit.cabal view
@@ -1,5 +1,5 @@ name:           kit-version:        0.6.7+version:        0.6.8 cabal-version:  >=1.2 build-type:     Simple license:        BSD3