Class: Pod::GiteeRepo::GiteeRepoUtil
- Inherits:
-
Object
- Object
- Pod::GiteeRepo::GiteeRepoUtil
- Defined in:
- lib/util/gitee_repo_util.rb
Class Method Summary collapse
-
.art_repo?(repo_root_path) ⇒ Boolean
Whether a source is an Gitee 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_default_repos_dir ⇒ Object
The full path to the cocoapods default repos directory.
-
.get_gitee_repo(name) ⇒ Source
The Gitee Repo source with the given name.
-
.get_gitee_repo_url(repo_root_path) ⇒ Object
The url of this Gitee repo which is stored in the .artpodrc file in it’s root.
-
.get_gitee_repos ⇒ Object
List of Gitee repos, read from the ~/.cocoapods/gitee-repos.
-
.get_gitee_repos_dir ⇒ Object
The full path to the gitee-repos directory.
Class Method Details
.art_repo?(repo_root_path) ⇒ Boolean
Returns whether a source is an Gitee backed repo.
45 46 47 |
# File 'lib/util/gitee_repo_util.rb', line 45 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.
61 62 63 |
# File 'lib/util/gitee_repo_util.rb', line 61 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
79 80 81 82 83 |
# File 'lib/util/gitee_repo_util.rb', line 79 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
85 86 87 88 |
# File 'lib/util/gitee_repo_util.rb', line 85 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_default_repos_dir ⇒ Object
Returns the full path to the cocoapods default repos directory.
73 74 75 |
# File 'lib/util/gitee_repo_util.rb', line 73 def self.get_default_repos_dir "#{Pod::Config.instance.home_dir}/repos" end |
.get_gitee_repo(name) ⇒ Source
Returns The Gitee Repo source with the given name.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/util/gitee_repo_util.rb', line 26 def self.get_gitee_repo(name) # specified_source = Pod::Config.instance.sources_manager.aggregate.sources.find { |s| s.name == name } repos = get_gitee_repos art_repo = nil repos.each { |repo| if repo.name == name art_repo = repo end } unless art_repo raise Informative, "Unable to find the Gitee-backed repo called `#{name}`." end art_repo end |
.get_gitee_repo_url(repo_root_path) ⇒ Object
Returns the url of this Gitee repo which is stored in the .artpodrc file in it’s root.
53 54 55 |
# File 'lib/util/gitee_repo_util.rb', line 53 def self.get_gitee_repo_url(repo_root_path) File.read("#{repo_root_path}/.artpodrc") end |
.get_gitee_repos ⇒ Object
Returns list of Gitee repos, read from the ~/.cocoapods/gitee-repos.
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/util/gitee_repo_util.rb', line 9 def self.get_gitee_repos gitee_repos_dir = UTIL.get_gitee_repos_dir dirs = Dir.glob "#{gitee_repos_dir}/*/" repos = [] dirs.each { |dir| if UTIL.artpodrc_file_exists(dir) url = UTIL.get_gitee_repo_url(dir) repos.push GiteeArtifactRepo.new(dir, url) end } repos end |
.get_gitee_repos_dir ⇒ Object
Returns the full path to the gitee-repos directory.
67 68 69 |
# File 'lib/util/gitee_repo_util.rb', line 67 def self.get_gitee_repos_dir "#{Pod::Config.instance.home_dir}/gitee-repos" end |