Class: CIJoePassenger::Git

Inherits:
Thor::Group
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/cijoe_passenger/git.rb

Instance Method Summary collapse

Instance Method Details

#add_config_to_repo(key, value) ⇒ Object



40
41
42
43
44
# File 'lib/cijoe_passenger/git.rb', line 40

def add_config_to_repo(key, value)
  inside(name) do
    run "git config --add \"#{key}\" \"#{value}\""
  end
end

#clone(url) ⇒ Object



36
37
38
# File 'lib/cijoe_passenger/git.rb', line 36

def clone(url)
  run "git clone #{url} #{name}"
end

#current_headObject



28
29
30
31
32
33
34
# File 'lib/cijoe_passenger/git.rb', line 28

def current_head
  res = ''
  inside(git_path) do
    res = run("cat #{File.join('refs', 'heads', 'master')}")
  end
  res.chop
end

#git_pathObject



8
9
10
# File 'lib/cijoe_passenger/git.rb', line 8

def git_path
  File.join(name, '.git')
end

#ls_remote_origin_masterObject



16
17
18
19
20
21
22
# File 'lib/cijoe_passenger/git.rb', line 16

def ls_remote_origin_master
  res = ''
  inside(name) do
    res = run("git ls-remote origin master")
  end
  res
end

#repo?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/cijoe_passenger/git.rb', line 12

def repo?
  File.exist?(git_path)
end

#upstream_headObject



24
25
26
# File 'lib/cijoe_passenger/git.rb', line 24

def upstream_head
  ls_remote_origin_master.split(' ').first
end