Class: AuPair::Github

Inherits:
Object
  • Object
show all
Defined in:
lib/au_pair/github.rb

Constant Summary collapse

BASEURL =
"https://github.com"

Instance Method Summary collapse

Instance Method Details

#add_remote(name:, username:, repo:) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/au_pair/github.rb', line 5

def add_remote(name:, username:, repo:)
  repo_url = "#{BASEURL}/#{username}/#{repo}.git"
  if has_remote?(name)
    `git remote remove #{name}`
  end
  `git remote add #{name} #{repo_url}`
end

#has_remote?(name) ⇒ Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/au_pair/github.rb', line 13

def has_remote?(name)
  !!(remotes =~ /^#{name}\s/)
end

#remotesObject



17
18
19
# File 'lib/au_pair/github.rb', line 17

def remotes
  `git remote -v`
end