docs/Cakefile.md in xcake-0.4.8 vs docs/Cakefile.md in xcake-0.5.0

- old
+ new

@@ -2,78 +2,54 @@ The `Cakefile` contains a lightweight DSL which provides the instructions on how to generate a project file. We adopt the convention over configuration and thus it can be very simple: ```ruby -Project.new do |project| - project.application_for :ios, 8.0 do |target| - target.name = "MyApp" - end -end + application_for :ios, 8.0 do |target| + target.name = "MyApp" + end ``` and here is much more complicated one: ```ruby -Project.new do |project| + debug_configuration :staging + debug_configuration :debug + release_configuration :release - project.debug_configuration :staging - project.debug_configuration :debug - project.release_configuration :release + application_for :ios, 8.0 do |target| + target.name = "test" + target.all_configurations.supported_devices = :iphone_only - project.application_for :ios, 8.0 do |target| - target.name = "test" - target.all_configurations.supported_devices = :iphone_only - - project.unit_tests_for(target) - end -end + unit_tests_for target + end ``` As you can see, it is super easy to read; The goal of Xcake is to keep everything readable, efficient and concise. ## Project -To create a project we must write the following: +A project is automatically created from a `Cakefile` below is all of the ways +you can customize this project. -```ruby -Project.new do |project| -end -``` -By default Xcake will create a project named "Project" but we can change the name -by passing a String argument with the name we would like it to be called: - -```ruby -Project.new "Workspace" do |project| -end -``` -We can also customize the structure of the project between the first and second lines, like so: - -```ruby -Project.new "Workspace" do |project| - project.debug_configuration :debug -end -``` -There are two main ways you can customize a Project, Targets and Configurations. - ###Properties #### Class Prefix Sets the class prefix for the project ```ruby -project.class_prefix = "XC" +class_prefix = "XC" ``` #### Organization Sets the organization for the project. ```ruby -project.organization = "Xcake Productions" +organization = "Xcake Productions" ``` ## Targets Targets are the way we make products such as Applications, Extensions, Libraries and Tests. @@ -85,57 +61,47 @@ A project can specify any application targets such as iOS or Mac Apps. iOS App: ```ruby -Project.new "Workspace" do |project| - project.application_for :ios, 8.0 -end +application_for :ios, 8.0 ``` Mac App: ```ruby -Project.new "Workspace" do |project| - project.application_for :mac, 8.0 -end +application_for :mac, 8.0 ``` ###Tests We can also specify a testing targets for other targets as well: ```ruby -Project.new "Workspace" do |project| - project.application_for :mac, 8.0 do |target| - project.unit_tests_for(target) - end +application_for :mac, 8.0 do |target| + unit_tests_for target end ``` ###Watch To create watch applications we can simply use the `watch_app_for` method: ```ruby -Project.new "Workspace" do |project| - project.application_for :mac, 8.0 do |target| - project.watch_app_for target, 2.0 - end +application_for :mac, 8.0 do |target| + watch_app_for target, 2.0 end ``` ###Custom Targets If these aren't enough for you then you can specify a target and manually set up it's properties. ```ruby -Project.new "Workspace" do |project| - project.target do |target| +target do |target| target.name = "Target" - end end ``` ###Properties @@ -178,10 +144,36 @@ ```ruby target.language = :swift ``` +#### Include Files + +Sets the files to be included for a target, files and groups will be added +to the project to match the file system. + +[See Here](https://guides.cocoapods.org/syntax/podspec.html#group_file_patterns) +for file patterns + +```ruby +target.include_files = "DifferentAppFolder/*.*" +target.include_files << "OtherFolder/*.*" +``` + +#### Exclude Files + +Sets the files to be excluded for a target, if no target uses these files they +will be excluded from the project + +[See Here](https://guides.cocoapods.org/syntax/podspec.html#group_file_patterns) +for file patterns + +```ruby +target.exclude_files = "FolderToIgnore/*.*" +target.exclude_files << "OtherFolderToIgnore/*.*" +``` + ## Configurations Configurations are an abstraction of build settings and scheme settings. Depending on the target Xcake will create a scheme per target and per configuration. @@ -192,28 +184,62 @@ For configurations used for internal testing we create a debug configuration, this comes with sensible defaults optimized for debugging (i.e Assertions enabled). ```ruby -project.debug_configuration :staging +debug_configuration :staging ``` +We can modify settings for each configuration easily. + +```ruby +debug_configuration :staging do |configuration| + configuration.settings["KEY"] = "VALUE" +end +``` + ### Release Configurations For configurations used for release we create a release configuration, this comes with sensible defaults optimized for releasing (i.e Compiler optimizations enabled). ```ruby -project.release_configuration :release +release_configuration :release ``` +We can modify settings for each configuration easily. + +```ruby +release_configuration :release do |configuration| + configuration.settings["KEY"] = "VALUE" +end +``` + ### All Configurations We can apply a particular shared setting across all of our configurations. Xcake provides a simply way of doing this via an "all" configuration. ```ruby -project.all_configurations.supported_devices = :iphone_only +all_configurations.supported_devices = :iphone_only +``` + +### Targets + +To modify settings for certain target, then its as simple as prefixing the +target we want to modify the configuration for. + +```ruby + +target.all_configurations.supported_devices = :iphone_only + +debug_configuration :staging do |configuration| + configuration.settings["KEY"] = "VALUE" +end + +target.release_configuration :release do |configuration| + configuration.settings["KEY"] = "VALUE" +end ``` ### Configuration Hiearchy Xcake allows you to manage the configurations for the project and the target but