Gauge theories in mechanics