masterview 0.2.5 → 0.3.0

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 (155) hide show
  1. data/CHANGELOG +31 -1
  2. data/README +70 -69
  3. data/RELEASE_NOTES +70 -64
  4. data/Rakefile +26 -27
  5. data/TODO +13 -29
  6. data/doc/about.html +246 -0
  7. data/doc/configuration.html +49 -36
  8. data/doc/developer.html +423 -41
  9. data/doc/directives.html +139 -51
  10. data/doc/guide.html +19 -9
  11. data/doc/index.html +90 -224
  12. data/doc/installation.html +36 -28
  13. data/doc/media_list.html +30 -20
  14. data/doc/simple_diagram.html +3 -5
  15. data/doc/stylesheets/masterview.css +16 -1
  16. data/examples/rails_app_config/masterview/settings.rb +2 -1
  17. data/init.rb +1 -1
  18. data/lib/#ChangeLog# +6 -0
  19. data/lib/masterview/analyzer.rb +48 -34
  20. data/lib/masterview/attr_string_parser.rb +5 -1
  21. data/lib/masterview/case_insensitive_hash.rb +69 -0
  22. data/lib/masterview/{pathname_extensions.rb → core_ext/pathname.rb} +0 -0
  23. data/lib/masterview/{string_extensions.rb → core_ext/string.rb} +0 -0
  24. data/lib/masterview/deprecated/directive_base.rb +362 -0
  25. data/lib/masterview/directive_base.rb +201 -179
  26. data/lib/masterview/directive_dsl.rb +457 -0
  27. data/lib/masterview/directive_helpers.rb +28 -141
  28. data/lib/masterview/directive_load_path.rb +388 -0
  29. data/lib/masterview/directive_metadata.rb +377 -0
  30. data/lib/masterview/directive_registry.rb +259 -69
  31. data/lib/masterview/directives/.metadata +16 -0
  32. data/lib/masterview/directives/attr.rb +9 -8
  33. data/lib/masterview/directives/block.rb +11 -14
  34. data/lib/masterview/directives/check_box.rb +13 -18
  35. data/lib/masterview/directives/collection_select.rb +15 -29
  36. data/lib/masterview/directives/content.rb +9 -3
  37. data/lib/masterview/directives/else.rb +15 -13
  38. data/lib/masterview/directives/elsif.rb +14 -13
  39. data/lib/masterview/directives/eval.rb +20 -0
  40. data/lib/masterview/directives/form.rb +56 -9
  41. data/lib/masterview/directives/form_remote.rb +26 -0
  42. data/lib/masterview/directives/global_inline_erb.rb +10 -14
  43. data/lib/masterview/directives/hidden_field.rb +11 -20
  44. data/lib/masterview/directives/if.rb +13 -12
  45. data/lib/masterview/directives/image_tag.rb +20 -28
  46. data/lib/masterview/directives/import.rb +5 -12
  47. data/lib/masterview/directives/import_render.rb +7 -19
  48. data/lib/masterview/directives/insert_generated_comment.rb +8 -11
  49. data/lib/masterview/directives/javascript_include.rb +21 -12
  50. data/lib/masterview/directives/link_to.rb +14 -8
  51. data/lib/masterview/directives/link_to_function.rb +22 -0
  52. data/lib/masterview/directives/link_to_if.rb +15 -13
  53. data/lib/masterview/directives/link_to_remote.rb +13 -8
  54. data/lib/masterview/directives/omit_tag.rb +32 -16
  55. data/lib/masterview/directives/password_field.rb +10 -22
  56. data/lib/masterview/directives/radio_button.rb +11 -22
  57. data/lib/masterview/directives/replace.rb +7 -8
  58. data/lib/masterview/directives/select.rb +11 -24
  59. data/lib/masterview/directives/stylesheet_link.rb +20 -12
  60. data/lib/masterview/directives/submit.rb +11 -5
  61. data/lib/masterview/directives/text_area.rb +10 -23
  62. data/lib/masterview/directives/text_field.rb +10 -22
  63. data/lib/masterview/exceptions.rb +21 -0
  64. data/lib/masterview/extras/app/controllers/masterview_controller.rb +102 -75
  65. data/lib/masterview/extras/app/views/layouts/masterview_admin.rhtml +24 -23
  66. data/lib/masterview/extras/app/views/layouts/masterview_admin_config.rhtml +81 -0
  67. data/lib/masterview/extras/app/views/masterview/admin/configuration.rhtml +5 -1
  68. data/lib/masterview/extras/app/views/masterview/admin/create.rhtml +2 -2
  69. data/lib/masterview/extras/app/views/masterview/admin/directives.rhtml +5 -0
  70. data/lib/masterview/extras/app/views/masterview/admin/features.rhtml +5 -79
  71. data/lib/masterview/extras/app/views/masterview/admin/interact.rhtml +5 -0
  72. data/lib/masterview/extras/app/views/masterview/admin/list.rhtml +3 -71
  73. data/lib/masterview/extras/init_mv_admin_pages.rb +42 -23
  74. data/lib/masterview/filter_helpers.rb +26 -0
  75. data/lib/masterview/initializer.rb +99 -53
  76. data/lib/masterview/io.rb +19 -15
  77. data/lib/masterview/keyword_expander.rb +7 -2
  78. data/lib/masterview/masterview_info.rb +229 -23
  79. data/lib/masterview/masterview_version.rb +2 -2
  80. data/lib/masterview/parser.rb +275 -105
  81. data/lib/masterview/parser_helpers.rb +54 -0
  82. data/lib/masterview/rails_ext/action_controller_erb_direct.rb +29 -0
  83. data/lib/masterview/rails_ext/action_controller_reparse_checking.rb +27 -0
  84. data/lib/masterview/{extras/init_rails_erb_mv_direct.rb → rails_ext/action_view_erb_direct.rb} +12 -59
  85. data/lib/masterview/template_spec.rb +3 -2
  86. data/lib/masterview.rb +21 -12
  87. data/lib/rexml/parsers/baseparser_with_doctype_fix.rb +473 -0
  88. data/lib/rexml/parsers/sax2parser_with_doctype_fix.rb +243 -0
  89. data/test/directive_test_helper.rb +135 -0
  90. data/test/fixtures/directives/id_check.rb +18 -0
  91. data/test/fixtures/directives/test_directive_events.rb +70 -0
  92. data/test/test_helper.rb +18 -5
  93. data/test/tmp/views/layouts/product.rhtml +10 -10
  94. data/test/tmp/views/product/_form.rhtml +4 -4
  95. data/test/tmp/views/product/_product.rhtml +3 -3
  96. data/test/tmp/views/product/destroy.rhtml +5 -5
  97. data/test/tmp/views/product/edit.rhtml +4 -4
  98. data/test/tmp/views/product/list.rhtml +3 -3
  99. data/test/tmp/views/product/new.rhtml +4 -4
  100. data/test/tmp/views/product/show.rhtml +2 -2
  101. data/test/unit/attr_string_parser_test.rb +105 -0
  102. data/test/unit/case_insensitive_hash_mod_test.rb +104 -0
  103. data/test/unit/config_settings_test.rb +13 -1
  104. data/test/unit/default_generate_mio_filter_test.rb +3 -3
  105. data/test/unit/deprecated_directive_base_test.rb +30 -0
  106. data/test/unit/directive_attr_test.rb +111 -35
  107. data/test/unit/directive_base_test.rb +520 -1
  108. data/test/unit/directive_block_test.rb +30 -22
  109. data/test/unit/directive_content_test.rb +24 -11
  110. data/test/unit/directive_else_test.rb +18 -15
  111. data/test/unit/directive_elsif_test.rb +17 -15
  112. data/test/unit/directive_form_remote_test.rb +59 -0
  113. data/test/unit/directive_form_test.rb +31 -39
  114. data/test/unit/directive_global_inline_erb_test.rb +28 -17
  115. data/test/unit/directive_grid_test_notready.rb +38 -0
  116. data/test/unit/directive_helpers_test.rb +39 -0
  117. data/test/unit/directive_hidden_field_test.rb +44 -29
  118. data/test/unit/directive_if_test.rb +10 -7
  119. data/test/unit/directive_image_tag_test.rb +69 -61
  120. data/test/unit/directive_import_render_test.rb +28 -38
  121. data/test/unit/directive_import_test.rb +16 -14
  122. data/test/unit/directive_insert_generated_comment_test.rb +32 -0
  123. data/test/unit/directive_javascript_include_test.rb +40 -43
  124. data/test/unit/directive_link_to_function_test.rb +40 -0
  125. data/test/unit/directive_link_to_if_test.rb +52 -12
  126. data/test/unit/directive_link_to_remote_test.rb +58 -0
  127. data/test/unit/directive_link_to_test.rb +46 -31
  128. data/test/unit/directive_load_path_test.rb +257 -0
  129. data/test/unit/directive_metadata_test.rb +313 -0
  130. data/test/unit/directive_omit_tag_test.rb +73 -21
  131. data/test/unit/directive_password_field_test.rb +44 -38
  132. data/test/unit/directive_registry_test.rb +44 -0
  133. data/test/unit/directive_replace_test.rb +28 -12
  134. data/test/unit/directive_stylesheet_link_test.rb +43 -36
  135. data/test/unit/directive_submit_test.rb +29 -30
  136. data/test/unit/directive_text_area_test.rb +40 -36
  137. data/test/unit/directive_text_field_test.rb +44 -38
  138. data/test/unit/example_directive_child_events_test.rb +41 -0
  139. data/test/unit/example_test.rb +31 -4
  140. data/test/unit/file_mio_test.rb +18 -13
  141. data/test/unit/filter_helpers_test.rb +10 -8
  142. data/test/unit/find_directive_parent_test.rb +174 -0
  143. data/test/unit/keyword_expander_test.rb +4 -2
  144. data/test/unit/mio_test.rb +18 -11
  145. data/test/unit/mtime_string_hash_mio_tree_test.rb +5 -1
  146. data/test/unit/parser_test.rb +41 -29
  147. data/test/unit/pathname_extensions_test.rb +1 -1
  148. data/test/unit/run_parser_test.rb +2 -2
  149. data/test/unit/simplified_directive_base_test.rb +256 -0
  150. data/test/unit/string_hash_mio_test.rb +5 -1
  151. data/test/unit/template_file_watcher_test.rb +2 -2
  152. data/test/unit/template_test.rb +221 -46
  153. metadata +86 -45
  154. data/lib/masterview/directives/testfilter.rb +0 -55
  155. data/lib/masterview/extras/init_rails_reparse_checking.rb +0 -62
data/CHANGELOG CHANGED
@@ -1,3 +1,33 @@
1
+ 0.3.0 - November 8, 2006
2
+ Fixed compatibility of AdminPages with edge rails using dependency mechanism
3
+ Refactored directive api using DSL to simplify and solidify creation of directives
4
+ Fix find_last_parent bug which failed to search nested arrays properly, found and patch submitted by Sergey Shalatskly
5
+ Added form_remote, link_to_function, eval directives based on ideas from Sergey Shalatskly
6
+ New method Configuration.add_directive_path to add directives directories to load path.
7
+ Reworked directive framework to use DirectiveMetadata, support declarative metadata DSL
8
+ Support multiple namespaces for directive attribute markup.
9
+ Provide separate config defaults for builtin masterview directives (mv:) and addon directives (mvx:)
10
+ Support installation-level config of directive dir metadata defaults using .metadata file in directives directory.
11
+ Support app-level config of directive dir metadata defaults using path-entry options
12
+ Internal rework of directive loading and management to handle namespaces, config options
13
+ Internal cleanup in parser to remove old hooks for namespace and dir path options; supported by MV config.
14
+ Internal restructuring to introduce MasterView::MIO namespace for i/o mechanisms.
15
+ Add 'View Directives' page to MasterView Admin to display loaded directives info
16
+ Fix missing context layout of View Configuration page in MasterView Admin
17
+ Add Developer's Guide documentation (describe directive implementation framework)
18
+ Change output of directives to use parens for methods
19
+ Output xml declaration (version and encoding) and doctype if provided in template
20
+ Added custom version of rexml sax2parser and baseparser which throws proper event for doctype
21
+ Added directive API method find_parent_directive which allows for directives to find and communicate with their parents
22
+ Changed form directive to output closing form tag rather than using end_form_tag helper which is deprecated in rails 1.2
23
+ Changed form_remote directive to allow normal output of </form> and not output end_form_tag helper since end_form_tag helper has been deprecated in rails 1.2
24
+ Updated sidebox.css to work better with small IE browser windows
25
+
26
+ **UPGRADE CONSIDERATIONS:
27
+ default namespace of extensions directives changed from mv: to mvx:
28
+ upgrade any user created custom directives to use new directive API (see release notes)
29
+
30
+
1
31
  0.2.5 - August 19th, 2006
2
32
  Added default generate filter which will add in a default generate directive if none is found in template
3
33
  Changed default_parser_options to be merged in with original set rather than to be absolute replacement
@@ -34,7 +64,7 @@ Update javascript_include directive to infer path from src if attr_value is empt
34
64
  Update stylesheet_link directive to infer path from src if attr_value is empty
35
65
  New illustration
36
66
 
37
- 0.2.0 - June 20th, 2006 - Big release. Added capability for eliminating rhtml generation, extends rails so that rhtml can be pulled directly from MasterView.
67
+ 0.2.0 - June 20th, 2006 - Big release. Added capability for eliminating rhtml generation, extends rails so that rhtml can be pulled directly from MasterView.
38
68
  Support template compilation directly into Rails view cache for templates in app/views (rhtml generation now optional)
39
69
  New mechanism for configuring MasterView from settings files; internal initialization rework. Configuration can now be driven by editing config/masterview/settings.rb and/or config/masterview/environments/*.rb.
40
70
  Add support for configuring MasterView logger and log_level; default level INFO for dev, WARN otherwise
data/README CHANGED
@@ -1,21 +1,21 @@
1
- = MasterView - Rails-optimized (x)html friendly template engine
2
-
3
- MasterView is a ruby/rails optimized HTML/XHTML friendly template engine.
4
- It is designed to use the full power and productivity of rails including
5
- layouts, partials, and rails html helpers while still being editable/styleable
6
- in a WYSIWYG HTML editor.
7
-
8
- MasterView is distributed as a gem or a plugin. You may install it as a gem and
9
- then generate a lightweight plugin which mainly refers to the gem *or* you can
10
- simply install as a plugin which is self contained. I personally prefer installing
11
- as a gem for ease of management, however if you are running at a shared hosting
12
- environment you might not have authority to install this gem so you may install
1
+ = MasterView - Rails-optimized (x)html friendly template engine
2
+
3
+ MasterView is a ruby/rails optimized HTML/XHTML friendly template engine.
4
+ It is designed to use the full power and productivity of rails including
5
+ layouts, partials, and rails html helpers while still being editable/styleable
6
+ in a WYSIWYG HTML editor.
7
+
8
+ MasterView is distributed as a gem or a plugin. You may install it as a gem and
9
+ then generate a lightweight plugin which mainly refers to the gem *or* you can
10
+ simply install as a plugin which is self contained. I personally prefer installing
11
+ as a gem for ease of management, however if you are running at a shared hosting
12
+ environment you might not have authority to install this gem so you may install
13
13
  as a self contained plugin.
14
14
 
15
15
  If you are interested in the background story behind all this, it is at the end of this page.
16
16
 
17
17
  Author:: Jeff Barczewski
18
- Email:: jeff.barczewski @ gmail.com
18
+ Email:: jeff.barczewski (at) gmail (dot) com
19
19
  Primary developers:: Jeff Barczewski, Deb Lewis
20
20
  Website:: http://masterview.org
21
21
  Rubyforge project:: masterview
@@ -35,16 +35,16 @@ License:: MIT open source license like Rails
35
35
  == Prerequisites
36
36
 
37
37
  Requires::
38
- No external dependencies
38
+ No external dependencies
39
39
 
40
40
  Optional::
41
- tidy (gem) and tidy library - if these are installed you can use tidy to cleanup html into valid xhtml for use by MasterView
42
- log4r (gem) - if this gem is installed then MasterView will use it for logging otherwise it defaults to using built in Logger.
41
+ tidy (gem) and tidy library - if these are installed you can use tidy to cleanup html into valid xhtml for use by MasterView
42
+ log4r (gem) - if this gem is installed then MasterView will use it for logging otherwise it defaults to using built in Logger.
43
43
 
44
44
  == User Documentation
45
45
 
46
46
  MasterView documentation is available online at the MasterView site:
47
- http://www.masterview.org
47
+ http://www.masterview.org
48
48
  and on the rubyforge project
49
49
  http://rubyforge.org/projects/masterview/
50
50
 
@@ -70,12 +70,12 @@ to assist you during development with creating and managing your templates.
70
70
 
71
71
  == Background story
72
72
 
73
- I came from a Java Struts environment when I was introduced to Ruby. I
74
- was just in the process of evaluating Tapestry and JSF when I learned about Rails.
75
- Ruby and Rails changed my world forever. I had to however drop many of my bad
76
- habits aquired from years of Java and C++ work. I had to embrace the new ideas
73
+ I came from a Java Struts environment when I was introduced to Ruby. I
74
+ was just in the process of evaluating Tapestry and JSF when I learned about Rails.
75
+ Ruby and Rails changed my world forever. I had to however drop many of my bad
76
+ habits aquired from years of Java and C++ work. I had to embrace the new ideas
77
77
  and approach things now with a different mindset. (If you ever have a chance to
78
- hear Dave Thomas speak, you will know what I mean. He has a wonderfully entertaining
78
+ hear Dave Thomas speak, you will know what I mean. He has a wonderfully entertaining
79
79
  yet enlightening way of illustrating this.)
80
80
 
81
81
  After learning the Ruby and Rails way, (Thank you Matz and DHH for such wonderful
@@ -84,74 +84,75 @@ fun once again, and everything you do in Ruby or Rails is easier than any other
84
84
  language or framework I have ever seen. Even taking into account having to learn
85
85
  something new, I was still far more productive than ever before. The only thing
86
86
  that I felt that could be done better, was to have a nice html friendly templating
87
- engine so that designers and developers could work collaboratively together on a project.
88
- The designers could style and layout the pages with their WYSIWYG HTML editors and
89
- developers would have the full power of Ruby and Rails without having to jump
90
- through extra hoops to use them. I looked at the available html template engines
91
- to see if anything fit with my style. I was disappointed with each of them, mainly because
92
- they all made it harder than straigt ERb (rhtml) and were not able to use layouts
87
+ engine so that designers and developers could work collaboratively together on a project.
88
+ The designers could style and layout the pages with their WYSIWYG HTML editors and
89
+ developers would have the full power of Ruby and Rails without having to jump
90
+ through extra hoops to use them. I looked at the available html template engines
91
+ to see if anything fit with my style. I was disappointed with each of them, mainly because
92
+ they all made it harder than straigt ERb (rhtml) and were not able to use layouts
93
93
  and partials easily.
94
94
 
95
- After all the hard work so many people have put into Ruby and Rails, I wanted to see
96
- if there was anyway I could contribute as well, maybe extending one of the existing
97
- template projects to have the ideal functionality I was striving for. I wanted
98
- something to make my own web development even more productive. However after
99
- reviewing each of them and even getting into the source code, the closest ones seemed
100
- to be Amrita2, Liquid, and Kwartz. Unfortunately it was not going to be easy to add
95
+ After all the hard work so many people have put into Ruby and Rails, I wanted to see
96
+ if there was anyway I could contribute as well, maybe extending one of the existing
97
+ template projects to have the ideal functionality I was striving for. I wanted
98
+ something to make my own web development even more productive. However after
99
+ reviewing each of them and even getting into the source code, the closest ones seemed
100
+ to be Amrita2, Liquid, and Kwartz. Unfortunately it was not going to be easy to add
101
101
  the functionality and usability I desired.
102
102
 
103
- During my research I learned that many of the rails gurus were putting down html
104
- template engines because they felt that they handicapped the developer severely,
105
- namely by not taking advantage of rails layouts, partials, and html helpers.
106
- After doing some projects with ERb (rhtml) I realized that they were right. I too
107
- did not want to give up any of that power either. I also didn't want to create a
108
- bunch of extra code or config to use the templates (extra view code, or data
103
+ During my research I learned that many of the rails gurus were putting down html
104
+ template engines because they felt that they handicapped the developer severely,
105
+ namely by not taking advantage of rails layouts, partials, and html helpers.
106
+ After doing some projects with ERb (rhtml) I realized that they were right. I too
107
+ did not want to give up any of that power either. I also didn't want to create a
108
+ bunch of extra code or config to use the templates (extra view code, or data
109
109
  structures to pass to the templates) as so many of the other engines relied on.
110
110
 
111
- I expanded my search outside of Ruby for the best html template technology I could find.
112
- After reviewing all the front runners I still didn't find anything that quite met with my
113
- goals for developing with ruby and rails. I also didn't find any technology that was
114
- close enough that I could adapt it. However I did come across features in a variety of
115
- systems that inspired me, and helped me shape the ideas that are presented here.
116
- A few of those systems were Tapestry, Zope/PHP TAL, Kwartz, Amrita 2, Liquid,
117
- and Web Objects.
111
+ I expanded my search outside of Ruby for the best html template technology I could find.
112
+ After reviewing all the front runners I still didn't find anything that quite met with my
113
+ goals for developing with ruby and rails. I also didn't find any technology that was
114
+ close enough that I could adapt it. However I did come across features in a variety of
115
+ systems that inspired me, and helped me shape the ideas that are presented here.
116
+ A few of those systems were Tapestry, Zope/PHP TAL, Kwartz, Amrita 2, Liquid,
117
+ and Web Objects.
118
118
 
119
- After putting much thought into all the possible options I could not see extending
119
+ After putting much thought into all the possible options I could not see extending
120
120
  an existing template engine to meet my needs. And since I wanted this engine to have
121
121
  all the power of ruby and rails, it seemed that I would be best served by developing
122
122
  a html template syntax that was a thin layer above ERb. That way it would be intuitive
123
- to use (not having to learn yet another syntax) yet very powerful. Once I was able to
124
- come up with the desired syntax and approach it became apparent that this would also
123
+ to use (not having to learn yet another syntax) yet very powerful. Once I was able to
124
+ come up with the desired syntax and approach it became apparent that this would also
125
125
  be fairly straightforward to build.
126
126
 
127
- I ran the concept by the guys at the St. Louis Ruby Group http://stlruby.org and
128
- they were excited about the project. With their help I was able to simply some of
129
- the confusing or complicated areas before beginning development. They also sparked
130
- some ideas about how to make this infinitely extensible such that developers could
131
- easily add their own attribute directives. This would give them the power to create
132
- custom extensions that would encapsulate some of their development work. This would
133
- serve a couple needs, it would not only make this engine extensible, it would also
127
+ I ran the concept by the guys at the St. Louis Ruby Group http://stlruby.org and
128
+ they were excited about the project. With their help I was able to simply some of
129
+ the confusing or complicated areas before beginning development. They also sparked
130
+ some ideas about how to make this infinitely extensible such that developers could
131
+ easily add their own attribute directives. This would give them the power to create
132
+ custom extensions that would encapsulate some of their development work. This would
133
+ serve a couple needs, it would not only make this engine extensible, it would also
134
134
  allow this engine to grow easily being composed of small pluggable attribute directives.
135
- Many thanks to the members of this group, I continue to enjoy discussing the power of
135
+ Many thanks to the members of this group, I continue to enjoy discussing the power of
136
136
  Ruby and learning from each of them on a monthly basis.
137
137
 
138
- While I am on the subject of thanks, I would like to thank my wife and daughter for
139
- their support as I took time away from them to work on this project and I want to
140
- thank God for bringing the right people into my life just when I needed them and for
141
- bringing me on this wonderful journey, I am so very blessed. May I be able to give
138
+ While I am on the subject of thanks, I would like to thank my wife and daughter for
139
+ their support as I took time away from them to work on this project and I want to
140
+ thank God for bringing the right people into my life just when I needed them and for
141
+ bringing me on this wonderful journey, I am so very blessed. May I be able to give
142
142
  back some of what has been given to me.
143
143
 
144
144
  And one more mention of tremendous thanks to Deb Lewis, the other core developer on the
145
- team, she has spent countless hours reviewing, revising, and improving the codebase,
146
- configuration, and documentation. The project wouldn't be half of what it is today
147
- without all her help, inspiration, and hard work. I thoroughly enjoy working and
145
+ team, she has spent countless hours reviewing, revising, and improving the codebase,
146
+ configuration, and documentation. The project wouldn't be half of what it is today
147
+ without all her help, inspiration, and hard work. I thoroughly enjoy working and
148
148
  debating the finer points of the project with her each step of the way.
149
149
 
150
150
  So that's the story, I hope that many of you will find MasterView to be a useful
151
151
  tool for your development. I am continuing to refine MasterView by using it daily for
152
- Genesis Ministry sites and all my web projects. I know that there is much more work needed
153
- in documentation, examples, test cases, additional directives, etc., so I would
154
- appreciate any feedback and ideas that you have. Thanks for taking the time to
152
+ Genesis Ministry sites and all my web projects. I know that there is much more work needed
153
+ in documentation, examples, test cases, additional directives, etc., so I would
154
+ appreciate any feedback and ideas that you have. Thanks for taking the time to
155
155
  review MasterView!
156
156
 
157
- Jeff Barczewski (jeff.barczewski @ gmail.com)
157
+ Jeff Barczewski
158
+ jeff.barczewski (at) gmail (dot) com
data/RELEASE_NOTES CHANGED
@@ -1,5 +1,11 @@
1
1
  = MasterView - Rails-optimized (x)html friendly template engine
2
2
 
3
+ == Recent changes (Release 0.3.0 - Major update - refactoring of directive API (for developing directives)
4
+ The directive API for creating directives has been refactored and simplified. This will enable directives to be developed more easily by both core developers and MasterView users. The end goal is to make it extremely simple for anyone to create their own custom directives and to share those with the community, and thus the project can live and grow into many specialty areas. The directive API refactoring is one more step towards those goals.
5
+
6
+ The old directive_base.rb which provided the API for directives has been deprecated and moved to deprecated/directive_base.rb, MasterViewdevelopers which have developed custom directives should upgrade those directives to the new API as soon as possible. During the transition period one can use the original API by requiring the deprecated/directive_base.rb file and changing their directive to inherit from DirectiveBaseOld rather than DirectiveBase.
7
+
8
+
3
9
  == Recent changes (Release 0.2.5)
4
10
  Fix AdminPage compatibility with Rails 1.1.5+ which uses safe_load_paths to find controllers
5
11
  Fix rake mv:view_rhtml RHTML=foo/_bar.rhtml was not able to find partials
@@ -20,7 +26,7 @@ rhtml.
20
26
  Changed default development settings for enable_admin_pages and
21
27
  enable_view_rhtml = true (false in production) to make it easy
22
28
  for new users to get up and running. Added check_box, radio_button,
23
- select, collection_select directives. Refactor attr_value parsing
29
+ select, collection_select directives. Refactor attr_value parsing
24
30
  to be more robust taking into account nested objects. Internal rework
25
31
  of directive handling to support alternate namespaces for directives.
26
32
  Std app directives dir at rails app/masterview/directives will be
@@ -31,8 +37,8 @@ automatically added to MasterView load path if exists.
31
37
 
32
38
  Fixes problem when rails encounters exception in either compiling or
33
39
  involving RuntimeError in the generated rhtml. The rails TemplateError
34
- class looks at the file system for the template contents. So when
35
- generate_rhtml is false (no file is generated) rails was not able to
40
+ class looks at the file system for the template contents. So when
41
+ generate_rhtml is false (no file is generated) rails was not able to
36
42
  find source and was not outputting an error page. Rails TemplateError
37
43
  class was extended to look at MasterView store first and then fallback
38
44
  to file system.
@@ -40,11 +46,11 @@ to file system.
40
46
  == Recent changes (Release 0.2.1)
41
47
 
42
48
  Release 0.2.1 adds Mongrel support, a new image_tag directive
43
- and some additional illustrations and links to videos. Also
49
+ and some additional illustrations and links to videos. Also
44
50
  javascript_include and stylesheet_link directives can infer the
45
51
  path from the src attribute if the attr_value is empty.
46
52
 
47
- Also added additional logging around startup and the version of
53
+ Also added additional logging around startup and the version of
48
54
  MasterView that is running and a new admin page to visually
49
55
  see what MasterView features are currently loaded (tidy,
50
56
  auto parsing on change, parse on startup, reading rhtml direct
@@ -89,87 +95,87 @@ a new Configuration Guide describing how to customize the
89
95
  MasterView configuration.
90
96
 
91
97
  UPGRADE NOTES: If you have customized your MasterView configuration
92
- in the init.rb file of your existing plugin installation, you *MUST*
98
+ in the init.rb file of your existing plugin installation, you *MUST*
93
99
  migrate your configuration to the new settings file configuration mechanism
94
100
  (config/masterview/settings.rb and environment settings files).
95
101
 
96
- Also note that a directive was renamed from gen_render to gen_partial to
102
+ Also note that a directive was renamed from gen_render to gen_partial to
97
103
  more clearly represent the functionality and eliminate future confusion.
98
104
  Be sure to change any references to gen_render to gen_partial.
99
105
 
100
- The default location for MasterView templates is now the standard Rails
101
- app/views directory. Either move your existing templates into app/views
106
+ The default location for MasterView templates is now the standard Rails
107
+ app/views directory. Either move your existing templates into app/views
102
108
  or update the MasterView config.template_src_dir_path setting in your
103
- config/masterview/settings.rb to reference your existing templates source
109
+ config/masterview/settings.rb to reference your existing templates source
104
110
  directory.
105
111
 
106
112
  == Recent changes (Release 0.1.0)
107
113
 
108
- MasterView now by default generates five masterview template files instead
109
- of one, though you can specify the --single-file option to only generate
110
- one file. Using one masterview template file gives the most DRY implementation
111
- but since all the views are in one file, it can become a point of contention
112
- and is a little more difficult for designers to work with.
113
- This Version 0.1.0 upgrade fixes that by generating one masterview template
114
- for each action (list, new, edit, show, destroy). The layout and message
115
- partials are defined in the list template and are imported into the other
116
- files so that you can have a complete page rendering when working with style
117
- and design of page. Similarly new defines the form partial which is imported
114
+ MasterView now by default generates five masterview template files instead
115
+ of one, though you can specify the --single-file option to only generate
116
+ one file. Using one masterview template file gives the most DRY implementation
117
+ but since all the views are in one file, it can become a point of contention
118
+ and is a little more difficult for designers to work with.
119
+ This Version 0.1.0 upgrade fixes that by generating one masterview template
120
+ for each action (list, new, edit, show, destroy). The layout and message
121
+ partials are defined in the list template and are imported into the other
122
+ files so that you can have a complete page rendering when working with style
123
+ and design of page. Similarly new defines the form partial which is imported
118
124
  into edit, and show defines a _show partial which is imported into destroy.
119
125
 
120
- One can edit the layout or other partials in the file they are defined in,
121
- so for instance to edit the layout, edit the list template and once finished,
122
- you can trigger the other templates to be rebuilt with the current information.
123
- MasterView now contains an MasterView admin controller/view to visually see
124
- all the status and details about the templates. You can rebuild any out of sync
125
- templates from this page. Alternatively you can view and rebuild templates from
126
- the command line as well using the built in rake commands (mv:list, mv:list_all,
126
+ One can edit the layout or other partials in the file they are defined in,
127
+ so for instance to edit the layout, edit the list template and once finished,
128
+ you can trigger the other templates to be rebuilt with the current information.
129
+ MasterView now contains an MasterView admin controller/view to visually see
130
+ all the status and details about the templates. You can rebuild any out of sync
131
+ templates from this page. Alternatively you can view and rebuild templates from
132
+ the command line as well using the built in rake commands (mv:list, mv:list_all,
127
133
  mv:rebuild TEMPLATE=foo.html, mv:rebuild_all).
128
134
 
129
- To make it easy to add additional actions which also import the layout,
130
- MasterView now has a way to generate a starter template file for your action
131
- by simply choosing from which other template file you want to import the layout
132
- from. For instance say you want to add an action called hello to your Product
133
- controller. Find the masterview template you want to get the layout imported
134
- from which could be (product_list.html, product_new.html, product_edit.html, ...),
135
- you can choose any of the templates that have the layout you want (it doesn't
136
- matter whether they defined the layout or simply imported it. To generate the
137
- starter template go to the MasterView Admin page http://yourserver/masterview
138
- and click copy link next to the appropriate template. On the next screen indicate
139
- the name of the action you wish to add (in this case 'hello') and click the submit
140
- button. MasterView generates a starter template file product_hello.html which
141
- imports the layout from the template file you chose and it creates some
142
- placeholder divs in the template that you can edit to add your hello view code.
143
- Alternatively there is also a
144
- rake mv:copy_layout TEMPLATE=product_list.html ACTION=hello
135
+ To make it easy to add additional actions which also import the layout,
136
+ MasterView now has a way to generate a starter template file for your action
137
+ by simply choosing from which other template file you want to import the layout
138
+ from. For instance say you want to add an action called hello to your Product
139
+ controller. Find the masterview template you want to get the layout imported
140
+ from which could be (product_list.html, product_new.html, product_edit.html, ...),
141
+ you can choose any of the templates that have the layout you want (it doesn't
142
+ matter whether they defined the layout or simply imported it. To generate the
143
+ starter template go to the MasterView Admin page http://yourserver/masterview
144
+ and click copy link next to the appropriate template. On the next screen indicate
145
+ the name of the action you wish to add (in this case 'hello') and click the submit
146
+ button. MasterView generates a starter template file product_hello.html which
147
+ imports the layout from the template file you chose and it creates some
148
+ placeholder divs in the template that you can edit to add your hello view code.
149
+ Alternatively there is also a
150
+ rake mv:copy_layout TEMPLATE=product_list.html ACTION=hello
145
151
  command to allow you to do the same thing via command line.
146
152
 
147
- Note that you don't have to use the starter or generated files to use MasterView
148
- (you can just add MasterView attribute directives manually), but I found that
149
- once you had things started and wanted to reuse that same information, that
150
- having an automated way to get the layout imported makes it much easier and
151
- quicker to get things going. You can also change the default action div that is
152
- generated by simply creating your own file in app/views/masterview/admin/empty.rhtml
153
- which if found the copy_layout will use it, otherwise it uses the one from the gem/plugin.
153
+ Note that you don't have to use the starter or generated files to use MasterView
154
+ (you can just add MasterView attribute directives manually), but I found that
155
+ once you had things started and wanted to reuse that same information, that
156
+ having an automated way to get the layout imported makes it much easier and
157
+ quicker to get things going. You can also change the default action div that is
158
+ generated by simply creating your own file in app/views/masterview/admin/empty.rhtml
159
+ which if found the copy_layout will use it, otherwise it uses the one from the gem/plugin.
154
160
 
155
161
  == Description
156
162
 
157
- MasterView is a ruby/rails optimized HTML/XHTML friendly template engine.
158
- It is designed to use the full power and productivity of rails including
159
- layouts, partials, and rails html helpers while still being editable/styleable
160
- in a WYSIWYG HTML editor.
163
+ MasterView is a ruby/rails optimized HTML/XHTML friendly template engine.
164
+ It is designed to use the full power and productivity of rails including
165
+ layouts, partials, and rails html helpers while still being editable/styleable
166
+ in a WYSIWYG HTML editor.
161
167
 
162
- MasterView is distributed as a gem or a plugin. You may install it as a gem and
163
- then generate a lightweight plugin which mainly refers to the gem *or* you can
164
- simply install as a plugin which is self contained. I personally prefer installing
165
- as a gem for ease of management, however if you are running at a shared hosting
166
- environment you might not have authority to install this gem so you may install
168
+ MasterView is distributed as a gem or a plugin. You may install it as a gem and
169
+ then generate a lightweight plugin which mainly refers to the gem *or* you can
170
+ simply install as a plugin which is self contained. I personally prefer installing
171
+ as a gem for ease of management, however if you are running at a shared hosting
172
+ environment you might not have authority to install this gem so you may install
167
173
  as a self contained plugin.
168
174
 
169
175
  If you are interested in the background story behind all this, it is at the end of this page.
170
176
 
171
177
  Author:: Jeff Barczewski
172
- Email:: jeff.barczewski @ gmail.com
178
+ Email:: jeff.barczewski (at) gmail (dot) com
173
179
  Primary developers:: Jeff Barczewski, Deb Lewis
174
180
  Website:: http://masterview.org
175
181
  Rubyforge project:: masterview
@@ -189,16 +195,16 @@ License:: MIT open source license like Rails
189
195
  == Prerequisites
190
196
 
191
197
  Requires::
192
- No external dependencies
198
+ No external dependencies
193
199
 
194
200
  Optional::
195
- tidy (gem) and tidy library - if these are installed you can use tidy to cleanup html into valid xhtml for use by MasterView
196
- log4r (gem) - if this gem is installed then MasterView will use it for logging otherwise it defaults to using built in Logger.
201
+ tidy (gem) and tidy library - if these are installed you can use tidy to cleanup html into valid xhtml for use by MasterView
202
+ log4r (gem) - if this gem is installed then MasterView will use it for logging otherwise it defaults to using built in Logger.
197
203
 
198
204
  == User Documentation
199
205
 
200
206
  MasterView documentation is available online at the MasterView site:
201
- http://www.masterview.org
207
+ http://www.masterview.org
202
208
  and on the rubyforge project
203
209
  http://rubyforge.org/projects/masterview/
204
210
 
data/Rakefile CHANGED
@@ -107,8 +107,8 @@ end
107
107
  desc 'Run parser on masterview html templates in examples'
108
108
  namespace 'dev' do
109
109
  task :mvparse_examples do
110
- template_mio_tree = MasterView::FileMIOTree.new('examples', '.html', :logging => true )
111
- output_mio_tree = MasterView::FileMIOTree.new('tmp/views', '.rhtml', :logging => true )
110
+ template_mio_tree = MasterView::MIO::FileMIOTree.new('examples', '.html', :logging => true )
111
+ output_mio_tree = MasterView::MIO::MFileMIOTree.new('tmp/views', '.rhtml', :logging => true )
112
112
  template_mio_tree.find(:pattern => '*.html') do |mio|
113
113
  MasterView::Parser.parse_mio( mio, output_mio_tree )
114
114
  end
@@ -118,7 +118,7 @@ end
118
118
  # Run syntax check on all ruby code files
119
119
  desc 'Run syntax check on all ruby code files'
120
120
  namespace 'dev' do
121
- task :check_syntax do
121
+ task :check_syntax do
122
122
  #WAS: filelist = Dir.glob('**/*.rb')
123
123
  #skip: generators - erb-ized code templates confuse the parser
124
124
  filelist = [ 'init.rb', 'lib/masterview.rb' ]
@@ -129,11 +129,11 @@ task :check_syntax do
129
129
  unless output =~ /Syntax OK/
130
130
  puts "#{file}:"
131
131
  puts " #{output}"
132
- return
132
+ return
133
133
  end
134
134
  end
135
135
  puts "#{filelist.length} files checked"
136
- puts 'Syntax OK'
136
+ puts 'Syntax OK'
137
137
  end
138
138
  end
139
139
 
@@ -144,15 +144,15 @@ task :count_loc do
144
144
  files = 0
145
145
  lines = 0
146
146
  codelines = 0
147
-
148
- #VER1 WAS: Dir.foreach("lib") { |file_name|
147
+
148
+ #VER1 WAS: Dir.foreach("lib") { |file_name|
149
149
  #VER1 WAS: next unless file_name =~ /.*rb/
150
150
  #VER1 WAS: f = File.open("lib/" + file_name)
151
151
  filelist = [ 'init.rb', 'lib/masterview.rb' ]
152
152
  filelist.concat Dir.glob('lib/**/*.rb')
153
153
  #filelist.concat Dir.glob('test**/*.rb')
154
154
  filelist.each { |file_name|
155
-
155
+
156
156
  f = File.open(file_name)
157
157
  files += 1
158
158
 
@@ -179,7 +179,7 @@ end
179
179
  # Build/Release Tasks
180
180
  #==============================================================================
181
181
 
182
- # Publish beta gem
182
+ # Publish beta gem
183
183
  #desc "Publish the gem"
184
184
  #task :publish => [:rdoc, :package] do
185
185
  # Rake::SshFilePublisher.new("foobar.com", "dist/pkg", "pkg", "#{PKG_FILE_NAME}.zip").upload
@@ -221,7 +221,7 @@ desc 'Build all packages'
221
221
  task :package => [
222
222
  :copy_duplicated_files,
223
223
  # gems (runtime, mv generator, mv plugin generator, 3-in-1 supersaver)
224
- 'masterview:package',
224
+ 'masterview:package',
225
225
  'masterview_generator:package',
226
226
  'masterview_plugin_generator:package',
227
227
  'masterview_gem_pack:package',
@@ -233,7 +233,7 @@ desc 'Re-build all packages'
233
233
  task :repackage => [
234
234
  :copy_duplicated_files,
235
235
  # gems (runtime, mv generator, mv plugin generator, 3-in-1 supersaver)
236
- 'masterview:repackage',
236
+ 'masterview:repackage',
237
237
  'masterview_generator:repackage',
238
238
  'masterview_plugin_generator:repackage',
239
239
  'masterview_gem_pack:repackage',
@@ -257,17 +257,16 @@ task :rm_packages do
257
257
  FileUtils.remove_dir('pkg', true)
258
258
  end
259
259
 
260
- ####
261
- #ISSUE: jeff - we don't include that top-level index.html in any of the packages?!
262
- ####
260
+
263
261
  PKG_FILES_RELEASE_DOCS = [
264
262
  "[A-Z]*" # README, RELEASE_NOTES, CHANGELOG, MIT_LICENSE, TODO
265
263
  ]
266
264
 
267
265
  PKG_FILES_RUNTIME = [
268
266
  "lib/**/*",
267
+ "lib/**/.metadata",
269
268
  "directives/**/*", #SHOULD THIS GO AWAY (??)
270
- "Rakefile",
269
+ "Rakefile",
271
270
  "init.rb"
272
271
  ]
273
272
  PKG_FILES_MV_GENERATOR = [
@@ -311,8 +310,8 @@ namespace 'masterview_plugin' do
311
310
  s.require_path = 'lib'
312
311
  s.autorequire = 'masterview'
313
312
  s.author = "Jeff Barczewski"
314
- s.email = "jeff.barczewski@gmail.com"
315
- s.homepage = "http://masterview.org/"
313
+ s.email = "jeff.barczewski (at) gmail (dot) com"
314
+ s.homepage = "http://masterview.org/"
316
315
  end
317
316
 
318
317
  # Create Rubygem package
@@ -323,7 +322,7 @@ namespace 'masterview_plugin' do
323
322
  end
324
323
 
325
324
  desc "Release files on RubyForge."
326
- task :release_files => [ :verify_rubyforge ] do
325
+ task :release_files => [ :verify_rubyforge ] do
327
326
  release_files = ["zip", "tgz"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
328
327
 
329
328
  Rake::XForge::Release.new(MASTERVIEW) do |release|
@@ -383,8 +382,8 @@ namespace 'masterview_gem_pack' do
383
382
  s.add_dependency( 'masterview_generator', ">= #{PKG_VERSION}" )
384
383
  s.add_dependency( 'masterview_plugin_generator', ">= #{PKG_VERSION}" )
385
384
  s.author = "Jeff Barczewski"
386
- s.email = "jeff.barczewski@gmail.com"
387
- s.homepage = "http://masterview.org/"
385
+ s.email = "jeff.barczewski (at) gmail (dot) com"
386
+ s.homepage = "http://masterview.org/"
388
387
  end
389
388
 
390
389
  # Create Rubygem package
@@ -395,7 +394,7 @@ namespace 'masterview_gem_pack' do
395
394
  end
396
395
 
397
396
  desc "Release files on RubyForge."
398
- task :release_files => [ :verify_rubyforge ] do
397
+ task :release_files => [ :verify_rubyforge ] do
399
398
  release_files = ["gem"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
400
399
 
401
400
  Rake::XForge::Release.new(MASTERVIEW) do |release|
@@ -453,8 +452,8 @@ namespace 'masterview' do
453
452
  s.autorequire = 'masterview'
454
453
  s.extra_rdoc_files = ['README']
455
454
  s.author = "Jeff Barczewski"
456
- s.email = "jeff.barczewski@gmail.com"
457
- s.homepage = "http://masterview.org/"
455
+ s.email = "jeff.barczewski (at) gmail (dot) com"
456
+ s.homepage = "http://masterview.org/"
458
457
  end
459
458
 
460
459
  # Create Rubygem package
@@ -465,7 +464,7 @@ namespace 'masterview' do
465
464
  end
466
465
 
467
466
  desc "Release files on RubyForge."
468
- task :release_files => [ :verify_rubyforge ] do
467
+ task :release_files => [ :verify_rubyforge ] do
469
468
  release_files = ["gem"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
470
469
 
471
470
  Rake::XForge::Release.new(MASTERVIEW) do |release|
@@ -514,7 +513,7 @@ namespace 'masterview_generator' do
514
513
  RELEASE_NAME = "REL #{PKG_VERSION}"
515
514
  #PKG_INCLUDES = PKG_FILES_MV_GENERATOR
516
515
  #PKG_FILES = FileList.new( PKG_INCLUDES ).exclude( PKG_FILES_EXCLUDE_PATTERN )
517
-
516
+
518
517
  desc "Package masterview_generator"
519
518
  task :package do
520
519
  work_dir = Dir.getwd
@@ -532,7 +531,7 @@ namespace 'masterview_generator' do
532
531
  end
533
532
 
534
533
  desc "Release files on RubyForge."
535
- task :release_files => [ :verify_rubyforge ] do
534
+ task :release_files => [ :verify_rubyforge ] do
536
535
  release_files = ["gem"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
537
536
 
538
537
  Rake::XForge::Release.new(MASTERVIEW) do |release|
@@ -598,7 +597,7 @@ namespace 'masterview_plugin_generator' do
598
597
  end
599
598
 
600
599
  desc "Release files on RubyForge."
601
- task :release_files => [ :verify_rubyforge ] do
600
+ task :release_files => [ :verify_rubyforge ] do
602
601
  release_files = ["gem"].map { |ext| "pkg/#{PKG_FILE_NAME}.#{ext}" }
603
602
 
604
603
  Rake::XForge::Release.new(MASTERVIEW) do |release|