packages feed

kit 0.7.6 → 0.7.7

raw patch · 9 files changed

+57/−32 lines, 9 filesdep ~cmdargs

Dependency ranges changed: cmdargs

Files

Kit/CmdArgs.hs view
@@ -4,10 +4,11 @@   import System.Console.CmdArgs as CA    appVersion :: String-  appVersion = "0.7.5" -- TODO how to keep this up to date with kit.cabal?+  appVersion = "0.7.7" -- TODO how to keep this up to date with kit.cabal?    data KitCmdArgs = Update                   | Package+                  | Info                   | PublishLocal { tag :: Maybe String }                    | Verify { sdk :: String }                   | CreateSpec { name :: String, version :: String } @@ -22,6 +23,7 @@                             explicit &=                             CA.name "create-spec" &=                             help "Write out a KitSpec file using the given name and version."+      , Info &= help "Show name and version of this kit"       , Package &=                     help "Create a tar.gz wrapping this kit"       , PublishLocal { tag = Nothing } &= explicit &= CA.name "publish-local" &=
Kit/Commands.hs view
@@ -1,6 +1,6 @@ {-# LANGUAGE GeneralizedNewtypeDeriving #-} module Kit.Commands (-  Command,+  Command(),   liftKit,   mySpec,   myWorkingCopy,@@ -19,7 +19,9 @@ import Control.Monad.Error import Control.Monad.Reader -newtype Command a = Command { unCommand :: (ReaderT (WorkingCopy, KitRepository) (ErrorT String IO) a) } deriving (Monad, MonadIO, Functor, Applicative)+newtype Command a = Command { +  unCommand :: (ReaderT (WorkingCopy, KitRepository) (ErrorT String IO) a) +} deriving (Monad, MonadIO, Functor, Applicative)  liftKit :: KitIO a -> Command a liftKit = Command . ReaderT . const
Kit/Dependency.hs view
@@ -40,18 +40,27 @@ totalSpecDependencies repo workingCopy = refineDeps <$> dependencyTree repo workingCopy  dependencyTree :: KitRepository -> WorkingCopy -> KitIO (Tree Dependency)-dependencyTree repo workingCopy = unfoldTreeM (unfoldDeps repo workingCopy) (workingKitSpec workingCopy)+dependencyTree repo workingCopy = unfoldTreeM (unfoldDeps repo devPackages) baseSpec+  where devPackages = workingDevPackages workingCopy+        baseSpec = workingKitSpec workingCopy -lookupDependency :: [(KitSpec, FilePath)] -> KitSpec -> Dependency+lookupDependency :: DevPackages -> KitSpec -> Dependency lookupDependency devPackages ks = maybe (Dependency ks Repo) (\(ks',fp) -> Dependency ks' (Dev fp)) thisDev-    where thisDev = find ((packageName ks ==) . packageName . fst) devPackages+    where thisDev = findDevPackage devPackages ks -findKitSpec :: [(KitSpec, FilePath)] -> Kit -> Maybe KitSpec-findKitSpec devPackages kit = fmap fst $ find (\(spec, _) -> packageName spec == packageName kit) devPackages+findKitSpec :: DevPackages -> Kit -> Maybe KitSpec+findKitSpec devPackages kit = fmap fst $ findDevPackage devPackages kit -unfoldDeps :: KitRepository -> WorkingCopy -> KitSpec -> KitIO (Dependency, [KitSpec])-unfoldDeps kr wc ks = let devPackages = workingDevPackages wc-                          theDep = lookupDependency devPackages ks-                          readKitSpec' kit = maybe (readKitSpec kr kit) return (findKitSpec devPackages kit)-                       in (theDep,) <$> mapM readKitSpec' (specDependencies $ depSpec theDep) +class KitSpecContainer a where+  lookupKit :: a -> Kit -> KitIO KitSpec++instance KitSpecContainer KitRepository where lookupKit = readKitSpec+instance KitSpecContainer DevPackages where lookupKit dp = maybeToKitIO "Not a dev package" . findKitSpec dp++unfoldDeps :: KitRepository -> DevPackages -> KitSpec -> KitIO (Dependency, [KitSpec])+unfoldDeps kr devPackages spec = let rootDep = lookupDependency devPackages spec+                                     lookup' kit = lookupKit devPackages kit <|> lookupKit kr kit+                                  in do+                                      children <- mapM lookup' . specDependencies . depSpec $ rootDep+                                      return (rootDep, children) 
Kit/Main.hs view
@@ -65,6 +65,11 @@       publishLocally repo updatedSpec specFile $ "dist" </> packageFileName updatedSpec ++ ".tar.gz"     return () +  doInfo :: Command()+  doInfo = do+      spec <- mySpec+      puts $ packageFileName spec+         doVerify :: String -> Command ()   doVerify sdk = do         spec <- mySpec@@ -93,6 +98,7 @@   handleArgs :: KA.KitCmdArgs -> Command ()   handleArgs KA.Update = doUpdate   handleArgs KA.Package = doPackageKit+  handleArgs KA.Info = doInfo   handleArgs (KA.PublishLocal versionTag) = doPublishLocal versionTag    handleArgs (KA.Verify sdkName) = doVerify sdkName   handleArgs (KA.CreateSpec name version) = doCreateSpec name version
Kit/Repository.hs view
@@ -9,7 +9,10 @@     readKitSpec,     unpackKit,     packagesDirectory,-    publishLocally+    publishLocally,++    -- Exposed for resolve, split this stuff out into a separate module+    kitPackagePath   ) where    import Kit.Spec@@ -44,10 +47,10 @@   readKitSpec :: KitRepository -> Kit -> KitIO KitSpec   readKitSpec repo kit = do     mbKitStuff <- liftIO $ readIfExists (localCacheDir repo </> kitSpecPath kit)-    maybe (throwError $ "Missing " ++ packageFileName kit) f mbKitStuff-    where f contents = maybeToKitIO ("Invalid KitSpec file for " ++ packageFileName kit) $ decodeSpec contents+    contents <- maybeToKitIO ("Missing " ++ packageFileName kit) mbKitStuff+    maybeToKitIO ("Invalid KitSpec file for " ++ packageFileName kit) $ decodeSpec contents -  readIfExists :: String -> IO (Maybe BS.ByteString) +  readIfExists :: String -> IO (Maybe BS.ByteString)   readIfExists file = do     exists <- doesFileExist file     T.sequenceA $ ifTrue exists $ BS.readFile file
Kit/Util/FSAction.hs view
@@ -17,8 +17,10 @@  runAction :: FSAction -> IO () runAction (FileCreate atPath contents) = do-  mkdirP $ dropFileName atPath -  writeFile atPath contents+    mkdirP $ dropFileName atPath +    writeFile tempPath contents+    renameFile tempPath atPath+  where tempPath = atPath ++ "_" runAction (Symlink target name) = do   catch (removeLink name) (\_ -> return ())   -- When a `name` has parent directories, symbolic link target needs to be made relative to that file
Kit/WorkingCopy.hs view
@@ -2,12 +2,14 @@ module Kit.WorkingCopy (     WorkingCopy(..),     currentWorkingCopy,-    isDevPackage,+    DevPackages,+    findDevPackage,     devKitDir     ) where  import Kit.Util import Kit.Spec+import qualified Data.List as L  import "mtl" Control.Monad.Trans import "mtl" Control.Monad.Error@@ -19,9 +21,14 @@ data WorkingCopy = WorkingCopy {   workingKitSpec :: KitSpec,   workingSpecFile :: FilePath,-  workingDevPackages :: [(KitSpec, FilePath)]+  workingDevPackages :: DevPackages } deriving (Eq, Show) +newtype DevPackages = DevPackages [(KitSpec, FilePath)] deriving (Eq, Show)++findDevPackage :: Packageable a => DevPackages -> a -> Maybe (KitSpec, FilePath)+findDevPackage (DevPackages pkgs) kit = L.find ((packageName kit ==) . packageName . fst) pkgs+ currentWorkingCopy :: KitIO WorkingCopy currentWorkingCopy = do   let specFile = "KitSpec"@@ -29,10 +36,7 @@   devKitSpecFiles <- liftIO $ glob $ devKitDir </> "*/KitSpec"   let f path = (,takeFileName . takeDirectory $ path) <$> readSpec path   devKitSpecs <- mapM f devKitSpecFiles-  return $ WorkingCopy spec specFile devKitSpecs--isDevPackage :: WorkingCopy -> KitSpec -> Bool-isDevPackage wc spec = any (\s -> packageName spec == packageName s) $ map fst (workingDevPackages wc)+  return $ WorkingCopy spec specFile $ DevPackages devKitSpecs  readSpec :: FilePath -> KitIO KitSpec readSpec path = checkExists path >>= liftIO . BS.readFile >>= ErrorT . return . parses
Kit/Xcode/ProjectFileTemplate.hs view
@@ -10,7 +10,7 @@ projectFile objects rootId = PListFile "!$*UTF8*$!" $ obj [       "archiveVersion" ~> val "1",       "classes" ~> obj [],-      "objectVersion" ~> val "45",+      "objectVersion" ~> val "46",       "objects" ~> obj objects,        "rootObject" ~> val rootId    ]@@ -56,7 +56,7 @@           ]) : kitUpdateTarget ++ ["0867D690FE84028FC02AAC07" ~> obj [             "isa" ~> val "PBXProject",             "buildConfigurationList" ~> val "1DEB922208733DC00010E9CD",-            "compatibilityVersion" ~> val "Xcode 3.1",+            "compatibilityVersion" ~> val "Xcode 3.2",             "hasScannedForEncodings" ~> val "1",             "mainGroup" ~> val mainGroupUUID ,             "productRefGroup" ~> val groupProductsUUID,@@ -75,7 +75,6 @@               "COPY_PHASE_STRIP" ~> val "NO",               "DSTROOT" ~> val "/tmp/KitDeps.dst",               "GCC_DYNAMIC_NO_PIC" ~> val "NO",-              "GCC_ENABLE_FIX_AND_CONTINUE" ~> val "YES",               "GCC_MODEL_TUNING" ~> val "G5",               "GCC_OPTIMIZATION_LEVEL" ~> val "0",               "GCC_PRECOMPILE_PREFIX_HEADER" ~> val "YES",@@ -111,7 +110,6 @@               "GCC_WARN_ABOUT_RETURN_TYPE" ~> val "YES",               "GCC_WARN_UNUSED_VARIABLE" ~> val "YES",               "OTHER_LDFLAGS" ~> val "-ObjC",-              "PREBINDING" ~> val "NO",               "SDKROOT" ~> val "iphoneos",               libSearch             ],@@ -126,7 +124,6 @@               "GCC_WARN_ABOUT_RETURN_TYPE" ~> val "YES",               "GCC_WARN_UNUSED_VARIABLE" ~> val "YES",               "OTHER_LDFLAGS" ~> val "-ObjC",-              "PREBINDING" ~> val "NO",               "SDKROOT" ~> val "iphoneos",               libSearch             ],
kit.cabal view
@@ -1,5 +1,5 @@ name:           kit-version:        0.7.6+version:        0.7.7 cabal-version:  >=1.6 build-type:     Simple license:        BSD3@@ -15,7 +15,7 @@   main-is:        Main.hs   buildable:      True   build-depends:  process -any, network -any, mtl >= 2.0 && < 3, -                  filepath -any, directory -any, containers -any, cmdargs >=0.3,+                  filepath -any, directory -any, containers -any, cmdargs >= 0.6.2,                   bytestring -any, base >=3 && <5,                   HTTP >=4000.0.9, Glob >= 0.5.1 && < 6, data-object -any, data-object-yaml -any,                   unix >= 2.4 && < 2.5, ansi-terminal >= 0.5.5