A framework to assess the resilience of farming systems