Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom script engines for donwloading/uplaod/listing #148

Closed
wants to merge 12 commits into from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ cabal.sandbox.config
*.aux
*.hp
*.eventlog
*.orig
.DS_Store
.stack-work/
.vscode/
Expand Down
5 changes: 3 additions & 2 deletions Rome.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Rome
version: 0.20.0.56
version: 0.21.0.57
synopsis: A cache for Carthage
description: Please see README.md
homepage: https://github.com/blender/Rome
Expand All @@ -26,7 +26,6 @@ library
, Data.Carthage.Common
, Data.Carthage.VersionFile
, Data.Romefile
, Data.S3Config
, Text.Parsec.Utils
, Xcode.DWARF
, Caches.S3.Probing
Expand All @@ -36,11 +35,13 @@ library
, Caches.Local.Uploading
, Caches.Local.Downloading
, Caches.Common
, Network.AWS.Utils

build-depends: base >= 4.7 && < 5
, amazonka >= 1.6.1
, amazonka-core >= 1.6.1
, amazonka-s3 >= 1.6.1
, amazonka-sts >= 1.6.1
, exceptions >= 0.8
, lens >= 4.13
, parsec >= 3.1.10
Expand Down
2 changes: 1 addition & 1 deletion Rome.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'Rome'
s.version = '0.20.0.56'
s.version = '0.21.0.57'
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" }
Expand Down
2 changes: 1 addition & 1 deletion app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import System.Exit


romeVersion :: RomeVersion
romeVersion = (0, 20, 0, 56)
romeVersion = (0, 21, 0, 57)



Expand Down
8 changes: 6 additions & 2 deletions src/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,14 @@ getRomefileEntries absoluteRomefilePath =
in withExceptT toErr $ fromYaml <|> fromIni
where toErr e = "Error while parsing " <> absoluteRomefilePath <> ": " <> e

getS3ConfigFile :: MonadIO m => m FilePath
getS3ConfigFile = (</> awsConfigFilePath) `liftM` liftIO getHomeDirectory
getAWSConfigFilePath :: MonadIO m => m FilePath
getAWSConfigFilePath = (</> awsConfigFilePath) `liftM` liftIO getHomeDirectory
where awsConfigFilePath = ".aws/config"

getAWSCredentialsFilePath:: MonadIO m => m FilePath
getAWSCredentialsFilePath = (</> awsCredentialsFilePath) `liftM` liftIO getHomeDirectory
where awsCredentialsFilePath = ".aws/credentials"

carthageBuildDirectory :: FilePath
carthageBuildDirectory = "Carthage" </> "Build"

Expand Down
15 changes: 12 additions & 3 deletions src/Data/Romefile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module Data.Romefile
, cacheInfo
, bucket
, localCacheDir
, enginePath
, frameworkName
, frameworkType
, FrameworkType (..)
Expand Down Expand Up @@ -174,26 +175,33 @@ cacheInfo :: Lens' Romefile RomeCacheInfo
cacheInfo = lens _cacheInfo (\parseResult n -> parseResult { _cacheInfo = n })

data RomeCacheInfo = RomeCacheInfo { _bucket :: Maybe T.Text
, _localCacheDir :: Maybe FilePath -- relative path
, _localCacheDir :: Maybe FilePath -- relative or absolue path
, _enginePath :: Maybe FilePath -- relative or absolue path
}
deriving (Eq, Show, Generic)

instance FromJSON RomeCacheInfo where
parseJSON = withObject "RomeCacheInfo" $ \v -> RomeCacheInfo
<$> v .:? "s3Bucket"
<*> v .:? "local"
<*> v .:? "engine"

instance ToJSON RomeCacheInfo where
toJSON (RomeCacheInfo b l) = object fields
toJSON (RomeCacheInfo b l e) = object fields
where
fields = [T.pack "s3Bucket" .= b | isJust b] ++ [T.pack "local" .= l | isJust l]
fields = [T.pack "s3Bucket" .= b | isJust b]
++ [T.pack "local" .= l | isJust l]
++ [T.pack "engine" .= e| isJust e]

bucket :: Lens' RomeCacheInfo (Maybe T.Text)
bucket = lens _bucket (\cInfo n -> cInfo { _bucket = n })

localCacheDir :: Lens' RomeCacheInfo (Maybe FilePath)
localCacheDir = lens _localCacheDir (\cInfo n -> cInfo { _localCacheDir = n })

enginePath :: Lens' RomeCacheInfo (Maybe FilePath)
enginePath = lens _enginePath (\cInfo n -> cInfo { _enginePath = n })

-- |The canonical name of the Romefile
canonicalRomefileName :: String
canonicalRomefileName = "Romefile"
Expand Down Expand Up @@ -226,6 +234,7 @@ toRomefile :: INI.Ini -> Either T.Text Romefile
toRomefile ini = do
_bucket <- getBucket ini
_localCacheDir <- getLocalCacheDir ini
let _engine = Nothing -- Engines are not supported in INI
let _repositoryMapEntries = getRepositoryMapEntries ini
_ignoreMapEntries = getIgnoreMapEntries ini
_cacheInfo = RomeCacheInfo {..}
Expand Down
45 changes: 0 additions & 45 deletions src/Data/S3Config.hs

This file was deleted.

Loading