Skip to content

Commit

Permalink
Add --pod-sources config option to fix realm#650
Browse files Browse the repository at this point in the history
  • Loading branch information
Jonathan Bailey committed Apr 11, 2020
1 parent ce952b9 commit 50b557e
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@

##### Enhancements

* None.
* Added a config option to provide sources of privately hosted pod
dependencies when using the `--podspec` option.
`--pod-sources url1,url2,…urlN`.
[Jonathan Bailey](https://github.com/jon889)
[#650](https://github.com/realm/jazzy/issues/650)

##### Bug Fixes

Expand Down
8 changes: 8 additions & 0 deletions lib/jazzy/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,14 @@ def hide_objc?
parse: ->(ps) { PodspecDocumenter.create_podspec(Pathname(ps)) if ps },
default: Dir['*.podspec{,.json}'].first

config_attr :pod_sources,
command_line: ['--pod-sources url1,url2,…urlN', Array],
description: 'A list of sources to find pod dependencies. Used only with '\
'--podspec when the podspec contains references to privately '\
'hosted pods. You must include the default pod source if '\
'public pods are also used.',
default: []

config_attr :docset_icon,
command_line: '--docset-icon FILEPATH',
parse: ->(di) { expand_path(di) }
Expand Down
10 changes: 7 additions & 3 deletions lib/jazzy/podspec_documenter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def sourcekitten_output(config)
Pod::Config.instance.with_changes(installation_root: installation_root,
verbose: false) do
sandbox = Pod::Sandbox.new(Pod::Config.instance.sandbox_root)
swift_version = compiler_swift_version(config.swift_version)
installer = Pod::Installer.new(sandbox, podfile(swift_version))
installer = Pod::Installer.new(sandbox, podfile(config))
installer.install!
stdout = Dir.chdir(sandbox.root) do
targets = installer.pod_targets
Expand Down Expand Up @@ -135,10 +134,15 @@ def pod_path
end

# rubocop:disable Metrics/MethodLength
def podfile(swift_version)
def podfile(config)
swift_version = compiler_swift_version(config.swift_version)
podspec = @podspec
path = pod_path
@podfile ||= Pod::Podfile.new do
config.pod_sources.each do |src|
source src
end

install! 'cocoapods',
integrate_targets: false,
deterministic_uuids: false
Expand Down

0 comments on commit 50b557e

Please sign in to comment.