Class: Pod::Command::Cache::Proxy::Add
- Inherits:
-
Pod::Command::Cache::Proxy
- Object
- Pod::Command
- Pod::Command::Cache
- Pod::Command::Cache::Proxy
- Pod::Command::Cache::Proxy::Add
- Defined in:
- lib/cocoapods-cache-proxy/command/cache_proxy/add.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Add
constructor
A new instance of Add.
- #run ⇒ Object
- #validate! ⇒ Object
Methods inherited from Pod::Command::Cache::Proxy
Constructor Details
#initialize(argv) ⇒ Add
Returns a new instance of Add.
21 22 23 24 25 26 |
# File 'lib/cocoapods-cache-proxy/command/cache_proxy/add.rb', line 21 def initialize(argv) init @name, @url, @user, @password = argv.shift_argument, argv.shift_argument, argv.shift_argument, argv.shift_argument @silent = argv.flag?('silent', false) super end |
Instance Method Details
#run ⇒ Object
36 37 38 39 40 41 42 43 |
# File 'lib/cocoapods-cache-proxy/command/cache_proxy/add.rb', line 36 def run raise Pod::Informative.exception "`#{@name}` 已经存在" if CPSH.check_source_conf_exists(@name) #raise Pod::Informative.exception "官方源不存在, 请先添加官方源" unless Pod::Config.instance.sources_manager.master_repo_functional? UI.section("Add proxy server config `#{@url}` into local spec repo `#{@name}`".green) do CPSH.init_cache_proxy_source(@name, @url, @user, @password) end end |
#validate! ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/cocoapods-cache-proxy/command/cache_proxy/add.rb', line 28 def validate! super help! 'This command requires both a repo name.' unless @name help! 'This command requires both a repo url.' unless @url help! 'This command requires both a repo user.' unless @user help! 'This command requires both a repo password.' unless @password end |