Class: Jazzy::PodspecDocumenter
- Inherits:
-
Object
- Object
- Jazzy::PodspecDocumenter
- Defined in:
- lib/jazzy/podspec_documenter.rb
Instance Attribute Summary collapse
-
#podspec ⇒ Object
readonly
Returns the value of attribute podspec.
Class Method Summary collapse
-
.apply_config_defaults(podspec, config) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity.
- .create_podspec(podspec_path) ⇒ Object
Instance Method Summary collapse
-
#initialize(podspec) ⇒ PodspecDocumenter
constructor
A new instance of PodspecDocumenter.
- #sourcekitten_output ⇒ Object
Constructor Details
#initialize(podspec) ⇒ PodspecDocumenter
Returns a new instance of PodspecDocumenter.
8 9 10 |
# File 'lib/jazzy/podspec_documenter.rb', line 8 def initialize(podspec) @podspec = podspec end |
Instance Attribute Details
#podspec ⇒ Object (readonly)
Returns the value of attribute podspec.
6 7 8 |
# File 'lib/jazzy/podspec_documenter.rb', line 6 def podspec @podspec end |
Class Method Details
.apply_config_defaults(podspec, config) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/PerceivedComplexity
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/jazzy/podspec_documenter.rb', line 44 def self.apply_config_defaults(podspec, config) return unless podspec unless config. config. = (podspec) end unless config.module_name_configured config.module_name = podspec.module_name end unless config. config. = 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 |
.create_podspec(podspec_path) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/jazzy/podspec_documenter.rb', line 34 def self.create_podspec(podspec_path) case podspec_path when Pathname, String require 'cocoapods' Pod::Specification.from_file(podspec_path) end end |
Instance Method Details
#sourcekitten_output ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jazzy/podspec_documenter.rb', line 12 def sourcekitten_output 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) installer.install! stdout = Dir.chdir(sandbox.root) do 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}), ) end end stdout.reduce([]) { |a, s| a + JSON.load(s) }.to_json end end |