Using and Mastering Cookiecutter Transcripts
Chapter: Creating Cookiecutter templates
Lecture: Demo: Dependent values

Login or purchase this course to watch this video and the rest of the course contents.
0:01 So we've seen that the prompts come from cookiecutter.json,
0:04 and cookicutter.json as the json extension would indicate, seems very static,
0:10 like if it was cookiecutter.js well, maybe we put a whole bunch
0:15 of conditionals and things like that, but just a json file,
0:19 that indicates static values, so let's run this Cokiecutter template cookiecutter-template,
0:25 that's right, it's a meta cookiecutter-template,
0:27 this is the one that we can use actually to create other Cookiecutters,
0:30 I just want to look at a question it asks, so let's run this,
0:33 and it says great, what's your name,
0:37 my name is Michael, here is my email address,
0:39 my username "this will be the funnest project template evah'",
0:49 So if we say this, watch what the next prompt is.
0:52 Cookiecutter-the-funnest-project-evah, now I think that little dash
0:57 might be causing me trouble but let's go and give it a shot anyway.
1:00 The important thing to notice is look it took this value,
1:03 that I entered here and it didn't just clone it,
1:06 it actually did something interesting here, it turned it into what is called a slug,
1:10 or project slug, it basically lower cased it, there is probably a bug in it,
1:14 should remove quotes and things like that, a punctuation,
1:17 and in here it put little dashes, right, so this is a good directory name
1:22 besides that little quote that got on the end, so we can keep going with this
1:26 and we just pick the defaults here, notice another thing,
1:28 look at that, that is actually today, right, that's the day that I am recording this.
1:34 This value changes if I run this tomorrow it will say 2017, 03 10.
1:40 That's really cool, and the version oh no, this is a very advanced template,
1:43 it's there, do you want to copy the hooks- no, don't worry about the details here,
1:48 yeah, I don't think it can take this dash, but I suppose I did it right,
1:53 it would also generate a thing that we could start,
1:56 so instead of one we did in a previous video with the bare template,
1:59 we can start from this one, we'll come back to this,
2:01 the important thing here is that we entered the value here, and it worked there,
2:05 and we also have time that is live here so these are two separate concepts
2:11 the first one we'e going to focus on is how did this happen,
2:14 so let's go over here and we'll say cd that, right, now if we look in here,
2:21 we'll see a couple of things, let's just look at this cookiecuter.json,
2:25 so check this out, this is the one where I typed the the funnest project evah,
2:32 and down here, look what's in here, we have cookiecutter-and then we have,
2:38 I'll go and just wrap it for you, obviously, that doesn't make any sense,
2:41 but we have cookiecutter-{{ that's a Jinja expression,
2:46 and here that relates back to that, right, and then we'e doing additional processing,
2:50 lower replace cookiecutter strip replace spaces with this,
2:54 I think we could do a little bit more work, we could add our dash or quotes,
3:00 or things like that, punctuation we can get that out of here,
3:03 that would be no problem, we'll just add it on this,
3:07 so these values here they can actually be live Jinja expressions
3:11 and the value available to them, basically all the values,
3:16 all the questions that have been asked or prompts
3:19 that have been run previously are available,
3:21 in this case, particularly we're interested in project_name.
3:24 The other thing that's cool is, down here released it we have % now.
3:30 Okay what is % now, we'll come back and figure out what that is in a little bit.