Sha256: 0cabc27fc8c52a28576aa03a998a4e27f9c66ebb18cf97693c99936408c259b5

Contents?: true

Size: 654 Bytes

Versions: 19

Compression:

Stored size: 654 Bytes

Contents

Execute.define_task do
desc "get-token", "Fetches current api token from rhoconnect"
  def get_token
    invoke :config
    password = ''
    login = ask "admin login: "
    begin
      system "stty -echo"
      password = ask "\nadmin password: "
      system "stty echo"
    rescue NoMethodError, Interrupt
      system "stty echo"
      exit
    end
    puts ''
    begin
      $token = RestClient.post("#{$url}/api/admin/login", { :login => login, :password => password})
    rescue
      puts "Login failed."
      exit
    end
    File.open($token_file,'w') {|f| f.write $token}
    puts "Token is saved in: #{$token_file}"
  end #get_token
end #do

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
rhoconnect-3.4.5 commands/rhoconnect/get_token.rb
rhoconnect-3.4.4 commands/rhoconnect/get_token.rb
rhoconnect-3.4.3 commands/rhoconnect/get_token.rb
rhoconnect-3.4.2 commands/rhoconnect/get_token.rb
rhoconnect-3.3.6 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.5 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.4 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.3 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.2 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.1 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.1.beta4 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.1.beta3 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.3.1.beta2 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.2.1 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.2.0 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.2.0.beta5 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.2.0.beta4 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.2.0.beta3 commands/commands/rhoconnect/get_token.rb
rhoconnect-3.2.0.beta2 commands/commands/rhoconnect/get_token.rb