padrino-core 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.0
1
+ 0.9.1
@@ -13,14 +13,13 @@ module Padrino
13
13
  # * Use render 'path/to/my/template' (with auto enegine lookup)
14
14
  #
15
15
  def render(engine, data=nil, options={}, locals={}, &block)
16
- # TODO: remove these @template_cache.respond_to?(:clear) when sinatra 1.0 will be released
17
- @template_cache.clear if Padrino.env != :production && @template_cache && @template_cache.respond_to?(:clear)
16
+ clear_template_cache!
18
17
  # If engine is an hash we convert to json
19
18
  return engine.to_json if engine.is_a?(Hash)
20
19
  # If an engine is a string probably is a path so we try to resolve them
21
20
  if data.nil?
22
21
  data = engine.to_sym
23
- engine = resolve_template_engine(engine)
22
+ engine = resolve_template_engine(engine, options)
24
23
  end
25
24
  # Use layout as rails do
26
25
  if (options[:layout].nil? || options[:layout] == true) && !self.class.templates.has_key?(:layout)
@@ -28,7 +27,7 @@ module Padrino
28
27
  if layout
29
28
  # We look first for views/layout_name.ext then then for views/layouts/layout_name.ext
30
29
  options[:layout] = Dir["#{self.options.views}/#{layout}.*"].present? ? layout.to_sym : File.join('layouts', layout.to_s).to_sym
31
- logger.debug "Rendering layout #{options[:layout]}"
30
+ logger.debug "Rendering layout #{options[:layout]}" if defined?(logger)
32
31
  end
33
32
  end
34
33
  super(engine, data, options, locals, &block)
@@ -38,11 +37,23 @@ module Padrino
38
37
  # Returns the template engine (i.e haml) to use for a given template_path
39
38
  # resolve_template_engine('users/new') => :haml
40
39
  #
41
- def resolve_template_engine(template_path)
42
- resolved_template_path = File.join(self.options.views, template_path.to_s + ".*")
40
+ def resolve_template_engine(template_path, options={})
41
+ view_path = options.delete(:views) || self.options.views || self.class.views || "./views"
42
+ resolved_template_path = File.join(view_path, template_path.to_s + ".*")
43
43
  template_file = Dir[resolved_template_path].first
44
44
  raise "Template path '#{template_path}' could not be located in views!" unless template_file
45
45
  template_engine = File.extname(template_file)[1..-1].to_sym
46
46
  end
47
+
48
+ ##
49
+ # Clears the template view cache when in development mode
50
+ # clear_template_cache!
51
+ #
52
+ def clear_template_cache!
53
+ # TODO: remove these @template_cache.respond_to?(:clear) when sinatra 1.0 will be released
54
+ can_clear_cache = @template_cache && @template_cache.respond_to?(:clear)
55
+ is_in_development = (defined?(Padrino) && Padrino.respond_to?(:env) && Padrino.env != :production)
56
+ @template_cache.clear if is_in_development && can_clear_cache
57
+ end
47
58
  end
48
- end
59
+ end
data/padrino-core.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{padrino-core}
8
- s.version = "0.9.0"
8
+ s.version = "0.9.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Padrino Team", "Nathan Esquenazi", "Davide D'Agostino", "Arthur Chiu"]
@@ -70,7 +70,7 @@ Gem::Specification.new do |s|
70
70
  s.rdoc_options = ["--charset=UTF-8"]
71
71
  s.require_paths = ["lib"]
72
72
  s.rubyforge_project = %q{padrino-core}
73
- s.rubygems_version = %q{1.3.5}
73
+ s.rubygems_version = %q{1.3.6}
74
74
  s.summary = %q{The required Padrino core gem}
75
75
 
76
76
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: padrino-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 9
8
+ - 1
9
+ version: 0.9.1
5
10
  platform: ruby
6
11
  authors:
7
12
  - Padrino Team
@@ -17,104 +22,144 @@ default_executable: padrino
17
22
  dependencies:
18
23
  - !ruby/object:Gem::Dependency
19
24
  name: sinatra
20
- type: :runtime
21
- version_requirement:
22
- version_requirements: !ruby/object:Gem::Requirement
25
+ prerelease: false
26
+ requirement: &id001 !ruby/object:Gem::Requirement
23
27
  requirements:
24
28
  - - ">="
25
29
  - !ruby/object:Gem::Version
30
+ segments:
31
+ - 0
32
+ - 9
33
+ - 4
26
34
  version: 0.9.4
27
- version:
35
+ type: :runtime
36
+ version_requirements: *id001
28
37
  - !ruby/object:Gem::Dependency
29
38
  name: i18n
30
- type: :runtime
31
- version_requirement:
32
- version_requirements: !ruby/object:Gem::Requirement
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
33
41
  requirements:
34
42
  - - ">="
35
43
  - !ruby/object:Gem::Version
44
+ segments:
45
+ - 0
46
+ - 3
47
+ - 2
36
48
  version: 0.3.2
37
- version:
49
+ type: :runtime
50
+ version_requirements: *id002
38
51
  - !ruby/object:Gem::Dependency
39
52
  name: usher
40
- type: :runtime
41
- version_requirement:
42
- version_requirements: !ruby/object:Gem::Requirement
53
+ prerelease: false
54
+ requirement: &id003 !ruby/object:Gem::Requirement
43
55
  requirements:
44
56
  - - ">="
45
57
  - !ruby/object:Gem::Version
58
+ segments:
59
+ - 0
60
+ - 6
61
+ - 2
46
62
  version: 0.6.2
47
- version:
63
+ type: :runtime
64
+ version_requirements: *id003
48
65
  - !ruby/object:Gem::Dependency
49
66
  name: thor
50
- type: :runtime
51
- version_requirement:
52
- version_requirements: !ruby/object:Gem::Requirement
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
53
69
  requirements:
54
70
  - - ">="
55
71
  - !ruby/object:Gem::Version
72
+ segments:
73
+ - 0
74
+ - 13
75
+ - 0
56
76
  version: 0.13.0
57
- version:
77
+ type: :runtime
78
+ version_requirements: *id004
58
79
  - !ruby/object:Gem::Dependency
59
80
  name: bundler
60
- type: :runtime
61
- version_requirement:
62
- version_requirements: !ruby/object:Gem::Requirement
81
+ prerelease: false
82
+ requirement: &id005 !ruby/object:Gem::Requirement
63
83
  requirements:
64
84
  - - "="
65
85
  - !ruby/object:Gem::Version
86
+ segments:
87
+ - 0
88
+ - 9
89
+ - 7
66
90
  version: 0.9.7
67
- version:
91
+ type: :runtime
92
+ version_requirements: *id005
68
93
  - !ruby/object:Gem::Dependency
69
94
  name: activesupport
70
- type: :runtime
71
- version_requirement:
72
- version_requirements: !ruby/object:Gem::Requirement
95
+ prerelease: false
96
+ requirement: &id006 !ruby/object:Gem::Requirement
73
97
  requirements:
74
98
  - - "="
75
99
  - !ruby/object:Gem::Version
100
+ segments:
101
+ - 2
102
+ - 3
103
+ - 5
76
104
  version: 2.3.5
77
- version:
105
+ type: :runtime
106
+ version_requirements: *id006
78
107
  - !ruby/object:Gem::Dependency
79
108
  name: shoulda
80
- type: :development
81
- version_requirement:
82
- version_requirements: !ruby/object:Gem::Requirement
109
+ prerelease: false
110
+ requirement: &id007 !ruby/object:Gem::Requirement
83
111
  requirements:
84
112
  - - ">="
85
113
  - !ruby/object:Gem::Version
114
+ segments:
115
+ - 2
116
+ - 10
117
+ - 3
86
118
  version: 2.10.3
87
- version:
119
+ type: :development
120
+ version_requirements: *id007
88
121
  - !ruby/object:Gem::Dependency
89
122
  name: mocha
90
- type: :development
91
- version_requirement:
92
- version_requirements: !ruby/object:Gem::Requirement
123
+ prerelease: false
124
+ requirement: &id008 !ruby/object:Gem::Requirement
93
125
  requirements:
94
126
  - - ">="
95
127
  - !ruby/object:Gem::Version
128
+ segments:
129
+ - 0
130
+ - 9
131
+ - 7
96
132
  version: 0.9.7
97
- version:
133
+ type: :development
134
+ version_requirements: *id008
98
135
  - !ruby/object:Gem::Dependency
99
136
  name: rack-test
100
- type: :development
101
- version_requirement:
102
- version_requirements: !ruby/object:Gem::Requirement
137
+ prerelease: false
138
+ requirement: &id009 !ruby/object:Gem::Requirement
103
139
  requirements:
104
140
  - - ">="
105
141
  - !ruby/object:Gem::Version
142
+ segments:
143
+ - 0
144
+ - 5
145
+ - 0
106
146
  version: 0.5.0
107
- version:
147
+ type: :development
148
+ version_requirements: *id009
108
149
  - !ruby/object:Gem::Dependency
109
150
  name: webrat
110
- type: :development
111
- version_requirement:
112
- version_requirements: !ruby/object:Gem::Requirement
151
+ prerelease: false
152
+ requirement: &id010 !ruby/object:Gem::Requirement
113
153
  requirements:
114
154
  - - ">="
115
155
  - !ruby/object:Gem::Version
156
+ segments:
157
+ - 0
158
+ - 5
159
+ - 1
116
160
  version: 0.5.1
117
- version:
161
+ type: :development
162
+ version_requirements: *id010
118
163
  description: The Padrino core gem required for use of this framework
119
164
  email: padrinorb@gmail.com
120
165
  executables:
@@ -184,18 +229,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
229
  requirements:
185
230
  - - ">="
186
231
  - !ruby/object:Gem::Version
232
+ segments:
233
+ - 0
187
234
  version: "0"
188
- version:
189
235
  required_rubygems_version: !ruby/object:Gem::Requirement
190
236
  requirements:
191
237
  - - ">="
192
238
  - !ruby/object:Gem::Version
239
+ segments:
240
+ - 0
193
241
  version: "0"
194
- version:
195
242
  requirements: []
196
243
 
197
244
  rubyforge_project: padrino-core
198
- rubygems_version: 1.3.5
245
+ rubygems_version: 1.3.6
199
246
  signing_key:
200
247
  specification_version: 3
201
248
  summary: The required Padrino core gem