For the roast shoulder of lamb, preheat the oven to 170C/325F/Gas 3.
Rub the shoulder of lamb all over with the olive oil, then season with salt and freshly ground black pepper.
Make small incisions all over the shoulder of lamb using a sharp knife. Push a piece of rosemary into each incision.
Arrange the slices of lemon and red onion in the bottom of a deep sided roasting tin. Place the shoulder of lamb on top and cover with aluminium foil.
Roast the lamb in the oven for 3-4 hours, basting every hour or so with the juices in the roasting tray. After two hours, remove the aluminium foil and continue to cook until the meat is very tender and falling off of the bone.
Remove the lamb from the tray and set aside to rest.
Place the roasting tray over a medium heat, pour in the red wine to deglaze and simmer until the volume of liquid has reduced by half, stirring well and scraping up any browned bits from the bottom of the pan using a wooden spoon.
Whisk in the flour and simmer the mixture for 1-2 minutes, then add the stock and cook for a further 2-3 minutes.
Strain the gravy mixture through a fine sieve into a clean saucepan then season, to taste, with salt and freshly ground black pepper.
Meanwhile, for the roasted ratatouille, increase the oven temperature to 190C/375F/Gas 5.
Mix the aubergine, patty pan courgettes, onion, red peppers and garlic together in a bowl until well combined. Season, to taste, with salt and freshly ground black pepper.
Transfer the mixture to a clean roasting tray and roast in the oven for 25-35 minutes, or until the vegetables are tender and lightly browned.
Remove the roasted ratatouille from the oven and stir in the basil leaves.
To serve, divide the vegetables among 4-6 serving plates, piling them into the centre of each plate. Tear or slice large pieces of the lamb shoulder from the bone and place them on top of the roasted ratatouille. Drizzle over the gravy.