Class: Fastlane::Actions::PodLibLintAction

Inherits:
Fastlane::Action show all
Defined in:
fastlane/lib/fastlane/actions/pod_lib_lint.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, lane_context, method_missing, other_action, return_type, sample_return_value, shell_out_should_use_bundle_exec?, step_text

Class Method Details

.authorsObject



164
165
166
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 164

def self.authors
  ["thierryxing"]
end

.available_optionsObject



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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 48

def self.available_options
  [
    FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
                                 description: "Use bundle exec when there is a Gemfile presented",
                                 type: Boolean,
                                 default_value: true,
                                 env_name: "FL_POD_LIB_LINT_USE_BUNDLE"),
    FastlaneCore::ConfigItem.new(key: :podspec,
                                 description: "Path of spec to lint",
                                 type: String,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_PODSPEC"),
    FastlaneCore::ConfigItem.new(key: :verbose,
                                 description: "Allow output detail in console",
                                 type: Boolean,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_VERBOSE"),
    FastlaneCore::ConfigItem.new(key: :allow_warnings,
                                 description: "Allow warnings during pod lint",
                                 type: Boolean,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_ALLOW_WARNINGS"),
    FastlaneCore::ConfigItem.new(key: :sources,
                                 description: "The sources of repos you want the pod spec to lint with, separated by commas",
                                 type: Array,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_SOURCES",
                                 verify_block: proc do |value|
                                   UI.user_error!("Sources must be an array.") unless value.kind_of?(Array)
                                 end),
    FastlaneCore::ConfigItem.new(key: :subspec,
                                 description: "A specific subspec to lint instead of the entire spec",
                                 type: String,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_SUBSPEC"),
    FastlaneCore::ConfigItem.new(key: :include_podspecs,
                                 description: "A Glob of additional ancillary podspecs which are used for linting via :path (available since cocoapods >= 1.7)",
                                 type: String,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_INCLUDE_PODSPECS"),
    FastlaneCore::ConfigItem.new(key: :external_podspecs,
                                 description: "A Glob of additional ancillary podspecs which are used for linting via :podspec. If there"\
                                   " are --include-podspecs, then these are removed from them (available since cocoapods >= 1.7)",
                                 type: String,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_EXTERNAL_PODSPECS"),
    FastlaneCore::ConfigItem.new(key: :swift_version,
                                 description: "The SWIFT_VERSION that should be used to lint the spec. This takes precedence over a .swift-version file",
                                 type: String,
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_SWIFT_VERSION"),
    FastlaneCore::ConfigItem.new(key: :use_libraries,
                                 description: "Lint uses static libraries to install the spec",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_USE_LIBRARIES"),
    FastlaneCore::ConfigItem.new(key: :use_modular_headers,
                                 description: "Lint using modular libraries (available since cocoapods >= 1.6)",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_USE_MODULAR_HEADERS"),
    FastlaneCore::ConfigItem.new(key: :fail_fast,
                                 description: "Lint stops on the first failing platform or subspec",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_FAIL_FAST"),
    FastlaneCore::ConfigItem.new(key: :private,
                                 description: "Lint skips checks that apply only to public specs",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_PRIVATE"),
    FastlaneCore::ConfigItem.new(key: :quick,
                                 description: "Lint skips checks that would require to download and build the spec",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_QUICK"),
    FastlaneCore::ConfigItem.new(key: :no_clean,
                                 description: "Lint leaves the build directory intact for inspection",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_NO_CLEAN"),
    FastlaneCore::ConfigItem.new(key: :no_subspecs,
                                 description: "Lint skips validation of subspecs",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_NO_SUBSPECS"),
    FastlaneCore::ConfigItem.new(key: :platforms,
                                 description: "Lint against specific platforms (defaults to all platforms supported by "\
                                    "the podspec). Multiple platforms must be comma-delimited (available since cocoapods >= 1.6)",
                                 optional: true,
                                 env_name: "FL_POD_LIB_LINT_PLATFORMS"),
    FastlaneCore::ConfigItem.new(key: :skip_import_validation,
                                 description: "Lint skips validating that the pod can be imported (available since cocoapods >= 1.3)",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_SKIP_IMPORT_VALIDATION"),
    FastlaneCore::ConfigItem.new(key: :skip_tests,
                                 description: "Lint skips building and running tests during validation (available since cocoapods >= 1.3)",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_SKIP_TESTS"),
    FastlaneCore::ConfigItem.new(key: :analyze,
                                 description: "Validate with the Xcode Static Analysis tool (available since cocoapods >= 1.6.1)",
                                 type: Boolean,
                                 default_value: false,
                                 env_name: "FL_POD_LIB_LINT_ANALYZE")
  ]
end

.categoryObject



184
185
186
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 184

def self.category
  :misc
end

.descriptionObject



40
41
42
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 40

def self.description
  "Pod lib lint"
end

.detailsObject



44
45
46
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 44

def self.details
  "Test the syntax of your Podfile by linting the pod against the files of its directory"
end

.example_codeObject



172
173
174
175
176
177
178
179
180
181
182
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 172

def self.example_code
  [
    'pod_lib_lint',
    '# Allow output detail in console
    pod_lib_lint(verbose: true)',
    '# Allow warnings during pod lint
    pod_lib_lint(allow_warnings: true)',
    '# If the podspec has a dependency on another private pod, then you will have to supply the sources
    pod_lib_lint(sources: ["https://github.com/username/Specs", "https://github.com/CocoaPods/Specs"])'
  ]
end

.is_supported?(platform) ⇒ Boolean

Returns:



168
169
170
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 168

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

.outputObject



157
158
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 157

def self.output
end

.return_valueObject



160
161
162
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 160

def self.return_value
  nil
end

.run(params) ⇒ Object

rubocop:disable Metrics/PerceivedComplexity



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'fastlane/lib/fastlane/actions/pod_lib_lint.rb', line 5

def self.run(params)
  command = []

  command << "bundle exec" if params[:use_bundle_exec] && shell_out_should_use_bundle_exec?
  command << "pod lib lint"

  command << params[:podspec] if params[:podspec]
  command << "--verbose" if params[:verbose]
  command << "--allow-warnings" if params[:allow_warnings]
  command << "--sources='#{params[:sources].join(',')}'" if params[:sources]
  command << "--subspec='#{params[:subspec]}'" if params[:subspec]
  command << "--include-podspecs='#{params[:include_podspecs]}'" if params[:include_podspecs]
  command << "--external-podspecs='#{params[:external_podspecs]}'" if params[:external_podspecs]
  command << "--swift-version=#{params[:swift_version]}" if params[:swift_version]
  command << "--use-libraries" if params[:use_libraries]
  command << "--use-modular-headers" if params[:use_modular_headers]
  command << "--fail-fast" if params[:fail_fast]
  command << "--private" if params[:private]
  command << "--quick" if params[:quick]
  command << "--no-clean" if params[:no_clean]
  command << "--no-subspecs" if params[:no_subspecs]
  command << "--platforms=#{params[:platforms]}" if params[:platforms]
  command << "--skip-import-validation" if params[:skip_import_validation]
  command << "--skip-tests" if params[:skip_tests]
  command << "--analyze" if params[:analyze]

  result = Actions.sh(command.join(' '))
  UI.success("Pod lib lint successful ⬆️ ")
  return result
end