Class: CocoapodsRepoSq::Repository
- Inherits:
-
Object
- Object
- CocoapodsRepoSq::Repository
- Defined in:
- lib/cocoapods_repo_sq/repository.rb
Overview
Class that represents the credentials needed to access a Square SDK repository of podspecs for a given Square Application. Responsible for downloading a copy of the repository from Square servers and cache it on the local filesystem.
Class Attribute Summary collapse
-
.current ⇒ CocoapodsRepoSq::Repository
Square SDK repository set by the plugin initialization on the Podfile.
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
Nickname under which a Square SDK repository was registered on the RepositoryStore.
-
#password ⇒ String
readonly
Server password used to access a specific Square SDK repository.
-
#path ⇒ String
readonly
Local filesystem path where this repository cache of podspecs is stored.
-
#url ⇒ String
readonly
Square SDK repositories server url.
-
#username ⇒ String
readonly
Server user name used to access a specific Square SDK repository.
Instance Method Summary collapse
-
#initialize(name, username, password, url, path) ⇒ Repository
constructor
A new instance of Repository.
-
#update_specs ⇒ Object
Updates the local copy of the podspecs from the Square SDK repository.
Constructor Details
#initialize(name, username, password, url, path) ⇒ Repository
Returns a new instance of Repository
79 80 81 82 83 84 85 |
# 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 |
Class Attribute Details
.current ⇒ CocoapodsRepoSq::Repository
Square SDK repository set by the plugin initialization on the
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.
40 41 42 |
# File 'lib/cocoapods_repo_sq/repository.rb', line 40 def current @current end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns nickname under which a Square SDK repository was registered on the CocoapodsRepoSq::RepositoryStore.
46 47 48 |
# File 'lib/cocoapods_repo_sq/repository.rb', line 46 def name @name end |
#password ⇒ String (readonly)
Returns server password used to access a specific Square SDK repository.
54 55 56 |
# File 'lib/cocoapods_repo_sq/repository.rb', line 54 def password @password end |
#path ⇒ String (readonly)
Returns local filesystem path where this repository cache of podspecs is stored.
62 63 64 |
# File 'lib/cocoapods_repo_sq/repository.rb', line 62 def path @path end |
#url ⇒ String (readonly)
Returns Square SDK repositories server url.
58 59 60 |
# File 'lib/cocoapods_repo_sq/repository.rb', line 58 def url @url end |
#username ⇒ String (readonly)
Returns server user name used to access a specific Square SDK repository.
50 51 52 |
# File 'lib/cocoapods_repo_sq/repository.rb', line 50 def username @username end |
Instance Method Details
#update_specs ⇒ Object
Updates the local copy of the podspecs from the Square SDK repository
88 89 90 91 92 93 94 95 96 97 98 99 100 |
# 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') FileUtils.rm(File.join(new_specs_path, "file.zip")) FileUtils.rm_rf(specs_path) FileUtils.mv(new_specs_path, specs_path) nil end |