Class: ReleaseManager::VCSManager::VcsAdapter

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/release_manager/vcs_manager/vcs_adapter.rb

Direct Known Subclasses

GitlabAdapter

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logger

#color, #log_level, #logger

Class Method Details

.createObject

Raises:

  • (NotImplementedError)


9
10
11
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 9

def self.create
  raise NotImplementedError
end

Instance Method Details

#add_known_hosts_keys(hostname) ⇒ Object

Parameters:

  • hostname (String)
    • the hostname of the system you wnat to add keys for



106
107
108
109
110
111
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 106

def add_known_hosts_keys(hostname)
  URI(ReleaseManager.gitlab_server)
  known_hosts = File.expand_dir(File.join('~', '.ssh', 'ssh_known_hosts'))
  `ssh-keygen -F #{hostname} -f #{known_hosts}  > /dev/null`
  `ssh-keyscan -H #{hostname} >> #{known_hosts}` unless $CHILD_STATUS.success?
end

#add_permission(user, repo) ⇒ Object

Raises:

  • (NotImplementedError)


17
18
19
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 17

def add_permission(user, repo)
  raise NotImplementedError
end

#add_ssh_key(public_key) ⇒ Object

Raises:

  • (NotImplementedError)


13
14
15
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 13

def add_ssh_key(public_key)
  raise NotImplementedError
end

#clone_repo(mod_name, url) ⇒ Object

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 29

def clone_repo(mod_name, url)
  raise NotImplementedError
end

#create_merge_request(project, title, options = {}) ⇒ Gitlab::ObjectifiedHash

Creates a merge request.

Examples:

create_merge_request(5, 'New merge request',
  { source_branch: 'source_branch', target_branch: 'target_branch' })
create_merge_request(5, 'New merge request',
  { source_branch: 'source_branch', target_branch: 'target_branch', assignee_id: 42 })

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • title (String)

    The title of a merge request.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :source_branch (String) — default: required

    The source branch name.

  • :target_branch (String) — default: required

    The target branch name.

  • :assignee_id (Integer) — default: optional

    The ID of a user to assign merge request.

  • :target_project_id (Integer) — default: optional

    The target project ID.

Returns:

  • (Gitlab::ObjectifiedHash)

    Information about created merge request.

Raises:

  • (NotImplementedError)


101
102
103
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 101

def create_merge_request(project, title, options={})
  raise NotImplementedError
end

#create_repo_branch(repo_id, branch_name) ⇒ Object

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 33

def create_repo_branch(repo_id, branch_name)
  raise NotImplementedError
end

#create_repo_fork(url, options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


21
22
23
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 21

def create_repo_fork(url, options = {} )
  raise NotImplementedError
end

#create_tag(url, tag_name, ref, message = nil, description = nil) ⇒ Gitlab::ObjectifiedHash

Parameters:

  • url (String)
    • a git url

  • tag_name (String)

    The name of the new tag.

  • ref (String)

    The ref (commit sha, branch name, or another tag) the tag will point to.

  • message (String) (defaults to: nil)

    Optional message for tag, creates annotated tag if specified.

  • description (String) (defaults to: nil)

    Optional release notes for tag.

Returns:

  • (Gitlab::ObjectifiedHash)

Raises:

  • (NotImplementedError)


64
65
66
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 64

def create_tag(url, tag_name, ref, message = nil, description = nil)
  raise NotImplementedError
end

#diff_2_commit(diff_obj) ⇒ Object

Parameters:

  • Array (Hash)

    the changed files in the commit or all the commits in the diff between src and dst

Raises:

  • (NotImplementedError)


120
121
122
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 120

def diff_2_commit(diff_obj)
  raise NotImplementedError
end

#rebase_mr(url, mr_id) ⇒ Object

Parameters:

  • url (String)
    • a git url

  • mr_id (String)

    The id of the merge request

Raises:

  • (NotImplementedError)


54
55
56
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 54

def rebase_mr(url, mr_id)
  raise NotImplementedError
end

#remote_tag_exists?(url, tag) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


132
133
134
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 132

def remote_tag_exists?(url, tag)
  raise NotImplementedError
end

#remote_tag_names(url) ⇒ Object

Raises:

  • (NotImplementedError)


128
129
130
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 128

def remote_tag_names(url)
  raise NotImplementedError
end

#remote_tags(url) ⇒ Object

Raises:

  • (NotImplementedError)


124
125
126
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 124

def remote_tags(url)
  raise NotImplementedError
end

#repo_exists?(url) ⇒ Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 37

def repo_exists?(url)
  raise NotImplementedError
end

#repo_id(url) ⇒ Object

Raises:

  • (NotImplementedError)


41
42
43
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 41

def repo_id(url)
  raise NotImplementedError
end

#swap_namespace(url, namespace = nil) ⇒ Object

Raises:

  • (NotImplementedError)


25
26
27
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 25

def swap_namespace(url, namespace = nil)
  raise NotImplementedError
end

#validate_authorizationObject

Parameters:

  • - (Boolean)

    returns true if the user has valid access by trying to access the api

Raises:

  • (NotImplementedError)


114
115
116
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 114

def validate_authorization
  raise NotImplementedError
end

#vcs_create_branch(url, name, ref) ⇒ Object

Parameters:

  • url (String)
    • a git url

  • name (String)

    The name of the new branch.

  • ref (String)

    The ref (commit sha, branch name, or another tag) the tag will point to.

Raises:

  • (NotImplementedError)


48
49
50
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 48

def vcs_create_branch(url, name, ref)
  raise NotImplementedError
end

#vcs_create_commit(url, branch, message, actions, options = {}) ⇒ Gitlab::ObjectifiedHash

Creates a single commit with one or more changes

create_commit(2726132, ‘master’, ‘refactors everything’, [‘create’, file_path: ‘/foo.txt’, content: ‘bar’]) create_commit(2726132, ‘master’, ‘refactors everything’, [‘delete’, file_path: ‘/foo.txt’])

Parameters:

  • url (String)
    • a git url

  • branch (String)

    the branch name you wish to commit to

  • message (String)

    the commit message

  • An (Array[Hash])

    array of action hashes to commit as a batch. See the next table for what attributes it can take.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :author_email (String)

    the email address of the author

  • :author_name (String)

    the name of the author

Returns:

  • (Gitlab::ObjectifiedHash)

    hash of commit related data

Raises:

  • (NotImplementedError)


81
82
83
# File 'lib/release_manager/vcs_manager/vcs_adapter.rb', line 81

def vcs_create_commit(url, branch, message, actions, options={})
  raise NotImplementedError
end