/[Frey]/trunk/lib/Frey/Manual.pod
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /trunk/lib/Frey/Manual.pod

Parent Directory Parent Directory | Revision Log Revision Log


Revision 801 - (hide annotations)
Wed Dec 10 20:27:56 2008 UTC (15 years, 5 months ago) by dpavlin
File size: 5981 byte(s)
move all documentation to Frey::Manual
1 dpavlin 693 =head1 Frey Manual
2    
3     This page describes how to use and develop with L<Frey>
4    
5 dpavlin 801 =head1 Developer parts
6    
7     =head2 Moose classes
8    
9     All Moose classes have simple introspection API which use
10     L<Frey::Introspect> to show class and it's pod (using L<Frey::Pod>).
11    
12     Example of valid REST URL is
13    
14     http://localhost:16001/Frey
15    
16     which will show L<Frey> class introspection.
17    
18     You can also add method invocation and optional parameters to C<new>
19     constructor like this:
20    
21     http://localhost:16001/Frey::Pod/as_markup?class=Frey
22    
23     this is same using L<Frey::Pod> from perl as
24    
25     Frey::Pod->new( class => 'Frey' )->as_markup;
26    
27     Forms to enter required parameters will be generated automatically,
28     allowing you to explore your data while you are making interface for it.
29    
30     =head2 Database
31    
32     FIXME broken if not noted in C<TODO>
33    
34     For database objects we support L<Fey> and when your objects are created
35     C<< with 'Frey::Collection' >> they will have basic CRUD functionality
36     implemented by L<Frey::ObjectBrowser>.
37    
38     =head1 User parts
39    
40     =head2 Pipes
41    
42     See L<Frey::Pipe> for now.
43    
44 dpavlin 722 =head1 Designing user interaction flows
45    
46     Frey is all about creating Moose classes as your interaction with pages.
47 dpavlin 801 Each page is instance of class with some parameters received with post or
48 dpavlin 722 get request.
49    
50     If you want to access those parameters in your object, you have to define
51     attributes for it using L<Moose/has>
52    
53     You can also generate result in three different forms:
54    
55 dpavlin 729
56 dpavlin 722 =over 20
57    
58     =item as_markup
59    
60     HTML content
61    
62     =item as_sponge
63    
64     Tabular output
65    
66     FIXME link to description
67    
68     =item as_data
69    
70     Any perl hash structure
71    
72     =back
73    
74 dpavlin 729
75     =head2 No html templates
76    
77 dpavlin 722 Frey doesn't have html templates. Since your methods are part of REST URIs,
78     it doesn't make sense to separate html from object itself, which represent
79     web page. L<Frey::Web> provides role which has a bunch of helpful things
80     when creating html.
81    
82     Basically, if html you are generating in readable code semantically correct
83     to you, it the right track.
84    
85     You don't even have to create initial entry form as L<Frey::Run>,
86     which will start your L<Moose> classes, will call L<Frey::Action>
87     for help and generate initial form for you.
88    
89 dpavlin 778 Creating files is mess, so L<Frey::Class::Create/create_class_source> will
90 dpavlin 722 create class and test skeleton for you.
91    
92 dpavlin 801 If I did it right, it should read similar to human language, like Smalltalk.
93 dpavlin 722
94 dpavlin 801 To make things simple, there are few conventions (with nod to Ruby on Rails)
95 dpavlin 722 which will help you get started:
96    
97 dpavlin 729
98 dpavlin 722 =head2 html markup
99    
100     HTML markup should be enclosed in C< qq| > and C< | > quotes. There is also
101     funny but very readable convention of multi line html when you have to
102 dpavlin 801 intermix conditions:
103 dpavlin 722
104     my $html
105     = qq|<h1>First</h1>|
106     . ( $is_second ? qq|<h2>Second</h2>| : '' )
107     . qq|<h3>Third</h3>|
108     ;
109    
110     This will be checked and reported at some point. Ideally, I would like to
111     write just
112    
113     my $html
114     = qq|<h1>First</h1>|
115     . $is_second ? qq|<h2>Second</h2>| : ''
116     . qq|<h3>Third</h3>|
117     ;
118    
119     which is valid perl syntax but doesn't work as expected.
120    
121 dpavlin 729
122 dpavlin 801 =head2 Smalltalk like refactoring
123 dpavlin 729
124 dpavlin 801 Frey is heavily influenced by Smalltalk, up to the point of syntax. Coding
125 dpavlin 729 Frey code should be like playing with L<Frey>. And you might end up with
126     result which might surprise you.
127    
128 dpavlin 801 Refactoring tools are not new in perl. We have L<PPI>, L<App::Ack> and C<vim>
129     so what more do we want?
130 dpavlin 729
131 dpavlin 801 If you look closely into Smalltalk development work-flow, you really need
132     ability to rename class or method without any additional effort. For that,
133     we use L<Frey::Class::Refactor> which allows code modifications at source
134     level with just few clicks.
135 dpavlin 729
136 dpavlin 801 =head2 Default values
137    
138     When L<Frey::Run> tries to create instance of class (usually because of web
139     request) it tried to read default values from C<yaml> files in C<etc/> and
140     if it doesn't find all of required values it will invoke L<Frey::Action> to
141     create end-user html form with missing fields.
142    
143 dpavlin 722 =head2 examples
144    
145     To help you get started, here are few implemented flows in Frey:
146    
147     =over 20
148    
149     =item L<Frey::Shell::Grep>
150    
151     Simple interaction with C<grep>
152    
153     =item L<Frey::SVK>
154    
155     Gather data, display selection form with checkboxes
156    
157     =item L<Frey::IconBrowser>
158    
159     Display a huge amount of icons with single HTTP request
160    
161     =back
162    
163 dpavlin 729
164 dpavlin 701 =head1 Command-line integration
165    
166     One of key points is that L<Frey> runs under your user. This means it has
167 dpavlin 801 access to your terminal, and ssh keys, so beware!
168 dpavlin 701
169 dpavlin 693 =head1 Install
170    
171 dpavlin 701 =head2 Firefox
172    
173 dpavlin 693 Frey is designed to provide close integration between your day-to-day data
174     mungling work in console and Firefox.
175    
176     You might want to open separate Firefox and terminal for Frey sessions.
177    
178     It's also useful to have Firebug extension installed in Firefox to provide
179     quick introspection on html, network traffic and request parameters.
180    
181 dpavlin 701 If nothing else, L<Frey::Bookmarklet> provides Firebug lite bookmarklet.
182 dpavlin 693
183 dpavlin 701 It's all Text! Firefox extension at
184     L<https://addons.mozilla.org/en-US/firefox/addon/4125> provides integration
185     between form textarea and your editor, so it's also handy.
186 dpavlin 693
187     =head2 vim
188    
189     Content on page will be linked to vim using L<Frey::Web/html_links>
190    
191     You might want to install vim plugin C<prel_synwrite.vim> from
192     L<http://www.vim.org/scripts/script.php?script_id=896>
193     to check syntax on every C<:Write>
194    
195    
196     =head2 xdotool
197    
198     Used for switching focus between browser and terminal
199    
200     =head1 Command-line helpers
201    
202 dpavlin 701 =head2 bin/dev.sh
203    
204 dpavlin 801 Recommended way to start development L<Frey> server since it will restart it
205 dpavlin 701 automatically and kill running instance if existing.
206    
207 dpavlin 693 =head2 bin/check-syntax.sh
208    
209     Check syntax of modified files.
210    
211 dpavlin 701 =head2 bin/grep-iselect.sh
212    
213     Helper using C<iselect> to quickly grep, select result and jump to C<vim>
214    
215 dpavlin 704 =head2 bin/log.sh
216    
217     Open last 3 logs in vim
218    
219 dpavlin 701 =head2 bin/checkout-js.sh
220    
221     Checkout bunch of JavaScript code from all over the net, some of which is
222     used in Frey and rest is kind of TODO list...
223    
224     =head2 bin/clean-var.sh
225    
226     Cleanup C<var/> directory which gets a lot of dumps. Most of useful data
227 dpavlin 801 is held forever because I believe that trends are most interesting way to
228 dpavlin 701 look at data.
229    
230 dpavlin 693 =cut

  ViewVC Help
Powered by ViewVC 1.1.26