Sha256: b0d73284df5e4e84e106b5ffd837388d1101a2f9f51306ae78638e584842e436

Contents?: true

Size: 1.02 KB

Versions: 4

Compression:

Stored size: 1.02 KB

Contents

module MyHelp
  module GetConfig
    def get_config #(args)
      parent_help_dir = options["help_dir"] || ""
      parent_help_dir = ENV["HOME"] unless File.exist?(parent_help_dir)
      # Forget necessity of these 
      return Config.new(parent_help_dir)
    end
  end

  class Git < Thor
    include MyHelp::GetConfig

    desc "pull", "pull my helps"

    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

    desc "push", "push my helps"

    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
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
my_help-1.2.9 lib/my_help/git_cli.rb
my_help-1.2.8 lib/my_help/git_cli.rb
my_help-1.2.7 lib/my_help/git_cli.rb
my_help-1.2.6 lib/my_help/git_cli.rb