You would build your first depot in the corner then your bunker in the middle and your second depot on the other corner like so:
This is the most typical wall off because it is the fastest. If your enemy is doing a super early attack such as a 6 pool you can have it up in time with only minor cutting of workers (based off your scouting info).
Later game you can then move your barracks to a more central location if you wish or if the ramp placement prevents add ons. If you wish to maintain the wall off you can easily replace it with another depot.
If you suspect there will be an early one base push you can move the rax to build a bunker in it's place, this will make you safe from most attacks with a few scvs repairing behind.
This kind of wall off is the most commonly used simply because it's the fastest standard way to get one down. In most cases it will be fine to do this in every game. However note that it is less likely to be useful against Terran and Protoss as a wall off to them provides them with a safe way to poke at your buildings. So if your apm isn't high enough to handle ramp harass on your wall off I would suggest you don't do it against Protoss and Terran.
Another similar wall off is a barracks and a depot at the bottom of the ramp. However this has been removed with the introduction of the rocks that render the bottom of the ramp unbuildable but still pathable.