masterview 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. data/Rakefile +8 -5
  2. data/init.rb +43 -0
  3. data/lib/facets/AUTHORS +36 -0
  4. data/lib/facets/CHANGELOG +266 -0
  5. data/lib/facets/COPYING +403 -0
  6. data/lib/facets/ProjectInfo +74 -0
  7. data/lib/facets/README +252 -0
  8. data/lib/facets/core/string/blank.rb +36 -0
  9. data/lib/facets/core/string/indent.rb +68 -0
  10. data/lib/facets/core/string/starts_with.rb +24 -0
  11. data/lib/masterview/directive_base.rb +163 -0
  12. data/lib/masterview/directive_helpers.rb +176 -0
  13. data/lib/masterview/directives/block.rb +30 -0
  14. data/lib/masterview/directives/content.rb +10 -0
  15. data/lib/masterview/directives/else.rb +25 -0
  16. data/lib/masterview/directives/elsif.rb +26 -0
  17. data/lib/masterview/directives/form.rb +19 -0
  18. data/lib/masterview/directives/global_inline_erb.rb +39 -0
  19. data/lib/masterview/directives/hidden_field.rb +31 -0
  20. data/lib/masterview/directives/if.rb +24 -0
  21. data/lib/masterview/directives/insert_generated_comment.rb +30 -0
  22. data/lib/masterview/directives/javascript_include.rb +15 -0
  23. data/lib/masterview/directives/link_to.rb +17 -0
  24. data/lib/masterview/directives/link_to_if.rb +21 -0
  25. data/lib/masterview/directives/link_to_remote.rb +17 -0
  26. data/lib/masterview/directives/password_field.rb +33 -0
  27. data/lib/masterview/directives/preview.rb +10 -0
  28. data/lib/masterview/directives/replace.rb +18 -0
  29. data/lib/masterview/directives/stylesheet_link.rb +14 -0
  30. data/lib/masterview/directives/submit.rb +14 -0
  31. data/lib/masterview/directives/testfilter.rb +55 -0
  32. data/lib/masterview/directives/text_area.rb +34 -0
  33. data/lib/masterview/directives/text_field.rb +33 -0
  34. data/lib/masterview/extras/rails_init.rb +67 -0
  35. data/lib/masterview/extras/watcher.rb +30 -0
  36. data/lib/masterview/masterview_version.rb +9 -0
  37. data/lib/masterview/parser.rb +585 -0
  38. data/lib/masterview/plugin_load_tracking.rb +41 -0
  39. data/lib/masterview/runtime_helpers.rb +9 -0
  40. data/lib/masterview/string_extensions.rb +15 -0
  41. data/lib/masterview.rb +129 -0
  42. data/test/block_test.rb +47 -0
  43. data/test/content_test.rb +26 -0
  44. data/test/else_test.rb +31 -0
  45. data/test/elsif_test.rb +31 -0
  46. data/test/example_test.rb +11 -0
  47. data/test/filter_helpers_test.rb +142 -0
  48. data/test/form_test.rb +66 -0
  49. data/test/global_inline_erb_test.rb +30 -0
  50. data/test/hidden_field_test.rb +62 -0
  51. data/test/if_test.rb +23 -0
  52. data/test/javascript_include_test.rb +26 -0
  53. data/test/link_to_if_test.rb +27 -0
  54. data/test/link_to_test.rb +52 -0
  55. data/test/parser_test.rb +166 -0
  56. data/test/password_field_test.rb +89 -0
  57. data/test/replace_test.rb +27 -0
  58. data/test/run_parser_test.rb +27 -0
  59. data/test/stylesheet_link_test.rb +26 -0
  60. data/test/submit_test.rb +54 -0
  61. data/test/template_file_watcher_test.rb +50 -0
  62. data/test/template_test.rb +181 -0
  63. data/test/test_helper.rb +24 -0
  64. data/test/text_area_test.rb +81 -0
  65. data/test/text_field_test.rb +89 -0
  66. metadata +71 -11
data/Rakefile CHANGED
@@ -226,7 +226,13 @@ namespace 'masterview' do
226
226
  PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
227
227
  RELEASE_NAME = "REL #{PKG_VERSION}"
228
228
  PKG_FILES = FileList[
229
+ "lib/**/*",
230
+ "directives/**/*",
231
+ "test/**/*",
232
+ "example/**/*",
229
233
  "[A-Z]*",
234
+ "Rakefile",
235
+ "init.rb"
230
236
  ].exclude(/\bCVS\b|~$|\.svn|semantic.cache/)
231
237
 
232
238
  spec = Gem::Specification.new do |s|
@@ -235,9 +241,8 @@ namespace 'masterview' do
235
241
  s.summary = "A (x)html friendly template engine for rails with the power of layouts, and partials. Main gem which requires all others"
236
242
  s.has_rdoc = true
237
243
  s.files = PKG_FILES
238
- #s.require_path = 'lib'
239
- #s.autorequire = 'masterview'
240
- s.add_dependency 'masterview_parser'
244
+ s.require_path = 'lib'
245
+ s.autorequire = 'masterview'
241
246
  s.add_dependency 'masterview_generator'
242
247
  s.add_dependency 'masterview_plugin_generator'
243
248
  s.author = "Jeff Barczewski"
@@ -387,7 +392,6 @@ namespace 'masterview_generator' do
387
392
  s.files = PKG_FILES
388
393
  s.require_path = 'generators/masterview'
389
394
  s.autorequire = 'masterview_generator'
390
- s.add_dependency 'masterview_parser'
391
395
  s.author = "Jeff Barczewski"
392
396
  s.email = "jeff.barczewski@gmail.com"
393
397
  s.homepage = "http://masterview.org/"
@@ -460,7 +464,6 @@ namespace 'masterview_plugin_generator' do
460
464
  s.files = PKG_FILES
461
465
  s.require_path = 'generators/masterview_plugin'
462
466
  s.autorequire = 'masterview_plugin_generator'
463
- s.add_dependency 'masterview_parser'
464
467
  s.author = "Jeff Barczewski"
465
468
  s.email = "jeff.barczewski@gmail.com"
466
469
  s.homepage = "http://masterview.org/"
data/init.rb ADDED
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ #--
4
+ # Copyright (c) 2006 Jeff Barczewski
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining
7
+ # a copy of this software and associated documentation files (the
8
+ # "Software"), to deal in the Software without restriction, including
9
+ # without limitation the rights to use, copy, modify, merge, publish,
10
+ # distribute, sublicense, and/or sell copies of the Software, and to
11
+ # permit persons to whom the Software is furnished to do so, subject to
12
+ # the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be
15
+ # included in all copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24
+ #++
25
+ #
26
+ # = MasterView - Rails-optimized (x)html friendly template engine
27
+ #
28
+ # MasterView is a ruby/rails optimized HTML/XHTML friendly template engine.
29
+ # It is designed to use the full power and productivity of rails including
30
+ # layouts, partials, and rails html helpers while still being editable/styleable
31
+ # in a WYSIWYG HTML editor.
32
+
33
+ require 'masterview'
34
+
35
+ module ::MasterView
36
+ #override any constants here, see masterview.rb for more
37
+ #DefaultDirectiveLoadPaths.push File.join( File.dirname(__FILE__), 'directives') #uncomment if you want to add a local directives dir
38
+ #DefaultParserOptions = { :tidy => false, :escape_erb => true }
39
+ #TidyPath = '/usr/lib/libtidy.so'
40
+ end
41
+
42
+ require 'masterview/extras/rails_init.rb'
43
+
@@ -0,0 +1,36 @@
1
+
2
+ = Facets' Contributing Authors
3
+
4
+ == Rubyists of Distinction
5
+
6
+ * Daniel J. Berger
7
+ * Paul Brannan
8
+ * Mikael Brockman
9
+ * Jamis Buck
10
+ * Renald Buter
11
+ * Shashank Date
12
+ * Florian Frank
13
+ * Hal Fulton
14
+ * Michael Granger
15
+ * Florian Gross
16
+ * Thomas-Ivo Heinen
17
+ * David H. H.
18
+ * Ara T. Howard
19
+ * Mohammad Khan
20
+ * Derek Lewis
21
+ * Jan Molic
22
+ * George Moschovitis
23
+ * Michael Neumann
24
+ * Jonas Pfenniger
25
+ * Thomas Sawyer
26
+ * Daniel Schierbeck
27
+ * Gavin Sinclair
28
+ * Tilo Sloboda
29
+ * Peter Vanbroekhoven
30
+ * Jim Weirich
31
+ * Jeff Wood
32
+ * Austin Ziegler
33
+ * why_the_lucky_stiff
34
+
35
+ If any names are missing from this list, please let me know
36
+ and I will correct immediately.
@@ -0,0 +1,266 @@
1
+ = Facets Change Log
2
+
3
+ == 1.1.0
4
+ * Calibre is it's own project. THAT'S FINAL!
5
+ * Added zimba.tm's string/modulize, pathize and methodize.
6
+ * Added some Gem methods, self/active?, self/gemspec, self/gempath.
7
+
8
+ == 1.0.3
9
+ * A last ditch attempt to keep facets and calibre as one project.
10
+ * Last Ditch is the key term here -- it has failed.
11
+
12
+ == 1.0.2
13
+ * Added _why's Array modulo.
14
+
15
+ == 1.0.0
16
+ * Sped up string#similarity.
17
+ * By popular protest deprecated usage of "AClass.use Facets, :amethod".
18
+ * Created nicer layout of facets/support, /group, /english (one day /method).
19
+ * Odd sets of facets have been move to facets/group/, eg. facets/group/inflect.
20
+ * All is now well preped for a Rolls release shoud that come about.
21
+
22
+ == v0.10.30 Halloween
23
+ * Change OrderedHash (ohash.rb) to Dictionary (dictionary.rb).
24
+ * Change BlankSlate (blankslate.rb) to BasicObject (basicobject.rb).
25
+ * Old versions of the above should still work, but throw warnings
26
+ and will stop working come next version.
27
+ * 1.rb has been renamed to one.rb (I know, two more characters,
28
+ but you can do it! ;)
29
+ * Methods enumerable/op_mod (%) and enumerable/eF are deprecated.
30
+ Use #every or #ew instead.
31
+
32
+ == v0.10.11 Palapable
33
+ * Merged Mega into Facets. I put the old Mega ChangeLog at
34
+ the bottom of this document.
35
+ * This represents the One-Point-Oh realease (albeit RC1) of
36
+ Facets, but from now on I'll be using date versioning
37
+ --if you look at the versions below you may understand why.
38
+ The versioning sequence has no real rationality.
39
+ Instead I will use this simple Rational Versioning Policy:
40
+ * If YYYY-MM-DD it's a development release.
41
+ * If YYYY-MM it's an official release.
42
+ * If just YYYY it's hella stable.
43
+ One might argue this is not as robust as a compatability
44
+ significant point-based versioning system, but I'd say that's
45
+ all well and good in theory, now give me something that actually
46
+ works in practice.
47
+
48
+ == v0.9.5 Rebirth
49
+ * Rebirth of Facets! As cool as the name Nano is, it became clear
50
+ that most people are drawn toward the name Facets. So we are
51
+ reverting back. Nonetheless Nano will remain a viable alias for
52
+ Facets.
53
+ * Must now use <code>require 'facets'</code> prior to using
54
+ other Facets. This does two things. First it loads the
55
+ base methods, which ensures that all programs have them
56
+ readibly available when using Facets. Secondly it supplements
57
+ #require to handle aliases. In essence, require 'facet/...',
58
+ require 'facets/...' and require 'nano/...' all point to the
59
+ same place(s). (NOTE This is a precursor to a more universal
60
+ system that will handle aliasing automatically.)
61
+ * kernel/require_esc has been removed. #require_nano will be also
62
+ in the next release. These will no longer be needed thanks to
63
+ the aliasing system.
64
+
65
+ == v0.9.2 Littles
66
+ * Added string/starts_with? and string/ends_with?
67
+ * Fixed module/memoize to cache on a per class/module bases.
68
+ * Added module/is as an alias for /include.
69
+ * Added module/shadow_method and shadow_all.
70
+ * Renamed module/superup (which was module/supers) to module/as. And defined a new
71
+ method called /superior which is like /super but skips to a sepecified ancestor.
72
+ * Renamed module/super_send to module/send_as.
73
+
74
+ == v0.9.1 Wraps
75
+ * Added module/nesting (not to be confused with the class method Module::nesting).
76
+ * Thanks goes to Gavien Kistner for new string/word_wrap methods
77
+ (with additioanl thanks to Dyane Borderson for his suggestions).
78
+ * Added hash/each_with_key and each_with_index, as well as array/each_with_key;
79
+ increasing polymorphism between the two classes.
80
+ * Moved array/each_pair to enumerable/each_pair and changed how it worked to
81
+ what one might expect.
82
+
83
+ == v0.9.0 NotUorI
84
+ * Deprecated object#special_class, which was a method for (class<<self;self;end).
85
+ Already have too many aliases for this, and though the name is fitting, the simpler
86
+ method #own is better (alternative: #singleton).
87
+ * Fixed enumerable/uniq_by file which was misnamed 'unique_by.rb'.
88
+ * BIG CHANGE! Got rid of URI encoding on file names and sub'd a converson table
89
+ of english readable names. Thanks Jeff Wood, Florain Gross, Dav Burt,
90
+ Gavin Kistner, James Edward Gray II, Brian Schröder, Mauricio Fernández,
91
+ David A. Black, Gavin Sinclair, Nikolai Weibull and Christian Neukirchen.
92
+
93
+ == v0.8.3 UorI
94
+ * Added kernel/uri and kernel/unuri
95
+ * (Good idea?) removed methods module/sattr, sattr_reader, &c. Instead created object/meta
96
+ in which attr, attr_reader, &c. are made public. So, sattr -> meta.attr.
97
+ * Added array/unzip
98
+ * Added logger/format and logger/format_message (stub).
99
+ * Added string/dequote.
100
+ * Class method file names now begin with '::' to separate them from instance methods.
101
+
102
+ == v0.8.2 Nano Revolution
103
+ * Name Change! What was Ruby Facets is now Nano Methods!
104
+ * New minor version as there has been a change of plans with the integration of what was Carats.
105
+ The classes and modules have been reseperated into their own project called Mega Modules.
106
+ * Modified the #firstxxx/#lastxxx methods to be more congruent and comprehensible.
107
+ * Renamed object/supers to object/superup. Better!
108
+ * Got rid ot symbol/gen. Use object/generate_method_name or module#generate_instance_method_name
109
+ instead ( Is that the longest non-foo method name ever? :)
110
+ * The file 1st.rb has moved to object/method. This modifies #method to persist the returned
111
+ Method object. The original non-persitent version of #method is aliased to #original_method.
112
+ (This arrangement is not set in stone though, and is still be considered.)
113
+ * Added module/clone_using, module/clone_ranaming and module/clone_removing.
114
+ * Added module/integrate (I love this one!)
115
+ * Added many new enumerable methods: #filter_map, #compact_map, #commonality, #frequency,
116
+ #probability and #find_collisions.
117
+ * Moved some methods from array to enumerable: #each_permutation, #each_combination,
118
+ #each_unique_pair and the class method ::combinations.
119
+ * Added string/bytes per ruby-dev summary 26385-26467.
120
+ * Moved #cattr_reader, #cattr_writer and #cattr_accessor from Class to Module.
121
+ * Renamed numeric/octet_units to numeric/bytes_to_s and added a #bits_to_s as well.
122
+ * Added class/descendants (alias subclasses) and class/remove_descendents, as well as
123
+ object/descendents_of and object/remove_descendents_of.
124
+ * Added methods to comparable: #cap, #clip. There are also #at_least and
125
+ #at_most, although FYI #cap and #clip handle the same functionality.
126
+ * Removed string/table_name and string/class_name (they were too Rails specific).
127
+ Note: A new module has been added to Mega Modules, called orm-inflect.rb. It contains numerous
128
+ methods for doing this sort of thing.
129
+ * Added numeric/ceil_multiple (not sure about name though, perhaps a better name like "ceil_to"?).
130
+ * Added string/soundex for calculating the soundex code of a word/name.
131
+ * Added io/expect. I thought Ruby already had this but can't find it, so here it is for now.
132
+ * Placed Florian's binding-of-caller.rb in binding/of_caller. Makes more sense there.
133
+ * Fixed bug with Continuation::create (it wasn't defined as a class method and should have been).
134
+ * Fixed bug with string/capitalized? which wasn't always giving the correct result.
135
+
136
+ == v0.7.2 George II
137
+ * Added a class method dir/recurse which allows one to loop through a dir and all its
138
+ subdirs, etc. It also has an alias #ls_r. Thanks goes to George Maschovitis for this.
139
+ * Changed array/permute to array/each_permutation.
140
+
141
+ == v0.7.1 Quick George
142
+ * Added facet.rb, although expiremental it makes it possible to use atomic methods without
143
+ specificaly requiring them. It uses Object#method_missing to require them as needed.
144
+ * Improved on "molecules", i.e. files that require numerous related atoms in a single go.
145
+ These will see a great deal of continued improvement in the future.
146
+
147
+ == v0.7.0 Georgian Transform
148
+ * All methods with names containing non-alphanumeric characters now have facet
149
+ files without those special characters. This removes some incompatibilites with
150
+ certain systems (including Windows). All such symbols have been replaced with
151
+ CGI escape sequences, for instance 'in?.rb' becomes 'in%3F.rb'. To avoid having
152
+ to use these "ugly" names, a new method has been added, kernel/require_facet.
153
+ * Methods that were grouped together in the same file have been separated
154
+ into their own files. Pure Atomicity has been achieved!
155
+ * The method array/put has been dropped in favor of array/top (as a better alias for #unshift).
156
+ * Methods #matchdata/post_match_from and #matchdata/pre_match_from have deprecated
157
+ in favor of more generalized methods that serves the same purposes,
158
+ matchdata/matchtree and matchdata/matchset.
159
+ * Added module/include_as.
160
+ * Added array/permute.
161
+
162
+ == v0.6.3 Gemstone
163
+ * Gem is now avaliable!
164
+ * Added kernel/require_all which allows one to require a pattern of files,
165
+ making it easy to require every file in a directory.
166
+ * Added hash/traverse and hash/traverse!, which takes a block and iterates over
167
+ each key-value pair descending into subhash values and applying the block.
168
+ (Thanks goes to Ara T. Howard and robert for their help.)
169
+ * Added hash/collect. This uses enumerable/graph so that
170
+ hash/collect will return a hash rather then an array.
171
+ * Added numeric/before and numeric/after in place of #ago and #since
172
+ and aliased #ago and #since to them, per the suggestions of
173
+ Francis Hwang.
174
+ * Added "poor man's profiler", time/elapse. (Thanks goes to Hal Fulton).
175
+ * Changed enumerable/build_hash to enumerable/graph. The method #build_hash
176
+ has been aliased to #graph for the time being for backward compatability.
177
+ * Added array/last_index. (Thanks goes to Jabari)
178
+
179
+ == v0.6.2 Refinement I
180
+ * Added kernel/resc as a shortcut for Regexp.escape.
181
+ * Renamed hash/keys_to_string to hash/key_to_s and
182
+ hash/keys_to_symbol to hash/keys_to_sym to be more consistant
183
+ with other methods and what these methods specifically do.
184
+ The old names have been deprecated.
185
+ * Added hash/has_keys?, which allows for checking mutliple keys at once.
186
+ Also includes #has_only_keys?
187
+ * Added Rail's Time and Byte modules for Numeric with
188
+ numeric/times.rb and numeric/bytes.rb (I've been informed that
189
+ thanks go to Richard Kilmer for this. Thanks!)
190
+ * Added numeric/octet_unit which utilizes numeric/bytes.
191
+ (The name of this method may change in the future though.)
192
+ * Added enumerable/uniq_by.
193
+ * Added module/abstract.
194
+ * Added module/redirect which is similar to alias, but does not
195
+ copy the method, but rather wraps it. It also takes a hash so
196
+ multiple methods can be redirected all at once.
197
+ * Added string/shatter which is similar to split but includes
198
+ the matched portions of text.
199
+
200
+ == v0.6.1 Florian's Mixes
201
+ * Updated the current set of mix files which were still from
202
+ version 0.5.0. (2004-12-31)
203
+
204
+ == v0.6.0 Florian's Onslaught
205
+ * Major revisions made by Florian's onslaught. (2004-12-28)
206
+ * First general public release.
207
+
208
+ == v0.5.0 Fit for First
209
+ * This is the beginning of offical releases. (2004-12-23)
210
+ * Now called Facets.
211
+ * Changed layout to be completely atomic! (2004-10-30)
212
+
213
+ == v0.4.0 Raspberry
214
+ * Scoured the Ruby world for useful additions.
215
+ * Changed name again from A.B.C. to Raspberry.
216
+ I can't seem to settle on a name. Even the new
217
+ subsections have changed five times. (2004-08-08)
218
+
219
+ == v0.3.0 ABC
220
+ * Reorganinzed all of this together in a nice neat way.
221
+ * Changed name of library from Succ to A.B.C.
222
+ which stands for All Base Common. (2004-02-02)
223
+
224
+ == v0.2.0 Succ
225
+ * A number of new methods added.
226
+ * Renamed it Succ for "successor". (2003-05-31)
227
+
228
+ == v0.1.0 TomsLib
229
+ * Tomslib's just a few useful methods. (2002-07-01)
230
+
231
+
232
+ == Old Mega/Carats ChangeLog
233
+
234
+ == v0.4.0
235
+ * Adjusted Tuple to use Tuple::[*args] instead of ::new, which now takes
236
+ a single argument instead, either an Array or a String which it splits.
237
+ * Removed services.rb unitl in gets fixed and a better name.
238
+
239
+ == v0.3.3
240
+ * Added inheritable.rb, a lib for creating class vars inherit from ancestors
241
+ * Addes annotations.rb, a lightweight metadata system good for annotating
242
+ methods esspecially. It is built on top of inheritable.rb.
243
+
244
+ == 0.3.2
245
+ * Added services.rb, a lib for managing methods as first class objects
246
+ * Fixed/cleaned-up orm_supprt.rb
247
+
248
+ == 0.3.1
249
+ * Aliased #autoload_classes with #autorequire.
250
+ * Added #strfbits and #strfbytes to binary_multiplers.rb.
251
+
252
+ == 0.3.0
253
+ * Name change to Mega Modules!
254
+ * Added a few important files: multipliers.rb, binary_multipliers.rb,
255
+ time_in_english.rb and orm_inlectors.rb.
256
+ * Each one of these is a "Methods Module", i.e. They are a collection of
257
+ closely related methods that modify one or more core classes/modules.
258
+ Individually these methods could have very well ended up in Nano Methods,
259
+ but given there quantity and interrelation they were more suitable to a
260
+ module, and thus placed here.
261
+
262
+ == 0.2.0
263
+ * Initial public release
264
+
265
+ == 0.1.0
266
+ * Early Development as Ruby Carats