Class: Gsbb

Inherits:
Thor
  • Object
show all
Defined in:
lib/gsbb.rb,
lib/gsbb/version.rb

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Instance Method Details

#emailObject



46
47
48
49
50
# File 'lib/gsbb.rb', line 46

def email
  stale_branches.each do |branch|
    puts branch.commit.to_hash['committer']['email'] # win!
  end
end

#pruneObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/gsbb.rb', line 29

def prune
  puts "Pruning:"
  stale_branches.each do |branch|
    name = branch.name.split("/").last

    # Grit breaks here:
    # puts repo.git.native(:push, {:raise => true}, "origin :#{name}")

    puts `git push origin :#{name}`

    if repo.heads.map(&:name).include?(name)
      puts `git branch -D #{name}`
    end
  end
end

#showObject



21
22
23
24
25
26
# File 'lib/gsbb.rb', line 21

def show
  puts "Stale Branches:"
  stale_branches.each do |branch|
    puts "#{branch.name} - #{branch.commit.author}, #{(Date.today - branch.commit.authored_date.to_date).to_i} days old - #{branch.commit.authored_date.to_date}"
  end
end