class CocoapodsRepoSq::Repository

Class that represents the credentials needed to access a Square SDK repository of {guides.cocoapods.org/syntax/podspec.html podspecs} for a given Square Application. Responsible for downloading a copy of the repository from Square servers and cache it on the local filesystem.

Attributes

current[RW]

Square SDK repository set by the plugin initialization on the {guides.cocoapods.org/syntax/podfile.html#plugin Podfile}. This setting is used by the {Downloader} class to know which repository to download files from in the context of a `pod install` or `pod update` command call. When a podspec indicates a Square source it does not have a Square SDK repository reference to provide to the Downloader class so this global setting is used instead.

@return [CocoapodsRepoSq::Repository]

current Square SDK repository
name[R]

@return [String]

nickname under which a Square SDK repository was registered on the
{RepositoryStore}.
password[R]

@return [String]

server password used to access a specific Square SDK repository.
path[R]

@return [String]

local filesystem path where this repository cache of podspecs is stored.
url[R]

@return [String]

Square SDK repositories server url.
username[R]

@return [String]

server user name used to access a specific Square SDK repository.

Public Class Methods

new(name, username, password, url, path) click to toggle source

@param name [String]

nickname under which a Square SDK repository was registered on the
{RepositoryStore}.

@param username [String]

server user name used to access a specific Square SDK repository.

@param password [String]

server password used to access a specific Square SDK repository.

@param url [String]

Square SDK repositories server url.

@param path [String]

local filesystem path where this repository cache of podspecs is stored.
# File lib/cocoapods_repo_sq/repository.rb, line 79
def initialize(name, username, password, url, path)
  @name = name
  @username = username
  @url = url
  @password = password
  @path = path
end

Public Instance Methods

update_specs() click to toggle source

Updates the local copy of the podspecs from the Square SDK repository

# File lib/cocoapods_repo_sq/repository.rb, line 88
def update_specs
  # download new specs to a temp directory
  new_specs_path = get_temporary_path
  downloader = Downloader.new(new_specs_path, "specs.zip", :repository => self)
  downloader.download

  # perform cleanup
  specs_path = File.join(@path, 'Specs')
  new_specs_file = File.join(new_specs_path, "file.zip")
  FileUtils.rm(new_specs_file) if File.exists?(new_specs_file)
  FileUtils.rm_rf(specs_path) if Dir.exists?(specs_path)
  FileUtils.mv(new_specs_path, specs_path)
  nil
end

Private Instance Methods

get_temporary_path() click to toggle source
# File lib/cocoapods_repo_sq/repository.rb, line 104
def get_temporary_path
  temp_path = File.join(@path, 'Specs.new')
  FileUtils.rm_rf(temp_path) if Dir.exists?(temp_path)
  temp_path
end