Class: Pod::CodingArSource
Instance Method Summary collapse
- #all_specs ⇒ Object
- #git? ⇒ Boolean
- #indexable? ⇒ Boolean
-
#initialize(repo) ⇒ CodingArSource
constructor
A new instance of CodingArSource.
- #name ⇒ Object
- #pod_path(name) ⇒ Object
- #pod_sets ⇒ Object
- #pods ⇒ Object
- #search(query) ⇒ Object
- #search_by_name(query, full_text_search = false) ⇒ Object
- #specification_path(name, version) ⇒ Object
- #specs_dir ⇒ Object
- #type ⇒ Object
- #update(_show_output) ⇒ Object
- #updateable? ⇒ Boolean
- #url ⇒ Object
- #versions(name) ⇒ Object
Constructor Details
#initialize(repo) ⇒ CodingArSource
Returns a new instance of CodingArSource.
3 4 5 |
# File 'lib/coding_ar_source.rb', line 3 def initialize(repo) super(repo) end |
Instance Method Details
#all_specs ⇒ Object
57 58 59 |
# 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? ⇒ Boolean
111 112 113 |
# File 'lib/coding_ar_source.rb', line 111 def git? false end |
#indexable? ⇒ Boolean
115 116 117 |
# File 'lib/coding_ar_source.rb', line 115 def indexable? false end |
#name ⇒ Object
7 8 9 |
# File 'lib/coding_ar_source.rb', line 7 def name repo.basename.to_s end |
#pod_path(name) ⇒ Object
23 24 25 |
# File 'lib/coding_ar_source.rb', line 23 def pod_path(name) specs_dir.join(name) end |
#pod_sets ⇒ Object
61 62 63 |
# 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 ⇒ Object
27 28 29 |
# 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) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# 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) ⇒ Object
80 81 82 |
# 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) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# 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 ⇒ Object
19 20 21 |
# File 'lib/coding_ar_source.rb', line 19 def specs_dir repo end |
#type ⇒ Object
15 16 17 |
# File 'lib/coding_ar_source.rb', line 15 def type 'CODING-AR' end |
#update(_show_output) ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# 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? ⇒ Boolean
107 108 109 |
# File 'lib/coding_ar_source.rb', line 107 def updateable? true end |
#url ⇒ Object
11 12 13 |
# File 'lib/coding_ar_source.rb', line 11 def url @url ||= File.read(repo.join('.coding_ar_url')).chomp.chomp('/') end |
#versions(name) ⇒ Object
31 32 33 34 35 36 37 38 |
# 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 |