Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Commit

Permalink
Add swift-version to pod_lib_lint action (fastlane#13524)
Browse files Browse the repository at this point in the history
* Added swift-version to pod_lib_lint and pod_lib_lint_spec

* Ran rubocop and fixed pod_lib_lint_spec

* Updated is_string to true for pod_lib_lint swift_version

Co-Authored-By: bdrelling <[email protected]>

* Set is_string to true for swift_version in pod_push.rb

* Update pod_push_spec.rb
  • Loading branch information
bdrelling authored and Josh Holtz committed Nov 6, 2018
1 parent 281cb56 commit 14f4a14
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 18 deletions.
41 changes: 25 additions & 16 deletions fastlane/lib/fastlane/actions/pod_lib_lint.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def self.run(params)
command << "--sources='#{sources}'"
end

if params[:swift_version]
swift_version = params[:swift_version]
command << "--swift-version=#{swift_version}"
end

if params[:allow_warnings]
command << "--allow-warnings"
end
Expand Down Expand Up @@ -46,25 +51,29 @@ def self.details
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :use_bundle_exec,
description: "Use bundle exec when there is a Gemfile presented",
is_string: false,
default_value: true),
description: "Use bundle exec when there is a Gemfile presented",
is_string: false,
default_value: true),
FastlaneCore::ConfigItem.new(key: :verbose,
description: "Allow output detail in console",
optional: true,
is_string: false),
description: "Allow output detail in console",
optional: true,
is_string: false),
FastlaneCore::ConfigItem.new(key: :allow_warnings,
description: "Allow warnings during pod lint",
optional: true,
is_string: false),
description: "Allow warnings during pod lint",
optional: true,
is_string: false),
FastlaneCore::ConfigItem.new(key: :sources,
description: "The sources of repos you want the pod spec to lint with, separated by commas",
optional: true,
is_string: false,
type: Array,
verify_block: proc do |value|
UI.user_error!("Sources must be an array.") unless value.kind_of?(Array)
end),
description: "The sources of repos you want the pod spec to lint with, separated by commas",
optional: true,
is_string: false,
type: Array,
verify_block: proc do |value|
UI.user_error!("Sources must be an array.") unless value.kind_of?(Array)
end),
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",
optional: true,
is_string: true),
FastlaneCore::ConfigItem.new(key: :use_libraries,
description: "Lint uses static libraries to install the spec",
is_string: false,
Expand Down
2 changes: 1 addition & 1 deletion fastlane/lib/fastlane/actions/pod_push.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def self.available_options
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",
optional: true,
is_string: false),
is_string: true),
FastlaneCore::ConfigItem.new(key: :verbose,
description: "Show more debugging information",
optional: true,
Expand Down
8 changes: 8 additions & 0 deletions fastlane/spec/actions_specs/pod_lib_lint_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@

expect(result).to eq("bundle exec pod lib lint --use-libraries")
end

it "generates the correct pod lib lint command with swift-version parameter" do
result = Fastlane::FastFile.new.parse("lane :test do
pod_lib_lint(swift_version: '4.2')
end").runner.execute(:test)

expect(result).to eq("bundle exec pod lib lint --swift-version=4.2")
end
end
end
end
2 changes: 1 addition & 1 deletion fastlane/spec/actions_specs/pod_push_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

it "generates the correct pod push command with a repo parameter with the swift version flag" do
result = Fastlane::FastFile.new.parse("lane :test do
pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec', repo: 'MyRepo', swift_version: 4.0)
pod_push(path: './fastlane/spec/fixtures/podspecs/test.podspec', repo: 'MyRepo', swift_version: '4.0')
end").runner.execute(:test)

expect(result).to eq("pod repo push MyRepo './fastlane/spec/fixtures/podspecs/test.podspec' --swift-version=4.0")
Expand Down

0 comments on commit 14f4a14

Please sign in to comment.