Class: Pod::Command::GitClone

Inherits:
Pod::Command show all
Defined in:
lib/cocoapods-hooks/command/git_clone.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ GitClone

Returns a new instance of GitClone.



15
16
17
18
19
# File 'lib/cocoapods-hooks/command/git_clone.rb', line 15

def initialize(argv)
  @tenantid = argv.option('tenantid')
  @version = argv.option('version')
  super
end

Class Method Details

.optionsObject



8
9
10
11
12
13
# File 'lib/cocoapods-hooks/command/git_clone.rb', line 8

def self.options
  [
    ['--tenantid=TENANTID', 'Specify the tenant ID'],
    ['--version=Version', 'Specify the sdk version for git clone']
  ].concat(super)
end

Instance Method Details

#runObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/cocoapods-hooks/command/git_clone.rb', line 27

def run
  UI.puts "Downloading OEM configuration for tenant #{@tenantid}"
  if @tenantid.nil? || @tenantid.empty?
      UI.puts "没有传入 tenantid, 直接退出程序"
      exit 1
  end
  # 执行你的业务逻辑
  if @version.nil? || @version.empty?
      UI.puts "没有传入指定版本,直接退出程序"
      exit 1
  end
  self.class.git_clone_project_config(@tenantid, @version)
end

#validate!Object



21
22
23
24
25
# File 'lib/cocoapods-hooks/command/git_clone.rb', line 21

def validate!
  super
  help! 'A tenant ID is required.' unless @tenantid
  help! 'A sdk version is required.' unless @version
end