Using and Mastering Cookiecutter Transcripts
Chapter: Programmatic Cookiecutter: Using the API
Lecture: Introducing the game maker
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
For this programmatic Cookiecutter demo throuhgout this chapter, we're going to try to do something fun here,
0:06
I am going to create an application called "game_maker", and this "game_maker" can make three types of games,
0:11
it can make pong, it can make Tic-tac-toe, it can make Hi-Lo, guess the number, it's too high, too low, that game.
0:18
So what we're going to do is we are going to start with the template, and we are going to write a program
0:23
that wraps up the project creation and of course, leverages Cookicutter in the internals to do so,
0:29
but it's going to have a custom experience, for the user, okay. Now, first thing we want to do is I want to start with the template,
0:35
I am going to just paste that in here, and it's called "cookiecutter-use-api", not a super creative name, but that is what I am calling it.
0:43
Now, notice over here in the template this is a cookiecutter thing, we have a hook we have a post generation hook, we have a name, we have three games,
0:52
we have Hi-Lo, we have pong, we have a readme that tells you what kind of game you've created, things like that,
0:57
really, it's just a demo but you know, people can play the game if they want. Right, so the idea is we are going to have our game maker,
1:04
and we are going to have this thing here, which I am going to need the path to in just a moment,
1:09
and, we are going to basically ask the necessary questions that would otherwise be asked here, by Cookiecutter itself
1:15
and we're going to use that to create the project, but before we do, let's just see what would happen
1:20
if I ran this directly, so if I say cookiecutter and I give it the whole URL there, it's going to run, it says what is the name of my game,
1:26
okay my_game, my name, I am going to pick let's say hilo, boom, great, so that was kind of an okay experience,
1:33
it didn't really tell me what kind of game it was going to be or it didn't explain a lot about what Cookiecutter use APIs about,
1:40
but technically, if I look here I do have a game, and I can even go into my game maybe I should have put that in source,
1:47
huh, I'll move, actually no, I want it right here, so I can come down here, I could even play my game, if you want, so that's pretty cool,
1:54
hey, my name is Michael, 3, 50, too low, 75 wow how was that for some luck awesome, so we played the game we created, but we can do better
2:05
if we wrap this API and just use this as the kernel to create the game itself.