class Licensed::Sources::Cocoapods
Constants
- DEFAULT_POD_COMMAND
- MISSING_PLUGIN_MESSAGE
Public Instance Methods
Source
# File lib/licensed/sources/cocoapods.rb, line 12 def enabled? return unless Licensed::Shell.tool_available?("pod") config.pwd.join("Podfile").exist? && config.pwd.join("Podfile.lock").exist? end
Source
# File lib/licensed/sources/cocoapods.rb, line 18 def enumerate_dependencies pods.map do |pod| Dependency.new( name: pod["name"], version: pod["version"], path: pod["path"], metadata: { "type" => Cocoapods.type, "summary" => pod["summary"], "homepage" => pod["homepage"] } ) end end
Private Instance Methods
Source
# File lib/licensed/sources/cocoapods.rb, line 39 def cocoapods_dependencies_json args = ["dependencies", "--include-path"] args << "--targets=#{targets.join(",")}" if targets.any? output = Licensed::Shell.execute(*pod_command, *args, allow_failure: true) if output.include? "Unknown command" raise Licensed::Sources::Source::Error, MISSING_PLUGIN_MESSAGE end JSON.parse(output) rescue JSON::ParserError => e message = "Licensed was unable to parse the output from 'pod dependencies'. JSON Error: #{e.message}" raise Licensed::Sources::Source::Error, message end
Source
# File lib/licensed/sources/cocoapods.rb, line 59 def pod_command return DEFAULT_POD_COMMAND unless source_config["command"].is_a?(String) source_config["command"].split end
Source
# File lib/licensed/sources/cocoapods.rb, line 35 def pods cocoapods_dependencies_json.values.flatten end
Source
# File lib/licensed/sources/cocoapods.rb, line 54 def targets return [] unless [String, Array].any? { |type| source_config["targets"].is_a?(type) } Array(source_config["targets"]).map { |t| "Pods-#{t}" } end