Skip to content

Commit

Permalink
DRY'd up instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
timcharper committed Aug 13, 2009
1 parent 38f5f2d commit 38c1d5f
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions git-cleanup-branches
Expand Up @@ -9,11 +9,8 @@ EDITOR=ENV['EDITOR'] || 'vim'
class GitCleanBranchesRunner
module CandidateState
module ConsiderAll
def instructions
<<-EOF
# The following is a list of all local and remote branches in your repository
# To delete the branches, delete them from this list, and then save and quit
EOF
def candidate_instructions
"# The following is a list of all local and remote branches in your repository"
end

def branch_candidates
Expand All @@ -34,11 +31,8 @@ class GitCleanBranchesRunner
)
end

def instructions
<<-EOF
# The following branches have been merged in to refs/remotes/origin/#{stable_branch}
# To delete the branches, delete them from this list, and then save and quit
EOF
def candidate_instructions
"# The following branches have been merged in to refs/remotes/origin/#{stable_branch}"
end
end
end
Expand Down Expand Up @@ -80,7 +74,7 @@ class GitCleanBranchesRunner
end.compact
end

def instructions
def candidate_instructions
raise NotImplemented
end

Expand All @@ -90,7 +84,8 @@ class GitCleanBranchesRunner

def edit_branch_list
file = Tempfile.new("cleanup-branch")
file.puts instructions
file.puts candidate_instructions
file.puts "# To delete the branches, delete them from this list, and then save and quit"
file.puts(branch_candidates * "\n")
file.close
system("#{EDITOR} #{file.path}")
Expand Down

0 comments on commit 38c1d5f

Please sign in to comment.