puppetlabs/packaging — pull request #281 by mckern (2014-03-25 08:57:01+00:00)
Title: Who loves prompts?

## I love prompts!

This pull request might not be quite ready for prime time (read: merging), but I wanted to get this out of my head and into code while it was still fresh. My hope is that this opens up some conversation (or at least review) around some rounding of a few of the sharper edges in our shipping process.

### Backstory

After the disastrously long time that the comedy of errors known as "Ryan tries to ship Puppet 3.5.0-rc2" wrapped up last night, I thought "I'd really appreciate it if the packaging repo yelled at me a little more, or at least was a little bit clearer when I'm shipping from the wrong branch".

To that end, I've added some helper methods to Pkg::Util::Version, such as:

Pkg::Util::Version.git_branch

return the name of the branch you're on, or "HEAD" when you're in a detached state

`Pkg::Util::Version.git_master?`

returns true if you're on master, otherwise false

`Pkg::Util::Version.git_stable?`

returns true if you're on stable, otherwise false

`Pkg::Util::Version.git_detached?`

returns true if you're in a detached HEAD state, otherwise false

There's some repetition in here that can probably be refactored and these aren't very flexible if you're not in a repo that uses a master/stable branching strategy but there's definitely some room for metaprogramming method_missing magic.

## Didn't you something about prompts? You definitely said something about prompts.

Indeed I did, indeed I did! I've added a new submodule called Pkg::Util::Prompts and I've moved (well, copied) some old utility methods from `00_utils.rb` into there while adding a couple of new prompts in the process. I also added a more verbose prompt to `ask_yes_or_no` so that the expected input is a little clearer.

### Disclaimer: caveat lector
I'm very tired, and it's very late. If there's egregious typos or blatant code hash then I'll review and revise in the morning after I've squeezed off a couple hours of sleep.