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,
0:05
we're going to try to do something fun here, I am going to create an application called "game_maker",
0:08
and this "game_maker" can make three types of games,
0:10
it can make pong, it can make Tic-tac-toe, it can make Hi-Lo,
0:14
guess the number, it's too high, too low, that game.
0:17
So what we're going to do is we are going to start with the template,
0:20
and we are going to write a program
0:22
that wraps up the project creation and of course,
0:25
leverages Cookicutter in the internals to do so,
0:28
but it's going to have a custom experience, for the user, okay.
0:31
Now, first thing we want to do is I want to start with the template,
0:34
I am going to just paste that in here, and it's called
0:37
"cookiecutter-use-api", not a super creative name,
0:40
but that is what I am calling it.
0:42
Now, notice over here in the template this is a cookiecutter thing,
0:45
we have a hook we have a post generation hook,
0:48
we have a name, we have three games,
0:51
we have Hi-Lo, we have pong, we have a readme
0:53
that tells you what kind of game you've created, things like that,
0:56
really, it's just a demo but you know, people can play the game if they want.
0:59
Right, so the idea is we are going to have our game maker,
1:03
and we are going to have this thing here,
1:05
which I am going to need the path to in just a moment,
1:08
and, we are going to basically ask the necessary questions
1:10
that would otherwise be asked here, by Cookiecutter itself
1:14
and we're going to use that to create the project,
1:16
but before we do, let's just see what would happen
1:19
if I ran this directly, so if I say cookiecutter and I give it the whole URL there,
1:23
it's going to run, it says what is the name of my game,
1:25
okay my_game, my name, I am going to pick let's say hilo,
1:29
boom, great, so that was kind of an okay experience,
1:32
it didn't really tell me what kind of game it was going to be
1:35
or it didn't explain a lot about what Cookiecutter use APIs about,
1:39
but technically, if I look here I do have a game,
1:42
and I can even go into my game maybe I should have put that in source,
1:46
huh, I'll move, actually no, I want it right here, so I can come down here,
1:49
I could even play my game, if you want, so that's pretty cool,
1:53
hey, my name is Michael, 3, 50, too low, 75 wow
1:59
how was that for some luck awesome,
2:02
so we played the game we created, but we can do better
2:04
if we wrap this API and just use this as the kernel to create the game itself.