class Abt::Providers::Devops::Configuration
Attributes
cli[RW]
Public Class Methods
new(cli:)
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 9 def initialize(cli:) @cli = cli end
Public Instance Methods
access_token_for_organization(organization_name)
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 45 def access_token_for_organization(organization_name) access_token_key = "organizations.#{organization_name}.accessToken" return git_global[access_token_key] unless git_global[access_token_key].nil? git_global[access_token_key] = cli.prompt.text(<<~TXT) Please provide your personal access token for the DevOps organization (#{organization_name}). If you don't have one, follow the guide here: https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate The token MUST have "Read" permission for Work Items Future features will likely require "Write" or "Manage Enter access token" TXT end
clear_global(verbose: true)
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 29 def clear_global(verbose: true) git_global.clear(output: verbose ? cli.err_output : nil) end
clear_local(verbose: true)
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 25 def clear_local(verbose: true) git.clear(output: verbose ? cli.err_output : nil) end
local_available?()
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 13 def local_available? git.available? end
path()
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 17 def path Path.new(local_available? && git["path"] || cli.directory_config.dig("devops", "path") || "") end
path=(new_path)
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 21 def path=(new_path) git["path"] = new_path end
username_for_organization(organization_name)
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 33 def username_for_organization(organization_name) username_key = "organizations.#{organization_name}.username" return git_global[username_key] unless git_global[username_key].nil? git_global[username_key] = cli.prompt.text([ "Please provide your username for the DevOps organization (#{organization_name}).", "", "Enter username" ].join("\n")) end
Private Instance Methods
git()
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 63 def git @git ||= GitConfig.new("local", "abt.devops") end
git_global()
click to toggle source
# File lib/abt/providers/devops/configuration.rb, line 67 def git_global @git_global ||= GitConfig.new("global", "abt.devops") end