Class: Pod::RepoArt::RepoUtil

Inherits:
Object
  • Object
show all
Defined in:
lib/util/repo_util.rb

Class Method Summary collapse

Class Method Details

.art_repo?(repo_root_path) ⇒ Boolean

Returns whether a source is an Artifactory backed repo.

Parameters:

  • repo_root_path (Pathname)

    root directory of the repo.

Returns:

  • (Boolean)

    whether a source is an Artifactory backed repo.



11
12
13
# File 'lib/util/repo_util.rb', line 11

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.

Parameters:

  • dir (Pathname)

    root directory of the repo.

Returns:

  • if the .artpodrc file exists in the given dir



27
28
29
# File 'lib/util/repo_util.rb', line 27

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



33
34
35
36
37
# File 'lib/util/repo_util.rb', line 33

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



39
40
41
42
# File 'lib/util/repo_util.rb', line 39

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_url(repo_root_path) ⇒ Object

Returns the url of this Artifactory repo which is stored in the .artpodrc file in it’s root.

Parameters:

  • repo_root_path (Pathname)

    root directory of the repo.

Returns:

  • the url of this Artifactory repo which is stored in the .artpodrc file in it’s root



19
20
21
# File 'lib/util/repo_util.rb', line 19

def self.get_art_url(repo_root_path)
  File.read("#{repo_root_path}/.artpodrc")
end