Class: Pod::Tdfire::InitAsker

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-tdfire-binary/init_asker.rb

Constant Summary collapse

QUESTIONS =
{
    BinaryConfig::SERVER_ROOT_KEY => '输入二进制服务器地址 (比如 http://xxxxx:8080)',
    BinaryConfig::REPO_URL_KEY => '输入私有源 Git 地址 (比如 https://github.com/tripleCC/PrivateSpecRepo.git)',
    BinaryConfig::TEMPLATE_URL_KEY => '输入 pod 模版 Git 地址 (比如 https://github.com/CocoaPods/pod-template.git)',
    BinaryConfig::THREE_PARTY_GROUP_KEY => '输入三方库所在的 group (比如 cocoapods-repos)'
}

Instance Method Summary collapse

Instance Method Details

#ask_with_answer(question, pre_answer) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cocoapods-tdfire-binary/init_asker.rb', line 17

def ask_with_answer(question, pre_answer)
  print "\n#{question}\n"

  print "旧值:#{pre_answer}\n" unless pre_answer.nil?

  answer = ''
  loop do
    show_prompt
    answer = STDIN.gets.chomp

    if answer == '' && !pre_answer.nil?
      answer = pre_answer
      print answer.yellow
      print "\n"
    end

    break unless answer.empty?
  end

  answer
end

#done_messageObject



51
52
53
# File 'lib/cocoapods-tdfire-binary/init_asker.rb', line 51

def done_message
  print "\n设置完成.\n"
end

#show_promptObject



13
14
15
# File 'lib/cocoapods-tdfire-binary/init_asker.rb', line 13

def show_prompt
  print ' > '.green
end

#wellcome_messageObject



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/cocoapods-tdfire-binary/init_asker.rb', line 39

def wellcome_message
  print "\n\u5F00\u59CB\u8BBE\u7F6E\u4E8C\u8FDB\u5236\u5316\u521D\u59CB\u4FE1\u606F.\n\u6240\u6709\u7684\u4FE1\u606F\u90FD\u4F1A\u4FDD\u5B58\u5728 binary_config.yaml \u6587\u4EF6\u4E2D.\n\u4F60\u53EF\u4EE5\u5728 \#{BinaryConfig.instance.binary_setting_file} \u76EE\u5F55\u4E0B\u624B\u52A8\u6DFB\u52A0\u7F16\u8F91\u8BE5\u6587\u4EF6.\n\#{BinaryConfig.instance.binary_setting_file} \u6587\u4EF6\u5305\u542B\u914D\u7F6E\u4FE1\u606F\u5982\u4E0B\uFF1A\n\n\#{QUESTIONS.to_yaml}\n"
end