Commit | Line | Data |
01dfb279 |
1 | 15:36 <t0m> right. so the first thing to do is probably write a test to check |
2 | generating an application doesn't change. |
3 | 15:37 <dhoss> per app? |
4 | 15:38 <t0m> no, I mean whilst you're ripping ::Helper apart. |
5 | 15:38 <dhoss> OH |
6 | 15:38 <dhoss> gotcha |
7 | 15:38 <t0m> if you install your branch.. Then catalyst.pl t/TestAppForComparison |
8 | 15:39 <dhoss> so we have the same results now as before, yes? |
9 | 15:39 <t0m> then you write a test which says catalyst.pl /tmp/TempTestApp; my |
10 | $diff = `diff -urN t/TestAppForComparison /tmp/TempTestApp`; ok |
11 | !length($diff) or warn $diff; |
12 | 15:40 <t0m> exactly. and that'll test you rip all of the files out of Helper.pm |
13 | correctly.. |
14 | 15:40 <dhoss> okay, TestAppForComparison created. i'll commit that initial |
15 | version |
16 | 15:40 <t0m> you'll probably want to nuke it after that, as testing the |
17 | generated strings of an entire app dir is gonna be a PITA |
18 | 15:41 <t0m> to maintain |
19 | 15:41 <dhoss> i could see that |
20 | 15:41 <t0m> But it's totally the right solution whilst you're trying to rip |
21 | stuff out without changing it |
22 | 15:41 <dhoss> temp testing :-D |
23 | 15:44 <t0m> I've got some ideas on doing better testing that the TestApp we |
24 | generate is good. |
25 | 15:44 <t0m> but they're a bit more involved, and not needed for this at all ;) |
26 | 15:45 <dhoss> this being this refactor, or this bit of the refactor? |
27 | 15:45 <t0m> the latter. |
28 | 15:45 <dhoss> okay - got it |
29 | 15:46 <t0m> and once this is done - you can branch again to work on the code, |
30 | and again to work on the generated app templates (as we'll want to |
31 | moosify those, so your app is moosetastic by default |
32 | 15:46 <t0m> and as it's all in different files - you can do both in parallel as |
33 | you feel like and safely merge back |
34 | 15:47 <t0m> did you get to grips with MX::GetOpt and do you have a plan for |
35 | that yet? |
36 | 15:48 <dhoss> so one branch for helper_refactor, one for code (which code?), |
37 | and one for app templates |
38 | 15:48 <t0m> As I guess catalyst.pl should be taught to use it, and so should |
39 | the generated scripts :) |
40 | 15:48 <dhoss> i've been playing with MX::GetOpt, i need a few more details on |
41 | what exactly needs to be beat up |
42 | 15:48 <t0m> yy, but you branch from completed helper_refactor :) |
43 | 15:49 <t0m> and 'code' is the actual refactor / api changes for helpers |
44 | 15:49 <t0m> bletch |
45 | 15:50 <dhoss> okay, so the 'code' branch will be simply the C::H code branched |
46 | from helper_refactor |
47 | 15:50 <t0m> get_file has to keep working as everything using ::Helper needs it |
48 | 15:50 <t0m> yes, exactly. |
49 | 15:51 <t0m> so you need to make a get_file_from_sharedir function or something |
50 | 15:51 <dhoss> okay, making sense now :-) |
51 | 15:51 <t0m> and change things over to use that. |
52 | 15:51 <t0m> that's fine though - means you can extract 1 file at a time |
53 | 15:52 <dhoss> which would be better, no? better atomicity and for testing |
54 | 15:52 <t0m> yy |
55 | 15:52 <t0m> bletch was at the fact that 'get_file' is a good method name, and |
56 | it's now deprecated |
57 | 15:53 <dhoss> is that in C::H? |
58 | 15:53 <t0m> yy |
59 | 15:53 * dhoss is a little behind in my api knowledge |
60 | 15:53 <dhoss> off the top of my head at least |
61 | 15:53 <t0m> it's the 'get me a file out the <DATA> section' method |
62 | 15:53 <dhoss> aha right |
63 | 15:54 <t0m> which you're replacing in favour of 'get me a file out of the share |
64 | dir' |
65 | 15:54 <t0m> and 'copy file out of sharedir' methods. |
66 | 15:54 <t0m> The former for templates |
67 | 15:54 <t0m> the latter for binaries, which gets rid of the hateful decoding and |
68 | writing out business |
69 | 15:54 <dhoss> get -> we're going to interpolate shit, copy -> we're giong to |
70 | use directly? |
71 | 15:55 <t0m> just so |
72 | 15:55 <t0m> eliminating the 'please turn this giant hex string back into |
73 | binary' thing |
74 | 15:55 <dhoss> definitely :-P |
75 | 16:00 <t0m> sub _mk_favicon { |
76 | 16:00 <t0m> my ( $self ) = @_; |
77 | 16:00 <t0m> $self->copy_share_file( |
78 | 16:00 <t0m> File::Spec->catfile( ( caller(0) )[0], 'favicon.ico' ), |
79 | 16:00 <t0m> File::Spec->catfile( $self->{root}, "favicon.ico" ) |
80 | 16:00 <t0m> ); |
81 | 16:00 <t0m> } |
82 | 16:00 <t0m> sumfin like dat |
83 | 16:01 <dhoss> easy enough |
84 | 16:01 <t0m> the actually, all the caller crap dies too |
85 | 16:02 <dhoss> hrm, i suppose we have to keep the atrocious |
86 | Class::Accessor::Fast method name artifacts? |
87 | 16:02 <t0m> that's to clue get_file what file to borg crap out off |
88 | 16:03 <t0m> I vote that most of them can burn, as we'll be working out what |
89 | shit to copy a lot more dynamically |
90 | 16:03 <t0m> and the ones which can't get deprecated, but preserved. |
91 | 16:04 <dhoss> so that's just for the current get_file, right? |
92 | 16:04 <t0m> yy |
11dbddd9 |
93 | ######################################################################## |
94 | ## done |
95 | 16:04 <t0m> $self->copy_share_file( |
01dfb279 |
96 | 16:04 <t0m> 'favicon.ico', |
97 | 16:04 <t0m> File::Spec->catfile( $self->{root}, "favicon.ico" ) |
98 | 16:04 <t0m> ); |
11dbddd9 |
99 | ######################################################################### |
01dfb279 |
100 | 16:05 <t0m> more like it |
101 | 16:05 <t0m> so we have sub mk_foo { shift->generate_foo(@_); } |
102 | |
c5387711 |
103 | ==== |
104 | 5-28 |
5430247e |
105 | 03:04 < dhoss> SO. official next step: 1) #done trim crap out 2) #done write test for how |
c5387711 |
106 | helpers are invoking Catalyst::Helper 3)??? 4) profit! |
6be0f534 |
107 | 03:05 < t0m> 3)#done Re arrange files in sharedir so we can make the comversion guts |
c5387711 |
108 | totally generic |
109 | 03:05 < t0m> 4) merge&profit |
110 | 03:05 < t0m> *conversion |
111 | 03:05 < dhoss> rearrange meaning mv foo MyApp? |
112 | 03:06 < t0m> erm, yes, as described above, so that the contents of share/ is |
113 | laid out the same as a newly generated MyApp |
114 | 03:06 < dhoss> OH |
115 | 03:06 < dhoss> okay |
116 | 03:06 < dhoss> instead of my current fuckery :-) |
117 | 03:06 < dhoss> autarch: btw if you have an idea for that i'd love an email to |
118 | the one in topic |
119 | 03:06 < t0m> cause then the entire generate application becomes 'copy this |
120 | directory from X => Y, applying some file mangling rules) |
6be0f534 |
121 | |
122 | ============================================================================= |
123 | 04:26 < t0m> dhoss: erm, yeah - so the two things to do is: unit tests for the |
124 | methods like get_file which we're not actually using any more.. |
125 | 04:27 < t0m> (do that by making t/lib/ExampleHelper.pm - copy the TT one from |
126 | CPAN or something, and then write some tests that get_file can |
127 | successfully pull chunks out the __DATA__ segment |
128 | 04:28 < t0m> and rename everything in the sharedir to be named as-per where it |
129 | ends up in your app, but suffixed by .tt or .bin |
130 | 04:29 < t0m> e.g. share/Makefile.PL.tt share/root/favicon.ico.bin |
131 | share/lib/MyApp.pm.tt |
132 | 04:30 < t0m> the exact reasons for this nameing scheme become aparent post |
133 | first merge, when we remove most of the code :) |
134 | 04:30 < t0m> but all of share/ needs to be in it's final resting place pre-merge |
135 | 04:31 < marcus> http://lumberjaph.net/blog/index.php/2009/05/30/catalystxdispatcherasgraph/ # <3 lazyweb |
136 | 04:31 < t0m> so tests the stuff we're no longer using in Helper.pm (e.g. |
137 | get_file) still works. Rename share/ bits |
138 | 04:31 < t0m> marcus: Indeed :) |
139 | 04:31 < t0m> ^^ those two, then first merge. |
9b5ece3f |
140 | 23:36 <@kd> dhoss: just found a bug in ::Devel ... |
141 | 23:36 <@kd> we're using #!/usr/bin/env perl now |
142 | 23:36 <@kd> that means we have to add the use warnings; pragma beneath it |
143 | 23:37 <@kd> that doesn't appear to be happeining in the scripts |
144 | 23:37 <@kd> please fix |
145 | 23:38 <@kd> dhoss: i.e. http://gist.github.com/122081 |
5c330d3c |
146 | ============================================================================== |
99d7d5b9 |
147 | |
148 | # DONE |
5c330d3c |
149 | 1. Rename everything into final layout: |
150 | . tt files all named .tt |
151 | . none tt files all named .bin |
152 | . directory structure as generated, e.g. share/lib/MyApp.pm.tt, share/root/favicon.ico.bin |
153 | |
154 | 2. get new layout working |
155 | |
99d7d5b9 |
156 | |
157 | # DONE |
5c330d3c |
158 | 3. get tests for back compat - i.e. the methods no longer used in Helper.pm like 'get_file' |
159 | . copy Catalyst::Helper::View::TT into t/lib/TestBackCompat.pm |
160 | . write test t/deprecated_methods_backcompat.t which says: |
161 | use FindBin qw/$Bin/; |
162 | use lib "$Bin/lib"; |
163 | use Test::More tests => 1; |
164 | |
165 | my $helper = TestBackCompat->new( %maybe_some_params_here ); |
166 | my $a_section = $helper->get_file('FileName'); |
167 | is $a_section, 'FILECONTENTSFROM__DATA__'; |
168 | |
99d7d5b9 |
169 | 3. RFC - DONE |
5c330d3c |
170 | |
171 | Looking ahead |
172 | |
173 | MooseX::Getopt |
6be0f534 |
174 | |
b87c5403 |
175 | ################################################################################ |
176 | 17:46 < t0m> dhoss: erm, oh, so the _other_ thing I didn't think of |
177 | 17:46 < t0m> Is Cat works on windows |
178 | 17:46 < t0m> I have stuffed loads of "t/foo.t" |
179 | 17:46 < t0m> into strings. |
180 | 17:46 < t0m> which will break win |
181 | 17:47 < t0m> so, all those places where I just "string/append/a/file.name" |
182 | 17:47 < t0m> you need to use Path::Class qw/file/; file(qw/ string append a |
183 | file.name /); |
184 | 17:47 < t0m> like ^^^ |
185 | 17:48 < t0m> then it will still work on win32 |
186 | 17:48 < dhoss> noted |
187 | 17:48 < t0m> There is already File::Spec->catfile |
188 | 17:48 < t0m> which does the same thing |
189 | 17:48 < t0m> but more ugly |
190 | 17:48 < t0m> either/or |
191 | 17:48 < purl> either/or is "public load_first_existing_class" or "load_class |
192 | passes multiple args to load_first_existing_class" |
193 | 17:48 < t0m> don't care... |
194 | 17:49 < t0m> Just "file/name" is BAD |
195 | 17:49 < t0m> and will hate windows users |
196 | |
197 | Summary: |
78b98607 |
198 | 17:43 < dhoss> 1. fix pod coverage, 2. remove TestAppForInvocation 3. ??? # DONE |
199 | 17:43 < t0m> 3. merge # DONE |
b37d9199 |
200 | ################################################################################ |
201 | --- Log opened Wed Jun 17 18:23:06 2009 |
202 | 18:23 -!- Irssi: Starting query in perl with t0m |
203 | 18:23 <t0m> yo. wanna pick my brain affore I crash? |
204 | 18:23 <t0m> I wanna branch, and start hacking local::lib stuff |
205 | 18:23 <t0m> but that'll do a 4am on me again |
206 | 18:24 <dhoss> okay, yes |
207 | 18:25 <dhoss> i stopped after the last thing we talked about, the Moose-ification of Helper.pm. started that but nothing significant |
208 | 18:26 <t0m> no worries. There's at least 2 things you can work on right now obviously |
209 | 18:26 <t0m> one being that |
210 | 18:26 <t0m> one being hacking the generated |
211 | 18:26 <t0m> +code |
212 | 18:26 <t0m> one being tests for the generation stuff |
213 | 18:27 <t0m> at least 2 :) |
214 | 18:27 <dhoss> :-D |
215 | 18:27 <dhoss> lemme check hiveminder |
216 | 18:28 <t0m> but yeah, first 2 can be independent branches. +tests can just go in trunk |
217 | 18:29 <dhoss> so branch again |
218 | 18:29 <dhoss> and work on scripts |
219 | 18:29 <dhoss> which are tasks...hold on |
220 | 18:30 <t0m> and branch again for moosify helper. if you want. I mean work on what you wanna work on - I'm just saying after stage 1, there is a whole spread of stuff to do now |
221 | 18:30 <dhoss> #PYMI,#PYM9? |
222 | 18:30 <dhoss> yea, i'd love to moosify the helper |
223 | 18:30 <t0m> Also, probably not enough todos to cover it - there is removing all the hardcoded filenames... |
224 | 18:31 <t0m> so many stuff. |
225 | 18:31 <t0m> cool, do that then :) |
226 | 18:31 <t0m> then we'll actually refactor/rewrite it |
227 | 18:31 <t0m> so all those _mk_foo things go away |
228 | 18:31 <dhoss> okay, sweet, yea i forgot the about the hardcoded shits |
229 | 18:31 <dhoss> okay, so my famous list: |
230 | 18:31 <t0m> that's going to involve some fun Module::Install hacking ;) |
231 | 18:32 <dhoss> making _mk_blargh go away is? |
232 | 18:32 <t0m> just so |
233 | 18:32 <t0m> oh, sorry - yeah. _mk_favicon |
234 | 18:32 <dhoss> just so == yes? (sorry, my crosspondia lang isn't up to snuff) |
235 | 18:32 <t0m> etc etc etc |
236 | 18:33 <t0m> just so = yes = exactly like you descibed but I misread what you said. |
237 | 18:33 <dhoss> ahaha :-) |
238 | 18:33 <t0m> basically, the code has sub _mk_foo { render('lib/foo..pm.tt', 'lib/foo.pm') } (pseudocode) |
239 | 18:34 <dhoss> okay, so: 1. #PMYI 2. #PYM9 3. Moosification of halper |
240 | 18:35 <t0m> if you could do foreach my $from_fn_-_to_fn ( $self->get_list_of_things_in_sharedir ) { |
241 | 18:35 <t0m> ^^ That would suck so much less |
242 | 18:36 <dhoss> yea i've been looking at something like that |
243 | 18:38 <t0m> that's fairly easy, with the way we did the rename |
244 | 18:38 <t0m> initially, if you just found everything not /\.tt$/ |
245 | 18:38 <dhoss> exactly, phrew |
246 | 18:39 <t0m> and transplanted them |
247 | 18:39 <t0m> that would be a good start |
248 | 18:39 <t0m> in fact, you could add that |
249 | 18:39 <t0m> not take any code away |
250 | 18:39 <t0m> just copy the files twice |
251 | 18:39 <t0m> not fail tests |
252 | 18:39 <t0m> commit |
253 | 18:39 <dhoss> copy the files twice? |
254 | 18:39 <t0m> take away the _mk_favicon etc methods one by one |
255 | 18:40 <dhoss> aha, and add that loop |
256 | 18:40 <t0m> well, if you run foreach my $binfile ($self->find_all_bin_files) { $self->copybinfile_to_app($binfile) } |
257 | 18:40 <t0m> (pseudocode) |
258 | 18:41 <t0m> ^^ Adding that to the current generation process won't break anything |
259 | 18:41 <t0m> You just generate the favicon.ico (etc) twice |
260 | 18:41 <t0m> once in that loop |
261 | 18:41 <t0m> once in pre-existing $self->_mk_favicon |
262 | 18:41 <t0m> in the same place.. |
263 | 18:41 <t0m> so you overwrite it the 2nd time |
264 | 18:41 <dhoss> okay, so *leave* _mk_blargh and copy it into the for loop, i get it |
265 | 18:42 <t0m> well, do the generic thing in the for loop |
266 | 18:42 <t0m> in fact - here is a smart move. You know the 'check generated files' test? |
267 | 18:42 <dhoss> yes |
268 | 18:42 <t0m> unlink each file |
269 | 18:43 <t0m> after you pass a test as it exists |
270 | 18:43 <t0m> then add an extra test doing a File::Find |
271 | 18:43 <t0m> and fail if it finds anything |
272 | 18:43 <dhoss> so check file, unlink, then another test to look for leftovers |
273 | 18:44 <t0m> exactly |
274 | 18:44 <t0m> then you add something generic to copy bin files |
275 | 18:44 <dhoss> and, forgive me, but what does that help us make sure we've done? |
276 | 18:45 <t0m> Makes sure you're not suddenly generating t/01app.t and t/01/app.t.tt # Oops, you fucked up the 'what file name do I generate test' |
277 | 18:45 <t0m> s/test'$/code'/ |
278 | 18:46 <t0m> so you don't ever accidentally generate duplicate files with diff names |
279 | 18:46 <t0m> or blank files with a weird name |
280 | 18:46 <dhoss> okay, i think i understand |
281 | 18:47 <t0m> or genrally any shit you're not specificially saying 'we test it generates a file named X' |
282 | 18:47 <t0m> you test it generates X |
283 | 18:47 <t0m> you test it does not generate anything other than X |
284 | 18:47 <dhoss> right |
285 | 18:47 <dhoss> oaky |
286 | 18:47 <dhoss> that's what i figured |
287 | 18:47 <t0m> sorry => tangent :) |
288 | 18:48 <dhoss> it's okay, i'm a one track mind with this stuff :-) |
289 | 18:48 <t0m> I can't find pmyi, but pym9 cool |
290 | 18:49 <dhoss> Try rewriting script_create.pl and see how far you can get - the big issue is going to be help display |
291 | 18:49 <dhoss> that's pmyi |
292 | 18:49 <t0m> yes |
293 | 18:49 <t0m> exactly so :) |
294 | 18:49 <t0m> Oh, no, hang on |
295 | 18:49 <t0m> Rewrite script_server.pl first |
296 | 18:50 <t0m> in fact, rewrite everything that isn't _create first |
297 | 18:50 <t0m> _create is the hardest |
298 | 18:50 <t0m> and needs the most thinking |
299 | 18:50 <t0m> by a fucking long shot |
300 | 18:50 <t0m> I think _create probably involves MooseX::App::Cmd |
301 | 18:51 <dhoss> so, rewrite with Moose sex getops |
302 | 18:51 <t0m> do the simple ones |
303 | 18:51 <t0m> first |
304 | 18:51 <t0m> like myapp_server.pl |
305 | 18:51 <t0m> like you just said :) |
306 | 18:51 <t0m> which will get you up to scratch on the Moo sex |
307 | 18:51 <t0m> before you have to hack it |
308 | 18:52 <t0m> Also, we can then start the bikeshedding about the right thing to do with moving the real code back into a CPAN dist |
309 | 18:52 <t0m> rather than it being in generated scripts |
310 | 18:52 <dhoss> right, that would be awesome :-) |
311 | 18:53 <t0m> myapp_XXXXX.pl should say: use Catalyst::Script::XXXXX; Catalyst::Script::XXXXX->new_with_options->run; |
312 | 18:53 <t0m> + shebang line |
313 | 18:53 <dhoss> right, i saw that in the list |
314 | 18:53 <t0m> kk. So make the simple scripts MX::Getopt packages |
315 | 18:54 <t0m> with the ->new_with_options->run incantation at the end of the source |
316 | 18:54 <t0m> hit until myapp_server.pl works like it used to. |
317 | 18:54 <t0m> rip Catalyst::Script::DevServer out |
318 | 18:55 <t0m> job done |
319 | 18:55 <dhoss> okay. i'll give it a crash |
320 | --- Log closed Wed Jun 17 19:00:38 2009 |
321 | --- Log opened Wed Jun 17 19:00:44 2009 |
322 | 19:00 <t0m> http://scsys.co.uk:8001/29932. |
323 | 19:00 <t0m> I guess something like that but with less syntax errors works |
324 | 19:01 <t0m> expand out till original functionality replicated :) |
325 | 19:01 <dhoss> Moose<3 |
326 | 19:01 <dhoss> thanks man |
327 | 19:04 <dhoss> i'm gonna get some grub. i'll ping you if i have any questions, i appreciate the help :-) |
328 | 19:06 <t0m> no worries. I'm at 2am |
329 | 19:06 <t0m> so => bed |
330 | 19:08 <dhoss> hehe sleep up man |
331 | --- Log closed Wed Jun 17 19:13:38 2009 |
884c19d3 |
332 | ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
333 | 12:39 < t0m> to check we generate an application which can pass it's own tests |
334 | :) |
335 | 12:40 < dhoss> so write a test to do taht? |
336 | 12:40 < t0m> yy, that would be cool. Can just be on the bottom of the generated |
337 | files one |
338 | 12:41 < t0m> run Makefile.PL, check exist status 0, check 'Makefile' exists, |
339 | run make test, check exit status zero |
340 | 12:41 < dhoss> i trust something like `$perl Makefile.pl; make test` would do? |
341 | 12:41 < t0m> *exit status |
342 | 12:41 < dhoss> or is that windows unfriendly? |
343 | 12:41 < dhoss> OH SHIT |
344 | 12:41 < dhoss> thats right |
345 | 12:41 < t0m> yeah, pretty much |
346 | 12:41 < dhoss> i have to fix those /'s |
347 | 12:41 < dhoss> make em windows happy |
348 | 12:41 < t0m> yy, good one, File::Spec->catfile it up :) |
349 | 12:42 < dhoss> i'm working on hacking buubot to read my mind |
350 | 12:42 < dhoss> so i can just tell it to grab shit i say and todo it |
351 | 12:42 < t0m> other than that, lets leave it till we can actually see a need for |
352 | more tests.. |
353 | 12:42 < dhoss> that's *fine* by me :-) |
354 | 12:43 < dhoss> so i can branch and moosify, and hack on the create scripts to |
355 | make them moosey |
356 | 12:43 < dhoss> also, what does MX::Getopt need to play nice? |
357 | 12:43 < t0m> yy. I guess if you hack on the scripts, you want to write tests |
358 | that they still perl -c in the generated app |
359 | 12:43 < t0m> yy. I guess if you hack on the scripts, you want to write tests |
360 | that they still perl -c in the generated app |
361 | 12:43 < t0m> and attack the simple scripts like myapp_server.pl first |
362 | 12:44 < t0m> And you'll work out what GetOpt struggles with :) |
363 | 12:44 < dhoss> which one was the pain in the ass one? was that create? |
364 | 12:44 < t0m> yy |
365 | 12:44 < dhoss> ok, i got them backwards |
366 | 12:44 < t0m> create has much more elaborate option parsin |
367 | 12:44 < t0m> *parsing |
368 | 12:44 < dhoss> okay. that will be a later beast |
369 | 12:45 < t0m> so yeah, just branch and jfdi, add tests for things as you touch |
370 | them - as you touch scripts add a 'scripts still compile' test |
371 | 12:46 < t0m> when each script is nicely getopt'd and refactored, it'll be easy |
372 | to test a lot more.. |
373 | |
b87c5403 |
374 | |
c5387711 |
375 | |
376 | |