Class: Gitomator::Task::EnableDisableCI

Inherits:
BaseReposTask show all
Defined in:
lib/gitomator/task/enable_disable_ci.rb

Overview

Abstract parent class

Direct Known Subclasses

DisableCI, EnableCI

Instance Attribute Summary

Attributes inherited from BaseReposTask

#local_dir, #repos

Attributes inherited from BaseTask

#context, #logger

Instance Method Summary collapse

Methods inherited from BaseReposTask

#after_processing_all_repos, #before_processing_any_repos, #process_repo, #process_repo_error, #run

Methods inherited from BaseTask

#ci, #git, #hosting, #run, #tagging

Constructor Details

#initialize(context, repos, opts = {}) ⇒ EnableDisableCI

Returns a new instance of EnableDisableCI.

Parameters:

  • context
    • Has a ci method that returns a Gitomator::Service::CI

  • repos (Array<String>)
    • Names of the repos to enable/disable CI on.

  • opts (Hash<Symbol,Object>) (defaults to: {})
    • Task options

Options Hash (opts):

  • :sync (Boolean)
    • Indicate whether we should start by sync’ing the CI service.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gitomator/task/enable_disable_ci.rb', line 17

def initialize(context, repos, opts={})
  super(context, repos)

  if opts[:sync]
    before_processing_any_repos do
      logger.info "Syncing CI service (this may take a little while) ..."
      ci.sync()
      while ci.syncing?
        print "."
        sleep 1
      end
      puts ""
      logger.info "CI service synchronized"
    end
  end
end