Module: GitlabBranchRename

Defined in:
lib/gitlab_branch_rename/main.rb,
lib/gitlab_branch_rename/version.rb,
lib/gitlab_branch_rename/operation.rb,
lib/gitlab_branch_rename/configuration.rb,
lib/gitlab_branch_rename/gitlab_configure.rb,
lib/gitlab_branch_rename/logger_configure.rb

Defined Under Namespace

Classes: Configuration, GitlabConfigure, LoggerConfigure, Operation

Constant Summary collapse

VERSION =
"0.6.0"

Class Method Summary collapse

Class Method Details

.launchObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/gitlab_branch_rename/main.rb', line 8

def self.launch
  c = Configuration.configure
  logger = LoggerConfigure.configure c
  logger.debug("Gitlab instance configuration:")
  logger.debug("Endpoint:     #{c.endpoint}")
  logger.debug("Token:        #{c.token.nil? ? "set" : "not set"}")
  logger.debug("Project filter criteria:")
  logger.debug("Visibility:   #{c.has_visibility.join(', ')}")
  logger.debug("Operation options:")
  logger.debug("Old branch:   #{c.branch_to_rename}")
  logger.debug("New branch:   #{c.new_branch_name}")
  logger.debug("Skip confirm: #{c.skip_confirm.nil? ? "yes" : "no"}")
  logger.debug("Pretend:      #{c.pretend.nil? ? "yes" : "no"}")
  logger.debug("Log file:     #{c.logfile == STDOUT ? "-" : c.logfile}")
  GitlabConfigure.configure c
  operation = Operation.new c, logger
  operation.execute
  logger.info("For any local repositories, use these commands to update:")
  logger.info("    git fetch `git remote` --prune")
  logger.info("    git checkout #{c.new_branch_name}")
  logger.info("    git remote set-head `git remote` #{c.new_branch_name}")
  logger.info("    git branch -d #{c.branch_to_rename}")
  logger.info("")
  logger.info("Or all as one line:")
  logger.info("    git fetch `git remote` --prune && git checkout #{c.new_branch_name} && git remote set-head `git remote` #{c.new_branch_name} && git branch -d #{c.branch_to_rename}")
  logger.close
end