I am going to do this using the Presentations Application. You have a rather special case because you are using even divisions with uneven intervals. Another possibility would be to have two legend scales, one for a larger range and one for close lying values.
It is easier to do this with a ContourPlot because the ticks will naturally go with the contour divisions. One of the commands in Presentations is the ColorFunction ContourColors. This uses distinct colors for each contour interval even though some may be close lying in value and others encompass a wide range. However, in the following the underlying intervals are evenly spaced so ContourColors is not doing much. It would be more useful in an actural contour plot.
Finally, I'm using CustomTicks to relabel the ticks values according to your values.
<< Presentations`
tickTable =
MapThread[{#1, #2} &, {Range[0, 10, 1],
Table[Rescale[i, {0, 10}, {-2., 30.}], {i, 0, 10}]}];
contours = Range[0, 10, 1] // N;
yticks = CustomTicks[Identity, databased[tickTable]];
legend1 =
Draw2D[
{ContourDraw[y, {x, 0, 1}, {y, First[contours], Last[contours]},
Contours -> contours,
ColorFunction ->
ContourColors[contours, ColorData["Rainbow"][#] &],
ColorFunctionScaling -> False,
PlotPoints -> 51]},
AspectRatio -> Automatic,
PlotRange -> {{0, 1}, {First[contours], Last[contours]}},
Frame -> True,
FrameTicks -> {None, yticks, None, None},
ImagePadding -> {{25, 2}, {5, 5}},
ImageSize -> {50, 200}]
Unfortunately, after all my work I am not allowed to post the image!
Well, now I can so here is the image - I hope.

Table[{i+1,...
in your definition ofticks
toTable[{i+1/2 ...
or toTable[{i+3/2...
. $\endgroup$ – kglr Jan 24 '13 at 10:27