class Pod::Command::Cache::Proxy::Add

Public Class Methods

new(argv) click to toggle source
Calls superclass method
# 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

Public Instance Methods

run() click to toggle source
# 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!() click to toggle source
Calls superclass method
# 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