Class: Azuki::Command::Accounts

Inherits:
Base
  • Object
show all
Defined in:
lib/azuki/command/accounts.rb

Overview

manage multiple azuki accounts

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#api, #app, #azuki, #initialize, namespace

Methods included from Helpers

#action, #ask, #confirm, #confirm_billing, #confirm_command, #create_git_remote, #deprecate, #display, #display_header, #display_object, #display_row, #display_table, #error, error_with_failure, error_with_failure=, extended, extended_into, #fail, #format_bytes, #format_date, #format_error, #format_with_bang, #get_terminal_environment, #git, #has_git?, #home_directory, #hprint, #hputs, included, included_into, #json_decode, #json_encode, #launchy, #line_formatter, #longest, #output_with_bang, #quantify, #redisplay, #retry_on_exception, #run_command, #running_on_a_mac?, #running_on_windows?, #set_buffer, #shell, #spinner, #status, #string_distance, #styled_array, #styled_error, #styled_hash, #styled_header, #suggestion, #time_ago, #truncate, #with_tty

Constructor Details

This class inherits a constructor from Azuki::Command::Base

Instance Method Details

#defaultObject

accounts:default set a system-wide default account



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/azuki/command/accounts.rb', line 11

def default
  name = shift_argument
  validate_arguments!

  unless name
    error("Please specify an account name.")
  end

  unless (name)
    error("That account does not exist.")
  end

  result = %x{ git config --global azuki.account #{name} }

  # update netrc
  Azuki::Auth.instance_variable_set(:@account, nil) # kill memoization
  Azuki::Auth.credentials = [Azuki::Auth.user, Azuki::Auth.password]
  Azuki::Auth.write_credentials

  result
end