Navigation Menu

Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tmspzz committed Aug 8, 2016
0 parents commit 6a60290
Show file tree
Hide file tree
Showing 9 changed files with 598 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .gitignore
@@ -0,0 +1,19 @@
dist
dist-*
cabal-dev
*.o
*.hi
*.chi
*.chs.h
*.dyn_o
*.dyn_hi
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
*.prof
*.aux
*.hp
*.eventlog
.stack-work/
cabal.project.local
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2016 Tommaso Piazza

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
115 changes: 115 additions & 0 deletions README.md
@@ -0,0 +1,115 @@
# Rome

Rome is a tool that allows developer on Apple platforms to use Amazon's S3 as a
cache for frameworks build with [Carthage](https://github.com/Carthage/Carthage).

## The problem

Suppose you're working on some frameworks for you iOS project and want to share
your frameworks with your team. A great way to do so is to use Carthage and have
team members point the `Cartfile` to the new framework version (or branch, tag, commit)
and run `carthage update`.

Unfortunately this will require them to build from scratch the new framework.
This is particularly annoying if the dependency tree for that framework is big
and / or takes a long time to build.

## The solution

Use a cache. The first team member can build the framework and share it while all
other developers can get it from the cache with no waiting time.

## Workflow

The Rome's workflow changes depending if you are the producer (i.e. the first
person in your team to build the framework) or the consumer.

### Producer workflow

```
$ vi Cartfile #point to the new version of the framework
$ carthage update && rome upload
```

### Consumer workflow

```
$ vi Cartfile
$ carthage update --no-build && rome download
```

or

```
$ vi Cartfile.resolved #point to the new version of the framework
$ rome download
```
## Set up and Usage

- First you need a `.aws-keys` file in your home folder. This is used to specify
your AWS Credentials
- Second you need a `Romefile` in the project where you want to use Rome. At the
same level where the `Cartfile` is.

### Setting up AWS credentials
In your home folder create a `.aws-keys` that contains the following line
```
default AWS_IDENTITY AWS_PRIVATE_KEY
```

this should look something like

```
default AGIAJQARMD67CE3DTKHA TedRV2/dFkBr1H3D7xuPsF9+CBHTjK0NKrJuoVs8
```

these will be the credentials that Rome will use to access S3 on your behalf

### Romefile

The Romefile has tow purposes:
1. Specifies what S3 bucket to use - [S3Bucket] section. This section is __required__.
1. Allows to use custom name mappings between repository names and framework names - [RepositoryMap] section. This section is __optional__ and can be omitted.

A Romefile looks like this

```
[S3Bucket]
ios-dev-bucket
[RepositoryMap]
awesome-framework-for-cat-names CatFramework
better-dog-names DogFramework
```

#### S3Bucket section
This section contains the name of the S3 bucket you want Rome to use to upload/download.

#### RepositoryMap
This contains the mappings of git repository names with framework names.
This is particularly useful inn case you are not using github and the "Organization/FrameworkName" convention.

Example:

Suppose you have the following in your `Cartfile`

```
git "http://stash.myAimalStartup.com/scm/iossdk/awesome-framework-for-cat-names.git" ~> 3.3.1
git "http://stash.myAimalStartup.com/scm/iossdk/better-dog-name.git" ~> 0.4.4
```

but your framework names are actually `CatFramework` and `DogFramework` as opposed to `awesome-framework-for-cat-names` and `better-dog-names`.

simply add a `[RepositoryMap]` section to your `Romefile` and specify the following mapping:

```
[S3Bucket]
ios-dev-bucket
[RepositoryMap]
awesome-framework-for-cat-names CatFramework
better-dog-names DogFramework
```

## Get Rome
The Rome binary is attached as a zip to the releases here on GitHub.
62 changes: 62 additions & 0 deletions Rome.cabal
@@ -0,0 +1,62 @@
name: Rome
version: 0.1.0.0
synopsis: An S3 cache for Carthage
description: Please see README.md
homepage: https://github.com/blender/Rome#readme
license: BSD3
license-file: LICENSE
author: Tommaso Piazza
maintainer: tommaso.piazza@gmail.com
copyright: 2016 Tommaso Piazza
category: Web
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10

library
hs-source-dirs: src
exposed-modules: Lib
build-depends: base >= 4.7 && < 5
, aws >= 0.13
, parsec >= 3.1.10
, mtl >= 2.2.1
, directory >= 1.2.2
, containers >= 0.5
, conduit >= 1.2
, conduit-extra >= 1.1
, http-conduit >= 2.1
, text >= 1.2
, bytestring >= 0.10
, zip-archive >= 0.2
, resourcet >= 1.1
, optparse-applicative >= 0.12



default-language: Haskell2010

executable rome
hs-source-dirs: app
main-is: Main.hs
ghc-options: -threaded -rtsopts -with-rtsopts=-N
build-depends: base >= 4.7 && < 5
, Rome
, mtl >= 2.2.1
, optparse-applicative >= 0.12



default-language: Haskell2010

test-suite Rome-test
type: exitcode-stdio-1.0
hs-source-dirs: test
main-is: Spec.hs
build-depends: base
, Rome
ghc-options: -threaded -rtsopts -with-rtsopts=-N
default-language: Haskell2010

source-repository head
type: git
location: https://github.com/blender/Rome
2 changes: 2 additions & 0 deletions Setup.hs
@@ -0,0 +1,2 @@
import Distribution.Simple
main = defaultMain
26 changes: 26 additions & 0 deletions app/Main.hs
@@ -0,0 +1,26 @@
module Main where

import Control.Monad.Except
import Options.Applicative as Opts
import Lib



romeVersion :: String
romeVersion = "0.1.0.0"



-- Main
main :: IO ()
main = do
let opts = info (Opts.helper <*> Opts.flag' Nothing (Opts.long "version" <> Opts.help "Prints the version information" <> Opts.hidden ) <|> Just <$> parseRomeOptions) (header "S3 cache tool for Carthage" )
cmd <- execParser opts
(cfg, s3cfg) <- getS3Configuration
case cmd of
Nothing -> putStrLn $ romeVersion ++ " - Romam uno die non fuisse conditam."
Just romeOptions -> do
l <- runExceptT $ donwloadORUpload cfg s3cfg romeOptions
case l of
Right _ -> return ()
Left e -> putStrLn e

0 comments on commit 6a60290

Please sign in to comment.