lib/jazzy/podspec_documenter.rb in jazzy-0.3.2 vs lib/jazzy/podspec_documenter.rb in jazzy-0.4.0

- old
+ new

@@ -21,27 +21,41 @@ end end stdout.reduce([]) { |a, s| a + JSON.load(s) }.to_json end - def self.configure(config, podspec) - case podspec + def self.create_podspec(podspec_path) + case podspec_path when Pathname, String require 'cocoapods' - podspec = Pod::Specification.from_file(podspec) + Pod::Specification.from_file(podspec_path) end + end + # rubocop:disable Metrics/CyclomaticComplexity + # rubocop:disable Metrics/PerceivedComplexity + def self.apply_config_defaults(podspec, config) return unless podspec - config.author_name = author_name(podspec) - config.module_name = podspec.module_name - config.author_url = podspec.homepage || github_file_prefix(podspec) - config.version = podspec.version.to_s - config.github_file_prefix = github_file_prefix(podspec) - - podspec + unless config.author_name_configured + config.author_name = author_name(podspec) + end + unless config.module_name_configured + config.module_name = podspec.module_name + end + unless config.author_url_configured + config.author_url = podspec.homepage || github_file_prefix(podspec) + end + 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 end + # rubocop:enable Metrics/CyclomaticComplexity + # rubocop:enable Metrics/PerceivedComplexity private # @!group Config helper methods @@ -93,10 +107,10 @@ targets = (@pod_targets ||= []) @podfile ||= Pod::Podfile.new do platform :ios, '8.0' [podspec, *podspec.recursive_subspecs].each do |ss| ss.available_platforms.each do |p| - t = "Jazzy-#{ss.name.gsub(/\//, '__')}-#{p.name}" + t = "Jazzy-#{ss.name.gsub('/', '__')}-#{p.name}" targets << "Pods-#{t}-#{ss.root.name}" target(t) do use_frameworks! platform p.name, p.deployment_target pod ss.name, path: path.realpath.to_s