Class: Pod::Command::Binary::Init

Inherits:
Pod::Command::Binary show all
Defined in:
lib/cocoapods-tdfire-binary/command/init.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::Binary

#binary_config, #first_podspec, #private_sources

Constructor Details

#initialize(argv) ⇒ Init

Returns a new instance of Init.



21
22
23
24
25
# File 'lib/cocoapods-tdfire-binary/command/init.rb', line 21

def initialize(argv)
  @without_ask = argv.flag?('without-ask')
  @asker = Pod::Tdfire::InitAsker.new
  super
end

Class Method Details

.optionsObject



15
16
17
18
19
# File 'lib/cocoapods-tdfire-binary/command/init.rb', line 15

def self.options
  [
    ['--without-ask', '直接下载配置'],
  ].concat(super)
end

Instance Method Details

#runObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/cocoapods-tdfire-binary/command/init.rb', line 27

def run
  @asker.wellcome_message

  if @without_ask
    binary_config.clone_default_config
  else 
    hash = binary_config.setting_hash

    Pod::Tdfire::InitAsker::QUESTIONS.each do |k, v|
      default = hash[k] if hash
      hash[k] = @asker.ask_with_answer(v, default)
    end

    binary_config.config_with_setting(hash)
  end

  @asker.done_message
end