From 515a91c5ca9c40235976f6fd8b103ad5964c9a83 Mon Sep 17 00:00:00 2001 From: Matthew Cross Date: Mon, 19 Nov 2018 13:27:33 +0100 Subject: [PATCH] Update generator and run script usage. --- README.md | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 812482a8..30be9b22 100644 --- a/README.md +++ b/README.md @@ -86,10 +86,12 @@ echo "Mocks Input Directory = $INPUT_DIR" # After running once, locate `GeneratedMocks.swift` and drag it into your Xcode test target group. ``` -Input files can be also specified directly in `Run script` in `Input Files` form. To force run script to rebuild generator even if it already exists, use `--clean` as first argument. +Input files can be also specified directly in `Run script` in `Input Files` form. + +To download generator from GitHub instead of building it if it's not present, use the `--download [version]` option as the first argument (i.e. `run --download generate ...` or `run --download 0.12 generate ...` if you need a specific version). If you're having issues with rather long build time (especially in CI), this might be the way to fix it. Notes: All paths in the Run script must be absolute. Variable `PROJECT_DIR` automatically points to your project directory. -Also include paths to inherited Classes and Protocols for mocking/stubbing parent and grandparents. +Keep in mind to include paths to inherited Classes and Protocols for mocking/stubbing parent and grandparents. #### Carthage To use Cuckoo with [Carthage](https://github.com/Carthage/Carthage) add in your Cartfile this line: @@ -422,11 +424,11 @@ If a path to a Swift file is supplied, all mocks will be in a single file. Default value is `GeneratedMocks.swift`. -##### `--testable` (string) +##### `--testable` (string)[,(string)...] A comma separated list of frameworks that should be imported as @testable in the mock files. -##### `--exclude` (string) +##### `--exclude` (string)[,(string)...] A comma separated list of classes and protocols that should be skipped during mock generation. @@ -442,7 +444,7 @@ Do not generate timestamp. Do not mock/stub parents and grandparents. -##### `--file-prefix` +##### `--file-prefix` (string) Names of generated files in directory will start with this prefix. Only works when output path is directory. @@ -450,6 +452,18 @@ Names of generated files in directory will start with this prefix. Only works wh Do not generate mocks for classes. +##### `--regex` (string) + +A regular expression pattern that is used to match Classes and Protocols. All that do not match are excluded. Can be used alongside `--exclude` in which case the `--exclude` has higher priority. + +##### `-g` or `--glob` + +Activate [glob](https://en.wikipedia.org/wiki/Glob_(programming)) parsing for specified input paths. + +##### `-d` or `--debug` + +Run generator in debug mode. There is more info output as well as included in the generated mocks (e.g. method parameter info). + #### `version` command Prints the version of this generator. @@ -465,10 +479,10 @@ After the `help` you can write name of another command for displaying a command- Cuckoo is open for everyone and we'd like you to help us make the best Swift mocking library. For Cuckoo development, follow these steps: 1. Make sure you have Xcode 9.1 installed 2. Clone the **Cuckoo** repository -3. In Terminal, run: `make dev` from inside the **Cuckoo** directory. +3. In Terminal, run: `make dev` from inside the **Cuckoo** directory 4. Open `Cuckoo.xcodeproj` and peek around -The project is made of two parts - runtime and code generator. When you open the `Cuckoo.xcodeproj` in Xcode, you'll see these directories: +The project consists of two parts - runtime and code generator. When you open the `Cuckoo.xcodeproj` in Xcode, you'll see these directories: * `Source` - runtime sources * `Tests` - tests for the runtime part * `CuckoGenerator.xcodeproj` - project generated by `swift package generate-xcodeproj` for the Generator sources