Skip to content

Commit

Permalink
feat: Add destination parameter (#6)
Browse files Browse the repository at this point in the history
* feat: add destination parameter

* change description of env variables

* fix typo

* add unit tests for the new paramater
  • Loading branch information
Kukurijek authored Oct 25, 2021
1 parent 7b86221 commit 875f2c8
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu

```ruby
docc(
scheme: "<Name of your package/library scheme>",
scheme: "<The name of your package/library scheme>",
derived_data_path: "<The path to write the DocC to>"
)
```

## List of all Parameters

| Key | Description | default value |
| ----------------- | -------------------------------------- | ------------- |
| scheme | The Scheme you want generate DocC for. | |
| derived_data_path | The path to write the DocC to. | |
| Key | Description | default value |
| ----------------- | ---------------------------------------------------------- | ------------- |
| scheme | The scheme you want generate DocC for. | |
| derived_data_path | The path to write the DocC to. | |
| destination | The destination of project (required for swift packages) | |

## Run tests for this plugin

Expand Down
10 changes: 8 additions & 2 deletions lib/fastlane/plugin/docc/actions/docc_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ def self.run(params)
command << "xcodebuild docbuild"
command << "-scheme #{params[:scheme]}"
command << "-derivedDataPath #{params[:derived_data_path]}" unless params[:derived_data_path].nil?
command << "-destination #{params[:destination]}" unless params[:destination].nil?

shell_command = command.join(' ')
UI.message(shell_command.to_s)
Expand Down Expand Up @@ -43,13 +44,18 @@ def self.available_options
[
FastlaneCore::ConfigItem.new(key: :scheme,
env_name: "DOCC_SCHEME",
description: "Scheme to use when calling docc",
description: "The scheme to use when calling docc",
optional: false,
type: String),

FastlaneCore::ConfigItem.new(key: :derived_data_path,
env_name: "DOCC_DERIVED_DATA_PATH",
description: "A description of your option",
description: "The path where the documentation will be created",
optional: true,
type: String),
FastlaneCore::ConfigItem.new(key: :destination,
env_name: "DESTINATION",
description: "The destination of project (required for swift packages)",
optional: true,
type: String)
]
Expand Down
12 changes: 12 additions & 0 deletions spec/docc_action_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,17 @@

Fastlane::Actions::DoccAction.run(scheme: "test", derived_data_path: "testPath")
end

it 'generate docc with specific destination' do
expect(Fastlane::UI).to receive(:message).with("xcodebuild docbuild -scheme test -destination generic/platform=macOS")

Fastlane::Actions::DoccAction.run(scheme: "test", destination: "generic/platform=macOS")
end

it 'generate docc with specific derived data path and destination' do
expect(Fastlane::UI).to receive(:message).with("xcodebuild docbuild -scheme test -derivedDataPath testPath -destination generic/platform=macOS")

Fastlane::Actions::DoccAction.run(scheme: "test", derived_data_path: "testPath", destination: "generic/platform=macOS")
end
end
end

0 comments on commit 875f2c8

Please sign in to comment.