Class: Fastlane::Actions::SourcedocsAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/sourcedocs.rb

Constant Summary

Constants inherited from Fastlane::Action

Fastlane::Action::AVAILABLE_CATEGORIES, Fastlane::Action::RETURN_TYPES

Documentation collapse

Class Method Summary collapse

Methods inherited from Fastlane::Action

action_name, author, deprecated_notes, details, lane_context, method_missing, other_action, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



144
145
146
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 144

def self.authors
  ["Kukurijek"]
end

.available_optionsObject



35
36
37
38
39
40
41
42
43
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 35

def self.available_options
  [
    FastlaneCore::ConfigItem.new(
      key: :all_modules,
      env_name: 'FL_SOURCEDOCS_OUTPUT_ALL_MODULES',
      description: 'Generate documentation for all modules in a Swift package',
      type: Boolean,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :spm_module,
      env_name: 'FL_SOURCEDOCS_SPM_MODULE',
      description: 'Generate documentation for Swift Package Manager module',
      type: String,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :module_name,
      env_name: 'FL_SOURCEDOCS_MODULE_NAME',
      description: 'Generate documentation for a Swift module',
      type: String,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :link_beginning,
      env_name: 'FL_SOURCEDOCS_LINK_BEGINNING',
      description: 'The text to begin links with',
      type: String,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :link_ending,
      env_name: 'FL_SOURCEDOCS_LINK_ENDING',
      description: 'The text to end links with (default: .md)',
      type: String,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :output_folder,
      env_name: 'FL_SOURCEDOCS_OUTPUT_FOLDER',
      description: 'Output directory to clean (default: Documentation/Reference)',
      type: String,
      optional: false
    ),
    FastlaneCore::ConfigItem.new(
      key: :min_acl,
      env_name: 'FL_SOURCEDOCS_MIN_ACL',
      description: 'Access level to include in documentation [private, fileprivate, internal, public, open] (default: public)',
      type: String,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :module_name_path,
      env_name: 'FL_SOURCEDOCS_MODULE_NAME_PATH',
      description: 'Include the module name as part of the output folder path',
      type: Boolean,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :clean,
      env_name: 'FL_SOURCEDOCS_CLEAN',
      description: 'Delete output folder before generating documentation',
      type: Boolean,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :collapsible,
      env_name: 'FL_SOURCEDOCS_COLLAPSIBLE',
      description: 'Put methods, properties and enum cases inside collapsible blocks',
      type: Boolean,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :table_of_contents,
      env_name: 'FL_SOURCEDOCS_TABLE_OF_CONTENT',
      description: 'Generate a table of contents with properties and methods for each type',
      type: Boolean,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :reproducible,
      env_name: 'FL_SOURCEDOCS_REPRODUCIBLE',
      description: 'Generate documentation that is reproducible: only depends on the sources',
      type: Boolean,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :scheme,
      env_name: 'FL_SOURCEDOCS_SCHEME',
      description: 'Create documentation for specific scheme',
      type: String,
      optional: true
    ),
    FastlaneCore::ConfigItem.new(
      key: :sdk_platform,
      env_name: 'FL_SOURCEDOCS_SDK_PlATFORM',
      description: 'Create documentation for specific sdk platform',
      type: String,
      optional: true
    )
  ]
end

.categoryObject



159
160
161
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 159

def self.category
  :documentation
end

.descriptionObject



31
32
33
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 31

def self.description
  "Generate docs using SourceDocs"
end

.example_codeObject



152
153
154
155
156
157
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 152

def self.example_code
  [
    "sourcedocs(output_folder: 'docs')",
    "sourcedocs(output_folder: 'docs', clean: true, reproducible: true, scheme: 'MyApp')"
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



148
149
150
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 148

def self.is_supported?(platform)
  [:ios, :mac].include?(platform)
end

.outputObject



138
139
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 138

def self.output
end

.return_valueObject



141
142
# File 'fastlane/lib/fastlane/actions/sourcedocs.rb', line 141

def self.return_value
end

.run(params) ⇒ Object



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

def self.run(params)
  UI.user_error!("You have to install sourcedocs using `brew install sourcedocs`") if `which sourcedocs`.to_s.length == 0 && !Helper.test?

  command =  "sourcedocs generate"
  command << " --all-modules" if params[:all_modules]
  command << " --spm-module #{params[:spm_module]}" unless params[:spm_module].nil?
  command << " --module-name #{params[:module_name]}" unless params[:module_name].nil?
  command << " --link-beginning #{params[:link_beginning]}" unless params[:link_beginning].nil?
  command << " --link-ending #{params[:link_ending]}" unless params[:link_ending].nil?
  command << " --output-folder #{params[:output_folder]}" unless params[:output_folder].nil?
  command << " --min-acl #{params[:min_acl]}" unless params[:min_acl].nil?
  command << " --module-name-path" if params[:module_name_path]
  command << " --clean" if params[:clean]
  command << " --collapsible" if params[:collapsible]
  command << " --table-of-contents" if params[:table_of_contents]
  command << " --reproducible-docs" if params[:reproducible]
  unless params[:scheme].nil?
    command << " -- -scheme #{params[:scheme]}"
    command << " -sdk #{params[:sdk_platform]}" unless params[:sdk_platform].nil?
  end
  Actions.sh(command)
end