class Pod::CodingArSource
Public Class Methods
new(repo)
click to toggle source
Calls superclass method
# File lib/coding_ar_source.rb, line 3 def initialize(repo) super(repo) end
Public Instance Methods
all_specs()
click to toggle source
# File lib/coding_ar_source.rb, line 57 def all_specs raise Informative, "Can't retrieve all the specs for a CODING-AR-backed source." end
git?()
click to toggle source
# File lib/coding_ar_source.rb, line 111 def git? false end
indexable?()
click to toggle source
# File lib/coding_ar_source.rb, line 115 def indexable? false end
name()
click to toggle source
# File lib/coding_ar_source.rb, line 7 def name repo.basename.to_s end
pod_path(name)
click to toggle source
# File lib/coding_ar_source.rb, line 23 def pod_path(name) specs_dir.join(name) end
pod_sets()
click to toggle source
# File lib/coding_ar_source.rb, line 61 def pod_sets raise Informative, "Can't retrieve all the pod sets for a CODING-AR-backed source." end
pods()
click to toggle source
# File lib/coding_ar_source.rb, line 27 def pods raise Informative, "Can't retrieve all the pods for a CODING-AR-backed source." end
search(query)
click to toggle source
# File lib/coding_ar_source.rb, line 65 def search(query) unless specs_dir raise Informative, "Unable to find a source named: `#{name}`" end if query.is_a?(Dependency) query = query.root_name end versions = list_version(query) if versions.class == Array and versions.length > 0 set = set(query) set if set.specification_name == query end end
search_by_name(query, full_text_search = false)
click to toggle source
# File lib/coding_ar_source.rb, line 80 def search_by_name(query, full_text_search = false) raise Informative, "Can't search a CODING-AR-backed source by name." end
specification_path(name, version)
click to toggle source
# File lib/coding_ar_source.rb, line 40 def specification_path(name, version) raise ArgumentError, 'No name' unless name raise ArgumentError, 'No version' unless version unless versions(name).include?(Version.new(version)) raise StandardError, "Unable to find the specification #{name} " \ "(#{version}) in the #{self.name} source." end spec_url = "#{url}/Specs/#{name}/#{version.to_s}/#{name}.podspec.json" spec_path = File.join(specs_dir, name, version.to_s, "#{name}.podspec.json") FileUtils.mkdir_p File.dirname(spec_path) require 'coding_ar_util' CodingArUtil.download(spec_url, spec_path) spec_path end
specs_dir()
click to toggle source
# File lib/coding_ar_source.rb, line 19 def specs_dir repo end
type()
click to toggle source
# File lib/coding_ar_source.rb, line 15 def type 'CODING-AR' end
update(_show_output)
click to toggle source
# File lib/coding_ar_source.rb, line 84 def update(_show_output) require 'json' require 'coding_ar_util' changed_spec_paths = [] UI.puts "Updating CODING-AR-backed repo #{name}".yellow if _show_output Pathname.glob(repo.join('**/*/*.json')).map do |f| origin_content = File.read(f) spec = JSON.parse origin_content spec_url = "#{url}/Specs/#{spec['name']}/#{spec['version']}/#{spec['name']}.podspec.json" UI.puts "- Fetch #{spec_url}" if _show_output FileUtils.mkdir_p File.dirname(f) CodingArUtil.download(spec_url, f) latest_content = File.read(f) FileUtils.rm_rf(File.dirname(f)) if latest_content.to_s.start_with?('Pod not found') JSON.parse latest_content changed_spec_paths.push(f) if origin_content != latest_content end UI.puts "Successfully update CODING-AR-backed repo #{name}".green if _show_output [] end
updateable?()
click to toggle source
# File lib/coding_ar_source.rb, line 107 def updateable? true end
url()
click to toggle source
# File lib/coding_ar_source.rb, line 11 def url @url ||= File.read(repo.join('.coding_ar_url')).chomp.chomp('/') end
versions(name)
click to toggle source
# File lib/coding_ar_source.rb, line 31 def versions(name) eturn nil unless specs_dir raise ArgumentError, 'No name' unless name list_version(name).map do |v| Version.new(v) end.compact.sort.reverse end
Private Instance Methods
list_version(pod)
click to toggle source
# File lib/coding_ar_source.rb, line 121 def list_version(pod) require 'coding_ar_util' CodingArUtil.get_json("#{url}/pods/#{pod}") end