uzuuzu-core 0.1.11 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/uzuuzu-core/application.rb +16 -18
- data/lib/uzuuzu-core/environments.rb +5 -5
- data/lib/uzuuzu-core/helper/renderer.rb +12 -3
- data/lib/uzuuzu-core/helper/route.rb +3 -0
- data/lib/uzuuzu-core/wrapper/dm.rb +5 -4
- data/lib/uzuuzu-core/wrapper/wrapper.rb +3 -2
- data/uzuuzu-core.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.13
|
@@ -153,8 +153,6 @@ module UzuUzu
|
|
153
153
|
action_return = send_action(request, response, controller, action, query)
|
154
154
|
if response.body.blank?
|
155
155
|
render = helper.render(action)
|
156
|
-
p action
|
157
|
-
p render
|
158
156
|
end
|
159
157
|
break
|
160
158
|
end
|
@@ -165,7 +163,6 @@ module UzuUzu
|
|
165
163
|
if response.status == 200 and response.body.blank?
|
166
164
|
response.write render || action_return
|
167
165
|
end
|
168
|
-
|
169
166
|
response.finish
|
170
167
|
end # call
|
171
168
|
|
@@ -199,6 +196,7 @@ module UzuUzu
|
|
199
196
|
def get_class_map(name, controller, route, query)
|
200
197
|
_c = controller.const_get(name) if controller.const_defined?(name)
|
201
198
|
return nil if _c.nil?
|
199
|
+
return nil if _c.name.index(controller.name).nil?
|
202
200
|
_h = find_helper(name, route)
|
203
201
|
map = {
|
204
202
|
:controller => _c,
|
@@ -248,31 +246,31 @@ module UzuUzu
|
|
248
246
|
rescue => e
|
249
247
|
end
|
250
248
|
_controllers.each do |c|
|
251
|
-
_c = c
|
252
249
|
_h = nil
|
253
250
|
request_paths.each_with_index do |request_path, index|
|
254
251
|
break if _c.nil?
|
255
252
|
c_str = request_path.camel_case
|
256
|
-
|
257
|
-
|
258
|
-
route
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
253
|
+
if c_str != 'Index'
|
254
|
+
route = "#{request_paths[0...index].join('/')}"
|
255
|
+
if route.blank?
|
256
|
+
route = "#{env['SCRIPT_NAME']}/index"
|
257
|
+
route.blank?
|
258
|
+
else
|
259
|
+
route = "#{env['SCRIPT_NAME']}/#{route}/index"
|
260
|
+
end
|
261
|
+
query = request_paths[index...-1]
|
262
|
+
map = get_class_map('Index', _c, route, query)
|
263
|
+
if map && map[:controller].kind_of?(::Class)
|
264
|
+
classies << map
|
265
|
+
end
|
267
266
|
end
|
268
|
-
next if c_str
|
269
|
-
route = "#{env['SCRIPT_NAME']}/#{request_paths[0
|
267
|
+
next if c_str.blank?
|
268
|
+
route = "#{env['SCRIPT_NAME']}/#{request_paths[0..index].join('/')}"
|
270
269
|
query = request_paths[(index+1)...-1]
|
271
270
|
map = get_class_map(c_str, _c, route, query)
|
272
271
|
_c = nil
|
273
272
|
if map
|
274
273
|
classies << map if map[:controller].kind_of?(::Class)
|
275
|
-
p map[:controller].kind_of?(::Module)
|
276
274
|
if map[:controller].kind_of?(::Class) || map[:controller].kind_of?(::Module)
|
277
275
|
_c = map[:controller]
|
278
276
|
end
|
@@ -86,7 +86,7 @@ module UzuUzu
|
|
86
86
|
|
87
87
|
def logger
|
88
88
|
if @logger.nil?
|
89
|
-
env = @config['logger']
|
89
|
+
env = @config['logger'] unless @config.nil?
|
90
90
|
@logger = Wrapper::Logger.new(env || {}).logger
|
91
91
|
end
|
92
92
|
@logger
|
@@ -94,7 +94,7 @@ module UzuUzu
|
|
94
94
|
|
95
95
|
def dm
|
96
96
|
if @dm.nil?
|
97
|
-
env = @config['dm']
|
97
|
+
env = @config['dm'] unless @config.nil?
|
98
98
|
@dm = Wrapper::Dm.new(env || {})
|
99
99
|
end
|
100
100
|
@dm
|
@@ -102,7 +102,7 @@ module UzuUzu
|
|
102
102
|
|
103
103
|
def s3
|
104
104
|
if @s3.nil?
|
105
|
-
env = @config['s3']
|
105
|
+
env = @config['s3'] unless @config.nil?
|
106
106
|
@s3 = Wrapper::S3.new(env || {})
|
107
107
|
end
|
108
108
|
@s3
|
@@ -110,7 +110,7 @@ module UzuUzu
|
|
110
110
|
|
111
111
|
def memcache
|
112
112
|
if @memcache.nil?
|
113
|
-
env = @config['memcache']
|
113
|
+
env = @config['memcache'] unless @config.nil?
|
114
114
|
@memcache = Wrapper::Wrapper.new('memcache', env || {}).wrapper
|
115
115
|
@memcache ||= {}
|
116
116
|
end
|
@@ -119,7 +119,7 @@ module UzuUzu
|
|
119
119
|
|
120
120
|
def rack_session
|
121
121
|
if @rack_session.nil?
|
122
|
-
env = @config['rack_session']
|
122
|
+
env = @config['rack_session'] unless @config.nil?
|
123
123
|
@rack_session = Wrapper::Wrapper.new('rack_session', env || {}).wrapper
|
124
124
|
end
|
125
125
|
@rack_session
|
@@ -25,11 +25,19 @@ module UzuUzu
|
|
25
25
|
#
|
26
26
|
#
|
27
27
|
#
|
28
|
-
def render(view, options={}, locals={}, &block)
|
28
|
+
def render(view=nil, options={}, locals={}, &block)
|
29
|
+
view = helper.action if view.blank?
|
29
30
|
view_path = nil
|
30
31
|
catch(:view_finded) do
|
31
|
-
|
32
|
-
|
32
|
+
route = helper.route
|
33
|
+
if /index$/ =~ route
|
34
|
+
route = route.split('/')[0...-1].join('/')
|
35
|
+
end
|
36
|
+
if view[0] == '/'
|
37
|
+
_view_path = "#{application.view_root}#{view}"
|
38
|
+
else
|
39
|
+
_view_path = "#{application.view_root}#{route}/#{view}"
|
40
|
+
end
|
33
41
|
::Tilt.mappings.each_key do |key|
|
34
42
|
_path = "#{_view_path}.#{key}"
|
35
43
|
if ::File.file?(_path)
|
@@ -37,6 +45,7 @@ module UzuUzu
|
|
37
45
|
throw :view_finded
|
38
46
|
end
|
39
47
|
end
|
48
|
+
return nil
|
40
49
|
end
|
41
50
|
if view_path.blank?
|
42
51
|
return nil
|
@@ -16,12 +16,13 @@ module UzuUzu
|
|
16
16
|
if env.nil?
|
17
17
|
return
|
18
18
|
end
|
19
|
+
@env = env.clone
|
19
20
|
|
20
|
-
unless env['logger'].nil?
|
21
|
-
DataMapper::logger = ::UzuUzu::Wrapper::Logger.new(env['logger']).logger
|
21
|
+
unless @env['logger'].nil?
|
22
|
+
DataMapper::logger = ::UzuUzu::Wrapper::Logger.new(@env['logger']).logger
|
22
23
|
end
|
23
24
|
@repositories = []
|
24
|
-
env.each do |key, value|
|
25
|
+
@env.each do |key, value|
|
25
26
|
@repositories.push key.to_sym
|
26
27
|
if value['adapter']
|
27
28
|
@adapter = value['adapter']
|
@@ -37,7 +38,7 @@ module UzuUzu
|
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
40
|
-
end #
|
41
|
+
end # env.each
|
41
42
|
end # new
|
42
43
|
|
43
44
|
#
|
@@ -15,11 +15,12 @@ module UzuUzu
|
|
15
15
|
unless env && env['adapter']
|
16
16
|
return
|
17
17
|
end
|
18
|
+
@env = env.clone
|
18
19
|
begin
|
19
|
-
adapter = env['adapter']
|
20
|
+
adapter = @env['adapter']
|
20
21
|
require "uzuuzu-core/#{wrapper}/#{adapter}"
|
21
22
|
adapter_class = eval("::UzuUzu::#{wrapper.camel_case}::#{adapter.camel_case}")
|
22
|
-
@wrapper = adapter_class.new(env)
|
23
|
+
@wrapper = adapter_class.new(@env)
|
23
24
|
rescue => e
|
24
25
|
$stderr.puts "#{wrapper} create error"
|
25
26
|
$stderr.puts e
|
data/uzuuzu-core.gemspec
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: uzuuzu-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.13
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Takuya Kondo
|
@@ -201,7 +201,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
201
201
|
requirements:
|
202
202
|
- - ">="
|
203
203
|
- !ruby/object:Gem::Version
|
204
|
-
hash: -
|
204
|
+
hash: -2416727837931408106
|
205
205
|
segments:
|
206
206
|
- 0
|
207
207
|
version: "0"
|