Class: MyHelp::Git

Inherits:
Thor
  • Object
show all
Includes:
GetConfig
Defined in:
lib/my_help/git_cli.rb

Instance Method Summary collapse

Methods included from GetConfig

#get_config

Instance Method Details

#pullObject



15
16
17
18
19
20
21
22
23
# File 'lib/my_help/git_cli.rb', line 15

def pull
  puts "called my_help git pull"
  config = get_config
  help_dir = config[:local_help_dir]
  puts "on the target git directory : %s" % help_dir
  Dir.chdir(help_dir) do
    system "git pull origin main"
  end
end

#pushObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/my_help/git_cli.rb', line 27

def push
  puts "called my_help git push"
  config = get_config
  help_dir = config[:local_help_dir]
  puts "on the target git directory : %s" % help_dir
  Dir.chdir(help_dir) do
    system "git add -A"
    system "git commit -m 'auto commit from my_help'"
    system "git pull origin main"
    system "git push origin main"
  end
end