Class: CIJoePassenger::Git
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- CIJoePassenger::Git
- Includes:
- Thor::Actions
- Defined in:
- lib/cijoe_passenger/git.rb
Instance Method Summary collapse
- #add_config_to_repo(key, value) ⇒ Object
- #clone(url) ⇒ Object
- #current_head ⇒ Object
- #git_path ⇒ Object
- #ls_remote_origin_master ⇒ Object
- #repo? ⇒ Boolean
- #upstream_head ⇒ Object
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_head ⇒ Object
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_path ⇒ Object
8 9 10 |
# File 'lib/cijoe_passenger/git.rb', line 8 def git_path File.join(name, '.git') end |
#ls_remote_origin_master ⇒ Object
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
12 13 14 |
# File 'lib/cijoe_passenger/git.rb', line 12 def repo? File.exist?(git_path) end |
#upstream_head ⇒ Object
24 25 26 |
# File 'lib/cijoe_passenger/git.rb', line 24 def upstream_head ls_remote_origin_master.split(' ').first end |