lib/jazzy/podspec_documenter.rb in jazzy-0.7.2 vs lib/jazzy/podspec_documenter.rb in jazzy-0.7.3

- old
+ new

@@ -7,11 +7,13 @@ def initialize(podspec) @podspec = podspec end - def sourcekitten_output + # Build documentation from the given options + # @param [Config] options + def sourcekitten_output(config) installation_root = Pathname(Dir.mktmpdir(['jazzy', podspec.name])) installation_root.rmtree if installation_root.exist? Pod::Config.instance.with_changes(installation_root: installation_root) do sandbox = Pod::Sandbox.new(Pod::Config.instance.sandbox_root) installer = Pod::Installer.new(sandbox, podfile) @@ -20,13 +22,15 @@ targets = installer.pod_targets .select { |pt| pt.pod_name == podspec.root.name } .map(&:label) targets.map do |t| - SourceKitten.run_sourcekitten( - %W(doc --module-name #{podspec.module_name} -- -target #{t}), - ) + args = %W(doc --module-name #{podspec.module_name} -- -target #{t}) + if config.swift_version + args << "SWIFT_VERSION=\"#{config.swift_version}\"" + end + SourceKitten.run_sourcekitten(args) end end stdout.reduce([]) { |a, s| a + JSON.load(s) }.to_json end end @@ -56,9 +60,13 @@ unless config.version_configured config.version = podspec.version.to_s end unless config.github_file_prefix_configured config.github_file_prefix = github_file_prefix(podspec) + end + unless config.swift_version_configured + trunk_swift_build = podspec.attributes_hash['pushed_with_swift_version'] + config.swift_version = trunk_swift_build if trunk_swift_build end end # rubocop:enable Metrics/CyclomaticComplexity # rubocop:enable Metrics/PerceivedComplexity