masterview 0.3.2 → 0.3.3

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 (73) hide show
  1. data/CHANGELOG +15 -0
  2. data/RELEASE_NOTES +26 -2
  3. data/Rakefile +35 -10
  4. data/ReleaseAnnouncement +124 -0
  5. data/TODO +6 -0
  6. data/doc/configuration.html +39 -0
  7. data/doc/guide.html +14 -13
  8. data/doc/index.html +1 -1
  9. data/doc/installation.html +1 -1
  10. data/doc/media_list.html +19 -3
  11. data/examples/rails_app_config/masterview/settings.rb +5 -0
  12. data/lib/masterview/analyzer.rb +13 -1
  13. data/lib/masterview/directives/form.rb +4 -1
  14. data/lib/masterview/directives/stylesheet_link.rb +1 -1
  15. data/lib/masterview/extras/auto_copy.rb +80 -0
  16. data/lib/masterview/initializer.rb +87 -4
  17. data/lib/masterview/io.rb +11 -0
  18. data/lib/masterview/masterview_version.rb +1 -1
  19. data/lib/masterview/mtime_tracking_hash.rb +12 -3
  20. data/lib/masterview/parser.rb +2 -2
  21. data/lib/masterview/rails_ext/action_controller_reparse_checking.rb +10 -9
  22. data/lib/masterview/rails_ext/action_view_erb_direct.rb +53 -34
  23. data/lib/masterview/rails_ext/short_path_calc.rb +127 -0
  24. data/lib/masterview/template_spec.rb +27 -9
  25. data/lib/masterview.rb +1 -1
  26. data/test/tmp/dst/public/images/FOO.GIF +1 -0
  27. data/test/tmp/dst/public/images/bar/baz.png +1 -0
  28. data/test/tmp/dst/public/images/blank.gif +1 -0
  29. data/test/tmp/dst/public/images/cat/dog/mouse.JPG +1 -0
  30. data/test/tmp/dst/public/images/star.jpg +1 -0
  31. data/test/tmp/dst/public/images/test.png +1 -0
  32. data/test/tmp/dst/public/javascript/custom/script.js +1 -0
  33. data/test/tmp/dst/public/javascript/nested/custom/foo.js +1 -0
  34. data/test/tmp/dst/public/javascript/prototype.js +1 -0
  35. data/test/tmp/dst/public/javascript/scriptaculous.js +1 -0
  36. data/test/tmp/dst/public/stylesheets/client/standard/great1.css +1 -0
  37. data/test/tmp/dst/public/stylesheets/custom/blue.css +1 -0
  38. data/test/tmp/dst/public/stylesheets/style.css +1 -0
  39. data/test/tmp/src/css/client/standard/great1.css +1 -0
  40. data/test/tmp/src/css/custom/blue.css +1 -0
  41. data/test/tmp/src/css/style.css +1 -0
  42. data/test/tmp/src/images/FOO.GIF +1 -0
  43. data/test/tmp/src/images/bar/baz.png +1 -0
  44. data/test/tmp/src/images/blank.gif +1 -0
  45. data/test/tmp/src/images/cat/dog/mouse.JPG +1 -0
  46. data/test/tmp/src/images/star.jpg +1 -0
  47. data/test/tmp/src/images/test.png +1 -0
  48. data/test/tmp/src/mixed/FOO.GIF +1 -0
  49. data/test/tmp/src/mixed/bar/baz.png +1 -0
  50. data/test/tmp/src/mixed/blank.gif +1 -0
  51. data/test/tmp/src/mixed/cat/dog/mouse.JPG +1 -0
  52. data/test/tmp/src/mixed/client/standard/great1.css +1 -0
  53. data/test/tmp/src/mixed/custom/blue.css +1 -0
  54. data/test/tmp/src/mixed/custom/script.js +1 -0
  55. data/test/tmp/src/mixed/nested/custom/foo.js +1 -0
  56. data/test/tmp/src/mixed/prototype.js +1 -0
  57. data/test/tmp/src/mixed/scriptaculous.js +1 -0
  58. data/test/tmp/src/mixed/star.jpg +1 -0
  59. data/test/tmp/src/mixed/style.css +1 -0
  60. data/test/tmp/src/mixed/test.png +1 -0
  61. data/test/tmp/src/scripts/custom/script.js +1 -0
  62. data/test/tmp/src/scripts/nested/custom/foo.js +1 -0
  63. data/test/tmp/src/scripts/prototype.js +1 -0
  64. data/test/tmp/src/scripts/scriptaculous.js +1 -0
  65. data/test/unit/auto_copy_test.rb +181 -0
  66. data/test/unit/directive_form_test.rb +63 -0
  67. data/test/unit/directive_stylesheet_link_test.rb +3 -3
  68. data/test/unit/file_mio_test.rb +24 -8
  69. data/test/unit/mtime_string_hash_mio_tree_test.rb +19 -6
  70. data/test/unit/short_path_calc_test.rb +135 -0
  71. data/test/unit/string_hash_mio_test.rb +18 -5
  72. data/test/unit/template_test.rb +37 -0
  73. metadata +85 -2
data/CHANGELOG CHANGED
@@ -1,3 +1,18 @@
1
+ 0.3.3
2
+ Added xml doctype to generated code
3
+ Fixed bug in gen_replace where it was generating <% %> rather than <%= %> (Thanks to Jon Frisby for indentifying)
4
+ Fix defect in form tag not setting :multipart => true when form enctype=multipart/form-data (Thanks to Rajavel Lenin for identifying)
5
+ Fix defect in stylesheet_link, was looking at attribute src rather than href (Thanks to Rajavel Lenin for identifying)
6
+ Make REXML sax2parser selection configurable and use patched sax2parser if compatible REXML version 3.1.4-3.1.5 is installed (Thanks to David Koontz for help in indentifying issue)
7
+ Update masterview_plugin generator which generates plugin stub to create examples/rails_app_admin_auth/admin_auth_mixin.rb
8
+ Added auto_copy feature that can be configured to auto copy static files like stylesheets, images, and javascripts from a non-standard location to the proper location at runtime (under public).
9
+ Fixed defect with integration of other plugins that can change view_base, causing templates to not be found from MasterView
10
+ Fix rebuild template so that doctypes are retained when rebuilding or copying and in scaffold generation
11
+ Fix rails runtime detection to include RadRails launch using -e
12
+ Added rake mv:clean_mv_rhtml task which removes MasterView generated rhtml if generating to file system
13
+
14
+
15
+
1
16
  0.3.2 - February 20, 2007
2
17
  Fix bug in mv:attr directive where multiparam eval method like :a => #{hello 1,2} was not being parsed properly
3
18
  Added mv:select to alphabetical list on bottom of directives html doc page
data/RELEASE_NOTES CHANGED
@@ -1,6 +1,30 @@
1
1
  = MasterView - Rails-optimized (x)html friendly template engine
2
2
 
3
- == Recent changes (Release 0.3.2 - Maintenance release plus custom admin auth
3
+ == Recent changes (Release 0.3.3) - Maintenance release plus auto_copy
4
+ Added auto copy feature which can be configured to automatically copy static files
5
+ like stylesheets, images, and javascripts from a non-standard location to the proper
6
+ location at runtime (under Rails public). This makes it easy to use HTML prototypes
7
+ and associated files with MasterView eliminating any manual copying.
8
+
9
+ This release fix adds doctype to generated code, and a bug in gen_replace which
10
+ outputted <% %> rather than <%= %> (thanks Jon Frisby). Fixed defect in multipart
11
+ form and stylesheet_link directives (thanks Rajavel Lenin).
12
+
13
+ Made REXML sax2parser configurable. Generator now creates example for custom
14
+ admin auth mixin controlling authentication with custom code. (thanks David Koontz)
15
+
16
+ Fix defect which prevented MasterView to be used with Goldberg or other plugins which
17
+ alter the view base unless MasterView was configured to generate the rhtml files.
18
+
19
+ Fix rails runtime detection when running in RadRails which launches using -e
20
+
21
+ Added rake task mv:clean_mv_rhtml task which removes the MasterView generated rhtml
22
+ if you have configured MasterView to generate to the file system. Only removes
23
+ files that it generates leaving other rhtml untouched. This is useful when switching
24
+ to not generating rhtml mode when it was previously enabled.
25
+
26
+
27
+ == Release 0.3.2 - Maintenance release plus custom admin auth
4
28
  This release addresses a compatibility problem with Rails 1.2 where a view syntax
5
29
  error would not display the normal debug output but instead displayed only a blank
6
30
  screen. Also fixed a parsing problem with multiple parameters in some directives.
@@ -8,7 +32,7 @@ Added the ability to use custom mixin for authorization to MasterView admin scre
8
32
  Changed the MasterView generator to use request, flash, and params rather than
9
33
  deprecated @request, @flash, and @params. Tested with Rails 1.2.2
10
34
 
11
- == Recent changes (Release 0.3.1 - Maintenance release
35
+ == Release 0.3.1 - Maintenance release
12
36
  This release addresses an issue with ruby 1.8.5, fixes a problem with the
13
37
  deprecated/directive_base used for custom directives, updates a few out of
14
38
  date docs, and accomodates a change to the API of the Rails 1.2 generator
data/Rakefile CHANGED
@@ -212,6 +212,7 @@ task :copy_duplicated_files do
212
212
  copy_if_different 'init.rb', 'generators/masterview_plugin/templates/init.rb'
213
213
  copy_if_different 'tasks/masterview.rake', 'generators/masterview_plugin/templates/masterview.rake'
214
214
  copy_if_different 'lib/masterview/extras/app/views/masterview/admin/empty.rhtml', 'generators/masterview_plugin/templates/empty.rhtml'
215
+ copy_if_different 'examples/rails_app_admin_auth/admin_auth_mixin.rb', 'generators/masterview_plugin/templates/admin_auth_mixin.rb'
215
216
  copy_if_different 'examples/rails_app_config/masterview/settings.rb', 'generators/masterview_plugin/templates/settings.rb'
216
217
  copy_if_different 'examples/rails_app_config/masterview/environment/development.rb', 'generators/masterview_plugin/templates/development.rb'
217
218
  copy_if_different 'examples/rails_app_config/masterview/environment/production.rb', 'generators/masterview_plugin/templates/production.rb'
@@ -635,15 +636,15 @@ end
635
636
 
636
637
 
637
638
  desc "Publish news on RubyForge"
638
- task :publish_news => [ :verify_rubyforge, :tar, :gem, :demotar] do
639
- Rake::XForge::NewsPublisher.new(Ruby_PDF) do |news|
639
+ task :publish_news => [ :verify_rubyforge] do
640
+ Rake::XForge::NewsPublisher.new(MASTERVIEW) do |news|
640
641
  news.user_name = ENV['RUBYFORGE_USER']
641
642
  news.password = ENV['RUBYFORGE_PASSWORD']
642
- news.subject = "PDF::Writer #{PDF::Writer::VERSION} Released"
643
+ news.subject = "MasterView #{MasterView::VERSION::STRING} Rails-optimized (x)html template engine"
643
644
  news.changes_file = nil
644
645
 
645
646
  details = []
646
- File.open("Release-Announcement") do |file|
647
+ File.open("ReleaseAnnouncement") do |file|
647
648
  file.each do |line|
648
649
  line.chomp!
649
650
  break if line =~ /^=/
@@ -654,14 +655,38 @@ task :publish_news => [ :verify_rubyforge, :tar, :gem, :demotar] do
654
655
  end
655
656
  end
656
657
 
657
- desc "Post a release announcement via GMail."
658
- #task :email_announcement => [ :verify_gmail, :tar, :gem, :demotar] do
659
- task :email_announcement => [ :verify_gmail ] do
658
+ # encapsulate gmail email call
659
+ # takes mail_to address using form - Foo <foo@bar.com>
660
+ def email_announcement_to(mail_to)
660
661
  require 'gmailer'
662
+ puts "Emailing #{mail_to}"
661
663
  GMailer.connect(ENV["GMAIL_USER"], ENV["GMAIL_PASSWORD"]) do |gmail|
662
- gmail.send :to => "ruby-talk@ruby-lang.org",
663
- :subject => "[ANN] PDF::Writer #{PDF::Writer::VERSION}",
664
- :body => File.read("Release-Announcement")
664
+ gmail.send :to => mail_to,
665
+ :subject => "[ANN] MasterView #{MasterView::VERSION::STRING} Rails-optimized (x)html template engine",
666
+ :body => File.read("ReleaseAnnouncement")
665
667
  end
668
+ end
669
+
670
+ desc "Post a release announcement via GMail to all mailing lists"
671
+ task :email_announcements => [ :email_ruby, :email_rails, :email_masterview, :email_stl ]
672
+
666
673
 
674
+ task :email_ruby => [ :verify_gmail ] do
675
+ email_announcement_to "Ruby-Talk <ruby-talk@ruby-lang.org>"
667
676
  end
677
+
678
+ task :email_rails => [ :verify_gmail ] do
679
+ email_announcement_to "Ruby on Rails - Talk <rubyonrails-talk@googlegroups.com>"
680
+ end
681
+
682
+ task :email_masterview => [ :verify_gmail ] do
683
+ email_announcement_to "MasterView-Devel <masterview-devel@rubyforge.org>"
684
+ email_announcement_to "MasterView-Users <masterview-users@rubyforge.org>"
685
+ email_announcement_to "MasterView-Announce <masterview-announce@rubyforge.org>"
686
+ end
687
+
688
+ task :email_stl => [ :verify_gmail ] do
689
+ email_announcement_to "St. Louis Ruby Users <stlruby@googlegroups.com>"
690
+ end
691
+
692
+
@@ -0,0 +1,124 @@
1
+ = MasterView - Rails-optimized (x)html friendly template engine
2
+
3
+ MasterView is a template engine plugin that provides another option to the existing rails view templates (rhtml and rxml). This template engine has all the power of layouts, partials, and rails helpers but is still editable/styleable in a WYSIWYG editor.
4
+
5
+ Another major goal it to have the syntax of these attribute directives be very similar to rails helpers so that one could intuitively start using MasterView with little learning curve other than knowing rails. MasterView users can additionally create their own directives to encapsulate custom functionality so the system can be easily extended into specific uses.
6
+
7
+ MasterView was inspired by Amrita, Kwartz, Tapestry, Zope/PHP TAL, Liquid, and Web Objects but designed with a fresh approach and specifically targetted for rails users.
8
+
9
+ There are several ways to use MasterView:
10
+
11
+ - Start with a pure HTML prototype of your site and add directives to the pages to make them live. You can continue to WYSIWYG edit HTML prototype throughout project life cycle. (See screencast for demonstration)
12
+
13
+ - If you don't have an HTML prototype and want to generate a CRUD application, you may use the MasterView generator which creates a styled CRUD application which you can then change as needed.
14
+
15
+ - If you already have an application but would like to use MasterView, you can start to use MasterView for new pages. MasterView will co-exist nicely with existing rhtml and you can slowly evolve the site over time.
16
+
17
+
18
+ == Recent changes (Release 0.3.3) - Maintenance release plus auto_copy
19
+ Added auto copy feature which can be configured to automatically copy static files like stylesheets, images, and javascripts from a non-standard location to the proper location at runtime (under Rails public). This makes it easy to use HTML prototypes and associated files with MasterView eliminating any manual copying.
20
+
21
+ This release fix adds doctype to generated code, and a bug in gen_replace which outputted <% %> rather than <%= %> (thanks Jon Frisby). Fixed defect in multipart form and stylesheet_link directives (thanks Rajavel Lenin).
22
+
23
+ Made REXML sax2parser configurable. Generator now creates example for custom admin auth mixin controlling authentication with custom code. (thanks David Koontz)
24
+
25
+ Fix defect which prevented MasterView to be used with Goldberg or other plugins which alter the view base unless MasterView was configured to generate the rhtml files.
26
+
27
+ Fix rails runtime detection when running in RadRails which launches using -e
28
+
29
+ Added rake task mv:clean_mv_rhtml task which removes the MasterView generated rhtml if you have configured MasterView to generate to the file system. Only removes files that it generates leaving other rhtml untouched. This is useful when switching to not generating rhtml mode when it was previously enabled.
30
+
31
+ == Release 0.3.2 - Maintenance release plus custom admin auth
32
+ This release addresses a compatibility problem with Rails 1.2 where a view syntax error would not display the normal debug output but instead displayed only a blank screen. Also fixed a parsing problem with multiple parameters in some directives. Added the ability to use custom mixin for authorization to MasterView admin screens. Changed the MasterView generator to use request, flash, and params rather than deprecated @request, @flash, and @params. Tested with Rails 1.2.2
33
+
34
+
35
+ == Details
36
+
37
+ Author:: Jeff Barczewski
38
+ Email:: jeff.barczewski (at) gmail (dot) com
39
+ Primary developers:: Jeff Barczewski, Deb Lewis
40
+ Website:: http://masterview.org
41
+ Rubyforge project:: masterview (http://rubyforge.org/projects/masterview)
42
+ License:: MIT open source license like Rails
43
+
44
+
45
+ === Video ===
46
+
47
+ A short video demonstrating use of MasterView converting an HTML prototype into a live application while still allowing round trip WYSIWYG editing.
48
+ http://masterview.org/media/html-to-live/screencast.html
49
+
50
+
51
+ === Screenshots, illustrations, other video ===
52
+
53
+ http://masterview.org/media_list.html
54
+
55
+
56
+ === Packaging ===
57
+
58
+ MasterView is distributed as a gem or a plugin. You may install it as a gem and then generate a lightweight plugin which mainly refers to the gem *or* you can simply install as a plugin which is self contained. I personally prefer installing as a gem for ease of management, however if you are running at a shared hosting environment you might not have authority to install this gem so you may install as a self contained plugin.
59
+
60
+
61
+ == Goals
62
+
63
+ - Create/extend a template engine for rails that would be XHTML friendly and thus could be edited/styled with a WYSIWYG HTML editor even late in development without breaking template.
64
+ - Keep it simple. DRY. No extra config files, simple syntax with ruby flavor.
65
+ - Design it specifically for ruby and rails. Use the full power and not be limited in its capabilities over what can be done with ERb
66
+ - Work nicely with layouts, partials, and rails html helpers.
67
+ - Reduce complexity, work with existing rails code, no extra view logic or hashes than what is used by ERb. Scaffold generate initial templates or work from existing html prototype.
68
+ - Reduce the numbers of files, simplifying editing. Define partials and layouts naturallyl right in the template, no need to go to another file.
69
+ - Preview in browser without running an app. Allow for dummy data in the template so that the page can be viewed and styled independently of the application.
70
+ - Performance equal to ERb
71
+
72
+
73
+ == Prerequisites
74
+
75
+ Requires::
76
+ No external dependencies
77
+
78
+ Optional::
79
+ tidy (gem) and tidy library
80
+ if these are installed you can use tidy to cleanup
81
+ html into valid xhtml for use by MasterView
82
+
83
+ log4r (gem)
84
+ if this gem is installed then MasterView will use
85
+ it for logging otherwise it defaults to using built
86
+ in Logger.
87
+
88
+
89
+
90
+ == User Documentation
91
+
92
+ MasterView documentation is available online at the MasterView site:
93
+ http://www.masterview.org
94
+ and on the rubyforge project
95
+ http://rubyforge.org/projects/masterview/
96
+
97
+
98
+ == Installation
99
+
100
+ Detailed installation instructions for installing the masterview gems or a self-contained copy of the plugin is provided in the MasterView Installation Guide.
101
+
102
+ The Configuration Guide describes how to customize the configuration of the MasterView template engine for your application.
103
+
104
+
105
+ == Usage
106
+
107
+ The MasterView User's Guide and a complete Directives Reference are provided in the MasterView user documentation. MasterView templates can be created by adding masterview directives markup to an (x)html ptototype, or can be generated for typical Rails controller/view scenarios using the supplied masterview generator developer tool.
108
+
109
+ A MasterView Admin controller can optionally be activated in your application to assist you during development with creating and managing your templates.
110
+
111
+
112
+ == Next Steps
113
+
114
+ Visit the online documentation page at http://masterview.org/ for screenshots, illustrations, complete installation and usage information.
115
+
116
+ We would love to hear your feedback and ideas around this project! Visit the rubyforge project to join the users mailing list or to add yourself to the announce list to receive future announcements. Check out the video to see MasterView in action!
117
+
118
+ Thanks for your time!!
119
+
120
+
121
+ MasterView Development Team
122
+ Jeff Barczewski and Deb Lewis
123
+
124
+
data/TODO CHANGED
@@ -59,3 +59,9 @@ TODO LIST
59
59
  - link_to can now take simple string as options rather than hash, but the implied name thing causes a problem since we don't know whether name was passed or not
60
60
 
61
61
  - REST generator
62
+
63
+ - mongrel + erb MERB, camping, nitro, examples
64
+
65
+ - image button submit directive
66
+
67
+ - other directive ideas from components (address block, nav menus, calendar, tree, tabbed pane, file upload, add/remove idiom, alert, editable list, sortable list, wizard)
@@ -290,6 +290,36 @@ Use <code>config.template_src_dir_abs_path(abs_path)</code> to specify the templ
290
290
  <td class="default">*.html</td>
291
291
  <td class="description">Filename pattern for masterview template files within the template source directory.</td>
292
292
  </tr>
293
+ <tr>
294
+ <td class="setting">auto_copy_file_entries</td>
295
+ <td class="default">[] (empty array) - nothing is auto copied</td>
296
+ <td class="description">Locations of files that MasterView will autocopy to a runtime location
297
+ <div class="explanation">
298
+ This autocopy feature makes it easy to have prototypes that display properly for
299
+ WYSIWYG editing and design, using files (images, stylesheets, and javascript) which are not
300
+ in the standard Rails locations but are automatically copied to proper place for runtime.
301
+ This is commonly used in conjunction with template_src_dir_path (which changes the
302
+ location of the source MasterView templates). Developers can have their templates in a non-standard
303
+ location along with images, stylesheets, and javascript, and then still have everything copied to
304
+ the proper runtime locations when Rails is fired up. In debug mode, timestamps are checked on every request,
305
+ in production mode, copy is done only on startup.
306
+ <br/><br/>
307
+ Each entry is a hash that needs to contain
308
+ <ul>
309
+ <li>:source => 'path to source folder' # absolute or relative to RAILS_ROOT</li>
310
+ <li>:destination => 'path to place to copy to' # absolute or relative to RAILS_ROOT</li>
311
+ </ul>
312
+ and can optionally have a file extension filter
313
+ <ul>
314
+ <li>:extensions => [:gif, :GIF, :jpg, :JPG] # limit files copied to this array of extensions, case sensitive</li>
315
+ </ul>
316
+ Example usage showing three paths added to be auto copied:<br/>
317
+ config.auto_copy_file_entries << { :source => 'path_to_my_images', :destination => 'public/images' }<br/>
318
+ config.auto_copy_file_entries << { :source => 'path_to_my_scripts', :destination => 'public/javascripts', :extensions => [:js, :JS] } # only copy js files<br/>
319
+ config.auto_copy_file_entries << { :source => 'path_to_my_css', :destination => 'public/stylesheets' }<br/>
320
+ </div>
321
+ </td>
322
+ </tr>
293
323
  <!--####
294
324
  <tr>
295
325
  <td class="setting">XXX</td>
@@ -427,6 +457,15 @@ element. If a body tag is present and mv:generate is being added then also add m
427
457
  <div class="explanation">Needs to match <code>inline_erb_start</code> and <code>inline_erb_end</code></div>
428
458
  </td>
429
459
  </tr>
460
+ <tr>
461
+ <td class="setting">use_original_rexml_sax2parser</td>
462
+ <td class="default">false</td>
463
+ <td class="description">Boolean to specify whether to use the original (unpatched) REXML sax2parser.
464
+ <div class="explanation">If this is not true and the REXML version is 3.1.4 - 3.1.6 MasterView will use a patched version of the REXML sax2parser which properly handles doctypes. If this is true or the REXML version is outside this range the original REXML sax2 parser will be used.</div>
465
+ </td>
466
+ </tr>
467
+
468
+
430
469
  <!--####
431
470
  <tr>
432
471
  <td class="setting">XXX</td>
data/doc/guide.html CHANGED
@@ -1,8 +1,8 @@
1
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
2
+ <!DOCTYPE html
3
3
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
4
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
-
5
+
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
8
 
@@ -95,7 +95,7 @@ that support standard uses for your particular application.
95
95
  <p>
96
96
  The masterview generator can create controllers, models,
97
97
  and MasterView template files in your Rails <code>app</code> directory,
98
- similar to how the built-in Rails generator works.
98
+ similar to how the built-in Rails generator works.
99
99
  </p>
100
100
  <p>
101
101
  To use the masterview generator, open a command shell and
@@ -216,18 +216,18 @@ The MasterView admin controller/view is used by a MasterView developer
216
216
  to obtain a birds-eye view of all your
217
217
  masterview templates, the status of those templates (OK, Invalid xhtml,
218
218
  Conflicts, Imports outdated), the details regarding the status, and the
219
- ultimate erb files generated from each template.
219
+ ultimate erb files generated from each template.
220
220
  The admin controller also displays a summary of your current configuration.
221
221
  </p>
222
222
 
223
- <p>The MasterView admin controller is enabled or disabled in your application
223
+ <p>The MasterView admin controller is enabled or disabled in your application
224
224
  by the Master <code>enable_admin_pages</code> configuration setting.
225
225
  By default, the admin controller is enabled.
226
226
  See the <a href="configuration.html">MasterView Configuration Guide</a> for details.
227
227
  </p>
228
228
 
229
229
  <p>
230
- When enabled, the MasterView admin controller is available in your application
230
+ When enabled, the MasterView admin controller is available in your application
231
231
  at <a href="http://yourserver/masterview">http://yourserver/masterview</a>.
232
232
  The Admin home page displays an overview of your application's templates
233
233
  and links to admin information and operations.
@@ -238,7 +238,7 @@ Since it can be difficult to import a layout by hand into a new file, the
238
238
  MasterView admin controller has a
239
239
  link where you can copy the layout into a new file by providing the new
240
240
  files Action. It will take the layout from the template chosen and create a
241
- new file <code><i>controller</i>_<i>action</i>.html</code> with the layout imported
241
+ new file <code><i>controller</i>_<i>action</i>.html</code> with the layout imported
242
242
  and a shell for the new Action code.
243
243
  </p>
244
244
  <p>
@@ -252,11 +252,11 @@ rake mv:copy_layout TEMPLATE=foo_list.html ACTION=newaction
252
252
  <h3>Using Rake for MasterView Admin Operations</h3>
253
253
 
254
254
  <p>All of the power of the MasterView admin controller is
255
- also available via a set of rake commands.
256
- MasterView includes a <code>masterview.rake</code> file in your
257
- <code>vendor/plugins/masterview/tasks</code> directory which is automatically included
255
+ also available via a set of rake commands.
256
+ MasterView includes a <code>masterview.rake</code> file in your
257
+ <code>vendor/plugins/masterview/tasks</code> directory which is automatically included
258
258
  by the top level Rails Rakefile, so the masterview <b>mv:</b> admin tasks
259
- are automatically available in your application's rake tasks
259
+ are automatically available in your application's rake tasks
260
260
  when the MasterView plugin is installed.
261
261
  </p>
262
262
 
@@ -270,13 +270,14 @@ rake mv:list_all
270
270
  rake mv:rebuild
271
271
  rake mv:rebuild_all
272
272
  rake mv:copy_layout
273
+ rake mv:clean_mv_rhtml
273
274
  </pre>
274
275
 
275
- <p>To obtain further information about the supported commands,
276
+ <p>To obtain further information about the supported commands,
276
277
  run the standard rake tasks report using the <code>--tasks</code> (<code>-T</code>) option:</p>
277
278
 
278
279
  <pre class="code">
279
- rake -T
280
+ rake -T
280
281
  </pre>
281
282
 
282
283
  </div> <!-- bodyContent -->
data/doc/index.html CHANGED
@@ -161,7 +161,7 @@ and overview of MasterView.
161
161
 
162
162
  <h2>Prerequisites</h2>
163
163
  <table summary="prerequisites summary">
164
- <tr><td valign="top">Requires:</td><td>No external dependencies
164
+ <tr><td valign="top">Requires:</td><td>No external dependencies, but needs REXML 3.1.4 or higher which comes with standard Ruby 1.8.5+ install
165
165
  </td></tr>
166
166
  <tr><td valign="top">Optional:</td><td>tidy, log4r</td></tr>
167
167
  </table>
@@ -91,7 +91,7 @@ on Ruby 1.8.5r3 and Rails 1.1.6 on *nix and Windows.
91
91
  </tr>
92
92
  <tr>
93
93
  <td>&nbsp;</td>
94
- <td class="explanation">No required external dependencies</td>
94
+ <td class="explanation">No required external dependencies, but needs REXML 3.1.4 or higher which comes with standard Ruby 1.8.5+ install</td>
95
95
  </tr>
96
96
  <tr class="subheader">
97
97
  <td colspan="2">Optional:</td>
data/doc/media_list.html CHANGED
@@ -1,12 +1,12 @@
1
1
  <?xml version="1.0" encoding="iso-8859-1"?>
2
- <!DOCTYPE html
2
+ <!DOCTYPE html
3
3
  PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
4
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
5
 
6
6
  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
7
  <head>
8
8
 
9
- <title>MasterView - Media list</title>
9
+ <title>MasterView Screencasts, Diagrams, Screenshots, and Presentations</title>
10
10
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
11
11
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
12
12
 
@@ -44,7 +44,7 @@
44
44
  <div id="pageBody">
45
45
  <div id="bodyContent">
46
46
 
47
- <h1>MasterView Screencasts, Diagrams, and Screenshots</h1>
47
+ <h1>MasterView Screencasts, Diagrams, Screenshots, and Presentations</h1>
48
48
 
49
49
  <h2>Illustrations/Diagrams</h2>
50
50
  <ul>
@@ -54,6 +54,22 @@ Click for larger view</a>
54
54
  </li>
55
55
  </ul>
56
56
 
57
+ <h2>Presentations</h2>
58
+ <ul>
59
+ <li>
60
+ <a href="presentations/sdruby-Nov2006/MasterView_FlyBy.pdf">MasterView FlyBy</a> - SD Ruby - Nov. 2006
61
+ <div class="explanation">
62
+ A quick overview of MasterView (history, objectives, features) by Deb Lewis at the <a href="http://sdruby.com" target="_blank">San Diego Ruby</a> User's Group.
63
+ (Podcast recording available at <a href="http://podcasts.sdruby.com" target="_blank">podcasts.sdruby.com</a>.)
64
+ </div>
65
+ </li>
66
+ <li><a href="presentations/mtnwestruby2007/masterview_evolution_070316.html">MasterView Evolution</a> - Mountain West Ruby Conference - March 16, 2007
67
+ <div class="explanation">
68
+ Presentation by Jeff Barczewski at Mountain West Ruby 2007 on the MasterView template system for Rails and how its implementation has evolved from its conception in 2005 into a capable Rails plugin.
69
+ </div>
70
+ </li>
71
+ </ul>
72
+
57
73
  <h2>Videos</h2>
58
74
  <ul>
59
75
  <li><a href="http://masterview.org/videos/demo_short.html">MasterView Short Video</a> - demonstrating basic usage of MasterView (no audio, ~5 minutes, uses flash)<br /><br />
@@ -26,6 +26,10 @@
26
26
  #config.template_src_dir_path = 'app/views' # relative path from config.root_path
27
27
  #config.template_src_dir_abs_path( '/path/to/masterview/templates' )
28
28
  #config.template_filename_pattern = '*.html'
29
+ #config.auto_copy_file_entries << { :source => 'path_to_my_images', :destination => 'public/images' }
30
+ #config.auto_copy_file_entries << { :source => 'path_to_my_scripts', :destination => 'public/javascripts', :extensions => [:js, :JS] } # only copy js files
31
+ #config.auto_copy_file_entries << { :source => 'path_to_my_css', :destination => 'public/stylesheets' }
32
+
29
33
 
30
34
  # Template Generation Options
31
35
  #config.template_dst_dir_path = 'app/views' # relative path from config.root_path
@@ -50,6 +54,7 @@
50
54
  #config.inline_erb_start = '{{{'
51
55
  #config.inline_erb_end = '}}}'
52
56
  #config.inline_erb_substitution_regex = /\{\{\{(([^}]|\}[^}]|\}\}[^}])*)\}\}\}/
57
+ #config.use_original_rexml_sax2parser = false
53
58
 
54
59
  # Rails application options
55
60
  #config.parse_masterview_templates_at_startup = true
@@ -110,6 +110,7 @@ module MasterView
110
110
  @depth = 0
111
111
  @stack = []
112
112
  @list = []
113
+ @prolog = [] # prolog if any
113
114
  @content = options[:content_hash] || {}
114
115
  @options = options
115
116
  @only_check_hash = options[:only_check_hash] || false
@@ -146,7 +147,14 @@ module MasterView
146
147
  end
147
148
 
148
149
  def doctype(name, pub_sys, long_name, uri)
149
- #todo
150
+ xml_doctype = []
151
+ xml_doctype << '<!DOCTYPE'
152
+ xml_doctype << name
153
+ xml_doctype << pub_sys unless pub_sys.nil?
154
+ xml_doctype << %Q["#{long_name}"] unless long_name.nil?
155
+ xml_doctype << %Q["#{uri}"] unless uri.nil?
156
+ doctype_str = xml_doctype.join(' ')+'>'
157
+ @prolog << doctype_str
150
158
  end
151
159
 
152
160
  def start_element(uri, localname, qname, attributes)
@@ -241,6 +249,10 @@ module MasterView
241
249
  @stack.last.inc_parts
242
250
  index = end_element ? -1 : @stack.last.parts-1
243
251
  data = @stack.last.buffer.join
252
+ unless @prolog.empty?
253
+ data = @prolog.join + data
254
+ @prolog = []
255
+ end
244
256
  hash_invalid = false;
245
257
  if @stack.last.import
246
258
  if only_check_hash?
@@ -11,7 +11,10 @@ module MasterView
11
11
  :element_usage => 'form'
12
12
 
13
13
  attr_arg :url_for_options
14
- attr_arg :options, :append_element_attrs => [:common_html, :method]
14
+ attr_arg :options, :append_element_attrs => [:common_html, :method] do |value, args, dir|
15
+ value = dir.merge_hash_into_str({:multipart => true}, value) if dir.element_attrs[:enctype] =~ /multipart\/form-data/i #add multipart => true ?
16
+ value
17
+ end
15
18
  attr_arg :parameters_for_url, :varargs => true
16
19
 
17
20
  event :stag do
@@ -16,7 +16,7 @@ module MasterView
16
16
 
17
17
  event :element do
18
18
  if @src.nil? or @src.empty?
19
- if src_attr = element_attrs[:src]
19
+ if src_attr = element_attrs[:href]
20
20
  if match = STYLESHEET_SRC_EXTRACT_REGEX.match(src_attr)
21
21
  @src = [match[1]]
22
22
  else
@@ -0,0 +1,80 @@
1
+ module MasterView
2
+
3
+ # Usage:
4
+ # Can be used as an isolated instance by doing the following
5
+ # autocopy = AutoCopy.new(src_mio, dst_mio, ['*.gif', '*.png'])
6
+ # pathnames_copied = autocopy.copy_updated_files
7
+ #
8
+ # or
9
+ #
10
+ # Register the the autocopy directories and patterns with
11
+ # AutoCopy and invoke to copy all
12
+ # AutoCopy.clear_registrations # clears out existing registrations
13
+ # AutoCopy.register(src_mio, dst_mio, ['*.gif', '*.png'])
14
+ # AutoCopy.register(another_src_mio, another_dst_mio, ['*.css'])
15
+ # pathnames_copied = AutoCopy.copy_all_updated_files
16
+ class AutoCopy
17
+
18
+ # inialize an autocopy instance
19
+ #
20
+ # source_mio_tree = tree where we are copying from
21
+ # dest_path = tree where we are copying to
22
+ # filename_patterns = array of glob style pattern of files to copy (defaults to ['*'] all files and subdirectories) (see File.fnmatch)
23
+ def initialize(source_mio_tree, dest_mio_tree, filename_patterns = ['*'])
24
+ @source_mio_tree = source_mio_tree
25
+ @dest_mio_tree = dest_mio_tree
26
+ @filename_patterns = filename_patterns
27
+ @mtimes = {}
28
+ end
29
+
30
+ # Auto copy files like stylesheets, images, javascript from a
31
+ # source directory into the Rails runtime location (usually under
32
+ # public folder). Checks modified time to see if different than
33
+ # last check and if so then copies file.
34
+ # Returns array of paths that were copied
35
+ def copy_updated_files
36
+ paths_copied = []
37
+ @filename_patterns.each do |filename_pattern|
38
+ @source_mio_tree.find(:pattern => filename_pattern) do |mio|
39
+ mtime = mio.mtime
40
+ unless @mtimes[mio.pathname.to_s] == mtime
41
+ @dest_mio_tree.path(mio.pathname).write(mio.read)
42
+ @mtimes[mio.pathname.to_s] = mtime
43
+ paths_copied << mio.pathname.to_s
44
+ end
45
+ end
46
+ end
47
+ paths_copied
48
+ end
49
+
50
+ # register a source, destination, and array of filename patterns with
51
+ # AutoCopy
52
+ def self.register(source_mio_tree, dest_mio_tree, filename_patterns = ['*'])
53
+ @@src_dst_registrations ||= []
54
+ @@src_dst_registrations << AutoCopy.new(source_mio_tree, dest_mio_tree, filename_patterns)
55
+ end
56
+
57
+ # clear all registrations
58
+ def self.clear_registrations
59
+ @@src_dst_registrations = []
60
+ end
61
+
62
+ # accessor for registrations
63
+ def self.registrations
64
+ @@src_dst_registrations ||= []
65
+ @@src_dst_registrations
66
+ end
67
+
68
+ # perform autocopy on all registered src_dst's
69
+ # returns array of paths that were copied
70
+ def self.copy_all_updated_files
71
+ paths_copied = []
72
+ self.registrations.each { |src_dst| paths_copied << src_dst.copy_updated_files }
73
+ paths_copied.flatten
74
+ end
75
+
76
+
77
+
78
+ end
79
+ end
80
+