Skip to content

Commit 3279870

Browse files
BalestraPatricktmspzz
authored andcommitted
Add Custom Script Engine (#185)
1 parent 012cb67 commit 3279870

20 files changed

+2133
-57
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ cabal.sandbox.config
1515
*.aux
1616
*.hp
1717
*.eventlog
18+
*.orig
1819
.DS_Store
1920
.stack-work/
2021
.vscode/

.travis.yml

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ jobs:
4646
- stack $ARGS install
4747
- travis_wait 60 bats integration-tests/dynamic-frameworks-ini.bats
4848
- travis_wait 60 bats integration-tests/dynamic-frameworks-yml.bats
49+
- travis_wait 60 bats integration-tests/dynamic-frameworks-engine-yml.bats
4950
- stage: "Build"
5051
name: "Build Rome & Test Current Frameworks"
5152
before_install:
@@ -80,8 +81,10 @@ jobs:
8081
- stack $ARGS build -j 2
8182
- stack $ARGS sdist
8283
- stack $ARGS install
83-
- travis_wait 60 bats integration-tests/current-framework-yaml.bats
84-
- travis_wait 60 bats integration-tests/current-framework-named-yaml.bats
84+
- travis_wait 60 bats integration-tests/current-framework-yml.bats
85+
- travis_wait 60 bats integration-tests/current-framework-engine-yml.bats
86+
- travis_wait 60 bats integration-tests/current-framework-named-yml.bats
87+
- travis_wait 60 bats integration-tests/current-framework-named-engine-yml.bats
8588
- stage: "Build"
8689
name: "Build Rome & Test Static Frameworks"
8790
before_install:
@@ -118,6 +121,7 @@ jobs:
118121
- stack $ARGS install
119122
- travis_wait 60 bats integration-tests/static-frameworks-ini.bats
120123
- travis_wait 60 bats integration-tests/static-frameworks-yml.bats
124+
- travis_wait 60 bats integration-tests/static-frameworks-engine-yml.bats
121125

122126
env:
123127
- ARGS="--resolver=lts-13.10"

README.md

+31-7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Rome is a tool that allows developers on Apple platforms to use:
99
- [Ceph](https://ceph.com/ceph-storage/object-storage/)
1010
- other S3 compatible object stores
1111
- or/and a local folder
12+
- [your own custom engine](#custom-engine)
1213

1314
as a shared cache for frameworks built with [Carthage](https://github.com/Carthage/Carthage).
1415

@@ -34,6 +35,7 @@ Trusted by:
3435
- [Setting up AWS credentials](#setting-up-aws-credentials)
3536
- [Selecting the AWS Region](#selecting-the-aws-region)
3637
- [Setting up endpoint override for Minio, Ceph, or other S3 compatible stores](#setting-up-endpoint-override)
38+
- [Custom Engine](#customengine)
3739
- [Romefile](#romefile)
3840
- [Cache](#cache)
3941
- [RepositoryMap](#repositorymap)
@@ -257,6 +259,25 @@ Default port for `http` endpoints is __9000__ if the port is left unspecified.
257259

258260
Alternatively the endpoint can also be specified by setting an `AWS_ENDPOINT` environment variable.
259261

262+
### Custom Engine
263+
You can write your own script that Rome will use as engine to execute upload/download/list commands. You start by specifying the path to a script or executable in your [Romefile](#romefile) as shown in the example [structure](#structure).
264+
Rome will invoke the specified script or executable with three commands and different parameters based on the action to perform:
265+
266+
- `./script.sh upload local-path remote-path`
267+
- `./script.sh download remote-path local-path`
268+
- `./script.sh list remote-path`
269+
270+
For example, if your [Romefile](#romefile) specifies `engine: script.sh`, Rome will execute the following command when uploading/downloading/listing a framework:
271+
```sh
272+
./script.sh upload Alamofire/iOS/Alamofire.framework-4.8.2.zip Alamofire/iOS/Alamofire.framework-4.8.2.zip
273+
./script.sh download Alamofire/iOS/Alamofire.framework-4.8.2.zip Alamofire/iOS/Alamofire.framework-4.8.2.zip
274+
./script.sh list Alamofire/iOS/Alamofire.framework-4.8.2.zip
275+
```
276+
277+
The script should take the given `remote-path`, carry out its logic to retrieve the artifact and place it at `local-path`. Please refer to the [cache structure](#cachestructure) definition for more information on the cache is constructed.
278+
279+
For an example of a custom engine, take a look at [engine.sh](https://github.com/blender/Rome/blob/master/integration-tests/engine.sh) which is used in the integration tests to simply copy artifacts in a different directory. Infinite uses cases are opened by using a custom engine, such as uploading artifacts to any non-compatible S3 storage system.
280+
260281
### Romefile
261282

262283
#### About the format
@@ -299,10 +320,11 @@ A Romefile looks like this:
299320

300321
```yaml
301322
cache: # required
302-
local: ~/Library/Caches/Rome # optional
303-
# at least one between `local` and `s3Bucket` is required
304-
s3Bucket: ios-dev-bucket # optional
305-
# at least one between `local` and `s3Bucket` is required
323+
# at least one of the following is required:
324+
local: ~/Library/Caches/Rome # optional and can be combined with either a `s3Bucket` or `engine`
325+
s3Bucket: ios-dev-bucket # optional and can be combined with `local`
326+
engine: script.sh # optional and can be combined with `local`
327+
306328
repositoryMap: # optional
307329
- better-dog-names: # entry that does not follow
308330
# the "Organization/FrameworkName" convention.
@@ -326,13 +348,16 @@ currentMap:
326348
The cache __must__ contain __at least one__ between:
327349
- the name of the S3 Bucket to upload/download to/from. The key `s3Bucket` is __optional__.
328350
- the path to local directory to use as an additional cache. The key `local` is __optional__.
351+
- the path to a custom engine to use as an additional cache. The key `engine` is __optional__.
329352

330353
```yaml
331354
cache: # required
332355
local: ~/Library/Caches/Rome # optional
333-
# at least one between `local` and `s3Bucket` is required
356+
# at least one between `local`, `s3bucket` and `engine` is required
334357
s3Bucket: ios-dev-bucket # optional
335-
# at least one between `local` and `s3Bucket` is required
358+
# at least one between `local`, `s3bucket` and `engine` is required
359+
engine: script.sh # optional
360+
# at least one between `local`, `s3bucket` and `engine` is required
336361
```
337362

338363
This is already a viable Romefile.
@@ -491,7 +516,6 @@ The above means that `t1` is only available for `iOS` and `Mac`.
491516
The `--platforms` command line options can be used to futher limit the Rome command to a
492517
specific subset of the supported platfroms.
493518

494-
495519
### Cache Structure
496520

497521
The following describes the structure of the cache that Rome creates and manages.

Rome.cabal

+3
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ library
3636
, Caches.Local.Downloading
3737
, Caches.Common
3838
, Network.AWS.Utils
39+
, Engine.Probing
40+
, Engine.Uploading
41+
, Engine.Downloading
3942

4043
build-depends: base >= 4.7 && < 5
4144
, amazonka >= 1.6.1

0 commit comments

Comments
 (0)