added tests for new methods
[catagits/Catalyst-Devel.git] / gsoc / gsoc-devel-plan-5-23.txt
CommitLineData
01dfb279 115:36 <t0m> right. so the first thing to do is probably write a test to check
2 generating an application doesn't change.
315:37 <dhoss> per app?
415:38 <t0m> no, I mean whilst you're ripping ::Helper apart.
515:38 <dhoss> OH
615:38 <dhoss> gotcha
715:38 <t0m> if you install your branch.. Then catalyst.pl t/TestAppForComparison
815:39 <dhoss> so we have the same results now as before, yes?
915: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;
1215:40 <t0m> exactly. and that'll test you rip all of the files out of Helper.pm
13 correctly..
1415:40 <dhoss> okay, TestAppForComparison created. i'll commit that initial
15 version
1615: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
1815:41 <t0m> to maintain
1915:41 <dhoss> i could see that
2015:41 <t0m> But it's totally the right solution whilst you're trying to rip
21 stuff out without changing it
2215:41 <dhoss> temp testing :-D
2315:44 <t0m> I've got some ideas on doing better testing that the TestApp we
24 generate is good.
2515:44 <t0m> but they're a bit more involved, and not needed for this at all ;)
2615:45 <dhoss> this being this refactor, or this bit of the refactor?
2715:45 <t0m> the latter.
2815:45 <dhoss> okay - got it
2915: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
3215: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
3415:47 <t0m> did you get to grips with MX::GetOpt and do you have a plan for
35 that yet?
3615:48 <dhoss> so one branch for helper_refactor, one for code (which code?),
37 and one for app templates
3815:48 <t0m> As I guess catalyst.pl should be taught to use it, and so should
39 the generated scripts :)
4015:48 <dhoss> i've been playing with MX::GetOpt, i need a few more details on
41 what exactly needs to be beat up
4215:48 <t0m> yy, but you branch from completed helper_refactor :)
4315:49 <t0m> and 'code' is the actual refactor / api changes for helpers
4415:49 <t0m> bletch
4515:50 <dhoss> okay, so the 'code' branch will be simply the C::H code branched
46 from helper_refactor
4715:50 <t0m> get_file has to keep working as everything using ::Helper needs it
4815:50 <t0m> yes, exactly.
4915:51 <t0m> so you need to make a get_file_from_sharedir function or something
5015:51 <dhoss> okay, making sense now :-)
5115:51 <t0m> and change things over to use that.
5215:51 <t0m> that's fine though - means you can extract 1 file at a time
5315:52 <dhoss> which would be better, no? better atomicity and for testing
5415:52 <t0m> yy
5515:52 <t0m> bletch was at the fact that 'get_file' is a good method name, and
56 it's now deprecated
5715:53 <dhoss> is that in C::H?
5815:53 <t0m> yy
5915:53 * dhoss is a little behind in my api knowledge
6015:53 <dhoss> off the top of my head at least
6115:53 <t0m> it's the 'get me a file out the <DATA> section' method
6215:53 <dhoss> aha right
6315:54 <t0m> which you're replacing in favour of 'get me a file out of the share
64 dir'
6515:54 <t0m> and 'copy file out of sharedir' methods.
6615:54 <t0m> The former for templates
6715:54 <t0m> the latter for binaries, which gets rid of the hateful decoding and
68 writing out business
6915:54 <dhoss> get -> we're going to interpolate shit, copy -> we're giong to
70 use directly?
7115:55 <t0m> just so
7215:55 <t0m> eliminating the 'please turn this giant hex string back into
73 binary' thing
7415:55 <dhoss> definitely :-P
7516:00 <t0m> sub _mk_favicon {
7616:00 <t0m> my ( $self ) = @_;
7716:00 <t0m> $self->copy_share_file(
7816:00 <t0m> File::Spec->catfile( ( caller(0) )[0], 'favicon.ico' ),
7916:00 <t0m> File::Spec->catfile( $self->{root}, "favicon.ico" )
8016:00 <t0m> );
8116:00 <t0m> }
8216:00 <t0m> sumfin like dat
8316:01 <dhoss> easy enough
8416:01 <t0m> the actually, all the caller crap dies too
8516:02 <dhoss> hrm, i suppose we have to keep the atrocious
86 Class::Accessor::Fast method name artifacts?
8716:02 <t0m> that's to clue get_file what file to borg crap out off
8816: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
9016:03 <t0m> and the ones which can't get deprecated, but preserved.
9116:04 <dhoss> so that's just for the current get_file, right?
9216:04 <t0m> yy
11dbddd9 93########################################################################
94## done
9516:04 <t0m> $self->copy_share_file(
01dfb279 9616:04 <t0m> 'favicon.ico',
9716:04 <t0m> File::Spec->catfile( $self->{root}, "favicon.ico" )
9816:04 <t0m> );
11dbddd9 99#########################################################################
01dfb279 10016:05 <t0m> more like it
10116:05 <t0m> so we have sub mk_foo { shift->generate_foo(@_); }
102
c5387711 103====
1045-28
5430247e 10503: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 10703:05 < t0m> 3)#done Re arrange files in sharedir so we can make the comversion guts
c5387711 108 totally generic
10903:05 < t0m> 4) merge&profit
11003:05 < t0m> *conversion
11103:05 < dhoss> rearrange meaning mv foo MyApp?
11203:06 < t0m> erm, yes, as described above, so that the contents of share/ is
113 laid out the same as a newly generated MyApp
11403:06 < dhoss> OH
11503:06 < dhoss> okay
11603:06 < dhoss> instead of my current fuckery :-)
11703:06 < dhoss> autarch: btw if you have an idea for that i'd love an email to
118 the one in topic
11903:06 < t0m> cause then the entire generate application becomes 'copy this
120 directory from X => Y, applying some file mangling rules)
6be0f534 121
122=============================================================================
12304: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..
12504: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
12804: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
13004:29 < t0m> e.g. share/Makefile.PL.tt share/root/favicon.ico.bin
131 share/lib/MyApp.pm.tt
13204:30 < t0m> the exact reasons for this nameing scheme become aparent post
133 first merge, when we remove most of the code :)
13404:30 < t0m> but all of share/ needs to be in it's final resting place pre-merge
13504:31 < marcus> http://lumberjaph.net/blog/index.php/2009/05/30/catalystxdispatcherasgraph/ # <3 lazyweb
13604:31 < t0m> so tests the stuff we're no longer using in Helper.pm (e.g.
137 get_file) still works. Rename share/ bits
13804:31 < t0m> marcus: Indeed :)
13904:31 < t0m> ^^ those two, then first merge.
9b5ece3f 14023:36 <@kd> dhoss: just found a bug in ::Devel ...
14123:36 <@kd> we're using #!/usr/bin/env perl now
14223:36 <@kd> that means we have to add the use warnings; pragma beneath it
14323:37 <@kd> that doesn't appear to be happeining in the scripts
14423:37 <@kd> please fix
14523:38 <@kd> dhoss: i.e. http://gist.github.com/122081
5c330d3c 146==============================================================================
99d7d5b9 147
148# DONE
5c330d3c 1491. 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
1542. get new layout working
155
99d7d5b9 156
157# DONE
5c330d3c 1583. 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 1693. RFC - DONE
5c330d3c 170
171Looking ahead
172
173MooseX::Getopt
6be0f534 174
b87c5403 175################################################################################
17617:46 < t0m> dhoss: erm, oh, so the _other_ thing I didn't think of
17717:46 < t0m> Is Cat works on windows
17817:46 < t0m> I have stuffed loads of "t/foo.t"
17917:46 < t0m> into strings.
18017:46 < t0m> which will break win
18117:47 < t0m> so, all those places where I just "string/append/a/file.name"
18217:47 < t0m> you need to use Path::Class qw/file/; file(qw/ string append a
183 file.name /);
18417:47 < t0m> like ^^^
18517:48 < t0m> then it will still work on win32
18617:48 < dhoss> noted
18717:48 < t0m> There is already File::Spec->catfile
18817:48 < t0m> which does the same thing
18917:48 < t0m> but more ugly
19017:48 < t0m> either/or
19117:48 < purl> either/or is "public load_first_existing_class" or "load_class
192 passes multiple args to load_first_existing_class"
19317:48 < t0m> don't care...
19417:49 < t0m> Just "file/name" is BAD
19517:49 < t0m> and will hate windows users
196
197Summary:
19817:43 < dhoss> 1. fix pod coverage, 2. remove TestAppForInvocation 3. ???
19917:43 < t0m> 3. merge
200
201
c5387711 202
203