-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathchapter-14.srt
275 lines (213 loc) · 5.08 KB
/
chapter-14.srt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
1
00:00:00,000 --> 00:00:04,000
Chapter 14.
Using FakeMake to build the sample project.
2
00:00:04,331 --> 00:00:06,091
TS: So where does that get us to?
3
00:00:06,114 --> 00:00:11,977
JC: Well if we go back to the
original example that we were given,
4
00:00:11,970 --> 00:00:14,720
There was that script that I
was hacking around with,
5
00:00:14,736 --> 00:00:21,970
trying to figure out what the
user interface to this should be.
6
00:00:21,977 --> 00:00:27,280
So this will now be lib/fakemake.
7
00:00:27,668 --> 00:00:32,571
[Silence]
8
00:00:32,570 --> 00:00:39,577
Now... With the target... there's two source files.
9
00:00:39,570 --> 00:00:43,188
I will need the target for both of those.
10
00:00:43,180 --> 00:00:46,982
These are in the namespace now.
11
00:00:47,120 --> 00:00:54,617
[Silence]
12
00:00:55,000 --> 00:00:59,554
Was it complimenter? TS: Yes.
13
00:00:59,725 --> 00:01:07,325
[Silence]
14
00:01:07,600 --> 00:01:11,714
JC: OK, so those are two targets with
no dependencies and no build instructions.
15
00:01:11,760 --> 00:01:22,971
They have hello.js. Which is derived
from hello.coffee and you build that.
16
00:01:23,370 --> 00:01:28,011
We could make a target for the lib directory,
I am not sure if I'll go through extracting that.
17
00:01:28,020 --> 00:01:30,491
Or maybe I will... Yes.
18
00:01:30,490 --> 00:01:32,994
Lib is erh.......
19
00:01:34,240 --> 00:01:38,982
Actually, directories do have mtimes.
20
00:01:40,605 --> 00:01:49,885
Yeah, target new example lib;
which has no dependencies.
21
00:01:49,942 --> 00:01:56,994
annd is built by calling make dir p example lib.
22
00:01:58,210 --> 00:02:01,085
Which means you can remove that.
23
00:02:05,428 --> 00:02:09,931
Which means that goes that way.
24
00:02:11,360 --> 00:02:15,188
Let's clone that rather than...
25
00:02:15,440 --> 00:02:21,440
[Silence]
26
00:02:21,680 --> 00:02:26,217
So complimenter.js depends on that.
27
00:02:26,262 --> 00:02:30,930
Let's do that one and then...
28
00:02:31,490 --> 00:02:38,994
So complimenter.js depends on
complimenter.coffee. That all looks OK.
29
00:02:39,490 --> 00:02:49,005
And bundle.js depends on two JavaScript files and
you build it by calling that and then you build it.
30
00:02:49,108 --> 00:02:52,411
OK so...
31
00:02:54,480 --> 00:02:57,980
This was in scratch/test.rb.
32
00:03:00,182 --> 00:03:08,765
As always, let's remove
everything that we had before.
33
00:03:09,074 --> 00:03:12,068
The tree just has the source code in it.
34
00:03:12,148 --> 00:03:15,668
If we run ruby scratch test.
35
00:03:15,965 --> 00:03:20,034
Uninitialized constant target.
Oh, I didn't namespace everything did I?
36
00:03:20,148 --> 00:03:31,760
[Silence]
37
00:03:32,457 --> 00:03:36,777
It's run everything. And
we've got everything in there.
38
00:03:36,811 --> 00:03:44,068
And example bundle contains
the code that we wanted.
39
00:03:44,060 --> 00:03:50,194
If we run it again, because we've
made it lazy enough, it should happen.
40
00:03:50,262 --> 00:03:54,228
And indeed nothing happens.
41
00:03:54,285 --> 00:03:57,714
Because we've made it this recursive structure...
42
00:03:57,771 --> 00:04:01,531
If anything does need rebuilding it
should rebuild it but not rebuild everything.
43
00:04:01,702 --> 00:04:09,690
So if I use touch, which just sets the mtime on a
file to now, and creates it if it's not there.
44
00:04:10,297 --> 00:04:19,130
If I touch example lib hello.js.
Or rather, let's touch hello.coffee. Sorry.
45
00:04:19,302 --> 00:04:23,291
TS: So this is simulating you having edited it?
46
00:04:23,337 --> 00:04:28,297
JC: Yes. So if I touch that. Hello.js is now
up to date. The complimenter.js isn't.
47
00:04:28,290 --> 00:04:32,125
So this should run the coffee
compiler once and then run uglify.
48
00:04:32,120 --> 00:04:36,491
Because the whole bundle is out of date
as well, because you changed the source file.
49
00:04:36,525 --> 00:04:40,270
So it should recompile what needs
to be recompiled but only those files.
50
00:04:40,331 --> 00:04:42,228
TS: OK.
51
00:04:42,220 --> 00:04:48,537
JC: And we see there that it has run coffee
once on hello.coffee. but not on complimenter.
52
00:04:48,530 --> 00:04:50,251
JC: So that seems to be doing what we want.
53
00:04:50,285 --> 00:04:53,800
I'm just going to check because
I haven't revisited this file in a while,
54
00:04:53,850 --> 00:04:59,360
that it is the changes we made that made it do this.
55
00:05:01,417 --> 00:05:11,828
If I delete this line, then it should become
unlazy. It should do all the work every time.
56
00:05:11,820 --> 00:05:16,080
It does, you can see it churning away there.
57
00:05:16,377 --> 00:05:20,468
I'll reinstate that line, and it becomes lazy again.
58
00:05:20,460 --> 00:05:21,154
TS: Excellent.
59
00:05:21,150 --> 00:05:22,880
JC: So that seems to do what we want.
60
00:05:23,150 --> 00:05:27,200
TS: That's great. Well congratulations
on getting it working, that's really good.
61
00:05:27,200 --> 00:05:32,137
That seems like a good place for us to stop.
Thanks very much, I've really enjoyed this.
62
00:05:32,130 --> 00:05:33,565
JC: Me too, thanks Tom.