Sha256: 3c8d44db09fc040ca4d3643950a732f6ca162c777dde115618fdb0d61fa4e971

Contents?: true

Size: 704 Bytes

Versions: 1

Compression:

Stored size: 704 Bytes

Contents

module GitFonky
  class Command
    attr_reader :repo_dir

    def initialize(repo_dir)
      @repo_dir = repo_dir
    end

    def current_branch
      `git branch --show-current`.strip
    end

    def fetch_upstream
      announce("fetching")
      `git fetch upstream #{repo_dir.branch} 2>&1`
    end

    def pull_upstream
      announce("pulling")
      `git pull upstream #{repo_dir.branch} 2>&1`
    end

    def push_to_origin
      announce("pushing", "to", "origin")
      `git push origin #{repo_dir.branch} 2>&1`
    end

    private

    def announce(action, direction = "from", remote = "upstream")
      puts "-----> #{action} #{direction} #{remote} #{repo_dir.branch}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
git_fonky-0.3.0 lib/git_fonky/command.rb