ramaze 2011.01.30 → 2011.07.25
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.mailmap +2 -0
- data/.rvmrc +1 -0
- data/README.md +119 -197
- data/Rakefile +14 -97
- data/bin/ramaze +6 -14
- data/doc/AUTHORS +8 -4
- data/doc/CHANGELOG +3784 -3339
- data/examples/app/chat/start.rb +2 -2
- data/lib/proto/app.rb +2 -3
- data/lib/proto/config.ru +4 -5
- data/lib/proto/controller/init.rb +11 -4
- data/lib/proto/controller/main.rb +12 -7
- data/lib/proto/layout/default.xhtml +56 -23
- data/lib/proto/model/init.rb +3 -1
- data/lib/proto/public/css/grid.css +107 -0
- data/lib/proto/public/css/layout.css +81 -0
- data/lib/proto/public/css/reset.css +123 -0
- data/lib/proto/public/css/text.css +109 -0
- data/lib/proto/public/images/bg.png +0 -0
- data/lib/proto/spec/main.rb +2 -2
- data/lib/proto/start.rb +11 -1
- data/lib/proto/view/index.xhtml +27 -23
- data/lib/ramaze.rb +0 -1
- data/lib/ramaze/app.rb +85 -12
- data/lib/ramaze/app_graph.rb +107 -0
- data/lib/ramaze/bin/console.rb +87 -0
- data/lib/ramaze/bin/create.rb +94 -0
- data/lib/ramaze/bin/helper.rb +107 -0
- data/lib/ramaze/bin/restart.rb +95 -0
- data/lib/ramaze/bin/runner.rb +141 -0
- data/lib/ramaze/bin/start.rb +206 -0
- data/lib/ramaze/bin/status.rb +152 -0
- data/lib/ramaze/bin/stop.rb +112 -0
- data/lib/ramaze/cache.rb +9 -4
- data/lib/ramaze/cache/localmemcache.rb +10 -13
- data/lib/ramaze/cache/lru.rb +49 -7
- data/lib/ramaze/cache/memcache.rb +170 -92
- data/lib/ramaze/cache/sequel.rb +301 -118
- data/lib/ramaze/controller.rb +108 -9
- data/lib/ramaze/controller/default.rb +15 -2
- data/lib/ramaze/current.rb +14 -2
- data/lib/ramaze/dependencies.rb +46 -0
- data/lib/ramaze/files.rb +38 -3
- data/lib/ramaze/gestalt.rb +12 -12
- data/lib/ramaze/helper.rb +0 -2
- data/lib/ramaze/helper/auth.rb +30 -23
- data/lib/ramaze/helper/blue_form.rb +175 -126
- data/lib/ramaze/helper/csrf.rb +76 -91
- data/lib/ramaze/helper/email.rb +105 -0
- data/lib/ramaze/helper/erector.rb +16 -15
- data/lib/ramaze/helper/gestalt.rb +2 -2
- data/lib/ramaze/helper/layout.rb +89 -73
- data/lib/ramaze/helper/link.rb +7 -6
- data/lib/ramaze/helper/localize.rb +6 -5
- data/lib/ramaze/helper/markaby.rb +25 -23
- data/lib/ramaze/helper/maruku.rb +3 -3
- data/lib/ramaze/helper/paginate.rb +19 -27
- data/lib/ramaze/helper/remarkably.rb +3 -3
- data/lib/ramaze/helper/request_accessor.rb +3 -3
- data/lib/ramaze/helper/send_file.rb +12 -8
- data/lib/ramaze/helper/simple_captcha.rb +5 -6
- data/lib/ramaze/helper/stack.rb +7 -4
- data/lib/ramaze/helper/tagz.rb +10 -11
- data/lib/ramaze/helper/thread.rb +19 -16
- data/lib/ramaze/helper/ultraviolet.rb +7 -4
- data/lib/ramaze/helper/user.rb +40 -21
- data/lib/ramaze/helper/xhtml.rb +29 -20
- data/lib/ramaze/log.rb +3 -11
- data/lib/ramaze/log/analogger.rb +5 -4
- data/lib/ramaze/log/growl.rb +9 -7
- data/lib/ramaze/log/hub.rb +3 -5
- data/lib/ramaze/log/informer.rb +15 -12
- data/lib/ramaze/log/knotify.rb +3 -5
- data/lib/ramaze/log/logger.rb +3 -5
- data/lib/ramaze/log/logging.rb +6 -8
- data/lib/ramaze/log/rotatinginformer.rb +27 -17
- data/lib/ramaze/log/syslog.rb +7 -7
- data/lib/ramaze/log/xosd.rb +3 -5
- data/lib/ramaze/middleware_compiler.rb +27 -4
- data/lib/ramaze/reloader.rb +50 -12
- data/lib/ramaze/reloader/watch_inotify.rb +4 -5
- data/lib/ramaze/reloader/watch_stat.rb +3 -3
- data/lib/ramaze/request.rb +18 -8
- data/lib/ramaze/response.rb +38 -7
- data/lib/ramaze/rest.rb +36 -0
- data/lib/ramaze/setup.rb +101 -31
- data/lib/ramaze/spec.rb +1 -1
- data/lib/ramaze/spec/bacon.rb +6 -3
- data/lib/ramaze/spec/helper/bacon.rb +0 -1
- data/lib/ramaze/version.rb +1 -1
- data/lib/ramaze/view.rb +2 -11
- data/lib/ramaze/view/erector.rb +46 -31
- data/lib/ramaze/view/erubis.rb +7 -3
- data/lib/ramaze/view/ezamar.rb +7 -3
- data/lib/ramaze/view/gestalt.rb +9 -3
- data/lib/ramaze/view/haml.rb +7 -3
- data/lib/ramaze/view/liquid.rb +3 -3
- data/lib/ramaze/view/lokar.rb +7 -3
- data/lib/ramaze/view/mustache.rb +11 -5
- data/lib/ramaze/view/nagoro.rb +3 -3
- data/lib/ramaze/view/sass.rb +1 -1
- data/lib/ramaze/view/slippers.rb +40 -13
- data/lib/ramaze/view/tagz.rb +9 -5
- data/ramaze.gemspec +23 -128
- data/spec/helper.rb +5 -0
- data/spec/ramaze/bin/app/config.ru +11 -0
- data/spec/ramaze/bin/create.rb +28 -0
- data/spec/ramaze/bin/runner.rb +30 -0
- data/spec/ramaze/bin/start.rb +38 -0
- data/spec/ramaze/cache/memcache.rb +10 -3
- data/spec/ramaze/cache/sequel.rb +7 -0
- data/spec/ramaze/controller/provide_inheritance.rb +0 -10
- data/spec/ramaze/dispatcher/file.rb +19 -15
- data/spec/ramaze/helper/auth.rb +10 -9
- data/spec/ramaze/helper/blue_form.rb +121 -68
- data/spec/ramaze/helper/email.rb +69 -0
- data/spec/ramaze/helper/layout.rb +12 -15
- data/spec/ramaze/helper/layout/alternative.xhtml +5 -0
- data/spec/ramaze/helper/user.rb +2 -0
- data/spec/ramaze/log/growl.rb +14 -1
- data/spec/{contrib → ramaze}/rest.rb +1 -1
- data/spec/ramaze/session/memcache.rb +2 -2
- data/spec/ramaze/view/sass.rb +1 -1
- data/tasks/bacon.rake +3 -3
- data/tasks/gem.rake +17 -18
- data/tasks/rcov.rake +2 -3
- data/tasks/release.rake +8 -65
- data/tasks/setup.rake +10 -8
- data/tasks/todo.rake +9 -5
- data/tasks/yard.rake +3 -2
- metadata +105 -397
- data/MANIFEST +0 -532
- data/TODO.md +0 -19
- data/benchmark/bench_templates/bench.rb +0 -67
- data/benchmark/bench_templates/view/large.erb +0 -79
- data/benchmark/bench_templates/view/large.haml +0 -41
- data/benchmark/bench_templates/view/large.lok +0 -79
- data/benchmark/bench_templates/view/large.xhtml +0 -79
- data/benchmark/bench_templates/view/small.erb +0 -21
- data/benchmark/bench_templates/view/small.haml +0 -12
- data/benchmark/bench_templates/view/small.lok +0 -21
- data/benchmark/bench_templates/view/small.xhtml +0 -21
- data/benchmark/results.txt +0 -131
- data/benchmark/run.rb +0 -355
- data/benchmark/suite/minimal.rb +0 -11
- data/benchmark/suite/no_informer.rb +0 -7
- data/benchmark/suite/no_sessions.rb +0 -9
- data/benchmark/suite/no_template.rb +0 -7
- data/benchmark/suite/simple.rb +0 -5
- data/benchmark/suite/template_erubis.rb +0 -8
- data/benchmark/suite/template_etanni.rb +0 -8
- data/benchmark/suite/template_ezamar.rb +0 -8
- data/benchmark/suite/template_haml.rb +0 -13
- data/benchmark/suite/template_liquid.rb +0 -11
- data/benchmark/suite/template_markaby.rb +0 -9
- data/benchmark/suite/template_nagoro.rb +0 -8
- data/benchmark/suite/template_redcloth.rb +0 -13
- data/benchmark/suite/template_tenjin.rb +0 -8
- data/benchmark/test.rb +0 -35
- data/doc/FAQ +0 -92
- data/doc/INSTALL +0 -92
- data/doc/TODO +0 -29
- data/doc/meta/announcement.txt +0 -119
- data/doc/meta/configuration.txt +0 -163
- data/doc/meta/internals.txt +0 -278
- data/doc/meta/users.kml +0 -64
- data/doc/tutorial/todolist.html +0 -1512
- data/doc/tutorial/todolist.txt +0 -920
- data/examples/app/sourceview/public/coderay.css +0 -104
- data/examples/app/sourceview/public/images/file.gif +0 -0
- data/examples/app/sourceview/public/images/folder.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-collapsable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-expandable.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item-last.gif +0 -0
- data/examples/app/sourceview/public/images/tv-item.gif +0 -0
- data/examples/app/sourceview/public/jquery.js +0 -11
- data/examples/app/sourceview/public/jquery.treeview.css +0 -48
- data/examples/app/sourceview/public/jquery.treeview.js +0 -223
- data/examples/app/sourceview/public/sourceview.js +0 -52
- data/examples/app/sourceview/start.rb +0 -79
- data/examples/app/sourceview/view/index.haml +0 -59
- data/examples/helpers/httpdigest.rb +0 -107
- data/lib/proto/public/css/screen.css +0 -30
- data/lib/proto/public/js/jquery.js +0 -7179
- data/lib/ramaze/contrib/addressable_route.rb +0 -56
- data/lib/ramaze/contrib/app_graph.rb +0 -64
- data/lib/ramaze/contrib/email.rb +0 -88
- data/lib/ramaze/contrib/facebook.rb +0 -23
- data/lib/ramaze/contrib/facebook/facebook.rb +0 -171
- data/lib/ramaze/contrib/gettext.rb +0 -113
- data/lib/ramaze/contrib/gettext/mo.rb +0 -155
- data/lib/ramaze/contrib/gettext/parser.rb +0 -46
- data/lib/ramaze/contrib/gettext/po.rb +0 -109
- data/lib/ramaze/contrib/gzip_filter.rb +0 -1
- data/lib/ramaze/contrib/maruku_uv.rb +0 -59
- data/lib/ramaze/contrib/profiling.rb +0 -36
- data/lib/ramaze/contrib/rest.rb +0 -23
- data/lib/ramaze/contrib/sequel/create_join.rb +0 -26
- data/lib/ramaze/contrib/sequel/form_field.rb +0 -129
- data/lib/ramaze/contrib/sequel/image.rb +0 -196
- data/lib/ramaze/contrib/sequel/relation.rb +0 -98
- data/lib/ramaze/helper/httpdigest.rb +0 -96
- data/lib/ramaze/tool/bin.rb +0 -340
- data/lib/ramaze/tool/create.rb +0 -48
- data/lib/ramaze/tool/project_creator.rb +0 -120
- data/lib/ramaze/view/less.rb +0 -12
- data/lib/ramaze/view/maruku.rb +0 -15
- data/lib/ramaze/view/redcloth.rb +0 -21
- data/spec/contrib/addressable_route.rb +0 -30
- data/spec/examples/helpers/httpdigest.rb +0 -64
- data/spec/examples/templates/template_redcloth.rb +0 -13
- data/spec/ramaze/bin/ramaze.rb +0 -96
- data/spec/ramaze/helper/httpdigest.rb +0 -176
- data/spec/ramaze/view/less.rb +0 -60
- data/spec/ramaze/view/less/file.css.less +0 -8
- data/spec/ramaze/view/redcloth.rb +0 -66
- data/spec/ramaze/view/redcloth/external.redcloth +0 -8
- data/tasks/copyright.rake +0 -21
- data/tasks/gem_setup.rake +0 -112
- data/tasks/git.rake +0 -46
- data/tasks/grancher.rake +0 -12
- data/tasks/jquery.rake +0 -15
- data/tasks/manifest.rake +0 -4
- data/tasks/metric_changes.rake +0 -24
- data/tasks/reversion.rake +0 -8
- data/tasks/traits.rake +0 -21
data/lib/ramaze/spec/bacon.rb
CHANGED
@@ -10,9 +10,9 @@ require File.expand_path('../', __FILE__) unless defined?(Ramaze)
|
|
10
10
|
require 'innate/spec/bacon'
|
11
11
|
|
12
12
|
# minimal middleware, no exception handling
|
13
|
-
Ramaze.middleware!(:spec)
|
13
|
+
Ramaze.middleware!(:spec) do |m|
|
14
14
|
m.run(Ramaze::AppMap)
|
15
|
-
|
15
|
+
end
|
16
16
|
|
17
17
|
shared :rack_test do
|
18
18
|
Ramaze.setup_dependencies
|
@@ -26,8 +26,11 @@ shared :webrat do
|
|
26
26
|
|
27
27
|
require 'webrat'
|
28
28
|
|
29
|
-
Webrat.configure{|config| config.mode = :rack }
|
29
|
+
Webrat.configure { |config| config.mode = :rack }
|
30
30
|
|
31
31
|
extend Webrat::Methods
|
32
32
|
extend Webrat::Matchers
|
33
33
|
end
|
34
|
+
|
35
|
+
# Ignore log messages
|
36
|
+
Ramaze::Log.level = Logger::ERROR
|
data/lib/ramaze/version.rb
CHANGED
data/lib/ramaze/view.rb
CHANGED
@@ -7,21 +7,14 @@ module Ramaze
|
|
7
7
|
# This is a container module for wrappers of templating engines and handles
|
8
8
|
# lazy requiring of needed engines.
|
9
9
|
module View
|
10
|
-
|
11
10
|
# Combine Kernel#autoload and Innate::View::register
|
12
|
-
|
13
11
|
def self.auto_register(name, *exts)
|
14
12
|
autoload(name, "ramaze/view/#{name}".downcase)
|
15
13
|
register("Innate::View::#{name}", *exts)
|
16
14
|
end
|
17
15
|
|
18
|
-
# TODO:
|
19
|
-
# * markaby - though we should advertise remarkably instead
|
20
|
-
# * XSLT - this one is just crazy, someone up for the task?
|
21
|
-
|
22
16
|
# Engines provided by Innate are:
|
23
17
|
# ERB, Etanni, None
|
24
|
-
|
25
18
|
auto_register :Erector, :erector
|
26
19
|
auto_register :Erubis, :erubis, :rhtml
|
27
20
|
auto_register :Ezamar, :zmr
|
@@ -30,14 +23,12 @@ module Ramaze
|
|
30
23
|
auto_register :Less, :lss, :less
|
31
24
|
auto_register :Liquid, :liquid
|
32
25
|
auto_register :Lokar, :lok
|
33
|
-
auto_register :Maruku, :mkd, :md
|
34
26
|
auto_register :Nagoro, :nag
|
35
|
-
auto_register :RedCloth, :redcloth
|
36
27
|
auto_register :Remarkably, :rem
|
37
28
|
auto_register :Sass, :sass
|
38
29
|
auto_register :Tagz, :tagz
|
39
30
|
auto_register :Tenjin, :rbhtml, :tenjin
|
40
31
|
auto_register :Slippers, :st
|
41
32
|
auto_register :Mustache, :mt
|
42
|
-
end
|
43
|
-
end
|
33
|
+
end # View
|
34
|
+
end # Ramaze
|
data/lib/ramaze/view/erector.rb
CHANGED
@@ -3,26 +3,36 @@ require 'erector'
|
|
3
3
|
module Ramaze
|
4
4
|
module View
|
5
5
|
##
|
6
|
-
# Adapter for Erector. Erector is a view engine that works a bit like
|
7
|
-
# a much more pleasant way of building your views. By
|
8
|
-
#
|
6
|
+
# Adapter for Erector. Erector is a view engine that works a bit like
|
7
|
+
# Markably but offers a much more pleasant way of building your views. By
|
8
|
+
# creating classes in plain ruby you can generate layouts and views without
|
9
|
+
# having to write a single line of HTML.
|
9
10
|
#
|
10
|
-
# Each layout or view is a simple class that matches the filename. A layout
|
11
|
-
# a class with the name "Default".
|
12
|
-
#
|
11
|
+
# Each layout or view is a simple class that matches the filename. A layout
|
12
|
+
# named "default.erector" would result in a class with the name "Default".
|
13
|
+
# It's *very* important to know that you should ALWAYS extend
|
14
|
+
# Ramaze::View::Erector. Without extending this class you won't be able to
|
15
|
+
# use Erector at all.
|
13
16
|
#
|
14
|
-
# When working with the Erector adapter there are a few things you'll need
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
17
|
+
# When working with the Erector adapter there are a few things you'll need
|
18
|
+
# to know. First all your views and layouts should be classes as explained
|
19
|
+
# earlier on. Each class should have at least a single method named
|
20
|
+
# "content". This method is executed by Erector and the HTML it produces
|
21
|
+
# will either be stored in the @content instance variable (if it's a view)
|
22
|
+
# or sent to the browser if it's a layout. The @content variable can be
|
23
|
+
# displayed by calling the rawtext() method and passing the variable as it's
|
24
|
+
# parameter.
|
18
25
|
#
|
19
|
-
# Using helper methods, such as the render_* methods is also possible
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
26
|
+
# Using helper methods, such as the render_* methods is also possible
|
27
|
+
# although slightly different than you're used to. Due to the way the
|
28
|
+
# Erector adapter works it isn't possible to directly call a helper method.
|
29
|
+
# As a workaround you can access these methods from the "@controller"
|
30
|
+
# instance variable. Don't forget to render the output of these helpers
|
31
|
+
# using rawtext(). Feel free to submit any patches if you think you have a
|
32
|
+
# better solution so that developers don't have to use the @controller
|
33
|
+
# instance variable.
|
23
34
|
#
|
24
35
|
# @example
|
25
|
-
#
|
26
36
|
# # This is the code for the layout
|
27
37
|
# class Default < Erector::Widget
|
28
38
|
# html do
|
@@ -54,19 +64,22 @@ module Ramaze
|
|
54
64
|
# @author Yorick Peterse
|
55
65
|
#
|
56
66
|
module Erector
|
57
|
-
# Include the Erector gem. By doing this Erector views can extend the
|
58
|
-
# causing any namespace errors.
|
67
|
+
# Include the Erector gem. By doing this Erector views can extend the
|
68
|
+
# Erector gem without causing any namespace errors.
|
59
69
|
include ::Erector
|
60
70
|
|
61
71
|
##
|
62
|
-
# The call method is called whenever a view is loaded. A view can either
|
63
|
-
# since they're treated the same way. First
|
72
|
+
# The call method is called whenever a view is loaded. A view can either
|
73
|
+
# be a layout or an actual view since they're treated the same way. First
|
74
|
+
# the view is loaded, followed by the layout.
|
64
75
|
#
|
65
76
|
# @author Yorick Peterse
|
66
|
-
# @param [Object] action Object containing a copy of the current Action
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
77
|
+
# @param [Object] action Object containing a copy of the current Action
|
78
|
+
# class data.
|
79
|
+
# @param [String] string The content of the currently loaded layout. This
|
80
|
+
# variable isn't used by the Erector adapter but is required since Ramaze
|
81
|
+
# expects 2 parameters. Usually this string is used to inline load (or
|
82
|
+
# evaluate) the content of a view.
|
70
83
|
# @return [String] The generated HTML.
|
71
84
|
#
|
72
85
|
def self.call action, string
|
@@ -79,23 +92,25 @@ module Ramaze
|
|
79
92
|
eval string
|
80
93
|
|
81
94
|
# Generate the class name based on the filename.
|
82
|
-
# Class names are a CamelCased version of the filename (without the
|
95
|
+
# Class names are a CamelCased version of the filename (without the
|
96
|
+
# extension).
|
83
97
|
klass = File.basename action.view, '.erector'
|
84
98
|
klass = klass.camel_case
|
85
99
|
view_obj = self.const_get(klass)
|
86
100
|
|
87
|
-
# Synchronize the methods of action.instance with the view. These
|
88
|
-
# by calling @controller.METHOD
|
101
|
+
# Synchronize the methods of action.instance with the view. These
|
102
|
+
# methods can be accessed by calling @controller.METHOD
|
89
103
|
action.variables[:controller] = action.instance
|
90
104
|
|
91
105
|
# Now that we have all the data we can start rendering the HTML.
|
92
|
-
# Note that we pass the action.variables hash to the new() method. This
|
93
|
-
#
|
106
|
+
# Note that we pass the action.variables hash to the new() method. This
|
107
|
+
# is done to give the view access to all existing (instance) variables.
|
108
|
+
# Syncing them using action.copy_variables didn't seem to do the trick.
|
94
109
|
html = view_obj.new(action.variables).to_html
|
95
110
|
|
96
111
|
# All done
|
97
112
|
return html, 'text/html'
|
98
113
|
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
114
|
+
end # Erector
|
115
|
+
end # View
|
116
|
+
end # Ramaze
|
data/lib/ramaze/view/erubis.rb
CHANGED
@@ -5,6 +5,10 @@ require 'erubis'
|
|
5
5
|
|
6
6
|
module Ramaze
|
7
7
|
module View
|
8
|
+
##
|
9
|
+
# View adapter for the Erubis template engine. More information about Erubis
|
10
|
+
# can be found here: http://www.kuwata-lab.com/erubis/
|
11
|
+
#
|
8
12
|
module Erubis
|
9
13
|
OPTIONS = { :engine => ::Erubis::Eruby }
|
10
14
|
|
@@ -18,6 +22,6 @@ module Ramaze
|
|
18
22
|
|
19
23
|
return html, 'text/html'
|
20
24
|
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
25
|
+
end # Erubis
|
26
|
+
end # View
|
27
|
+
end # Ramaze
|
data/lib/ramaze/view/ezamar.rb
CHANGED
@@ -2,6 +2,10 @@ require 'ezamar'
|
|
2
2
|
|
3
3
|
module Ramaze
|
4
4
|
module View
|
5
|
+
##
|
6
|
+
# View adapter for the Ezamar template engine. More information about this
|
7
|
+
# engine can be found here: https://github.com/manveru/ezamar
|
8
|
+
#
|
5
9
|
module Ezamar
|
6
10
|
TRANSFORM_PIPELINE = [ ::Ezamar::Element ]
|
7
11
|
|
@@ -18,6 +22,6 @@ module Ramaze
|
|
18
22
|
|
19
23
|
::Ezamar::Template.new(template, :file => file)
|
20
24
|
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
25
|
+
end # Ezamar
|
26
|
+
end # View
|
27
|
+
end # Ramaze
|
data/lib/ramaze/view/gestalt.rb
CHANGED
@@ -2,6 +2,12 @@ require 'ramaze/gestalt'
|
|
2
2
|
|
3
3
|
module Ramaze
|
4
4
|
module View
|
5
|
+
##
|
6
|
+
# View adapter that allows you to use Ramaze::Gestalt in your views. See the
|
7
|
+
# documentation of Ramaze::Gestalt for more information.
|
8
|
+
#
|
9
|
+
# @see Ramaze::Gestalt
|
10
|
+
#
|
5
11
|
module Gestalt
|
6
12
|
def self.call(action, string)
|
7
13
|
string = action.instance.instance_eval(string) if action.view
|
@@ -9,6 +15,6 @@ module Ramaze
|
|
9
15
|
|
10
16
|
return html, 'text/html'
|
11
17
|
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
18
|
+
end # Gestalt
|
19
|
+
end # View
|
20
|
+
end # Ramaze
|
data/lib/ramaze/view/haml.rb
CHANGED
@@ -3,6 +3,10 @@ require 'haml/engine'
|
|
3
3
|
|
4
4
|
module Ramaze
|
5
5
|
module View
|
6
|
+
##
|
7
|
+
# View adapter that allows views to use Haml, for more information see the
|
8
|
+
# following website: http://haml-lang.com/
|
9
|
+
#
|
6
10
|
module Haml
|
7
11
|
def self.call(action, string)
|
8
12
|
options = action.options
|
@@ -17,6 +21,6 @@ module Ramaze
|
|
17
21
|
|
18
22
|
return html, 'text/html'
|
19
23
|
end
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
24
|
+
end # Haml
|
25
|
+
end # View
|
26
|
+
end # Ramaze
|
data/lib/ramaze/view/liquid.rb
CHANGED
data/lib/ramaze/view/lokar.rb
CHANGED
@@ -2,6 +2,10 @@ require 'lokar'
|
|
2
2
|
|
3
3
|
module Ramaze
|
4
4
|
module View
|
5
|
+
##
|
6
|
+
# Allows views to use Lokar as the template engine. See the following
|
7
|
+
# website for more information: https://github.com/Zoxc/Lokar
|
8
|
+
#
|
5
9
|
module Lokar
|
6
10
|
def self.call(action, string)
|
7
11
|
compiled = View.compile(string){|s| ::Lokar.compile(s, action.view || __FILE__) }
|
@@ -9,6 +13,6 @@ module Ramaze
|
|
9
13
|
|
10
14
|
return html, 'text/html'
|
11
15
|
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
16
|
+
end # Helper
|
17
|
+
end # View
|
18
|
+
end # Ramaze
|
data/lib/ramaze/view/mustache.rb
CHANGED
@@ -9,6 +9,12 @@ module Ramaze
|
|
9
9
|
#
|
10
10
|
# @see http://github.com/defunkt/mustache
|
11
11
|
module Mustache
|
12
|
+
class RamazeContext < ::Mustache::Context
|
13
|
+
def escapeHTML(str)
|
14
|
+
str.escape(:html)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
12
18
|
def self.call(action, string)
|
13
19
|
context, path, ext = class_defined?(action)
|
14
20
|
|
@@ -22,7 +28,7 @@ module Ramaze
|
|
22
28
|
end
|
23
29
|
|
24
30
|
def self.class_defined?(action)
|
25
|
-
return
|
31
|
+
return RamazeContext.new(nil), nil, nil unless action.view
|
26
32
|
|
27
33
|
path = File.dirname(action.view)
|
28
34
|
|
@@ -33,8 +39,8 @@ module Ramaze
|
|
33
39
|
::Mustache
|
34
40
|
end
|
35
41
|
|
36
|
-
return
|
42
|
+
return RamazeContext.new(klass.new), path, View.exts_of(self).first
|
37
43
|
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
44
|
+
end # Mustache
|
45
|
+
end # View
|
46
|
+
end # Ramaze
|
data/lib/ramaze/view/nagoro.rb
CHANGED
data/lib/ramaze/view/sass.rb
CHANGED
data/lib/ramaze/view/slippers.rb
CHANGED
@@ -2,23 +2,50 @@ require 'slippers'
|
|
2
2
|
|
3
3
|
module Ramaze
|
4
4
|
module View
|
5
|
+
##
|
6
|
+
# View adapter for Slippers, see the website of Slippers for more
|
7
|
+
# information: http://starapor.github.com/slippers/
|
8
|
+
#
|
9
|
+
#
|
5
10
|
module Slippers
|
6
11
|
def self.call(action, string)
|
7
|
-
slippers = View.compile(string)
|
12
|
+
slippers = View.compile(string) do |s|
|
13
|
+
::Slippers::Engine.new(s, :template_group => template_group(action))
|
14
|
+
end
|
15
|
+
|
8
16
|
object_to_render = ::Slippers::BindingWrapper.new(action.instance.binding)
|
9
|
-
html
|
17
|
+
html = slippers.render(object_to_render)
|
18
|
+
|
10
19
|
return html, 'text/html'
|
11
20
|
end
|
12
|
-
|
21
|
+
|
13
22
|
private
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
23
|
+
|
24
|
+
def self.template_group(action)
|
25
|
+
subtemplates = action.instance.ancestral_trait[:slippers_options] || {}
|
26
|
+
missing_template_handler = action.instance.ancestral_trait[
|
27
|
+
:slippers_missing_template_handler
|
28
|
+
]
|
29
|
+
default_string = action.instance.ancestral_trait[
|
30
|
+
:slippers_default_string
|
31
|
+
]
|
32
|
+
|
33
|
+
views = action.instance.options[:views].map do |view|
|
34
|
+
"#{action.instance.options[:roots]}/#{view}"
|
21
35
|
end
|
22
|
-
|
23
|
-
|
24
|
-
|
36
|
+
|
37
|
+
super_group = ::Slippers::TemplateGroup.new(
|
38
|
+
:templates => subtemplates,
|
39
|
+
:missing_template_handler => missing_template_handler,
|
40
|
+
:default_string => default_string
|
41
|
+
)
|
42
|
+
|
43
|
+
::Slippers::TemplateGroupDirectory.new(
|
44
|
+
views, :super_group => super_group,
|
45
|
+
:missing_template_handler => missing_template_handler,
|
46
|
+
:default_string => default_string
|
47
|
+
)
|
48
|
+
end
|
49
|
+
end # Slippers
|
50
|
+
end # View
|
51
|
+
end # Ramaze
|
data/lib/ramaze/view/tagz.rb
CHANGED
@@ -39,11 +39,15 @@ module Ramaze
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def p(*a)
|
42
|
-
a.each
|
42
|
+
a.each do |elem|
|
43
|
+
tagz << "#{ Rack::Utils.escape_html elem.inspect }#{ eol }"
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
def pp(*a)
|
46
|
-
a.each
|
48
|
+
a.each do |elem|
|
49
|
+
tagz << "#{ Rack::Utils.escape_html PP.pp(elem, '') }#{ eol }"
|
50
|
+
end
|
47
51
|
end
|
48
52
|
|
49
53
|
def eol
|
@@ -58,6 +62,6 @@ module Ramaze
|
|
58
62
|
concat eol
|
59
63
|
end
|
60
64
|
end
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
65
|
+
end # Tagz
|
66
|
+
end # View
|
67
|
+
end # Ramaze
|