|
1 | 1 | # Cuckoo generator
|
2 |
| -## Generator of Mocks for [Cuckoo](https://github.com/SwiftKit/Cuckoo). |
| 2 | +Generator of Mocks for [Cuckoo](https://github.com/SwiftKit/Cuckoo). |
3 | 3 |
|
4 |
| -[](https://travis-ci.org/SwiftKit/CuckooGenerator) |
5 |
| -[ |
6 |
| -[](http://swiftkit.tmspark.com) |
7 |
| - |
8 |
| - |
9 |
| -## Introduction |
10 |
| - |
11 |
| -Cuckoo generator is a second part to [Cuckoo](https://github.com/SwiftKit/Cuckoo) (Swift mocking framework). |
12 |
| - |
13 |
| -To have a chat, [join our Slack team](http://swiftkit.tmspark.com)! |
14 |
| - |
15 |
| -## How does it work |
16 |
| - |
17 |
| -We take the source file, parse it and according to them generate mocks. They work based on inheritance and protocol adoption. This means that only overridable things can be mocked. We currently support all features which fulfill this rule except for things listed in TODO. Due to the complexity of Swift it is not easy to check for all edge cases so if you find some unexpected behavior please report it in issues. |
18 |
| - |
19 |
| -## TODO |
20 |
| - |
21 |
| -We are still missing support for some important features like: |
22 |
| -* static properties |
23 |
| -* static methods |
24 |
| -* generics |
25 |
| - |
26 |
| -We are planning to fix this as soon as possible. |
27 |
| - |
28 |
| -## What will not be supported |
29 |
| - |
30 |
| -Due to the limitations mentioned above, basically all things which don't allow overriding cannot be supported. This includes: |
31 |
| -* `struct` - workaround is to use a common protocol |
32 |
| -* everything with `final` or `private` modifier |
33 |
| -* global constants and functions |
34 |
| - |
35 |
| -## Installation |
36 |
| - |
37 |
| -For normal use you can skip this because [run script](https://github.com/SwiftKit/Cuckoo/blob/master/run) in [Cuckoo](https://github.com/SwiftKit/Cuckoo) downloads and builds correct version of the generator automatically. |
38 |
| - |
39 |
| -### Homebrew |
40 |
| - |
41 |
| -Simply run `brew install cuckoo` and you are ready to go. |
42 |
| - |
43 |
| -### Custom |
44 |
| - |
45 |
| -This is more complicated path. You need to clone this repository and build it yourself. You can look in the [run script](https://github.com/SwiftKit/Cuckoo/blob/master/run) for more inspiration. |
46 |
| - |
47 |
| -## Usage |
48 |
| - |
49 |
| -Generator can be called through a terminal. Each call consists of command, options and arguments. Options and arguments depends on used command. Options can have additional parameters. Names of all of them are case sensitive. The order goes like this: |
50 |
| - |
51 |
| -```Bash |
52 |
| -cuckoo command options arguments |
53 |
| -``` |
54 |
| - |
55 |
| -### `generate` command |
56 |
| - |
57 |
| -Generates mock files. |
58 |
| - |
59 |
| -This command accepts arguments, in this case list (separated by spaces) of files for which you want to generate mocks. Also more options can be used to adjust behavior, these are listed below. |
60 |
| - |
61 |
| -#### `--output` (string) |
62 |
| - |
63 |
| -Where to put the generated mocks. |
64 |
| - |
65 |
| -If a path to a directory is supplied, each input file will have a respective output file with mocks. |
66 |
| - |
67 |
| -If a path to a Swift file is supplied, all mocks will be in a single file. |
68 |
| - |
69 |
| -Default value is `GeneratedMocks.swift`. |
70 |
| - |
71 |
| -#### `--testable` (string) |
72 |
| - |
73 |
| -A comma separated list of frameworks that should be imported as @testable in the mock files. |
74 |
| - |
75 |
| -#### `--no-header` |
76 |
| - |
77 |
| -Do not generate file headers. |
78 |
| - |
79 |
| -#### `--no-timestamp` |
80 |
| - |
81 |
| -Do not generate timestamp. |
82 |
| - |
83 |
| -### `version` command |
84 |
| - |
85 |
| -Prints the version of this generator. |
86 |
| - |
87 |
| -### `help` command |
88 |
| - |
89 |
| -Display general or command-specific help. |
90 |
| - |
91 |
| -After the `help` you can write name of another command for displaying a command-specific help. |
92 |
| - |
93 |
| -## Author |
94 |
| - |
95 |
| -Tadeas Kriz, tadeas@brightify.org |
96 |
| - |
97 |
| -## License |
98 |
| - |
99 |
| -CuckooGenerator is available under the [MIT License](LICENSE). |
100 |
| - |
101 |
| -## Used libraries |
102 |
| - |
103 |
| -* [Commandant](https://github.com/Carthage/Commandant) |
104 |
| -* [Result](https://github.com/antitypical/Result) |
105 |
| -* [FileKit](https://github.com/nvzqz/FileKit) |
106 |
| -* [SourceKitten](https://github.com/jpsim/SourceKitten) |
| 4 | +Please report all issues in [Cuckoo](https://github.com/SwiftKit/Cuckoo) repository. Also documentation can be found there too. |
0 commit comments