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')
  @branch = argv.option('branch')
  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'],
    ['--branch=Branch', 'Specify the branch for git clone']
  ].concat(super)
end

Instance Method Details

#runObject



26
27
28
29
30
31
32
33
34
# File 'lib/cocoapods-hooks/command/git_clone.rb', line 26

def run
  UI.puts "Downloading OEM configuration for tenant #{@tenantid}"
  # 执行你的业务逻辑
  if @branch == nil
      UI.puts "没有传入指定分支,默认使用 main_develop"
      @branch = 'main_develop'
  end
  self.class.git_clone_project_config(@tenantid, @branch)
end

#validate!Object



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

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