Sha256: c66e465043461468a1b0ab5f7f5eb0e45a0aaa3841a7da4b8aa1963a7ccc7849

Contents?: true

Size: 701 Bytes

Versions: 1

Compression:

Stored size: 701 Bytes

Contents

module Toothpick
  class Git

    attr_reader :git_dir

    def self.clone_repo(repo, target_dir)
      system("git clone #{repo} #{target_dir}")
    end

    def self.on_git?(dir)
      return system("cd #{dir} && git rev-parse --git-dir")
    end

    def initialize(git_dir)
      @git_dir = git_dir
    end

    def update
      system("cd #{git_dir} && git pull --rebase")
    end

    def commit
      system("cd #{git_dir} "\
        "&& git add --all "\
        "&& git commit -m '#{make_commit_message}'")
    end

    def make_commit_message
      "Added pick by #{ENV['USER']} on #{Time.now}"
    end

    def push
      system("cd #{git_dir} && git push origin master")
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
toothpick-0.0.2 lib/toothpick/git.rb