diff --git a/.travis.yml b/.travis.yml index 2a89c68..231d92e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -40,9 +40,9 @@ jobs: - brew install bats-core script: - bundle exec danger - - stack $ARGS setup + - stack $ARGS setup -j 2 - stack $ARGS test --no-terminal --haddock --no-haddock-deps - - stack $ARGS build + - stack $ARGS build -j 2 - stack $ARGS sdist - stack $ARGS install - travis_wait 60 bats integration-tests/dynamic-frameworks-ini.bats @@ -77,9 +77,9 @@ jobs: - brew install bats-core script: - bundle exec danger - - stack $ARGS setup + - stack $ARGS setup -j 2 - stack $ARGS test --no-terminal --haddock --no-haddock-deps - - stack $ARGS build + - stack $ARGS build -j 2 - stack $ARGS sdist - stack $ARGS install - travis_wait 60 bats integration-tests/current-framework-yaml.bats @@ -114,9 +114,9 @@ jobs: - brew install bats-core script: - bundle exec danger - - stack $ARGS setup + - stack $ARGS setup -j 2 - stack $ARGS test --no-terminal --haddock --no-haddock-deps - - stack $ARGS build + - stack $ARGS build -j 2 - stack $ARGS sdist - stack $ARGS install - travis_wait 60 bats integration-tests/static-frameworks-ini.bats @@ -126,4 +126,5 @@ cache: directories: - $HOME/.local/bin - $HOME/.stack + - $TRAVIS_BUILD_DIR/.stack-work - vendor/bundle diff --git a/Rome.cabal b/Rome.cabal index 9faf80a..df615e0 100644 --- a/Rome.cabal +++ b/Rome.cabal @@ -1,5 +1,5 @@ name: Rome -version: 0.18.1.53 +version: 0.18.2.54 synopsis: A cache for Carthage description: Please see README.md homepage: https://github.com/blender/Rome diff --git a/Rome.podspec b/Rome.podspec index 64341f2..d9a9fc1 100644 --- a/Rome.podspec +++ b/Rome.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'Rome' - s.version = '0.18.1.53' + s.version = '0.18.2.54' s.summary = 'A cache tool for Carthage' s.homepage = 'https://github.com/blender/Rome' s.source = { :http => "#{s.homepage}/releases/download/v#{s.version}/rome.zip" } diff --git a/app/Main.hs b/app/Main.hs index e284830..b2195c7 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -10,7 +10,7 @@ import System.Exit romeVersion :: RomeVersion -romeVersion = (0, 18, 1, 53) +romeVersion = (0, 18, 2, 54) diff --git a/src/Configuration.hs b/src/Configuration.hs index 0d190ec..fb109d5 100644 --- a/src/Configuration.hs +++ b/src/Configuration.hs @@ -13,6 +13,7 @@ import qualified Data.Text.IO as T import System.Directory import System.FilePath import Types +import Debug.Trace getCartfileEntires :: RomeMonad [CartfileEntry] diff --git a/src/Data/Carthage/Cartfile.hs b/src/Data/Carthage/Cartfile.hs index 01c7fab..5da5c58 100644 --- a/src/Data/Carthage/Cartfile.hs +++ b/src/Data/Carthage/Cartfile.hs @@ -17,6 +17,7 @@ import qualified Text.Parsec as Parsec import qualified Text.Parsec.String as Parsec import qualified Text.Parsec.Utils as Parsec import Data.Carthage.Common +import Debug.Trace newtype Location = Location { unLocation :: String } deriving (Eq, Show, Ord) @@ -55,20 +56,45 @@ quotedContent :: Parsec.Parsec String () String quotedContent = Parsec.char '"' *> Parsec.parseUnquotedString <* Parsec.char '"' -parseCartfileResolvedLine :: Parsec.Parsec String () CartfileEntry -parseCartfileResolvedLine = do +parseCartfileEntry :: Parsec.Parsec String () CartfileEntry +parseCartfileEntry = do hosting <- repoHosting location <- Location <$> quotedContent _ <- Parsec.many1 Parsec.space version <- Version <$> quotedContent return CartfileEntry {..} -parseMaybeCartfileEntry :: Parsec.Parsec String () (Maybe CartfileEntry) -parseMaybeCartfileEntry = - Parsec.optional Parsec.spaces - *> (parseCartfileResolvedLine `Parsec.onceAndConsumeTill` Parsec.endOfLine) - parseCartfileResolved :: MonadIO m => String -> m (Either Parsec.ParseError [CartfileEntry]) parseCartfileResolved = liftIO . Parsec.parseFromFile - (catMaybes <$> Parsec.many (Parsec.try parseMaybeCartfileEntry)) + ( catMaybes + <$> ( (Parsec.many $ do + line <- + Parsec.optional Parsec.endOfLine + *> ( Parsec.try parseEmtpyLine + <|> Parsec.try parseDependency + <|> Parsec.try parseComment + ) + <* Parsec.optional Parsec.endOfLine + case line of + Dependency entry -> + return $ Just entry + _ -> return Nothing + ) + <* Parsec.eof + ) + ) + +data CartfileLine = EmptyLine | Comment | Dependency { entry :: CartfileEntry } deriving (Eq, Show) + +parseDependency :: Parsec.Parsec String () CartfileLine +parseDependency = Dependency <$> parseCartfileEntry + +parseComment :: Parsec.Parsec String () CartfileLine +parseComment = + Parsec.char '#' + >> Parsec.manyTill Parsec.anyChar (Parsec.lookAhead Parsec.endOfLine) + >> return Comment + +parseEmtpyLine :: Parsec.Parsec String () CartfileLine +parseEmtpyLine = Parsec.many1 Parsec.space >> return EmptyLine diff --git a/src/Text/Parsec/Utils.hs b/src/Text/Parsec/Utils.hs index 9d232f4..6573294 100644 --- a/src/Text/Parsec/Utils.hs +++ b/src/Text/Parsec/Utils.hs @@ -3,7 +3,6 @@ module Text.Parsec.Utils ( parseWhiteSpaces , parseUnquotedString - , onceAndConsumeTill ) where @@ -21,15 +20,3 @@ parseWhiteSpaces = parseUnquotedString :: Parsec.Parsec String () String parseUnquotedString = Parsec.many1 (Parsec.noneOf ['"', ' ', '\t', '\n', '\'', '\\', '\r']) - - --- | @onceOrConsumeTill p@ end@ tries to apply the parser @p@ /once/ and consumes --- | the input until @end@. Returns a `Maybe` of the value of @p@. --- | Thanks to Tobias Mayer, Berlin Haskell Group. -onceAndConsumeTill - :: (Parsec.Stream s Identity Char) - => Parsec.Parsec s u a - -> Parsec.Parsec s u b - -> Parsec.Parsec s u (Maybe a) -onceAndConsumeTill p end = Parsec.optionMaybe (Parsec.try p) <* consume - where consume = Parsec.try end <|> Parsec.anyChar *> consume