masterview 0.1.5 → 0.2.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.
- data/CHANGELOG +17 -0
- data/README +36 -504
- data/RELEASE_NOTES +126 -45
- data/Rakefile +215 -86
- data/TODO +8 -3
- data/doc/configuration.html +485 -0
- data/doc/directives.html +1085 -0
- data/doc/guide.html +243 -0
- data/doc/index.html +287 -0
- data/doc/installation.html +376 -0
- data/doc/stylesheets/masterview.css +206 -0
- data/doc/stylesheets/mv-config.css +23 -0
- data/doc/stylesheets/mv-directives.css +18 -0
- data/doc/stylesheets/mv-installation.css +10 -0
- data/doc/troubleshooting.html +18 -0
- data/examples/product.html +256 -0
- data/examples/product.html.old +107 -0
- data/examples/rails_app_config/masterview/environment/development.rb +22 -0
- data/examples/rails_app_config/masterview/environment/production.rb +9 -0
- data/examples/rails_app_config/masterview/settings.rb +59 -0
- data/examples/test.import +80 -0
- data/init.rb +26 -12
- data/lib/masterview/analyzer.rb +25 -15
- data/lib/masterview/directive_base.rb +4 -0
- data/lib/masterview/directive_helpers.rb +7 -5
- data/lib/masterview/directives/import_render.rb +6 -0
- data/lib/masterview/directives/insert_generated_comment.rb +8 -8
- data/lib/masterview/extras/app/controllers/masterview_controller.rb +154 -2
- data/lib/masterview/extras/app/views/masterview/admin/create.rhtml +4 -4
- data/lib/masterview/extras/app/views/masterview/admin/empty.rhtml +1 -1
- data/lib/masterview/extras/app/views/masterview/admin/list.rhtml +14 -9
- data/lib/masterview/extras/app/views/masterview/admin/view_rhtml.rhtml +70 -0
- data/lib/masterview/extras/init_logger.rb +102 -0
- data/lib/masterview/extras/init_rails_erb_mv_direct.rb +117 -0
- data/lib/masterview/extras/init_rails_reparse_checking.rb +59 -0
- data/lib/masterview/extras/watcher.rb +17 -23
- data/lib/masterview/filter_helpers.rb +26 -0
- data/lib/masterview/initializer.rb +912 -0
- data/lib/masterview/io.rb +352 -0
- data/lib/masterview/keyword_expander.rb +116 -0
- data/lib/masterview/masterview_version.rb +2 -2
- data/lib/masterview/mtime_tracking_hash.rb +44 -0
- data/lib/masterview/parser.rb +64 -92
- data/lib/masterview/pathname_extensions.rb +33 -0
- data/lib/masterview/template_spec.rb +49 -56
- data/lib/masterview.rb +40 -85
- data/test/fixtures/configs/fake_rails_app_with_config/config/masterview/environments/development.rb +12 -0
- data/test/fixtures/configs/fake_rails_app_with_config/config/masterview/environments/production.rb +11 -0
- data/test/fixtures/configs/fake_rails_app_with_config/config/masterview/settings.rb +23 -0
- data/test/fixtures/templates/product.html +256 -0
- data/test/fixtures/templates/test.import +80 -0
- data/test/test_helper.rb +5 -3
- data/test/tmp/template/foo.txt +1 -0
- data/test/tmp/templates_src/product.html +256 -0
- data/test/tmp/views/layouts/product.rhtml +35 -0
- data/test/tmp/views/product/_form.rhtml +30 -0
- data/test/tmp/views/product/_product.rhtml +14 -0
- data/test/tmp/views/product/_show.rhtml +27 -0
- data/test/tmp/views/product/destroy.rhtml +27 -0
- data/test/tmp/views/product/edit.rhtml +26 -0
- data/test/tmp/views/product/list.rhtml +31 -0
- data/test/tmp/views/product/new.rhtml +29 -0
- data/test/tmp/views/product/show.rhtml +16 -0
- data/test/unit/config_settings_test.rb +172 -0
- data/test/{attr_test.rb → unit/directive_attr_test.rb} +2 -2
- data/test/{block_test.rb → unit/directive_block_test.rb} +2 -2
- data/test/{content_test.rb → unit/directive_content_test.rb} +2 -2
- data/test/{else_test.rb → unit/directive_else_test.rb} +2 -2
- data/test/{elsif_test.rb → unit/directive_elsif_test.rb} +2 -2
- data/test/{form_test.rb → unit/directive_form_test.rb} +2 -2
- data/test/{global_inline_erb_test.rb → unit/directive_global_inline_erb_test.rb} +2 -2
- data/test/{hidden_field_test.rb → unit/directive_hidden_field_test.rb} +2 -2
- data/test/{if_test.rb → unit/directive_if_test.rb} +2 -2
- data/test/unit/directive_import_render_test.rb +62 -0
- data/test/{import_test.rb → unit/directive_import_test.rb} +2 -2
- data/test/{javascript_include_test.rb → unit/directive_javascript_include_test.rb} +2 -2
- data/test/{link_to_if_test.rb → unit/directive_link_to_if_test.rb} +2 -2
- data/test/{link_to_test.rb → unit/directive_link_to_test.rb} +2 -2
- data/test/{omit_tag_test.rb → unit/directive_omit_tag_test.rb} +2 -2
- data/test/{password_field_test.rb → unit/directive_password_field_test.rb} +2 -2
- data/test/{replace_test.rb → unit/directive_replace_test.rb} +2 -2
- data/test/{stylesheet_link_test.rb → unit/directive_stylesheet_link_test.rb} +2 -2
- data/test/{submit_test.rb → unit/directive_submit_test.rb} +2 -2
- data/test/{text_area_test.rb → unit/directive_text_area_test.rb} +2 -2
- data/test/{text_field_test.rb → unit/directive_text_field_test.rb} +2 -2
- data/test/{example_test.rb → unit/example_test.rb} +1 -1
- data/test/unit/file_mio_test.rb +368 -0
- data/test/{filter_helpers_test.rb → unit/filter_helpers_test.rb} +1 -1
- data/test/unit/keyword_expander_test.rb +95 -0
- data/test/unit/mio_test.rb +110 -0
- data/test/unit/mtime_string_hash_mio_tree_test.rb +289 -0
- data/test/unit/mtime_tracking_hash_test.rb +38 -0
- data/test/{parser_test.rb → unit/parser_test.rb} +19 -1
- data/test/unit/pathname_extensions_test.rb +46 -0
- data/test/{run_parser_test.rb → unit/run_parser_test.rb} +7 -3
- data/test/unit/string_hash_mio_test.rb +320 -0
- data/test/unit/template_file_watcher_test.rb +107 -0
- data/test/{template_spec_test.rb → unit/template_spec_test.rb} +57 -21
- data/test/{template_test.rb → unit/template_test.rb} +123 -22
- data/test/xtras/config-mv-logger_config.rb +109 -0
- data/test/xtras/config_initialize_standalone.rb +53 -0
- metadata +111 -38
- data/lib/masterview/extras/rails_init.rb +0 -72
- data/test/import_render_test.rb +0 -30
- data/test/template_file_watcher_test.rb +0 -50
@@ -0,0 +1,172 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
currentPath = File.dirname(__FILE__)
|
5
|
+
require File.join( currentPath, '../../lib/masterview/initializer' )
|
6
|
+
|
7
|
+
class TestConfiguration < Test::Unit::TestCase
|
8
|
+
CurrentPath = File.dirname(__FILE__)
|
9
|
+
#TestCasesDir = File.join(CurrentPath, '../..')
|
10
|
+
TestFixturesDir = File.join(CurrentPath, '../fixtures/configs')
|
11
|
+
|
12
|
+
def setup
|
13
|
+
#STDOUT.puts "\n============= #{method_name} ==============="
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def test_mv_install_dir_refs
|
18
|
+
|
19
|
+
# default settings for standalone operation
|
20
|
+
config = MasterView::Configuration.new
|
21
|
+
|
22
|
+
code_base_from_install_dir = "#{config.mv_installation_dir}/lib/masterview"
|
23
|
+
assert File.directory?( code_base_from_install_dir ), "no lib/masterview code dir at mv_installation_dir='#{config.mv_installation_dir}'"
|
24
|
+
|
25
|
+
assert_equal code_base_from_install_dir, config.mv_code_base_dir, "inconsistent mv_code_base_dir='#{config.mv_code_base_dir}'"
|
26
|
+
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
def test_default_settings_standalone
|
31
|
+
|
32
|
+
# default settings for standalone operation
|
33
|
+
config = MasterView::Configuration.new
|
34
|
+
|
35
|
+
# general options
|
36
|
+
assert ! config.rails_app?, 'standalone config is not a rails app'
|
37
|
+
assert ! config.on_rails?, 'standalone config is not running on rails'
|
38
|
+
assert_nil config.rails_root_path, 'no rails root for a standalone config'
|
39
|
+
assert_nil config.config_dir_path, 'no opinion on location of config settings in standalone config'
|
40
|
+
#??assert_equal "#{config.root_path}/masterview/config", config.config_dir_path, 'default config settings dir'
|
41
|
+
assert_nil config.environment, 'no opinion on environment for a standalone config'
|
42
|
+
assert config.logger, 'default config includes a logger'
|
43
|
+
assert_equal 'WARN', config.log_level, 'default log level is WARN unless development'
|
44
|
+
|
45
|
+
# template source/dst/parsing options...
|
46
|
+
assert_equal "#{config.root_path}/masterview/templates", config.template_src_dir_path, 'default templates dir'
|
47
|
+
assert_equal "#{config.root_path}/masterview/output", config.template_dst_dir_path, 'default template output dir'
|
48
|
+
|
49
|
+
# rails application options
|
50
|
+
#we probably ought to support this for non-rails app iff src/dst dirs known, anyway
|
51
|
+
#assert ! config.parse_masterview_templates_at_startup
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def test_default_settings_rails_app
|
56
|
+
|
57
|
+
# default settings for a rails app
|
58
|
+
fake_rails_app_root = File.join( TestFixturesDir, 'fake_rails_app' )
|
59
|
+
rails_root_full_path = File.expand_path(fake_rails_app_root)
|
60
|
+
rails_views_root = File.join(rails_root_full_path, 'app/views')
|
61
|
+
config = MasterView::Configuration.new( :rails_app_root_path => fake_rails_app_root )
|
62
|
+
|
63
|
+
# general options
|
64
|
+
assert config.rails_app?, 'this is a rails app'
|
65
|
+
assert ! config.on_rails?, 'operating on a rails app but not running rails'
|
66
|
+
assert_equal rails_root_full_path, config.rails_root_path, 'we explicitly provided the rails root'
|
67
|
+
assert_equal rails_root_full_path, config.root_path, 'app root is rails app root'
|
68
|
+
assert_equal "#{rails_root_full_path}/config/masterview", config.config_dir_path, 'standard MV rails config settings dir'
|
69
|
+
assert_nil config.environment, 'no opinion on environment when not running rails'
|
70
|
+
assert config.logger, 'default config includes a logger'
|
71
|
+
assert_equal 'WARN', config.log_level, 'default log level is WARN unless development'
|
72
|
+
|
73
|
+
# template source/dst/parsing options...
|
74
|
+
# check defaults - users would care about changing this assumption for release upgrade
|
75
|
+
assert_equal "#{rails_root_full_path}/app/views", config.template_src_dir_path, 'default templates directory in rails app'
|
76
|
+
assert_equal rails_views_root, config.template_dst_dir_path, 'default template output in rails is app/views'
|
77
|
+
|
78
|
+
# rails application options
|
79
|
+
assert config.parse_masterview_templates_at_startup, 'template parsing at startup should be on by default for a rails app'
|
80
|
+
assert ! config.reparse_changed_masterview_templates, 'reparsing changed templates is only supported when actually running on rails'
|
81
|
+
assert ! config.enable_admin_pages
|
82
|
+
end
|
83
|
+
|
84
|
+
def test_config_settings_rails_app
|
85
|
+
|
86
|
+
# default settings for a rails app (standard app settings, no env)
|
87
|
+
fake_rails_app_root = File.join( TestFixturesDir, 'fake_rails_app_with_config' )
|
88
|
+
rails_root_full_path = File.expand_path(fake_rails_app_root)
|
89
|
+
rails_views_root = File.join(rails_root_full_path, 'app/views')
|
90
|
+
config = MasterView::Configuration.new( :rails_app_root_path => fake_rails_app_root )
|
91
|
+
MasterView::Initializer.run(:load_config_settings, config)
|
92
|
+
|
93
|
+
# general options
|
94
|
+
assert config.rails_app?, 'this should be configured for a rails app'
|
95
|
+
assert ! config.on_rails?, 'operating on a rails app but not running rails'
|
96
|
+
assert_equal rails_root_full_path, config.rails_root_path, 'we explicitly provided the rails root'
|
97
|
+
assert_equal rails_root_full_path, config.root_path, 'app root is rails app root'
|
98
|
+
assert_equal "#{rails_root_full_path}/config/masterview", config.config_dir_path, 'standard MV rails config settings dir'
|
99
|
+
assert_nil config.environment, 'no point of view on environment when not running rails'
|
100
|
+
assert_equal 'WARN', config.log_level, 'default log level is WARN unless development'
|
101
|
+
|
102
|
+
# template source/dst/parsing options...
|
103
|
+
# this application customized the output directory for its templates
|
104
|
+
assert_equal "#{rails_root_full_path}/app/views", config.template_src_dir_path, 'default templates directory in rails app'
|
105
|
+
assert_equal "#{rails_views_root}/content", config.template_dst_dir_path, 'alt template output dir'
|
106
|
+
|
107
|
+
# rails application options
|
108
|
+
assert config.parse_masterview_templates_at_startup, 'template parsing at startup should be on by default for a rails app'
|
109
|
+
assert ! config.reparse_changed_masterview_templates, 'reparsing changed templates is only supported when actually running on rails'
|
110
|
+
assert ! config.enable_admin_pages
|
111
|
+
end
|
112
|
+
|
113
|
+
def test_config_settings_rails_app_development
|
114
|
+
|
115
|
+
# default settings for a rails app (standard app settings, development config)
|
116
|
+
fake_rails_app_root = File.join( TestFixturesDir, 'fake_rails_app_with_config' )
|
117
|
+
rails_root_full_path = File.expand_path(fake_rails_app_root)
|
118
|
+
rails_views_root = File.join(rails_root_full_path, 'app/views')
|
119
|
+
environment = 'development'
|
120
|
+
config = MasterView::Configuration.new( :rails_app_root_path => fake_rails_app_root, :environment => environment )
|
121
|
+
MasterView::Initializer.run(:load_config_settings, config)
|
122
|
+
|
123
|
+
# general options
|
124
|
+
assert config.rails_app?, 'this should be configured for a rails app'
|
125
|
+
assert ! config.on_rails?, 'operating on a rails app but not running rails'
|
126
|
+
assert_equal rails_root_full_path, config.rails_root_path, 'we explicitly provided the rails root'
|
127
|
+
assert_equal rails_root_full_path, config.root_path, 'app root is rails app root'
|
128
|
+
assert_equal "#{rails_root_full_path}/config/masterview", config.config_dir_path, 'standard MV rails config settings dir'
|
129
|
+
assert_equal environment, config.environment, "loading config settings for environment #{environment}"
|
130
|
+
assert_equal 'INFO', config.log_level, 'default log level is WARN unless development'
|
131
|
+
|
132
|
+
# template source/dst/parsing options...
|
133
|
+
# this application wants to try some alternate templates for a development test
|
134
|
+
assert_equal "#{rails_root_full_path}/app/mv_test_templates", config.template_src_dir_path, 'alt template dir in this dev config'
|
135
|
+
assert_equal "#{rails_views_root}/content", config.template_dst_dir_path, 'alt template output dir'
|
136
|
+
|
137
|
+
# rails application options
|
138
|
+
assert config.parse_masterview_templates_at_startup, 'template parsing at startup should be on by default for a rails app'
|
139
|
+
#assert config.reparse_changed_masterview_templates, 'reparsing changed templates is enabled by default in development mode'
|
140
|
+
assert ! config.enable_admin_pages
|
141
|
+
end
|
142
|
+
|
143
|
+
def test_config_settings_rails_app_production
|
144
|
+
|
145
|
+
# default settings for a rails app (standard app settings, development config)
|
146
|
+
fake_rails_app_root = File.join( TestFixturesDir, 'fake_rails_app_with_config' )
|
147
|
+
rails_root_full_path = File.expand_path(fake_rails_app_root)
|
148
|
+
rails_views_root = File.join(rails_root_full_path, 'app/views')
|
149
|
+
environment = 'production'
|
150
|
+
config = MasterView::Configuration.new( :rails_app_root_path => fake_rails_app_root, :environment => environment )
|
151
|
+
MasterView::Initializer.run(:load_config_settings, config)
|
152
|
+
|
153
|
+
# general options
|
154
|
+
assert config.rails_app?, 'this should be configured for a rails app'
|
155
|
+
assert ! config.on_rails?, 'operating on a rails app but not running rails'
|
156
|
+
assert_equal rails_root_full_path, config.rails_root_path, 'we explicitly provided the rails root'
|
157
|
+
assert_equal rails_root_full_path, config.root_path, 'app root is rails app root'
|
158
|
+
assert_equal "#{rails_root_full_path}/config/masterview", config.config_dir_path, 'MV config settings loaded from rails app config'
|
159
|
+
assert_equal environment, config.environment, "loading config settings for environment #{environment}"
|
160
|
+
assert_equal 'WARN', config.log_level, 'default log level is WARN unless development'
|
161
|
+
|
162
|
+
# template source/dst/parsing options...
|
163
|
+
assert_equal "#{rails_root_full_path}/app/views", config.template_src_dir_path, 'default templates directory in rails app'
|
164
|
+
assert_equal "#{rails_views_root}/content", config.template_dst_dir_path, 'alt template output dir'
|
165
|
+
|
166
|
+
# rails application options
|
167
|
+
assert config.parse_masterview_templates_at_startup, 'template parsing at startup should be on by default for a rails app'
|
168
|
+
#assert config.reparse_changed_masterview_templates, 'reparsing changed templates is enabled by default in development mode'
|
169
|
+
assert ! config.enable_admin_pages, 'this app doesn\'t want the MasterView admin pages in the production site'
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/attr')
|
7
7
|
|
8
8
|
class TestAttr < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/block')
|
7
7
|
|
8
8
|
class TestBlock < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/content')
|
7
7
|
|
8
8
|
class TestContent < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/else')
|
7
7
|
|
8
8
|
class TestElse < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/elsif')
|
7
7
|
|
8
8
|
class TestElsif < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/form')
|
7
7
|
|
8
8
|
class TestForm < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/global_inline_erb')
|
7
7
|
|
8
8
|
class TestGlobalInlineErb < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/hidden_field')
|
7
7
|
|
8
8
|
class TestHiddenField < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/if')
|
7
7
|
|
8
8
|
class TestIf < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -0,0 +1,62 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
currentPath = File.dirname(__FILE__)
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/import_render')
|
7
|
+
|
8
|
+
class TestImportRender < Test::Unit::TestCase
|
9
|
+
include MasterView::Directives
|
10
|
+
include MasterView::DirectiveHelpers
|
11
|
+
|
12
|
+
def setup
|
13
|
+
@mio_output_tree = MasterView::StringHashMIOTree.new
|
14
|
+
@renderer = MasterView::Renderer.new(:output_mio_tree => @mio_output_tree) #this sets up Renderer.last_renderer for import_test
|
15
|
+
@directives = MasterView::DirectiveSet.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_import_render
|
19
|
+
import_render_tag = MasterView::Tag.new(@directives, 'bar', {}, :normal, nil)
|
20
|
+
@directives.directives = []
|
21
|
+
attr_value = ":partial => 'foo/bar'"
|
22
|
+
@directives << Import_render.new(attr_value)
|
23
|
+
dcs = @directives.determine_dcs(:stag)
|
24
|
+
dcs.context = import_render_tag.create_context
|
25
|
+
assert_equal nil, dcs.render
|
26
|
+
|
27
|
+
dcs = @directives.determine_dcs(:etag)
|
28
|
+
dcs.context = import_render_tag.create_context
|
29
|
+
assert_equal ERB_EVAL+'render( '+attr_value+' )'+ERB_END, dcs.render.join
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_import_render_keyword_expansion
|
33
|
+
@renderer.keyword_expander.set_template_pathname('foo/bar.html', '.rhtml')
|
34
|
+
import_render_tag = MasterView::Tag.new(@directives, 'bar', {}, :normal, nil)
|
35
|
+
@directives.directives = []
|
36
|
+
attr_value = %q[:partial => '{template_dir_path}/{template_basename}']
|
37
|
+
@directives << Import_render.new(attr_value)
|
38
|
+
dcs = @directives.determine_dcs(:stag)
|
39
|
+
dcs.context = import_render_tag.create_context
|
40
|
+
assert_equal nil, dcs.render
|
41
|
+
|
42
|
+
dcs = @directives.determine_dcs(:etag)
|
43
|
+
dcs.context = import_render_tag.create_context
|
44
|
+
assert_equal ERB_EVAL+ %q[render( :partial => 'foo/bar' )]+ERB_END, dcs.render.join
|
45
|
+
end
|
46
|
+
|
47
|
+
def test_import_render_keyword_expansion_subdir
|
48
|
+
@renderer.keyword_expander.set_template_pathname('one/foo/bar.html', '.rhtml')
|
49
|
+
import_render_tag = MasterView::Tag.new(@directives, 'bar', {}, :normal, nil)
|
50
|
+
@directives.directives = []
|
51
|
+
attr_value = %q[:partial => '{template_dir_path}/{template_basename}']
|
52
|
+
@directives << Import_render.new(attr_value)
|
53
|
+
dcs = @directives.determine_dcs(:stag)
|
54
|
+
dcs.context = import_render_tag.create_context
|
55
|
+
assert_equal nil, dcs.render
|
56
|
+
|
57
|
+
dcs = @directives.determine_dcs(:etag)
|
58
|
+
dcs.context = import_render_tag.create_context
|
59
|
+
assert_equal ERB_EVAL+ %q[render( :partial => 'one/foo/bar' )]+ERB_END, dcs.render.join
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/import')
|
7
7
|
|
8
8
|
class TestImport < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/javascript_include' )
|
7
7
|
|
8
8
|
class JavascriptIncludeTest < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/link_to_if')
|
7
7
|
|
8
8
|
class TestLinkToIf < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/link_to')
|
7
7
|
|
8
8
|
class TestLinkTo < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/omit_tag')
|
7
7
|
|
8
8
|
class TestOmit_tag < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/password_field')
|
7
7
|
|
8
8
|
class TestPasswordField < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/replace')
|
7
7
|
|
8
8
|
class TestReplace < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/stylesheet_link' )
|
7
7
|
|
8
8
|
class StylesheetLinkTest < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/submit')
|
7
7
|
|
8
8
|
class TestSubmitTag < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/text_area')
|
7
7
|
|
8
8
|
class TestTextArea < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
require 'test/unit'
|
4
4
|
currentPath = File.dirname(__FILE__)
|
5
|
-
require File.join( currentPath, '
|
6
|
-
require File.join( currentPath, '
|
5
|
+
require File.join( currentPath, '../../lib/masterview' )
|
6
|
+
require File.join( currentPath, '../../lib/masterview/directives/text_field')
|
7
7
|
|
8
8
|
class TestTextField < Test::Unit::TestCase
|
9
9
|
include MasterView::Directives
|