Class: Pod::Command::Mod::Config

Inherits:
Pod::Command::Mod show all
Defined in:
lib/cocoapods-modularization/command/mod/config.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Config

Returns a new instance of Config.



25
26
27
28
29
30
31
# File 'lib/cocoapods-modularization/command/mod/config.rb', line 25

def initialize(argv)
  @name = argv.shift_argument
  @url = argv.shift_argument
  @binary = argv.flag?('binary')
  @binary ||= false
  super
end

Class Method Details

.optionsObject



19
20
21
22
23
# File 'lib/cocoapods-modularization/command/mod/config.rb', line 19

def self.options 
  [
    ['--binary', 'Mark NAME as binary repo, is this options is not specified, repo will be marked as source repo']
  ].concat(super)
end

Instance Method Details

#runObject



44
45
46
47
# File 'lib/cocoapods-modularization/command/mod/config.rb', line 44

def run
  Private::PrivateCache.cache_repo(@name, @url, @binary)
  `pod repo add #{@name} #{@url}`
end

#validate!Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/cocoapods-modularization/command/mod/config.rb', line 33

def validate!
  super
  unless @name && @url
    help! 'Adding a repo needs a `NAME` and a `URL`.'
  end
  if @name == 'trunk'
    raise Informative,
          "Repo name `trunk` is reserved for CocoaPods' main spec repo accessed via CDN."
  end
end