Class: Fastlane::Actions::DoccAction

Inherits:
Action
  • Object
show all
Defined in:
lib/fastlane/plugin/docc/actions/docc_action.rb

Class Method Summary collapse

Class Method Details

.authorsObject



31
32
33
# File 'lib/fastlane/plugin/docc/actions/docc_action.rb', line 31

def self.authors
  ["Kukurijek"]
end

.available_optionsObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fastlane/plugin/docc/actions/docc_action.rb', line 44

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :scheme,
                                 env_name: "DOCC_SCHEME",
                                 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: "The path where the documentation will be created",
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :destination,
                                 env_name: "DESTINATION",
                                 description: "The destination of the project (required for swift packages)",
                                 optional: true,
                                 type: String),
    FastlaneCore::ConfigItem.new(key: :configuration,
                                 env_name: "CONFIGURATION",
                                 description: "The configuration for building the project (e.g. 'Debug')",
                                 optional: true,
                                 type: String)
  ]
end

.descriptionObject



27
28
29
# File 'lib/fastlane/plugin/docc/actions/docc_action.rb', line 27

def self.description
  "Automate docc - documentation for swift frameworks and packages"
end

.detailsObject



39
40
41
42
# File 'lib/fastlane/plugin/docc/actions/docc_action.rb', line 39

def self.details
  # Optional:
  "Xcode 13 has new features to build, write, and browse documentation for Swift frameworks and packages. With this plugin you can automate building of your documentation (e.g. in CI), so you can deploy the new docs automatically."
end

.is_supported?(platform) ⇒ Boolean

Returns:

  • (Boolean)


70
71
72
73
74
75
# File 'lib/fastlane/plugin/docc/actions/docc_action.rb', line 70

def self.is_supported?(platform)
  # Adjust this if your plugin only works for a particular platform (iOS vs. Android, for example)
  # See: https://docs.fastlane.tools/advanced/#control-configuration-by-lane-and-by-platform
  [:ios, :mac, :watch].include?(platform)
  true
end

.return_valueObject



35
36
37
# File 'lib/fastlane/plugin/docc/actions/docc_action.rb', line 35

def self.return_value
  # If your method provides a return value, you can describe here what it does
end

.run(params) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/fastlane/plugin/docc/actions/docc_action.rb', line 7

def self.run(params)
  command = []
  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?
  command << "-configuration #{params[:configuration]}" unless params[:configuration].nil?

  shell_command = command.join(' ')
  UI.message(shell_command.to_s)
  selected_version = sh("xcodebuild -version").match(/^Xcode (.*)$/)
  pure_version = selected_version.to_s.sub('Xcode ', '')

  unless selected_version.nil? == true
    UI.user_error!("Make sure Xcode 13 is installed and select it for Command Line Tool - your version: #{selected_version}") unless pure_version.to_i >= 13.0
  end

  sh(shell_command.to_s)
end