Closed homebysix closed 9 years ago
Hmmm. I'm not sure.
If this were OOP, there would be some kind of manager class in charge of telling the recipe classes what to do. But it would have no idea of whether a recipe could or could not proceed. That task would be hidden within the recipe.
That said, we could create a recipe generator class that included some base validation code that each sub-recipe type could inherit from and override to add facts specific to their domain. And that would keep redundancy down.
TBH, I think the current approach is decent:
generate_recipes()
function that determines whether we have the basic information needed to produce any recipes at all (app name, how to download the app).generate_pkg_recipe()
that determine whether we have the information needed to produce a certain type of recipe. For a pkg recipe, that would include the bundle identifier.So I'm unconvinced that we need a fact_validator()
.
The only thing that's currently not working is this: #44.
Right now the
generate_recipes()
function and variousgenerate_x_recipe()
functions individually determine whether they can proceed, given the info in thefacts
dict. It might be more efficient to have a singlefact_validator()
function that centrally determines which recipes can be built and which should be skipped.