diff --git a/README.md b/README.md index 12a776e..8bdf533 100644 --- a/README.md +++ b/README.md @@ -22,17 +22,18 @@ Check out the [example `Fastfile`](fastlane/Fastfile) to see how to use this plu ```ruby docc( - scheme: "", + scheme: "", derived_data_path: "" ) ``` ## 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 diff --git a/lib/fastlane/plugin/docc/actions/docc_action.rb b/lib/fastlane/plugin/docc/actions/docc_action.rb index c2513dd..ce5d0f1 100644 --- a/lib/fastlane/plugin/docc/actions/docc_action.rb +++ b/lib/fastlane/plugin/docc/actions/docc_action.rb @@ -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) @@ -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) ] diff --git a/spec/docc_action_spec.rb b/spec/docc_action_spec.rb index 9b4fc35..251ae9b 100644 --- a/spec/docc_action_spec.rb +++ b/spec/docc_action_spec.rb @@ -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