Class: Pod::RepoArt::RepoUtil
- Inherits:
-
Object
- Object
- Pod::RepoArt::RepoUtil
- Defined in:
- lib/util/repo_util.rb
Class Method Summary collapse
-
.art_repo?(repo_root_path) ⇒ Boolean
Whether a source is an Artifactory backed repo.
-
.artpodrc_file_exists(dir) ⇒ Object
If the .artpodrc file exists in the given dir.
-
.cleanup_index_download(tmp_file_dir) ⇒ Object
Cleans up all of the junk left over from using the Downloader.
- .del_redundant_spec_dir(redundant_specs_dir) ⇒ Object
-
.get_art_repo(name) ⇒ Source
The Artifactory source with the given name.
-
.get_art_repos ⇒ Object
List of Artifactory repos, read from the ~/.cocoapods/repos-art.
-
.get_art_url(repo_root_path) ⇒ Object
The url of this Artifactory repo which is stored in the .artpodrc file in it’s root.
-
.get_repos_art_dir ⇒ Object
The full path to the repos-art directory.
Class Method Details
.art_repo?(repo_root_path) ⇒ Boolean
Returns whether a source is an Artifactory backed repo.
46 47 48 |
# File 'lib/util/repo_util.rb', line 46 def self.art_repo?(repo_root_path) true if File.exist?("#{repo_root_path}/.artpodrc") end |
.artpodrc_file_exists(dir) ⇒ Object
Returns if the .artpodrc file exists in the given dir.
62 63 64 |
# File 'lib/util/repo_util.rb', line 62 def self.artpodrc_file_exists(dir) File.exist?("#{dir}/.artpodrc") end |
.cleanup_index_download(tmp_file_dir) ⇒ Object
Cleans up all of the junk left over from using the Downloader
74 75 76 77 78 |
# File 'lib/util/repo_util.rb', line 74 def self.cleanup_index_download(tmp_file_dir) # The downloader names every file it gets file.<ext> temp_file = "#{tmp_file_dir}/file.tgz" File.delete(temp_file) if File.exist?(temp_file) end |
.del_redundant_spec_dir(redundant_specs_dir) ⇒ Object
80 81 82 83 |
# File 'lib/util/repo_util.rb', line 80 def self.del_redundant_spec_dir(redundant_specs_dir) # The default flattening the Downloader uses for tgz makes this screwy Dir.delete(redundant_specs_dir) if (Dir.exist?(redundant_specs_dir) && Dir.glob(redundant_specs_dir + '/' + '*').empty?) end |
.get_art_repo(name) ⇒ Source
Returns The Artifactory source with the given name.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/util/repo_util.rb', line 26 def self.get_art_repo(name) #specified_source = Pod::Config.instance.sources_manager.aggregate.sources.find { |s| s.name == name } repos = get_art_repos() art_repo = nil for repo in repos if repo.name == name art_repo = repo end end unless art_repo raise Informative, "Unable to find the Artifactory-backed repo called `#{name}`." end art_repo end |
.get_art_repos ⇒ Object
Returns list of Artifactory repos, read from the ~/.cocoapods/repos-art.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/util/repo_util.rb', line 9 def self.get_art_repos repos_art_dir = UTIL.get_repos_art_dir() dirs = Dir.glob "#{repos_art_dir}/*/" repos = [] for dir in dirs if UTIL.artpodrc_file_exists(dir) url = UTIL.get_art_url(dir) repos.push ArtifactoryRepo.new(dir, url) end end repos end |
.get_art_url(repo_root_path) ⇒ Object
Returns the url of this Artifactory repo which is stored in the .artpodrc file in it’s root.
54 55 56 |
# File 'lib/util/repo_util.rb', line 54 def self.get_art_url(repo_root_path) File.read("#{repo_root_path}/.artpodrc") end |
.get_repos_art_dir ⇒ Object
Returns the full path to the repos-art directory.
68 69 70 |
# File 'lib/util/repo_util.rb', line 68 def self.get_repos_art_dir() "#{Pod::Config.instance.home_dir}/repos-art" end |