hpack 0.2.0 → 0.3.0
raw patch · 4 files changed
+11/−10 lines, 4 files
Files
- driver/Main.hs +4/−4
- hpack.cabal +2/−2
- src/Run.hs +4/−3
- test/ConfigSpec.hs +1/−1
driver/Main.hs view
@@ -13,8 +13,8 @@ import Paths_hpack (version) import Run -header :: String -> String-header configFile = unlines [+header :: String+header = unlines [ "-- This file has been generated from " ++ configFile ++ " by hpack version " ++ showVersion version ++ "." , "--" , "-- see: https://github.com/sol/hpack"@@ -23,10 +23,10 @@ main :: IO () main = do- (configFile, warnings, name, new) <- run+ (warnings, name, new) <- run forM_ warnings $ \warning -> hPutStrLn stderr ("WARNING: " ++ warning) old <- force . either (const Nothing) (Just . stripHeader) <$> tryJust (guard . isDoesNotExistError) (readFile name)- unless (old == Just (lines new)) (writeFile name $ header configFile ++ new)+ unless (old == Just (lines new)) (writeFile name $ header ++ new) where stripHeader :: String -> [String] stripHeader = dropWhile null . dropWhile ("--" `isPrefixOf`) . lines
hpack.cabal view
@@ -1,9 +1,9 @@--- This file has been generated from package.yml by hpack version 0.2.0.+-- This file has been generated from package.yaml by hpack version 0.3.0. -- -- see: https://github.com/sol/hpack name: hpack-version: 0.2.0+version: 0.3.0 synopsis: An alternative format for Haskell packages homepage: https://github.com/sol/hpack#readme bug-reports: https://github.com/sol/hpack/issues
src/Run.hs view
@@ -1,6 +1,7 @@ {-# LANGUAGE QuasiQuotes, RecordWildCards #-} module Run ( run+, configFile -- exported for testing , renderPackage ) where@@ -15,9 +16,9 @@ import Config configFile :: FilePath-configFile = "package.yml"+configFile = "package.yaml" -run :: IO (FilePath, [String], FilePath, String)+run :: IO ([String], FilePath, String) run = do mPackage <- readPackageConfig configFile case mPackage of@@ -28,7 +29,7 @@ let alignment = fromMaybe 16 (old >>= sniffAlignment) output = renderPackage alignment (maybe [] extractFieldOrderHint old) package- return (configFile, warnings, cabalFile, output)+ return (warnings, cabalFile, output) Left err -> die err renderPackage :: Int -> [String] -> Package -> String
test/ConfigSpec.hs view
@@ -441,7 +441,7 @@ Right (_, c) <- readPackageConfig "package.yml" c `shouldBe` package {packageTests = [(executable "spec" "test/Spec.hs") {executableDependencies = [["hspec", "QuickCheck"]]}]} - context "when both top-level and section specific dependencies are specified" $ do+ context "when both global and section specific dependencies are specified" $ do it "combines dependencies" $ do writeFile "package.yml" [i| dependencies: