fortitude 0.0.7 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +73 -0
- data/CONTRIBUTORS.md +17 -0
- data/ext/com/fortituderuby/ext/fortitude/FortitudeNativeLibrary.java +23 -7
- data/ext/fortitude_native_ext/fortitude_native_ext.c +91 -54
- data/lib/fortitude/doctypes/html4.rb +4 -0
- data/lib/fortitude/doctypes/html5.rb +4 -0
- data/lib/fortitude/doctypes/unknown_doctype.rb +4 -0
- data/lib/fortitude/doctypes/xhtml10.rb +4 -0
- data/lib/fortitude/doctypes/xhtml11.rb +4 -0
- data/lib/fortitude/erector.rb +1 -0
- data/lib/fortitude/errors.rb +16 -0
- data/lib/fortitude/extensions/fortitude_ruby_ext.rb +27 -12
- data/lib/fortitude/method_templates/assign_locals_from_template.rb.smpl +2 -0
- data/lib/fortitude/method_templates/need_assignment_template.rb.smpl +2 -2
- data/lib/fortitude/method_templates/simple_compiled_template.rb +94 -0
- data/lib/fortitude/method_templates/tag_method_template.rb.smpl +4 -4
- data/lib/fortitude/method_templates/text_method_template.rb.smpl +2 -2
- data/lib/fortitude/rails/railtie.rb +5 -1
- data/lib/fortitude/rails/rendering_methods.rb +66 -47
- data/lib/fortitude/rails/template_handler.rb +0 -1
- data/lib/fortitude/rendering_context.rb +2 -2
- data/lib/fortitude/tags/tag.rb +4 -3
- data/lib/fortitude/version.rb +1 -1
- data/lib/fortitude/widget.rb +1 -1
- data/lib/fortitude/widget/content.rb +1 -1
- data/lib/fortitude/widget/integration.rb +12 -3
- data/lib/fortitude/widget/localization.rb +1 -37
- data/lib/fortitude/widget/needs.rb +41 -12
- data/lib/fortitude/widget/rendering.rb +25 -7
- data/lib/fortitude/widget/start_and_end_comments.rb +1 -0
- data/lib/fortitude/widget/tags.rb +2 -1
- data/lib/fortitude/widget/widget_class_inheritable_attributes.rb +1 -0
- data/lib/fortitude_jruby_native_ext.jar +0 -0
- data/spec/helpers/system_helpers.rb +4 -0
- data/spec/rails/class_loading_system_spec.rb +10 -2
- data/spec/rails/development_mode_system_spec.rb +91 -0
- data/spec/rails/erector_coexistence_system_spec.rb +16 -0
- data/spec/rails/layouts_system_spec.rb +8 -3
- data/spec/rails/rendering_system_spec.rb +24 -2
- data/spec/rails/templates/class_loading_system_spec/app/controllers/class_loading_system_spec_controller.rb +6 -2
- data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/_foo.rb +5 -0
- data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/bar.html.rb +5 -0
- data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/bar.rb +5 -0
- data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/foo.rb +5 -0
- data/spec/rails/templates/development_mode_system_spec/app/controllers/development_mode_system_spec_controller.rb +4 -0
- data/spec/rails/templates/development_mode_system_spec/app/views/base.rb +5 -0
- data/spec/rails/templates/development_mode_system_spec/app/views/development_mode_system_spec/form.rb +11 -0
- data/spec/rails/templates/erector_coexistence_system_spec/app/controllers/erector_coexistence_system_spec_controller.rb +16 -0
- data/spec/rails/templates/erector_coexistence_system_spec/app/views/erector_widget.rb +5 -0
- data/spec/rails/templates/erector_coexistence_system_spec/app/views/fortitude_widget.rb +5 -0
- data/spec/rails/templates/localization_system_spec/app/views/localization_system_spec/content_method.rb +2 -0
- data/spec/rails/templates/rendering_system_spec/app/controllers/rendering_system_spec_controller.rb +14 -1
- data/spec/rails/templates/rendering_system_spec/app/helpers/application_helper.rb +5 -0
- data/spec/rails/templates/rendering_system_spec/app/views/widget_to_render_class_only.rb +5 -0
- data/spec/rails/templates/rendering_system_spec/app/views/widget_to_render_with_helper.rb +5 -0
- data/spec/system/doctypes_system_spec.rb +30 -8
- data/spec/system/erector_compatibility_system_spec.rb +27 -0
- data/spec/system/localization_system_spec.rb +4 -0
- data/spec/system/needs_system_spec.rb +31 -0
- data/spec/system/rebuild_notifications_system_spec.rb +180 -85
- data/spec/system/setting_inheritance_system_spec.rb +47 -0
- data/spec/system/static_method_system_spec.rb +2 -0
- data/spec/system/tag_rendering_system_spec.rb +41 -0
- data/spec/system/void_tags_system_spec.rb +1 -0
- data/spec/system/yield_system_spec.rb +188 -0
- metadata +27 -5
- data/lib/fortitude/method_templates/simple_template.rb +0 -50
- data/spec/rails/templates/class_loading_system_spec/app/views/class_loading_system_spec/_underscore_widget.rb +0 -11
@@ -1,50 +0,0 @@
|
|
1
|
-
require 'active_support'
|
2
|
-
require 'active_support/core_ext/hash'
|
3
|
-
|
4
|
-
module Fortitude
|
5
|
-
module MethodTemplates
|
6
|
-
class SimpleTemplate
|
7
|
-
class << self
|
8
|
-
def template(name)
|
9
|
-
@templates ||= { }
|
10
|
-
@templates[name] ||= new(File.join(File.dirname(__FILE__), "#{name}.rb.smpl"))
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def initialize(source_file)
|
15
|
-
@lines = File.read(source_file).split(/\r\n|\r|\n/)
|
16
|
-
end
|
17
|
-
|
18
|
-
def result(bindings)
|
19
|
-
bindings = bindings.stringify_keys
|
20
|
-
bindings_target = Object.new
|
21
|
-
bindings.each do |key, value|
|
22
|
-
(class << bindings_target; self; end).send(:define_method, key) { value }
|
23
|
-
end
|
24
|
-
|
25
|
-
result_lines = [ ]
|
26
|
-
@lines.each do |l|
|
27
|
-
if l =~ /^(.*)\#\s*\:if\s*(.*?)\s*$/i
|
28
|
-
l, condition = $1, $2
|
29
|
-
next unless bindings_target.instance_eval(condition)
|
30
|
-
end
|
31
|
-
|
32
|
-
while l =~ /[^\\]\#\{([^}]+)\}/ || l =~ /^\#\{([^}]+)\}/
|
33
|
-
name = $1
|
34
|
-
begin
|
35
|
-
value = bindings_target.send($1)
|
36
|
-
rescue => e
|
37
|
-
raise "Failed when processing #{l.inspect}: #{e.inspect}"
|
38
|
-
end
|
39
|
-
l = l.gsub("\#\{#{$1}\}", value.to_s)
|
40
|
-
end
|
41
|
-
l = l.gsub(/\\\#\{/, "\#\{")
|
42
|
-
|
43
|
-
result_lines << l
|
44
|
-
end
|
45
|
-
|
46
|
-
result_lines.join("\n")
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|