RubyApp 0.0.91 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/.rvmrc +56 -1
- data/Gemfile.lock +22 -22
- data/bin/console.rb +9 -1
- data/bin/ruby_app +2 -24
- data/features/default.feature +1 -0
- data/features/elements/input.feature +2 -0
- data/features/elements/page.feature +0 -9
- data/features/step_definitions/default_macros.rb +1 -4
- data/features/step_definitions/default_steps.rb +1 -1
- data/lib/ruby_app.rb +8 -1
- data/lib/ruby_app/application.rb +5 -67
- data/lib/ruby_app/configuration.rb +2 -3
- data/lib/ruby_app/configuration.ru +32 -0
- data/lib/ruby_app/configuration.yml +28 -0
- data/lib/ruby_app/element.rb +12 -6
- data/lib/ruby_app/elements.rb +50 -0
- data/lib/ruby_app/elements/base/base_mail.rb +2 -2
- data/lib/ruby_app/elements/base/base_page.html.haml +1 -1
- data/lib/ruby_app/elements/base/base_page.js.haml +3 -3
- data/lib/ruby_app/elements/base/base_page.rb +2 -2
- data/lib/ruby_app/elements/dialogs/base/base_ok_dialog.rb +0 -1
- data/lib/ruby_app/elements/dialogs/blank_dialog.rb +1 -1
- data/lib/ruby_app/elements/dialogs/exception_dialog.rb +1 -2
- data/lib/ruby_app/elements/navigation/back_button.rb +1 -1
- data/lib/ruby_app/elements/navigation/base/base_breadcrumbs.rb +1 -0
- data/lib/ruby_app/elements/navigation/page_link.rb +1 -0
- data/lib/ruby_app/elements/pages/authentication/open_id/ax_authentication_page.rb +1 -1
- data/lib/ruby_app/elements/pages/authentication/open_id/base/base_authentication_page.rb +1 -3
- data/lib/ruby_app/elements/pages/authentication/open_id/email_authentication_page.rb +1 -1
- data/lib/ruby_app/elements/pages/authentication/open_id/sreg_authentication_page.rb +1 -1
- data/lib/ruby_app/elements/pages/base/base_blank_page.rb +0 -1
- data/lib/ruby_app/elements/pages/default_page.rb +2 -1
- data/lib/ruby_app/elements/pages/quit_page.html.haml +0 -3
- data/lib/ruby_app/elements/pages/quit_page.rb +0 -2
- data/lib/ruby_app/elements/pages/settings_page.rb +2 -1
- data/lib/ruby_app/elements/pages/test_pages.rb +9 -0
- data/lib/ruby_app/elements/pages/test_pages/button_test_page.rb +3 -5
- data/lib/ruby_app/elements/pages/test_pages/default_test_page.rb +10 -15
- data/lib/ruby_app/elements/pages/test_pages/dialog_test_page.rb +2 -8
- data/lib/ruby_app/elements/pages/test_pages/input_test_page.rb +2 -9
- data/lib/ruby_app/elements/pages/test_pages/link_test_page.rb +3 -5
- data/lib/ruby_app/elements/pages/test_pages/linked_test_page.rb +1 -2
- data/lib/ruby_app/elements/pages/test_pages/list_test_page.rb +4 -8
- data/lib/ruby_app/elements/pages/test_pages/markdown_test_page.rb +3 -4
- data/lib/ruby_app/elements/pages/test_pages/test_page.rb +3 -8
- data/lib/ruby_app/exceptions.rb +2 -0
- data/lib/ruby_app/exceptions/base/base_exception.rb +1 -1
- data/lib/ruby_app/language.rb +9 -15
- data/lib/ruby_app/log.rb +32 -28
- data/lib/ruby_app/mixins.rb +7 -0
- data/lib/ruby_app/mixins/configuration_mixin.rb +1 -1
- data/lib/ruby_app/mixins/delegate_mixin.rb +1 -1
- data/lib/ruby_app/mixins/hash_mixin.rb +1 -1
- data/lib/ruby_app/mixins/render_mixin.rb +37 -39
- data/lib/ruby_app/mixins/route_mixin.rb +1 -5
- data/lib/ruby_app/mixins/template_mixin.rb +4 -12
- data/lib/ruby_app/mixins/translate_mixin.rb +2 -2
- data/lib/ruby_app/rack.rb +8 -0
- data/lib/ruby_app/rack/application.rb +9 -5
- data/lib/ruby_app/rack/duration.rb +22 -0
- data/lib/ruby_app/rack/language.rb +26 -0
- data/lib/ruby_app/rack/memory.rb +22 -0
- data/lib/ruby_app/rack/request.rb +27 -0
- data/lib/ruby_app/rack/response.rb +26 -0
- data/lib/ruby_app/rack/route.rb +24 -87
- data/lib/ruby_app/rack/session.rb +31 -0
- data/lib/ruby_app/request.rb +4 -55
- data/lib/ruby_app/response.rb +58 -0
- data/lib/ruby_app/session.rb +102 -35
- data/lib/ruby_app/templates/application/Rakefile +1 -1
- data/lib/ruby_app/templates/application/configuration.ru +41 -0
- data/lib/ruby_app/templates/application/configuration.yml +16 -0
- data/lib/ruby_app/templates/application/console.rb +15 -10
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_.rb +3 -0
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/application.rb +3 -3
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/elements/pages/default_page.rb +1 -1
- data/lib/ruby_app/templates/application/lib/_APPLICATION_DOWNCODE_/session.rb +3 -3
- data/lib/ruby_app/templates/application/spec/application_spec.rb +17 -0
- data/lib/ruby_app/templates/application/spec/request_spec.rb +18 -0
- data/lib/ruby_app/templates/application/spec/support/shared.rb +34 -9
- data/lib/ruby_app/themes/mobile.rb +1 -17
- data/lib/ruby_app/themes/mobile/base/base_page.html.haml +1 -1
- data/lib/ruby_app/translations/en.yml +133 -144
- data/lib/ruby_app/version.rb +1 -1
- data/rakefile +1 -16
- data/spec/application_spec.rb +5 -13
- data/spec/elements/base_element.html.haml +5 -0
- data/spec/elements/container_element.html.haml +6 -0
- data/spec/elements/derived_element.html.haml +5 -0
- data/spec/elements/element_spec.rb +101 -0
- data/spec/request_spec.rb +6 -13
- data/spec/support/shared.rb +14 -6
- metadata +95 -125
- data/features/elements/pages/quit_page.feature +0 -8
- data/lib/ruby_app/config.ru +0 -25
- data/lib/ruby_app/config.yml +0 -16
- data/lib/ruby_app/elements/pages/test_pages/select_test_page.rb +0 -44
- data/lib/ruby_app/templates/application/config.ru +0 -40
- data/lib/ruby_app/templates/application/config.yml +0 -1
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.css.haml +0 -3
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.html.haml +0 -4
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.js.haml +0 -3
- data/lib/ruby_app/templates/page/_PAGE_DOWNCODE_.rb +0 -14
- data/spec/configuration_spec.rb +0 -25
- data/spec/element_spec.rb +0 -72
- data/spec/elements/navigation/breadcrumbs_spec.rb +0 -62
- data/spec/elements/page_spec.rb +0 -20
- data/spec/language_spec.rb +0 -25
- data/spec/log_spec.rb +0 -25
- data/spec/mixins/configuration_mixin_spec.rb +0 -24
- data/spec/mixins/delegate_mixin_spec.rb +0 -28
- data/spec/mixins/hash_mixin_spec.rb +0 -39
- data/spec/mixins/render_mixin_spec.rb +0 -127
- data/spec/mixins/route_mixin_spec.rb +0 -60
- data/spec/mixins/template_mixin_spec.rb +0 -78
- data/spec/mixins/test_a.css.haml +0 -4
- data/spec/mixins/test_a.html.haml +0 -2
- data/spec/mixins/test_a.js.haml +0 -4
- data/spec/mixins/test_b.css.haml +0 -4
- data/spec/mixins/test_b.html.haml +0 -3
- data/spec/mixins/test_b.js.haml +0 -4
- data/spec/mixins/test_c.css.haml +0 -4
- data/spec/mixins/test_c.html.haml +0 -2
- data/spec/mixins/test_c.js.haml +0 -4
- data/spec/mixins/translate_mixin_spec.rb +0 -25
- data/spec/session_spec.rb +0 -39
@@ -5,11 +5,8 @@ module RubyApp
|
|
5
5
|
module Pages
|
6
6
|
|
7
7
|
module TestPages
|
8
|
-
require 'ruby_app
|
9
|
-
require 'ruby_app/elements
|
10
|
-
require 'ruby_app/elements/pages/blank_page'
|
11
|
-
require 'ruby_app/elements/pages/test_pages/linked_test_page'
|
12
|
-
require 'ruby_app/session'
|
8
|
+
require 'ruby_app'
|
9
|
+
require 'ruby_app/elements'
|
13
10
|
|
14
11
|
class LinkTestPage < RubyApp::Elements::Pages::BlankPage
|
15
12
|
|
@@ -22,6 +19,7 @@ module RubyApp
|
|
22
19
|
|
23
20
|
@link = RubyApp::Elements::Link.new
|
24
21
|
@link.clicked do |element, event|
|
22
|
+
require 'ruby_app/elements/pages/test_pages/linked_test_page'
|
25
23
|
RubyApp::Session.pages.push(RubyApp::Elements::Pages::TestPages::LinkedTestPage.new)
|
26
24
|
event.refresh
|
27
25
|
end
|
@@ -5,12 +5,8 @@ module RubyApp
|
|
5
5
|
module Pages
|
6
6
|
|
7
7
|
module TestPages
|
8
|
-
require 'ruby_app
|
9
|
-
require 'ruby_app/elements
|
10
|
-
require 'ruby_app/elements/pages/blank_page'
|
11
|
-
require 'ruby_app/elements/list'
|
12
|
-
require 'ruby_app/elements/lists/select'
|
13
|
-
require 'ruby_app/session'
|
8
|
+
require 'ruby_app'
|
9
|
+
require 'ruby_app/elements'
|
14
10
|
|
15
11
|
class ListTestPage < RubyApp::Elements::Pages::BlankPage
|
16
12
|
|
@@ -29,7 +25,7 @@ module RubyApp
|
|
29
25
|
'Item 05' ]
|
30
26
|
@list.clicked do |element, event|
|
31
27
|
RubyApp::Session.show_dialog(event, RubyApp::Elements::Dialogs::MessageDialog.new(self.translate.message_dialog.message.title,
|
32
|
-
|
28
|
+
self.translate.message_dialog.message.message(event.item)))
|
33
29
|
end
|
34
30
|
|
35
31
|
@select = RubyApp::Elements::Lists::Select.new
|
@@ -40,7 +36,7 @@ module RubyApp
|
|
40
36
|
'Item 15' ]
|
41
37
|
@select.clicked do |element, event|
|
42
38
|
RubyApp::Session.show_dialog(event, RubyApp::Elements::Dialogs::MessageDialog.new(self.translate.message_dialog.message.title,
|
43
|
-
|
39
|
+
self.translate.message_dialog.message.message(@select.selected_item)))
|
44
40
|
end
|
45
41
|
|
46
42
|
end
|
@@ -5,10 +5,8 @@ module RubyApp
|
|
5
5
|
module Pages
|
6
6
|
|
7
7
|
module TestPages
|
8
|
-
require 'ruby_app
|
9
|
-
require 'ruby_app/elements
|
10
|
-
require 'ruby_app/elements/pages/test_pages/linked_test_page'
|
11
|
-
require 'ruby_app/session'
|
8
|
+
require 'ruby_app'
|
9
|
+
require 'ruby_app/elements'
|
12
10
|
|
13
11
|
class MarkdownTestPage < RubyApp::Elements::Pages::BlankPage
|
14
12
|
|
@@ -20,6 +18,7 @@ module RubyApp
|
|
20
18
|
@markdown = RubyApp::Elements::Markdown.new
|
21
19
|
@markdown.clicked do |element, event|
|
22
20
|
if event.name == "go"
|
21
|
+
require 'ruby_app/elements/pages/test_pages/linked_test_page'
|
23
22
|
RubyApp::Session.pages.push(RubyApp::Elements::Pages::TestPages::LinkedTestPage.new)
|
24
23
|
event.refresh
|
25
24
|
end
|
@@ -5,13 +5,8 @@ module RubyApp
|
|
5
5
|
module Pages
|
6
6
|
|
7
7
|
module TestPages
|
8
|
-
require 'ruby_app
|
9
|
-
require 'ruby_app/elements
|
10
|
-
require 'ruby_app/elements/input'
|
11
|
-
require 'ruby_app/elements/markdown'
|
12
|
-
require 'ruby_app/elements/pages/blank_page'
|
13
|
-
require 'ruby_app/request'
|
14
|
-
require 'ruby_app/session'
|
8
|
+
require 'ruby_app'
|
9
|
+
require 'ruby_app/elements'
|
15
10
|
|
16
11
|
class TestPage < RubyApp::Elements::Pages::BlankPage
|
17
12
|
|
@@ -35,7 +30,7 @@ module RubyApp
|
|
35
30
|
@input.changed do |element, event|
|
36
31
|
event.set_cookie('_cookie', @input.value)
|
37
32
|
RubyApp::Session.show_dialog(event, RubyApp::Elements::Dialogs::MessageDialog.new(self.translate.message_dialog.message.title,
|
38
|
-
|
33
|
+
self.translate.message_dialog.message.message(@input.value)))
|
39
34
|
end
|
40
35
|
|
41
36
|
end
|
data/lib/ruby_app/language.rb
CHANGED
@@ -1,29 +1,23 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
3
|
|
4
|
+
require 'facets/string/interpolate'
|
4
5
|
require 'r18n-core'
|
5
6
|
|
6
7
|
module RubyApp
|
7
|
-
require 'ruby_app/
|
8
|
-
require 'ruby_app/mixins/delegate_mixin'
|
9
|
-
require 'ruby_app/request'
|
8
|
+
require 'ruby_app/mixins'
|
10
9
|
|
11
10
|
class Language < R18n::I18n
|
11
|
+
extend RubyApp::Mixins::ConfigurationMixin
|
12
12
|
extend RubyApp::Mixins::DelegateMixin
|
13
13
|
|
14
14
|
def self.get
|
15
|
-
R18n.get
|
15
|
+
return R18n.get
|
16
16
|
end
|
17
17
|
|
18
|
-
def self.load!
|
19
|
-
|
20
|
-
|
21
|
-
begin
|
22
|
-
yield
|
23
|
-
ensure
|
24
|
-
self.unload!
|
25
|
-
end
|
26
|
-
end
|
18
|
+
def self.load!(language = nil)
|
19
|
+
paths = RubyApp::Language.configuration.paths.collect { |path| String.interpolate { path } }
|
20
|
+
R18n.thread_set(RubyApp::Language.new(language || RubyApp::Language.configuration.default, paths))
|
27
21
|
end
|
28
22
|
|
29
23
|
def self.unload!
|
@@ -32,8 +26,8 @@ module RubyApp
|
|
32
26
|
|
33
27
|
private
|
34
28
|
|
35
|
-
def initialize(language,
|
36
|
-
super(language,
|
29
|
+
def initialize(language, paths)
|
30
|
+
super(language, paths)
|
37
31
|
end
|
38
32
|
|
39
33
|
end
|
data/lib/ruby_app/log.rb
CHANGED
@@ -1,20 +1,35 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'bundler/setup'
|
3
3
|
|
4
|
+
require 'facets/string/interpolate'
|
4
5
|
require 'fileutils'
|
5
6
|
require 'logger'
|
6
7
|
|
7
8
|
module RubyApp
|
8
|
-
require 'ruby_app/mixins
|
9
|
+
require 'ruby_app/mixins'
|
9
10
|
|
10
11
|
class Log < ::Logger
|
12
|
+
extend RubyApp::Mixins::ConfigurationMixin
|
11
13
|
extend RubyApp::Mixins::DelegateMixin
|
12
14
|
|
13
15
|
def duration(message)
|
14
16
|
start = Time.now
|
15
|
-
|
16
|
-
|
17
|
-
|
17
|
+
begin
|
18
|
+
return yield if block_given?
|
19
|
+
ensure
|
20
|
+
self.debug("#{message} #{Time.now - start}s")
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def memory(message)
|
25
|
+
begin
|
26
|
+
return yield if block_given?
|
27
|
+
ensure
|
28
|
+
GC.start
|
29
|
+
count = ObjectSpace.each_object { |item| }
|
30
|
+
self.debug("#{message} count=#{count}")
|
31
|
+
self.debug("#{message} memory=#{`ps -o rss= -p #{$$}`.to_i}")
|
32
|
+
end
|
18
33
|
end
|
19
34
|
|
20
35
|
def exception(exception)
|
@@ -27,38 +42,27 @@ module RubyApp
|
|
27
42
|
self.error('-' * 80)
|
28
43
|
end
|
29
44
|
|
30
|
-
def
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
def hash(hash, indent = 0)
|
35
|
-
hash.each do |name, value|
|
36
|
-
if value.is_a?(Hash)
|
37
|
-
self.debug("#{' ' * 2 * indent}#{name.inspect}")
|
38
|
-
self.debug_hash(value, indent + 1)
|
39
|
-
else
|
40
|
-
self.debug("#{' ' * 2 * indent}#{name.inspect} = #{value.inspect}")
|
41
|
-
end
|
42
|
-
end
|
45
|
+
def self.prefix(object, method)
|
46
|
+
return "#{object.is_a?(Class) ? object : object.class}#{object.is_a?(Class) ? '.' : '#'}#{method}"
|
43
47
|
end
|
44
48
|
|
45
49
|
def self.get
|
46
|
-
@@_log
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.prefix(object, method)
|
50
|
-
return "#{object.is_a?(Class) ? object : object.class}#{object.is_a?(Class) ? '.' : '#'}#{method}"
|
50
|
+
( @@_log ||= nil ) || ( @@_standard_log ||= RubyApp::Log.new($stdout) )
|
51
51
|
end
|
52
52
|
|
53
|
-
def self.open!
|
54
|
-
|
55
|
-
|
56
|
-
|
53
|
+
def self.open!
|
54
|
+
unless @@_log ||= nil
|
55
|
+
path = String.interpolate { RubyApp::Log.configuration.path }
|
56
|
+
FileUtils.mkdir_p(File.dirname(path))
|
57
|
+
@@_log = RubyApp::Log.new(path)
|
58
|
+
end
|
57
59
|
end
|
58
60
|
|
59
61
|
def self.close!
|
60
|
-
@@_log
|
61
|
-
|
62
|
+
if @@_log ||= nil
|
63
|
+
@@_log.close
|
64
|
+
@@_log = nil
|
65
|
+
end
|
62
66
|
end
|
63
67
|
|
64
68
|
private
|
@@ -0,0 +1,7 @@
|
|
1
|
+
require 'ruby_app/mixins/configuration_mixin'
|
2
|
+
require 'ruby_app/mixins/delegate_mixin'
|
3
|
+
require 'ruby_app/mixins/hash_mixin'
|
4
|
+
require 'ruby_app/mixins/render_mixin'
|
5
|
+
require 'ruby_app/mixins/route_mixin'
|
6
|
+
require 'ruby_app/mixins/template_mixin'
|
7
|
+
require 'ruby_app/mixins/translate_mixin'
|
@@ -8,59 +8,57 @@ module RubyApp
|
|
8
8
|
module Mixins
|
9
9
|
|
10
10
|
module RenderMixin
|
11
|
-
require 'ruby_app
|
11
|
+
require 'ruby_app'
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def templates(format)
|
14
|
+
return self.is_a?(Class) ? self.get_templates(format) : self.class.get_templates(format)
|
15
|
+
end
|
16
|
+
|
17
|
+
def rendered?(file)
|
18
|
+
unless RubyApp::Response.rendered?(file)
|
15
19
|
yield
|
16
|
-
RubyApp::
|
20
|
+
RubyApp::Response.rendered(file)
|
17
21
|
end
|
18
22
|
end
|
19
23
|
|
20
24
|
def content_for(name, value = nil, &block)
|
21
|
-
RubyApp::
|
25
|
+
return RubyApp::Response.content_for(self, name, value, &block)
|
22
26
|
end
|
23
27
|
|
24
|
-
def render(format
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
28
|
+
def render(format)
|
29
|
+
|
30
|
+
templates = self.templates(format)
|
31
|
+
|
32
|
+
unless templates.empty?
|
33
|
+
|
34
|
+
self.init_haml_helpers unless @haml_buffer
|
35
|
+
|
36
|
+
begin
|
37
|
+
|
38
|
+
yield(self) if block_given?
|
39
|
+
|
40
|
+
templates.each_with_index do |template, index|
|
41
|
+
content = Haml::Engine.new(File.read(template), :filename => template).render(self) do |*arguments|
|
42
|
+
if arguments.empty?
|
43
|
+
index == 0 ? nil : RubyApp::Response.get_content(self, templates[index - 1])
|
44
|
+
else
|
45
|
+
_content = RubyApp::Response.get_content(self, arguments[0])
|
46
|
+
if self.block_is_haml?(_content)
|
47
|
+
self.capture_haml(arguments, &_content)
|
40
48
|
else
|
41
|
-
_content
|
42
|
-
if self.block_is_haml?(_content)
|
43
|
-
self.capture_haml(arguments, &_content)
|
44
|
-
else
|
45
|
-
_content
|
46
|
-
end
|
49
|
+
_content
|
47
50
|
end
|
48
51
|
end
|
49
|
-
RubyApp::Request.content_for(self, template, content)
|
50
|
-
end
|
51
|
-
if cache && write_cache
|
52
|
-
cache_directory = File.dirname(cache)
|
53
|
-
Dir.mkdir(cache_directory) unless File.exists?(cache_directory)
|
54
|
-
File.open(cache, 'w') do |file|
|
55
|
-
file.write(RubyApp::Request.get_content(self, templates.last))
|
56
|
-
file.flush
|
57
|
-
end
|
58
52
|
end
|
59
|
-
|
60
|
-
ensure
|
61
|
-
RubyApp::Request.clear_content(self)
|
53
|
+
RubyApp::Response.content_for(self, template, content)
|
62
54
|
end
|
55
|
+
|
56
|
+
return RubyApp::Response.get_content(self, templates.last)
|
57
|
+
|
58
|
+
ensure
|
59
|
+
RubyApp::Response.clear_content(self)
|
63
60
|
end
|
61
|
+
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
@@ -5,13 +5,11 @@ module RubyApp
|
|
5
5
|
module TemplateMixin
|
6
6
|
|
7
7
|
def template_name
|
8
|
-
|
9
8
|
name = self.to_s.split('::').last
|
10
9
|
name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
|
11
10
|
name.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
|
12
11
|
name.tr!("-", "_")
|
13
|
-
name.downcase
|
14
|
-
|
12
|
+
return name.downcase
|
15
13
|
end
|
16
14
|
|
17
15
|
def template_path(format, path)
|
@@ -19,7 +17,7 @@ module RubyApp
|
|
19
17
|
end
|
20
18
|
|
21
19
|
def exclude_parent_template?(format)
|
22
|
-
( @_exclude_parent_template_formats ||= [] ).include?(:all) || @_exclude_parent_template_formats.include?(format)
|
20
|
+
return ( @_exclude_parent_template_formats ||= [] ).include?(:all) || @_exclude_parent_template_formats.include?(format)
|
23
21
|
end
|
24
22
|
|
25
23
|
def exclude_parent_template(*formats)
|
@@ -27,18 +25,12 @@ module RubyApp
|
|
27
25
|
end
|
28
26
|
|
29
27
|
def get_template(format)
|
30
|
-
(@_template_path[format] || @_template_path[:all]).gsub(/\*/,format.to_s)
|
31
|
-
end
|
32
|
-
|
33
|
-
def get_cache(format)
|
34
|
-
cache = self.get_template(format)
|
35
|
-
cache = cache.gsub(/\.haml/, '')
|
36
|
-
File.join(File.dirname(cache), '.cache', File.basename(cache))
|
28
|
+
return (@_template_path[format] || @_template_path[:all]).gsub(/\*/,format.to_s)
|
37
29
|
end
|
38
30
|
|
39
31
|
def get_templates(format)
|
40
32
|
template = self.get_template(format)
|
41
|
-
(File.exists?(template) ? [template] : []).concat((!self.exclude_parent_template?(format) && self.superclass.respond_to?(:get_templates) ) ? self.superclass.get_templates(format) : [])
|
33
|
+
return (File.exists?(template) ? [template] : []).concat((!self.exclude_parent_template?(format) && self.superclass.respond_to?(:get_templates) ) ? self.superclass.get_templates(format) : [])
|
42
34
|
end
|
43
35
|
|
44
36
|
end
|