class Abt::Providers::Devops::Commands::BranchName

Public Class Methods

description() click to toggle source
# File lib/abt/providers/devops/commands/branch_name.rb, line 12
def self.description
  "Suggest a git branch name for the current/specified work-item."
end
usage() click to toggle source
# File lib/abt/providers/devops/commands/branch_name.rb, line 8
def self.usage
  "abt branch-name devops[:<organization-name>/<project-name>/<board-id>/<work-item-id>]"
end

Public Instance Methods

perform() click to toggle source
# File lib/abt/providers/devops/commands/branch_name.rb, line 16
          def perform
            require_work_item!

            if work_item
              puts name
            else
              abort(<<~TXT)
                Unable to find work item for configuration:
                devops:#{path}
              TXT
            end
          end

Private Instance Methods

name() click to toggle source
# File lib/abt/providers/devops/commands/branch_name.rb, line 31
def name
  str = work_item["id"]
  str += "-"
  str += work_item["name"].downcase.gsub(/[^\w]/, "-")
  str.squeeze("-").gsub(/(^-|-$)/, "")
end