uzuuzu-core 0.0.15 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. data/VERSION +1 -1
  2. data/lib/{uzuuzu → uzuuzu-core}/application.rb +111 -51
  3. data/lib/uzuuzu-core/controller.rb +23 -0
  4. data/lib/uzuuzu-core/controller/index.rb +18 -0
  5. data/lib/{uzuuzu → uzuuzu-core}/controller/login/openid.rb +1 -1
  6. data/lib/{uzuuzu → uzuuzu-core}/controller/login/twitter.rb +2 -2
  7. data/lib/uzuuzu-core/controller/view/error/404.rhtml +39 -0
  8. data/lib/uzuuzu-core/controller/view/error/500.rhtml +39 -0
  9. data/lib/{uzuuzu → uzuuzu-core}/environments.rb +0 -0
  10. data/lib/{uzuuzu → uzuuzu-core}/ext/object.rb +0 -0
  11. data/lib/uzuuzu-core/helper.rb +23 -0
  12. data/lib/{uzuuzu → uzuuzu-core}/helper/controller.rb +2 -2
  13. data/lib/{uzuuzu → uzuuzu-core}/helper/form.rb +0 -0
  14. data/lib/{uzuuzu → uzuuzu-core}/helper/jquery.rb +0 -0
  15. data/lib/{uzuuzu → uzuuzu-core}/helper/localize.rb +0 -0
  16. data/lib/{uzuuzu → uzuuzu-core}/helper/renderer.rb +4 -6
  17. data/lib/{uzuuzu → uzuuzu-core}/helper/route.rb +0 -0
  18. data/lib/{uzuuzu → uzuuzu-core}/helper/xhtml.rb +0 -0
  19. data/lib/{uzuuzu → uzuuzu-core}/lang/en.yaml +0 -0
  20. data/lib/{uzuuzu → uzuuzu-core}/lang/ja.yaml +0 -0
  21. data/lib/{uzuuzu → uzuuzu-core}/logger/appengine.rb +0 -0
  22. data/lib/{uzuuzu → uzuuzu-core}/logger/file.rb +0 -0
  23. data/lib/{uzuuzu → uzuuzu-core}/logger/loggers.rb +1 -2
  24. data/lib/{uzuuzu → uzuuzu-core}/logger/stderr.rb +0 -0
  25. data/lib/{uzuuzu → uzuuzu-core}/logger/stdout.rb +0 -0
  26. data/lib/{uzuuzu → uzuuzu-core}/memcache/appengine.rb +0 -0
  27. data/lib/{uzuuzu → uzuuzu-core}/memcache/dalli.rb +0 -0
  28. data/lib/{uzuuzu → uzuuzu-core}/memcache/leveldb.rb +0 -0
  29. data/lib/{uzuuzu → uzuuzu-core}/memcache/memcached.rb +0 -0
  30. data/lib/{uzuuzu → uzuuzu-core}/rack_session/appengine.rb +1 -0
  31. data/lib/{uzuuzu → uzuuzu-core}/rack_session/cookie.rb +0 -0
  32. data/lib/{uzuuzu → uzuuzu-core}/rack_session/memcache.rb +0 -0
  33. data/lib/{uzuuzu → uzuuzu-core}/request.rb +0 -0
  34. data/lib/{uzuuzu → uzuuzu-core}/response.rb +2 -2
  35. data/lib/{uzuuzu → uzuuzu-core}/tilt.rb +0 -0
  36. data/lib/{uzuuzu/wrapper/uzuuzu.rb → uzuuzu-core/uzuuzu-core.rb} +0 -15
  37. data/lib/{uzuuzu → uzuuzu-core}/wrapper/logger.rb +2 -2
  38. data/lib/{uzuuzu → uzuuzu-core}/wrapper/wrapper.rb +1 -1
  39. data/lib/uzuuzu_core.rb +11 -12
  40. data/uzuuzu-core.gemspec +39 -41
  41. metadata +40 -42
  42. data/lib/uzuuzu/controller.rb +0 -25
  43. data/lib/uzuuzu/controller/error.rb +0 -11
  44. data/lib/uzuuzu/controller/logout/index.rb +0 -25
  45. data/lib/uzuuzu/controller/view/error/404.rhtml +0 -6
  46. data/lib/uzuuzu/controller/view/error/500.rhtml +0 -6
  47. data/lib/uzuuzu/helper.rb +0 -23
  48. data/lib/uzuuzu/service.rb +0 -50
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.15
1
+ 0.1.0
@@ -20,9 +20,11 @@ module UzuUzu
20
20
  #
21
21
  attr_accessor :helpers
22
22
  #
23
- attr_accessor :views
23
+ attr_accessor :controller_root
24
24
  #
25
- attr_accessor :servicies
25
+ attr_accessor :helper_root
26
+ #
27
+ attr_accessor :view_root
26
28
 
27
29
  #
28
30
  #
@@ -90,20 +92,28 @@ module UzuUzu
90
92
  @helpers ||= self.class.helpers.clone
91
93
  end
92
94
 
93
- def self.views
94
- @@views ||= ['./view']
95
+ def self.controller_root
96
+ @@controller_root ||= 'controller'
95
97
  end
96
98
 
97
- def views
98
- @views ||= self.class.views.clone
99
+ def controller_root
100
+ @controller_root ||= self.class.controller_root.clone
99
101
  end
100
-
101
- def self.services
102
- @@services ||= []
102
+
103
+ def self.view_root
104
+ @@view_root ||= 'view'
103
105
  end
104
106
 
105
- def services
106
- @services ||= self.class.services.clone
107
+ def view_root
108
+ @view_root ||= self.class.view_root.clone
109
+ end
110
+
111
+ def self.helper_root
112
+ @@helper_root ||= 'helper'
113
+ end
114
+
115
+ def helper_root
116
+ @helper_root ||= self.class.helper_root.clone
107
117
  end
108
118
 
109
119
  #
@@ -113,8 +123,9 @@ module UzuUzu
113
123
  Thread.current[:application] = self
114
124
  request = UzuUzu::Request.new(env)
115
125
  response = UzuUzu::Response.new
116
- clazz = find_controller(env)
117
- if clazz.blank?
126
+ auto_require(env)
127
+ classies = find_controller(env)
128
+ if classies.blank?
118
129
  di_thread(request, response, nil, nil, nil, nil, nil)
119
130
  return not_found(response)
120
131
  end
@@ -122,13 +133,17 @@ module UzuUzu
122
133
  is_send = false
123
134
  action_return = nil
124
135
  render = nil
125
- clazz.reverse.each do |map|
126
- controller_class = map[:clazz]
136
+ classies.reverse.each do |map|
137
+ controller_class = map[:controller]
138
+ helper_module = map[:helper]
127
139
  query = map[:query]
128
140
  route = map[:route]
129
141
  controller = controller_class.new
130
142
  helper = Helper::Helper.new
131
- include_helper(helper)
143
+ helpers.each do |h|
144
+ helper.extend(h)
145
+ end
146
+ helper.extend(helper_module) if helper_module.kind_of?(::Module)
132
147
 
133
148
  action, query = find_action(controller, query)
134
149
  di_thread(request, response, controller, helper, action, query, route)
@@ -151,6 +166,56 @@ module UzuUzu
151
166
  response.finish
152
167
  end # call
153
168
 
169
+ def require_noerror(path)
170
+ begin
171
+ require path
172
+ rescue LoadError => e
173
+ end
174
+ end
175
+ #
176
+ #
177
+ #
178
+ def auto_require(env)
179
+ require_base = "#{@name.to_s}/"
180
+ require_base = '' if @name == :uzuuzu
181
+ array = []
182
+ if env['PATH_INFO'] == '/'
183
+ require_noerror "#{controller_root}/#{require_base}index"
184
+ require_noerror "#{helper_root}/#{require_base}index"
185
+ end
186
+ env['PATH_INFO'].split('/').each do |path|
187
+ array << path
188
+ begin
189
+ if array.size > 1
190
+ require_noerror "#{controller_root}/#{require_base}#{array.join('/')}/index"
191
+ require_noerror "#{helper_root}/#{require_base}#{array.join('/')}/index"
192
+ end
193
+ require_noerror "#{controller_root}/#{require_base}#{array.join('/')}"
194
+ require_noerror "#{helper_root}/#{require_base}#{array.join('/')}"
195
+ rescue
196
+ end
197
+ end
198
+ end # auto_require
199
+
200
+ def get_class_map(name, controller, route, query)
201
+ _c = controller.const_get(name) if controller.const_defined?(name)
202
+ return nil if _c.nil?
203
+ _h = find_helper(name, route)
204
+ map = {
205
+ :controller => _c,
206
+ :helper => _h,
207
+ :route => route,
208
+ :query => query
209
+ }
210
+ end
211
+
212
+ #
213
+ #
214
+ #
215
+ def find_helper(name, route)
216
+
217
+ end # find_helper
218
+
154
219
  #
155
220
  #
156
221
  #
@@ -159,9 +224,22 @@ module UzuUzu
159
224
  request_paths = env['PATH_INFO'].split('/')
160
225
  request_paths.shift if request_paths[0].blank?
161
226
 
162
- controllers.each do |c|
227
+ _controllers = controllers.clone
228
+ _base = "::#{@name.to_s.camel_case}"
229
+ _base = '' if @name == :uzuuzu || @name == 'uzuuzu'
230
+ begin
231
+ _controllers << eval("#{_base}::#{controller_root.camel_case}")
232
+ rescue LoadError => e
233
+ rescue => e
234
+ end
235
+ _controllers.each do |c|
236
+ _c = c
237
+ _h = nil
163
238
  if request_paths.size == 0
164
- add_classies(classies, c, 'Index', env['SCRIPT_NAME'], request_paths)
239
+ map = get_class_map('Index', _c, env['SCRIPT_NAME'], request_paths)
240
+ if map && map[:controller].kind_of?(::Class)
241
+ classies << map
242
+ end
165
243
  end
166
244
  request_paths.each_with_index do |request_path, index|
167
245
  next if request_path.blank?
@@ -173,47 +251,25 @@ module UzuUzu
173
251
  route = "#{env['SCRIPT_NAME']}/#{route}"
174
252
  end
175
253
  query = request_paths[index..-1]
176
- add_classies(classies, c, 'Index', route, query)
254
+ map = get_class_map('Index', _c, route, query)
255
+ if map && map[:controller].kind_of?(::Class)
256
+ classies << map
257
+ end
177
258
  next if c_str == 'Index'
178
259
  route = "#{env['SCRIPT_NAME']}/#{request_paths[0..index].join('/')}"
179
260
  query = request_paths[(index+1)..-1]
180
- _c = add_classies(classies, c, c_str, route, query)
181
- if _c
182
- c = _c
183
- else
261
+ map = get_class_map(c_str, _c, route, query)
262
+ if map && map[:controller].kind_of?(::Class)
263
+ classies << map
264
+ end
265
+ _c = map[:controller] if map
266
+ if _c.kind_of?(::Class) || _c.kind_of?(::Module)
184
267
  break
185
268
  end
186
269
  end
187
270
  end
188
271
  classies
189
272
  end # find_controller
190
-
191
- def add_classies(classies, c, c_str, route, query)
192
- _c = nil
193
- begin
194
- if c.const_defined?(c_str)
195
- _c = c.const_get(c_str)
196
- classies << {:clazz => _c,
197
- :route => route,
198
- :query => query}
199
- elsif c.const_defined?("#{c_str}Controller")
200
- classies << {:clazz => c.const_get("#{c_str}Controller"),
201
- :route => route,
202
- :query => query}
203
- end
204
- rescue NameError => e
205
- end
206
- _c
207
- end
208
-
209
- #
210
- #
211
- #
212
- def include_helper(helper)
213
- helpers.each do |h|
214
- helper.extend(h)
215
- end
216
- end # include_helper
217
273
 
218
274
  #
219
275
  #
@@ -243,6 +299,10 @@ module UzuUzu
243
299
  action = 'index'
244
300
  end
245
301
 
302
+ #p controller
303
+ #p controller.methods.sort
304
+ #p action
305
+ #p query[0]
246
306
  unless action.nil?
247
307
  arity = controller.method(action).arity
248
308
  owner = controller.method(action).owner
@@ -306,7 +366,7 @@ module UzuUzu
306
366
 
307
367
  def not_found(response)
308
368
  catch(:finish) do
309
- response.redirect("/error/404")
369
+ response.not_found
310
370
  end
311
371
  response.finish
312
372
  end
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ include ::UzuUzu::Helper::Controller
6
+ require 'uzuuzu-core/controller/index'
7
+ module Login
8
+ require 'uzuuzu-core/controller/login/openid'
9
+ require 'uzuuzu-core/controller/login/twitter'
10
+ end
11
+
12
+ def self.current
13
+ Thread.current[:controller]
14
+ end
15
+
16
+ def self.before_all
17
+ ::UzuUzu.logger.debug "params : #{::UzuUzu::Request.current.params}"
18
+ end
19
+
20
+ def self.after_all
21
+ end
22
+ end # Controller
23
+ end # UzuUzu
@@ -0,0 +1,18 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Controller
5
+ class Index
6
+ include ::UzuUzu::Controller
7
+
8
+ def error(code)
9
+ response.respond(helper.render_file(__DIR__("view/error/#{code}.rhtml")))
10
+ end
11
+
12
+ def logout
13
+ session.clear
14
+ response.redirect '/'
15
+ end
16
+ end # Index
17
+ end # Controller
18
+ end # UzuUzu
@@ -12,7 +12,7 @@ module UzuUzu
12
12
  #
13
13
  #
14
14
  class Openid
15
- include ::UzuUzuCms::Helper::Controller
15
+ include ::UzuUzu::Controller
16
16
 
17
17
  # need params['domain']
18
18
  def index
@@ -1,11 +1,11 @@
1
1
  # coding: utf-8
2
2
  require 'oauth'
3
3
 
4
- module UzuUzuCms
4
+ module UzuUzu
5
5
  module Controller
6
6
  module Login
7
7
  class Twitter
8
- include ::UzuUzuCms::Helper::Controller
8
+ include ::UzuUzu::Controller
9
9
 
10
10
  def index
11
11
  @config = Environments.current.config['twitter']
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+ <title><%= localize(:not_found) %></title>
6
+ <style type="text/css">
7
+ body {
8
+ background-color: white;
9
+ color: #333333;
10
+ font-family: Arial, sans-serif;
11
+ margin: 0;
12
+ padding: 36px;
13
+ line-height: 18px;
14
+ font-size: 14px;
15
+ }
16
+ .section {
17
+ margin-bottom: 36px;
18
+ color: #222222;
19
+ }
20
+ .section h1 {
21
+ font-size: 26px;
22
+ background-color: #dad8e4;
23
+ padding: 18px 22px 15px 22px;
24
+ margin: 0;
25
+ overflow: hidden;
26
+ }
27
+ .article {
28
+ border: 4px solid #dad8e4;
29
+ padding: 24px 18px 18px 18px;
30
+ font-size: 14px;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body>
35
+ <div class="section">
36
+ <h1><%= localize(:not_found) %></h1>
37
+ </div>
38
+ </body>
39
+ </html>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
+ <title><%= localize(:server_error) %></title>
6
+ <style type="text/css">
7
+ body {
8
+ background-color: white;
9
+ color: #333333;
10
+ font-family: Arial, sans-serif;
11
+ margin: 0;
12
+ padding: 36px;
13
+ line-height: 18px;
14
+ font-size: 14px;
15
+ }
16
+ .section {
17
+ margin-bottom: 36px;
18
+ color: #222222;
19
+ }
20
+ .section h1 {
21
+ font-size: 26px;
22
+ background-color: #dad8e4;
23
+ padding: 18px 22px 15px 22px;
24
+ margin: 0;
25
+ overflow: hidden;
26
+ }
27
+ .article {
28
+ border: 4px solid #dad8e4;
29
+ padding: 24px 18px 18px 18px;
30
+ font-size: 14px;
31
+ }
32
+ </style>
33
+ </head>
34
+ <body>
35
+ <div class="section">
36
+ <h1><%= localize(:server_error) %></h1>
37
+ </div>
38
+ </body>
39
+ </html>
File without changes
File without changes
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+
3
+ module UzuUzu
4
+ module Helper
5
+ require 'uzuuzu-core/helper/controller'
6
+ require 'uzuuzu-core/helper/form'
7
+ require 'uzuuzu-core/helper/jquery'
8
+ require 'uzuuzu-core/helper/localize'
9
+ require 'uzuuzu-core/helper/renderer'
10
+ require 'uzuuzu-core/helper/route'
11
+ require 'uzuuzu-core/helper/xhtml'
12
+
13
+ def self.current
14
+ Thread.current[:helper]
15
+ end
16
+
17
+ #
18
+ #
19
+ #
20
+ class Helper
21
+ end
22
+ end
23
+ end
@@ -82,8 +82,8 @@ module UzuUzu
82
82
  #
83
83
  #
84
84
  #
85
- def service(name)
86
- ::UzuUzu.service(name)
85
+ def service
86
+ ::UzuUzu.service
87
87
  end
88
88
 
89
89
  #
File without changes
File without changes
File without changes
@@ -29,12 +29,10 @@ module UzuUzu
29
29
  view_path = nil
30
30
  catch(:view_finded) do
31
31
  ::Tilt.mappings.each_key do |key|
32
- application.views.each do |view_route|
33
- _view_path = "#{view_route}#{helper.route}/#{view}.#{key}"
34
- if ::File.file?(_view_path)
35
- view_path = _view_path
36
- throw :view_finded
37
- end
32
+ _view_path = "#{application.view_root}#{helper.route}/#{view}.#{key}"
33
+ if ::File.file?(_view_path)
34
+ view_path = _view_path
35
+ throw :view_finded
38
36
  end
39
37
  end
40
38
  end
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -16,7 +16,7 @@ module UzuUzu
16
16
  end
17
17
  env.each do |logger_env|
18
18
  adapter = logger_env["adapter"]
19
- require "uzuuzu/logger/#{adapter}"
19
+ require "uzuuzu-core/logger/#{adapter}"
20
20
  adapter_class = eval("::UzuUzu::Logger::#{adapter.camel_case}")
21
21
  logger = adapter_class.new(logger_env)
22
22
  @loggers << logger
@@ -37,7 +37,6 @@ module UzuUzu
37
37
  # puts standerd error output
38
38
  $stderr.puts 'logger unknown error'
39
39
  $stderr.puts e
40
- $stderr.puts e.backtrace
41
40
  end
42
41
  end
43
42
  end # method_missing
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,4 +1,5 @@
1
1
  # coding: utf-8
2
+ require 'rack/session/abstract/id'
2
3
 
3
4
  module UzuUzu
4
5
  module RackSession
File without changes
File without changes
@@ -127,5 +127,5 @@ module UzuUzu
127
127
  end
128
128
  end # etag
129
129
 
130
- end
131
- end
130
+ end # Response
131
+ end # UzuUzu
File without changes
@@ -63,21 +63,6 @@ module UzuUzu
63
63
  Response.current
64
64
  end
65
65
 
66
- def service
67
- _service = nil
68
- Application.current.services.reverse.each do |service|
69
- begin
70
- _service = service.send(name)
71
- rescue => e
72
- logger.error "service not found : #{service.name}::#{name}"
73
- logger.debug e
74
- logger.debug e.backtrace
75
- end
76
- break if _service
77
- end
78
- _service
79
- end
80
-
81
66
  #
82
67
  def render_engine(instance, view_string, engine='erb', options={}, locals={}, &block)
83
68
  Tilt.render_engine(instance, view_string, engine, options, locals, &block)
@@ -14,11 +14,11 @@ module UzuUzu
14
14
  def initialize(env=nil)
15
15
  begin
16
16
  if env.nil? || env.kind_of?(Array) || env['adapter'].nil?
17
- require 'uzuuzu/logger/loggers'
17
+ require 'uzuuzu-core/logger/loggers'
18
18
  @logger = ::UzuUzu::Logger::Loggers.new(env)
19
19
  else
20
20
  adapter = env['adapter']
21
- require "uzuuzu/logger/#{adapter}"
21
+ require "uzuuzu-core/logger/#{adapter}"
22
22
  adapter_class = eval("::UzuUzu::Logger::#{adapter.camel_case}")
23
23
  @logger = adapter_class.new(env)
24
24
  end
@@ -17,7 +17,7 @@ module UzuUzu
17
17
  end
18
18
  begin
19
19
  adapter = env['adapter']
20
- require "uzuuzu/#{wrapper}/#{adapter}"
20
+ require "uzuuzu-core/#{wrapper}/#{adapter}"
21
21
  adapter_class = eval("::UzuUzu::#{wrapper.camel_case}::#{adapter.camel_case}")
22
22
  @wrapper = adapter_class.new(env)
23
23
  rescue => e
data/lib/uzuuzu_core.rb CHANGED
@@ -6,15 +6,14 @@ require 'rack'
6
6
  require 'rack/builder'
7
7
  require 'tilt'
8
8
 
9
- require 'uzuuzu/ext/object'
10
- require 'uzuuzu/wrapper/uzuuzu'
11
- require 'uzuuzu/wrapper/logger'
12
- require 'uzuuzu/wrapper/wrapper'
13
- require 'uzuuzu/application'
14
- require 'uzuuzu/environments'
15
- require 'uzuuzu/helper'
16
- require 'uzuuzu/request'
17
- require 'uzuuzu/response'
18
- require 'uzuuzu/controller'
19
- require 'uzuuzu/service'
20
- require 'uzuuzu/tilt'
9
+ require 'uzuuzu-core/ext/object'
10
+ require 'uzuuzu-core/uzuuzu-core'
11
+ require 'uzuuzu-core/wrapper/logger'
12
+ require 'uzuuzu-core/wrapper/wrapper'
13
+ require 'uzuuzu-core/application'
14
+ require 'uzuuzu-core/environments'
15
+ require 'uzuuzu-core/helper'
16
+ require 'uzuuzu-core/request'
17
+ require 'uzuuzu-core/response'
18
+ require 'uzuuzu-core/controller'
19
+ require 'uzuuzu-core/tilt'
data/uzuuzu-core.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{uzuuzu-core}
8
- s.version = "0.0.15"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Takuya Kondo"]
12
- s.date = %q{2011-12-14}
12
+ s.date = %q{2011-12-18}
13
13
  s.description = %q{uzuuzu core library}
14
14
  s.email = %q{takuya.v3v@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -26,45 +26,43 @@ Gem::Specification.new do |s|
26
26
  "README.rdoc",
27
27
  "Rakefile",
28
28
  "VERSION",
29
- "lib/uzuuzu/application.rb",
30
- "lib/uzuuzu/controller.rb",
31
- "lib/uzuuzu/controller/error.rb",
32
- "lib/uzuuzu/controller/login/openid.rb",
33
- "lib/uzuuzu/controller/login/twitter.rb",
34
- "lib/uzuuzu/controller/logout/index.rb",
35
- "lib/uzuuzu/controller/view/error/404.rhtml",
36
- "lib/uzuuzu/controller/view/error/500.rhtml",
37
- "lib/uzuuzu/environments.rb",
38
- "lib/uzuuzu/ext/object.rb",
39
- "lib/uzuuzu/helper.rb",
40
- "lib/uzuuzu/helper/controller.rb",
41
- "lib/uzuuzu/helper/form.rb",
42
- "lib/uzuuzu/helper/jquery.rb",
43
- "lib/uzuuzu/helper/localize.rb",
44
- "lib/uzuuzu/helper/renderer.rb",
45
- "lib/uzuuzu/helper/route.rb",
46
- "lib/uzuuzu/helper/xhtml.rb",
47
- "lib/uzuuzu/lang/en.yaml",
48
- "lib/uzuuzu/lang/ja.yaml",
49
- "lib/uzuuzu/logger/appengine.rb",
50
- "lib/uzuuzu/logger/file.rb",
51
- "lib/uzuuzu/logger/loggers.rb",
52
- "lib/uzuuzu/logger/stderr.rb",
53
- "lib/uzuuzu/logger/stdout.rb",
54
- "lib/uzuuzu/memcache/appengine.rb",
55
- "lib/uzuuzu/memcache/dalli.rb",
56
- "lib/uzuuzu/memcache/leveldb.rb",
57
- "lib/uzuuzu/memcache/memcached.rb",
58
- "lib/uzuuzu/rack_session/appengine.rb",
59
- "lib/uzuuzu/rack_session/cookie.rb",
60
- "lib/uzuuzu/rack_session/memcache.rb",
61
- "lib/uzuuzu/request.rb",
62
- "lib/uzuuzu/response.rb",
63
- "lib/uzuuzu/service.rb",
64
- "lib/uzuuzu/tilt.rb",
65
- "lib/uzuuzu/wrapper/logger.rb",
66
- "lib/uzuuzu/wrapper/uzuuzu.rb",
67
- "lib/uzuuzu/wrapper/wrapper.rb",
29
+ "lib/uzuuzu-core/application.rb",
30
+ "lib/uzuuzu-core/controller.rb",
31
+ "lib/uzuuzu-core/controller/index.rb",
32
+ "lib/uzuuzu-core/controller/login/openid.rb",
33
+ "lib/uzuuzu-core/controller/login/twitter.rb",
34
+ "lib/uzuuzu-core/controller/view/error/404.rhtml",
35
+ "lib/uzuuzu-core/controller/view/error/500.rhtml",
36
+ "lib/uzuuzu-core/environments.rb",
37
+ "lib/uzuuzu-core/ext/object.rb",
38
+ "lib/uzuuzu-core/helper.rb",
39
+ "lib/uzuuzu-core/helper/controller.rb",
40
+ "lib/uzuuzu-core/helper/form.rb",
41
+ "lib/uzuuzu-core/helper/jquery.rb",
42
+ "lib/uzuuzu-core/helper/localize.rb",
43
+ "lib/uzuuzu-core/helper/renderer.rb",
44
+ "lib/uzuuzu-core/helper/route.rb",
45
+ "lib/uzuuzu-core/helper/xhtml.rb",
46
+ "lib/uzuuzu-core/lang/en.yaml",
47
+ "lib/uzuuzu-core/lang/ja.yaml",
48
+ "lib/uzuuzu-core/logger/appengine.rb",
49
+ "lib/uzuuzu-core/logger/file.rb",
50
+ "lib/uzuuzu-core/logger/loggers.rb",
51
+ "lib/uzuuzu-core/logger/stderr.rb",
52
+ "lib/uzuuzu-core/logger/stdout.rb",
53
+ "lib/uzuuzu-core/memcache/appengine.rb",
54
+ "lib/uzuuzu-core/memcache/dalli.rb",
55
+ "lib/uzuuzu-core/memcache/leveldb.rb",
56
+ "lib/uzuuzu-core/memcache/memcached.rb",
57
+ "lib/uzuuzu-core/rack_session/appengine.rb",
58
+ "lib/uzuuzu-core/rack_session/cookie.rb",
59
+ "lib/uzuuzu-core/rack_session/memcache.rb",
60
+ "lib/uzuuzu-core/request.rb",
61
+ "lib/uzuuzu-core/response.rb",
62
+ "lib/uzuuzu-core/tilt.rb",
63
+ "lib/uzuuzu-core/uzuuzu-core.rb",
64
+ "lib/uzuuzu-core/wrapper/logger.rb",
65
+ "lib/uzuuzu-core/wrapper/wrapper.rb",
68
66
  "lib/uzuuzu_core.rb",
69
67
  "spec/spec_helper.rb",
70
68
  "spec/uzuuzu-core_spec.rb",
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: uzuuzu-core
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.15
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Takuya Kondo
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-12-14 00:00:00 +09:00
13
+ date: 2011-12-18 00:00:00 +09:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
@@ -131,45 +131,43 @@ files:
131
131
  - README.rdoc
132
132
  - Rakefile
133
133
  - VERSION
134
- - lib/uzuuzu/application.rb
135
- - lib/uzuuzu/controller.rb
136
- - lib/uzuuzu/controller/error.rb
137
- - lib/uzuuzu/controller/login/openid.rb
138
- - lib/uzuuzu/controller/login/twitter.rb
139
- - lib/uzuuzu/controller/logout/index.rb
140
- - lib/uzuuzu/controller/view/error/404.rhtml
141
- - lib/uzuuzu/controller/view/error/500.rhtml
142
- - lib/uzuuzu/environments.rb
143
- - lib/uzuuzu/ext/object.rb
144
- - lib/uzuuzu/helper.rb
145
- - lib/uzuuzu/helper/controller.rb
146
- - lib/uzuuzu/helper/form.rb
147
- - lib/uzuuzu/helper/jquery.rb
148
- - lib/uzuuzu/helper/localize.rb
149
- - lib/uzuuzu/helper/renderer.rb
150
- - lib/uzuuzu/helper/route.rb
151
- - lib/uzuuzu/helper/xhtml.rb
152
- - lib/uzuuzu/lang/en.yaml
153
- - lib/uzuuzu/lang/ja.yaml
154
- - lib/uzuuzu/logger/appengine.rb
155
- - lib/uzuuzu/logger/file.rb
156
- - lib/uzuuzu/logger/loggers.rb
157
- - lib/uzuuzu/logger/stderr.rb
158
- - lib/uzuuzu/logger/stdout.rb
159
- - lib/uzuuzu/memcache/appengine.rb
160
- - lib/uzuuzu/memcache/dalli.rb
161
- - lib/uzuuzu/memcache/leveldb.rb
162
- - lib/uzuuzu/memcache/memcached.rb
163
- - lib/uzuuzu/rack_session/appengine.rb
164
- - lib/uzuuzu/rack_session/cookie.rb
165
- - lib/uzuuzu/rack_session/memcache.rb
166
- - lib/uzuuzu/request.rb
167
- - lib/uzuuzu/response.rb
168
- - lib/uzuuzu/service.rb
169
- - lib/uzuuzu/tilt.rb
170
- - lib/uzuuzu/wrapper/logger.rb
171
- - lib/uzuuzu/wrapper/uzuuzu.rb
172
- - lib/uzuuzu/wrapper/wrapper.rb
134
+ - lib/uzuuzu-core/application.rb
135
+ - lib/uzuuzu-core/controller.rb
136
+ - lib/uzuuzu-core/controller/index.rb
137
+ - lib/uzuuzu-core/controller/login/openid.rb
138
+ - lib/uzuuzu-core/controller/login/twitter.rb
139
+ - lib/uzuuzu-core/controller/view/error/404.rhtml
140
+ - lib/uzuuzu-core/controller/view/error/500.rhtml
141
+ - lib/uzuuzu-core/environments.rb
142
+ - lib/uzuuzu-core/ext/object.rb
143
+ - lib/uzuuzu-core/helper.rb
144
+ - lib/uzuuzu-core/helper/controller.rb
145
+ - lib/uzuuzu-core/helper/form.rb
146
+ - lib/uzuuzu-core/helper/jquery.rb
147
+ - lib/uzuuzu-core/helper/localize.rb
148
+ - lib/uzuuzu-core/helper/renderer.rb
149
+ - lib/uzuuzu-core/helper/route.rb
150
+ - lib/uzuuzu-core/helper/xhtml.rb
151
+ - lib/uzuuzu-core/lang/en.yaml
152
+ - lib/uzuuzu-core/lang/ja.yaml
153
+ - lib/uzuuzu-core/logger/appengine.rb
154
+ - lib/uzuuzu-core/logger/file.rb
155
+ - lib/uzuuzu-core/logger/loggers.rb
156
+ - lib/uzuuzu-core/logger/stderr.rb
157
+ - lib/uzuuzu-core/logger/stdout.rb
158
+ - lib/uzuuzu-core/memcache/appengine.rb
159
+ - lib/uzuuzu-core/memcache/dalli.rb
160
+ - lib/uzuuzu-core/memcache/leveldb.rb
161
+ - lib/uzuuzu-core/memcache/memcached.rb
162
+ - lib/uzuuzu-core/rack_session/appengine.rb
163
+ - lib/uzuuzu-core/rack_session/cookie.rb
164
+ - lib/uzuuzu-core/rack_session/memcache.rb
165
+ - lib/uzuuzu-core/request.rb
166
+ - lib/uzuuzu-core/response.rb
167
+ - lib/uzuuzu-core/tilt.rb
168
+ - lib/uzuuzu-core/uzuuzu-core.rb
169
+ - lib/uzuuzu-core/wrapper/logger.rb
170
+ - lib/uzuuzu-core/wrapper/wrapper.rb
173
171
  - lib/uzuuzu_core.rb
174
172
  - spec/spec_helper.rb
175
173
  - spec/uzuuzu-core_spec.rb
@@ -188,7 +186,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
188
186
  requirements:
189
187
  - - ">="
190
188
  - !ruby/object:Gem::Version
191
- hash: -784320366249850912
189
+ hash: 2970858063230439040
192
190
  segments:
193
191
  - 0
194
192
  version: "0"
@@ -1,25 +0,0 @@
1
- # coding: utf-8
2
-
3
- module UzuUzu
4
- module Controller
5
- autoload(:Error, 'uzuuzu/controller/error')
6
- module Login
7
- autoload(:Openid, 'uzuuzu/controller/login/openid')
8
- autoload(:Twitter, 'uzuuzu/controller/login/twitter')
9
- end
10
- module Logout
11
- autoload(:Index, 'uzuuzu/controller/logout')
12
- end
13
-
14
- def self.current
15
- Thread.current[:controller]
16
- end
17
-
18
- def self.before_all
19
- ::UzuUzu.logger.debug ::UzuUzu::Request.current.params
20
- end
21
-
22
- def self.after_all
23
- end
24
- end # Controller
25
- end # UzuUzu
@@ -1,11 +0,0 @@
1
- # coding: utf-8
2
-
3
- module UzuUzu
4
- module Controller
5
- class Error
6
- def index(code)
7
- response.respond(helper.render_file(__DIR__("view/error/#{code}.rhtml")))
8
- end
9
- end
10
- end
11
- end # UzuUzuCms
@@ -1,25 +0,0 @@
1
- # coding: utf-8
2
-
3
- module UzuUzuCms
4
- module Controller
5
- module Logout
6
- class Index
7
- include ::UzuUzuCms::Helper::Controller
8
-
9
- def index
10
- session.delete(:openid_identity)
11
- session.delete(:openid_sreg)
12
- session.delete(:openid_domain)
13
- session.delete(:openid_entry)
14
- session.delete(:twitter_user_id)
15
- session.delete(:twitter_access_token)
16
- session.delete(:twitter_access_token_secret)
17
- session.delete(:login_user_id)
18
- session.delete(:login_name)
19
- session.delete(:login_domain)
20
- session.clear
21
- end
22
- end # Index
23
- end # Logout
24
- end # Controller
25
- end # UzuUzuCms
@@ -1,6 +0,0 @@
1
-
2
- <html>
3
- <body>
4
- <%= localize(:not_found) %>
5
- </body>
6
- </html>
@@ -1,6 +0,0 @@
1
-
2
- <html>
3
- <body>
4
- <%= localize(:server_error) %>
5
- </body>
6
- </html>
data/lib/uzuuzu/helper.rb DELETED
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
-
3
- module UzuUzu
4
- module Helper
5
- autoload(:Controller, 'uzuuzu/helper/controller')
6
- autoload(:Form, 'uzuuzu/helper/form')
7
- autoload(:Jquery, 'uzuuzu/helper/jquery')
8
- autoload(:Localize, 'uzuuzu/helper/localize')
9
- autoload(:Renderer, 'uzuuzu/helper/renderer')
10
- autoload(:Route, 'uzuuzu/helper/route')
11
- autoload(:XHtml, 'uzuuzu/helper/xhtml')
12
-
13
- def self.current
14
- Thread.current[:helper]
15
- end
16
-
17
- #
18
- #
19
- #
20
- class Helper
21
- end
22
- end
23
- end
@@ -1,50 +0,0 @@
1
- # coding: utf-8
2
-
3
- module UzuUzu
4
- module Service
5
- AppsLoaded = {}
6
- #
7
- #
8
- #
9
- def const_missing(id)
10
- AppsLoaded[::UzuUzu.current.name] ||= {}
11
- service = AppsLoaded[::UzuUzu.current.name][id.to_sym]
12
- unless service
13
- require_base = self.name.gsub(/::/, '/').sub(/^UzuUzu/, 'uzuuzu').snake_case
14
- service_name = ::Environments.current.service_name || ''
15
- service_name = "#{service_name}/" unless service_name.blank?
16
- require "#{require_base}/#{service_name}#{id.to_s.snake_case}"
17
- service = const_get("#{service_name.camel_case}").const_get("#{id}")
18
- service.apploaded if service.respond_to?(:apsploaded)
19
- AppsLoaded[::UzuUzu.current.name][id.to_sym] = service
20
- end
21
- if service
22
- service
23
- else
24
- super(id)
25
- end
26
- rescue => e
27
- ::UzuUzu.logger.debug e
28
- ::UzuUzu.logger.debug e.backtrace
29
- super(id)
30
- end
31
-
32
- #
33
- #
34
- #
35
- def method_missing(id)
36
- service = const_missing(id.to_s.camel_case)
37
- if service
38
- service.new
39
- else
40
- super(id)
41
- end
42
- rescue => e
43
- ::UzuUzu.logger.debug e
44
- ::UzuUzu.logger.debug e.backtrace
45
- super(id)
46
- end
47
-
48
- extend self
49
- end # Service
50
- end # UzuUzu