Sha256: 6e279fe15b4cd53d8b092327f872aa59ad850668c48b8ee5ab1481190ca3280e
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
class GitCleanup class Branch include Comparable def self.remote(repo) repo.remotes.map { |r| new(repo, r) } end attr_reader :remote, :name, :ref def initialize(repo, ref) @repo = repo @ref = ref @remote, @name = ref.name.split('/') end def to_s "#{remote}/#{name}" end def diff(ref) @repo.git.native(:diff, {}, "#{ref.commit.sha}...#{@ref.commit.sha}") end def commit @ref.commit end def delete(local_branches = nil) puts "Deleting..." @repo.git.native(:push, {}, @remote, ":#{@name}") puts "Done" if local_branches && local_branches.include?(name) Helper.boolean "There is also a local branch called #{name}. Would you like to delete that too?" do puts "Deleting..." @repo.git.native(:branch, {}, '-d', name) puts "Done" end end end def <=>(other) commit.committed_date <=> other.commit.committed_date end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git-cleanup-0.1.1 | lib/git-cleanup/branch.rb |
git-cleanup-0.1.0 | lib/git-cleanup/branch.rb |