Sha256: fe9de727ecdcac24373a9c17d908e5277dbaeda8187bfc1970276b1671d21e32

Contents?: true

Size: 1009 Bytes

Versions: 8

Compression:

Stored size: 1009 Bytes

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

8 entries across 8 versions & 1 rubygems

Version Path
my_help-1.2.5 lib/my_help/git_cli.rb
my_help-1.2.4p1 lib/my_help/git_cli.rb
my_help-1.2.4 lib/my_help/git_cli.rb
my_help-1.2.3 lib/my_help/git_cli.rb
my_help-1.2.2 lib/my_help/git_cli.rb
my_help-1.2 lib/my_help/git_cli.rb
my_help-1.1a lib/my_help/git_cli.rb
my_help-1.1 lib/my_help/git_cli.rb