Class: ControlRepo

Inherits:
Object
  • Object
show all
Includes:
ReleaseManager::Git::Utilities, ReleaseManager::Logger, ReleaseManager::VCSManager
Defined in:
lib/release_manager/control_repo.rb

Constant Summary collapse

DEFAULT_BRANCH =
ENV['CONTROL_REPO_DEFAULT_BRANCH'] || 'dev'
DEFAULT_BRANCHES =
ENV['CONTROL_REPO_DEFAULT_BRANCHES'] || %w(dev qa integration acceptance production)

Instance Attribute Summary collapse

Attributes included from ReleaseManager::VCSManager

#vcs

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ReleaseManager::VCSManager

adapter_instance, adapter_types, default_instance

Methods included from ReleaseManager::Logger

#color, #log_level, #logger

Methods included from ReleaseManager::Git::Utilities

#add_all, #add_file, #add_remote, #apply_diff, #apply_patch, #author, #author_email, #author_name, #branch_exist?, #changed_files, #checkout_branch, #cherry_pick, #cli_create_commit, #clone, #create_branch, #create_commit, #create_diff, #create_diff_obj, #create_local_tag, #credentials, #current_branch, #current_branch?, #delete_branch, #fetch, #fetch_cli, #find_or_create_remote, #find_ref, #find_tag, #get_content, #git_command, #git_url?, #push_branch, #push_tags, #rebase_branch, #ref_exists?, #remote_exists?, #remote_from_name, #remote_from_url, #remote_url_matches?, #remove_file, #tag_exists?, #tags, #transports, #up2date?

Constructor Details

#initialize(path, url = nil) ⇒ ControlRepo

Returns a new instance of ControlRepo.



14
15
16
17
# File 'lib/release_manager/control_repo.rb', line 14

def initialize(path, url = nil)
  @path = path
  @url = url
end

Instance Attribute Details

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/release_manager/control_repo.rb', line 6

def path
  @path
end

#repoObject

Returns the value of attribute repo.



6
7
8
# File 'lib/release_manager/control_repo.rb', line 6

def repo
  @repo
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/release_manager/control_repo.rb', line 6

def url
  @url
end

Class Method Details

.create(path, url) ⇒ ControlRepo

Returns - creates a new control repo object and clones the url unless already cloned.

Returns:

  • (ControlRepo)
    • creates a new control repo object and clones the url unless already cloned



20
21
22
23
24
# File 'lib/release_manager/control_repo.rb', line 20

def self.create(path, url)
  c = ControlRepo.new(path, url)
  c.clone(url, path)
  c
end

Instance Method Details

#commit(message, diff_obj, branch_name, remote = false) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/release_manager/control_repo.rb', line 38

def commit(message, diff_obj, branch_name, remote = false)
  message = "[ReleaseManager] - #{message}"
  if remote
    actions = diff_2_commit(diff_obj)
    obj = vcs_create_commit(url, branch_name, message, actions)
    obj.id if obj
  else
    create_commit(message)
  end
end

#puppetfileObject



30
31
32
33
34
35
36
# File 'lib/release_manager/control_repo.rb', line 30

def puppetfile
  unless @puppetfile
    @puppetfile = Puppetfile.new(File.join(path, 'Puppetfile'))
    @puppetfile.base_path = path
  end
  @puppetfile
end