Method: CIRunner::CLI#circle_ci_token

Defined in:
lib/ci_runner/cli.rb

#circle_ci_token(token) ⇒ Object



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
# File 'lib/ci_runner/cli.rb', line 102

def circle_ci_token(token)
  ::CLI::UI::StdoutRouter.enable

  ::CLI::UI.frame("Saving CircleCI Token") do
    user = Client::CircleCI.new(token).me
    Configuration::User.instance.save_circle_ci_token(token)

    ::CLI::UI.puts("      Hello {{warning:\#{user[\"login\"]}}}! {{success:Your token is valid!}}\n\n      {{info:The token has been saved in this file: \#{Configuration::User.instance.config_file}}}\n    EOM\n  rescue Client::Error => e\n    ::CLI::UI.puts(\"{{red:\\nYour token doesn't seem to be valid. The response from Circle CI was: \#{e.message}}}\")\n\n    exit(false)\n  end\nend\n")