ramaze 2008.06 → 2008.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. data/README.markdown +6 -6
  2. data/Rakefile +33 -3
  3. data/bin/ramaze +18 -0
  4. data/doc/CHANGELOG +960 -0
  5. data/doc/LEGAL +5 -1
  6. data/doc/meta/announcement.txt +20 -36
  7. data/doc/tutorial/todolist.html +421 -313
  8. data/doc/tutorial/todolist.mkd +33 -16
  9. data/examples/app/blog/spec/blog.rb +3 -3
  10. data/examples/app/rapaste/controller/paste.rb +8 -1
  11. data/examples/app/rapaste/model/paste.rb +3 -0
  12. data/examples/app/rapaste/spec/rapaste.rb +3 -1
  13. data/examples/app/rapaste/start.rb +3 -2
  14. data/examples/app/sourceview/public/sourceview.js +2 -2
  15. data/examples/app/todolist/spec/todolist.rb +6 -6
  16. data/examples/app/todolist/template/index.xhtml +1 -1
  17. data/examples/app/whywiki/spec/whywiki.rb +2 -2
  18. data/examples/app/wikore/spec/wikore.rb +2 -2
  19. data/examples/app/wikore/src/model.rb +4 -3
  20. data/examples/app/wiktacular/spec/wiktacular.rb +7 -7
  21. data/examples/basic/simple.rb +2 -2
  22. data/examples/helpers/paginate.rb +71 -0
  23. data/examples/misc/simple_auth.rb +20 -8
  24. data/lib/proto/controller/init.rb +10 -0
  25. data/lib/proto/controller/main.rb +1 -3
  26. data/lib/proto/model/init.rb +4 -0
  27. data/lib/proto/public/dispatch.fcgi +1 -1
  28. data/lib/proto/spec/main.rb +2 -1
  29. data/lib/proto/start.rb +3 -3
  30. data/lib/proto/start.ru +1 -1
  31. data/lib/proto/view/error.xhtml +4 -4
  32. data/lib/ramaze.rb +8 -3
  33. data/lib/ramaze/action.rb +6 -6
  34. data/lib/ramaze/adapter.rb +1 -6
  35. data/lib/ramaze/adapter/base.rb +30 -27
  36. data/lib/ramaze/adapter/cgi.rb +1 -0
  37. data/lib/ramaze/cache.rb +1 -3
  38. data/lib/ramaze/cache/memcached.rb +3 -5
  39. data/lib/ramaze/contrib/auto_params.rb +2 -2
  40. data/lib/ramaze/contrib/auto_params/get_args.rb +2 -1
  41. data/lib/ramaze/contrib/gems.rb +17 -18
  42. data/lib/ramaze/contrib/gzip_filter.rb +22 -9
  43. data/lib/ramaze/contrib/maruku_uv.rb +59 -0
  44. data/lib/ramaze/contrib/profiling.rb +1 -1
  45. data/lib/ramaze/contrib/rest.rb +16 -13
  46. data/lib/ramaze/contrib/sequel/create_join.rb +25 -0
  47. data/lib/ramaze/contrib/sequel/form_field.rb +129 -0
  48. data/lib/ramaze/contrib/sequel/image.rb +198 -0
  49. data/lib/ramaze/contrib/sequel/relation.rb +82 -0
  50. data/lib/ramaze/controller.rb +33 -34
  51. data/lib/ramaze/controller/resolve.rb +29 -9
  52. data/lib/ramaze/current.rb +60 -20
  53. data/lib/ramaze/current/request.rb +8 -7
  54. data/lib/ramaze/current/response.rb +15 -3
  55. data/lib/ramaze/current/session/flash.rb +8 -0
  56. data/lib/ramaze/dispatcher.rb +17 -9
  57. data/lib/ramaze/dispatcher/action.rb +4 -5
  58. data/lib/ramaze/dispatcher/directory.rb +1 -1
  59. data/lib/ramaze/dispatcher/error.rb +4 -4
  60. data/lib/ramaze/dispatcher/file.rb +4 -4
  61. data/lib/ramaze/gestalt.rb +15 -20
  62. data/lib/ramaze/helper/cgi.rb +7 -15
  63. data/lib/ramaze/helper/formatting.rb +41 -1
  64. data/lib/ramaze/helper/httpdigest.rb +20 -7
  65. data/lib/ramaze/helper/link.rb +4 -6
  66. data/lib/ramaze/helper/paginate.rb +233 -0
  67. data/lib/ramaze/helper/redirect.rb +1 -1
  68. data/lib/ramaze/helper/rest.rb +1 -1
  69. data/lib/ramaze/helper/thread.rb +17 -0
  70. data/lib/ramaze/helper/ultraviolet.rb +44 -0
  71. data/lib/ramaze/helper/user.rb +4 -9
  72. data/lib/ramaze/log.rb +2 -2
  73. data/lib/ramaze/log/analogger.rb +21 -23
  74. data/lib/ramaze/log/growl.rb +21 -23
  75. data/lib/ramaze/log/hub.rb +1 -1
  76. data/lib/ramaze/log/informer.rb +97 -99
  77. data/lib/ramaze/log/knotify.rb +14 -16
  78. data/lib/ramaze/log/logger.rb +11 -13
  79. data/lib/ramaze/log/logging.rb +61 -63
  80. data/lib/ramaze/log/rotatinginformer.rb +168 -0
  81. data/lib/ramaze/log/syslog.rb +41 -31
  82. data/lib/ramaze/log/xosd.rb +70 -72
  83. data/lib/ramaze/option.rb +9 -6
  84. data/lib/ramaze/option/holder.rb +5 -27
  85. data/lib/ramaze/reloader.rb +186 -0
  86. data/lib/ramaze/setup.rb +1 -1
  87. data/lib/ramaze/snippets.rb +13 -0
  88. data/lib/ramaze/snippets/array/put_within.rb +31 -24
  89. data/lib/ramaze/snippets/binding/locals.rb +23 -11
  90. data/lib/ramaze/snippets/dictionary.rb +2 -2
  91. data/lib/ramaze/snippets/fiber.rb +63 -0
  92. data/lib/ramaze/snippets/kernel/constant.rb +36 -21
  93. data/lib/ramaze/snippets/kernel/pretty_inspect.rb +12 -6
  94. data/lib/ramaze/snippets/numeric/filesize_format.rb +24 -17
  95. data/lib/ramaze/snippets/numeric/time.rb +63 -0
  96. data/lib/ramaze/snippets/object/__dir__.rb +29 -0
  97. data/lib/ramaze/snippets/object/acquire.rb +40 -0
  98. data/lib/ramaze/snippets/object/instance_variable_defined.rb +16 -5
  99. data/lib/ramaze/snippets/object/pretty.rb +14 -4
  100. data/lib/ramaze/snippets/object/scope.rb +14 -7
  101. data/lib/ramaze/snippets/ordered_set.rb +25 -14
  102. data/lib/ramaze/snippets/proc/locals.rb +17 -9
  103. data/lib/ramaze/snippets/ramaze/deprecated.rb +13 -0
  104. data/lib/ramaze/snippets/ramaze/fiber.rb +24 -0
  105. data/lib/ramaze/snippets/ramaze/state.rb +86 -0
  106. data/lib/ramaze/snippets/ramaze/struct.rb +45 -0
  107. data/lib/ramaze/snippets/string/camel_case.rb +13 -8
  108. data/lib/ramaze/snippets/string/color.rb +24 -20
  109. data/lib/ramaze/snippets/string/each.rb +14 -3
  110. data/lib/ramaze/snippets/string/end_with.rb +20 -0
  111. data/lib/ramaze/snippets/string/esc.rb +26 -21
  112. data/lib/ramaze/snippets/string/ord.rb +12 -6
  113. data/lib/ramaze/snippets/string/snake_case.rb +13 -7
  114. data/lib/ramaze/snippets/string/start_with.rb +16 -5
  115. data/lib/ramaze/snippets/string/unindent.rb +23 -15
  116. data/lib/ramaze/snippets/thread/into.rb +3 -3
  117. data/lib/ramaze/spec/helper/bacon.rb +5 -5
  118. data/lib/ramaze/spec/helper/mock_http.rb +1 -1
  119. data/lib/ramaze/spec/helper/pretty_output.rb +2 -2
  120. data/lib/ramaze/spec/helper/snippets.rb +8 -0
  121. data/lib/ramaze/template.rb +4 -1
  122. data/lib/ramaze/template/ezamar/textpow.syntax +34 -0
  123. data/lib/ramaze/template/maruku.rb +34 -0
  124. data/lib/ramaze/template/tagz.rb +2 -2
  125. data/lib/ramaze/template/xslt.rb +2 -2
  126. data/lib/ramaze/tool/create.rb +27 -53
  127. data/lib/ramaze/tool/localize.rb +8 -4
  128. data/lib/ramaze/tool/mime.rb +11 -1
  129. data/lib/ramaze/tool/project_creator.rb +110 -0
  130. data/lib/ramaze/trinity.rb +4 -1
  131. data/lib/ramaze/version.rb +1 -1
  132. data/lib/vendor/bacon.rb +323 -0
  133. data/rake_tasks/gem.rake +10 -1
  134. data/rake_tasks/maintenance.rake +40 -2
  135. data/rake_tasks/metric.rake +24 -0
  136. data/rake_tasks/release.rake +17 -4
  137. data/rake_tasks/spec.rake +1 -2
  138. data/ramaze.gemspec +549 -495
  139. data/spec/contrib/auto_params.rb +3 -3
  140. data/spec/contrib/profiling.rb +2 -2
  141. data/spec/examples/simple_auth.rb +2 -2
  142. data/spec/examples/templates/template_haml.rb +0 -2
  143. data/spec/ramaze/action/file_cache.rb +22 -0
  144. data/spec/ramaze/adapter.rb +2 -2
  145. data/spec/ramaze/controller/actionless_templates.rb +1 -1
  146. data/spec/ramaze/controller/subclass.rb +15 -0
  147. data/spec/ramaze/controller/template_resolving.rb +1 -1
  148. data/spec/ramaze/controller/view/bar.xhtml +1 -0
  149. data/spec/ramaze/controller/view/base/another.xhtml +1 -0
  150. data/spec/ramaze/current/session.rb +1 -1
  151. data/spec/ramaze/dispatcher/file.rb +2 -2
  152. data/spec/ramaze/helper/aspect.rb +26 -17
  153. data/spec/ramaze/helper/formatting.rb +13 -0
  154. data/spec/ramaze/log/informer.rb +10 -10
  155. data/spec/ramaze/log/syslog.rb +67 -4
  156. data/spec/ramaze/rewrite.rb +1 -1
  157. data/spec/ramaze/route.rb +1 -1
  158. data/spec/ramaze/struct.rb +47 -0
  159. data/spec/ramaze/template/markaby.rb +1 -1
  160. data/spec/ramaze/template/tagz.rb +1 -1
  161. data/spec/snippets/binding/locals.rb +9 -0
  162. data/spec/snippets/numeric/time.rb +12 -0
  163. data/spec/snippets/{kernel → object}/__dir__.rb +0 -0
  164. data/spec/snippets/{kernel → object}/acquire.rb +0 -0
  165. metadata +90 -81
  166. data/cache.yaml +0 -7
  167. data/examples/app/rammit/spec/rammit.rb +0 -31
  168. data/examples/app/rammit/src/controller/main.rb +0 -3
  169. data/examples/app/rammit/src/controller/page.rb +0 -16
  170. data/examples/app/rammit/src/model.rb +0 -33
  171. data/examples/app/rammit/start.rb +0 -8
  172. data/examples/app/rammit/template/index.xhtml +0 -14
  173. data/examples/app/rammit/template/page/view.xhtml +0 -4
  174. data/lib/ramaze/snippets/kernel/__dir__.rb +0 -23
  175. data/lib/ramaze/snippets/kernel/acquire.rb +0 -34
  176. data/lib/ramaze/snippets/object/thread_accessor.rb +0 -5
  177. data/lib/ramaze/snippets/ramaze/thread_accessor.rb +0 -58
  178. data/lib/ramaze/snippets/struct/fill.rb +0 -23
  179. data/lib/ramaze/snippets/struct/values_at.rb +0 -39
  180. data/lib/ramaze/snippets/symbol/to_proc.rb +0 -24
  181. data/lib/ramaze/sourcereload.rb +0 -176
  182. data/spec/snippets/struct/fill.rb +0 -26
  183. data/spec/snippets/struct/values_at.rb +0 -52
  184. data/spec/snippets/symbol/to_proc.rb +0 -13
@@ -0,0 +1,233 @@
1
+ require 'ramaze/gestalt'
2
+
3
+ module Ramaze
4
+ module Helper
5
+
6
+ # Helper for pagination and pagination-navigation.
7
+ #
8
+ # See detailed API docs for Paginator below.
9
+ # Also have a look at the examples/helpers/paginate.rb
10
+
11
+ module Paginate
12
+
13
+ # Define default options in your Controller, they are being retrieved by
14
+ # ancestral_trait, so you can also put it into a common superclass
15
+
16
+ trait :paginate => {
17
+ :limit => 10,
18
+ :var => 'pager',
19
+ }
20
+
21
+ # Returns a new Paginator instance.
22
+ #
23
+ # Note that the pagination relies on being inside a Ramaze request to
24
+ # gain necessary metadata about the page it resides on, you cannot use it
25
+ # outside of Ramaze yet.
26
+ #
27
+ # The examples below are meant to be used within your controller or view.
28
+ #
29
+ # Usage with Array:
30
+ # data = (1..100).to_a
31
+ # @pager = paginate(data, :limit => 30, :page => 2)
32
+ # @pager.navigation
33
+ # @pager.each{|e| puts(e) }
34
+ #
35
+ # Usage with Sequel:
36
+ # data = Article.filter(:public => true)
37
+ # @pager = paginate(data, :limit => 5)
38
+ # @pager.navigation
39
+ # @pager.each{|e| puts(e)
40
+ #
41
+ # +dataset+ may be a Sequel dataset or Array
42
+ # +options+ Takes precedence to trait[:paginate] and may contain
43
+ # following pairs:
44
+ # :limit The number of elements used when you call #each on the
45
+ # paginator
46
+ # :var The variable name being used in the request, this is helpful
47
+ # if you want to use two or more independent paginations on the
48
+ # same page.
49
+ # :page The page you are currently on, if not given it will be
50
+ # retrieved from current request variables. Defaults to 1 if
51
+ # neither exists.
52
+
53
+ def paginate(dataset, options = {})
54
+ options = ancestral_trait[:paginate].merge(options)
55
+ limit = options[:limit]
56
+ var = options[:var]
57
+ page = options[:page] || (request[var] || 1).to_i
58
+
59
+ Paginator.new(dataset, page, limit, var)
60
+ end
61
+
62
+ # Provides easy pagination and navigation
63
+
64
+ class Paginator
65
+ include Ramaze::Helper::Link
66
+ include Ramaze::Helper::CGI
67
+
68
+ def initialize(data = [], page = 1, limit = 10, var = 'pager')
69
+ @data, @page, @limit, @var = data, page, limit, var
70
+ @pager = pager_for(data)
71
+ @page = @page > page_count ? page_count : @page
72
+ @pager = pager_for(data)
73
+ end
74
+
75
+ # Returns String with navigation div.
76
+ #
77
+ # This cannot be customized very nicely, but you can style it easily
78
+ # with CSS.
79
+ #
80
+ # Output with 5 elements, page 1, limit 3:
81
+ # <div class="pager">
82
+ # <span class="first grey">&lt;&lt;</span>
83
+ # <span class="previous grey">&lt;</span>
84
+ # <a class="current" href="/index?pager=1">1</a>
85
+ # <a href="/index?pager=2">2</a>
86
+ # <a class="next" href="/index?pager=2">&gt;</a>
87
+ # <a class="last" href="/index?pager=2">&gt;&gt;</a>
88
+ # </div>
89
+ #
90
+ # Output with 5 elements, page 2, limit 3:
91
+ # <div class="pager" />
92
+ # <a class="first" href="/index?user_page=1">&lt;&lt;</a>
93
+ # <a class="previous" href="/index?user_page=1">&lt;</a>
94
+ # <a href="/index?user_page=1">1</a>
95
+ # <a class="current" href="/index?user_page=2">2</a>
96
+ # <span class="next grey">&gt;</span>
97
+ # <span class="last grey">&gt;&gt;</span>
98
+ # </div>
99
+
100
+
101
+ def navigation(limit = 8)
102
+ out = [ g.div(:class => :pager) ]
103
+
104
+ if first_page?
105
+ out << g.span(:class => 'first grey'){ h('<<') }
106
+ out << g.span(:class => 'previous grey'){ h('<') }
107
+ else
108
+ out << link(1, '<<', :class => :first)
109
+ out << link(prev_page, '<', :class => :previous)
110
+ end
111
+
112
+ lower = limit ? (current_page - limit) : 1
113
+ lower = lower < 1 ? 1 : lower
114
+
115
+ (lower...current_page).each do |n|
116
+ out << link(n)
117
+ end
118
+
119
+ out << link(current_page, current_page, :class => :current)
120
+
121
+ if last_page?
122
+ out << g.span(:class => 'next grey'){ h('>') }
123
+ out << g.span(:class => 'last grey'){ h('>>') }
124
+ elsif next_page
125
+ higher = limit ? (next_page + limit) : page_count
126
+ higher = [higher, page_count].min
127
+ (next_page..higher).each do |n|
128
+ out << link(n)
129
+ end
130
+
131
+ out << link(next_page, '>', :class => :next)
132
+ out << link(page_count, '>>', :class => :last)
133
+ end
134
+
135
+ out << '</div>'
136
+ out.map{|e| e.to_s}.join("\n")
137
+ end
138
+
139
+ # Useful to omit pager if it's of no use.
140
+
141
+ def needed?
142
+ @pager.page_count > 1
143
+ end
144
+
145
+ # Forward everything to the inner @pager
146
+
147
+ def method_missing(meth, *args, &block)
148
+ @pager.send(meth, *args, &block)
149
+ end
150
+
151
+ private
152
+
153
+ def pager_for(obj)
154
+ @page = @page < 1 ? 1 : @page
155
+
156
+ case obj
157
+ when Array
158
+ ArrayPager.new(obj, @page, @limit)
159
+ else
160
+ obj.paginate(@page, @limit)
161
+ end
162
+ end
163
+
164
+ def link(n, text = n, hash = {})
165
+ text = h(text.to_s)
166
+
167
+ params = Ramaze::Request.current.params.merge(@var.to_s => n)
168
+ name = Ramaze::Request.current.request_path
169
+ hash[:href] = R(name, params)
170
+
171
+ g.a(hash){ text }
172
+ end
173
+
174
+ def g
175
+ Ramaze::Gestalt.new
176
+ end
177
+
178
+ # Wrapper for Array to behave like the Sequel pagination
179
+
180
+ class ArrayPager
181
+ def initialize(array, page, limit)
182
+ @array, @page, @limit = array, page, limit
183
+ @page = page_count if @page > page_count
184
+ end
185
+
186
+ def size
187
+ @array.size
188
+ end
189
+
190
+ def empty?
191
+ @array.empty?
192
+ end
193
+
194
+ def page_count
195
+ pages, rest = @array.size.divmod(@limit)
196
+ rest == 0 ? pages : pages + 1
197
+ end
198
+
199
+ def current_page
200
+ @page
201
+ end
202
+
203
+ def next_page
204
+ page_count == @page ? nil : @page + 1
205
+ end
206
+
207
+ def prev_page
208
+ @page <= 1 ? nil : @page - 1
209
+ end
210
+
211
+ def first_page?
212
+ @page <= 1
213
+ end
214
+
215
+ def last_page?
216
+ page_count == @page
217
+ end
218
+
219
+ def each(&block)
220
+ from = ((@page - 1) * @limit)
221
+ to = from + @limit
222
+
223
+ a = @array[from...to] || []
224
+ a.each(&block)
225
+ end
226
+
227
+ include Enumerable
228
+ end
229
+
230
+ end
231
+ end
232
+ end
233
+ end
@@ -59,7 +59,7 @@ module Ramaze
59
59
  def raw_redirect(target, opts = {})
60
60
  target = target.to_s
61
61
  header = {'Location' => target}
62
- status = opts[:status] || STATUS_CODE["See Other"]
62
+ status = opts[:status] || STATUS_CODE["Moved Temporarily"]
63
63
  body = %{You are being redirected, please follow <a href="#{target}">this link to: #{target}</a>!}
64
64
 
65
65
  Log.info("Redirect to '#{target}'")
@@ -25,7 +25,7 @@ module Ramaze
25
25
  trait[:REST][:active] = hm
26
26
  end
27
27
 
28
- (%w[GET PUT POST DELETE] << :any).each do |http_method|
28
+ (%w[GET PUT POST DELETE] << 'any').each do |http_method|
29
29
  define_method("on_#{http_method.downcase}") do |*args|
30
30
  if args.empty?
31
31
  on(http_method)
@@ -0,0 +1,17 @@
1
+ # Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
2
+ # All files in this distribution are subject to the terms of the Ruby license.
3
+
4
+ module Ramaze
5
+ module Helper::Thread
6
+ def thread &block
7
+ parent_thread = Thread.current
8
+ Thread.new do
9
+ begin
10
+ block.call
11
+ rescue Exception => e
12
+ parent_thread.raise(e)
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,44 @@
1
+ module Ramaze
2
+ module Helper
3
+ module Ultraviolet
4
+ trait :ultraviolet => {
5
+ :output => 'xhtml',
6
+ :syntax => nil, # syntax_name, nil|false indicates automatic detection
7
+ :line_numbers => false,
8
+ :style => 'classic', # render_style
9
+ :headers => false, # ouput document with all headers
10
+ }
11
+
12
+ # Parse and output the file at the given path.
13
+ # Please head over to the Ultraviolet documentation for more information
14
+ # on possible options.
15
+ def ultraviolet(path, options = {})
16
+ o = ancestral_trait[:ultraviolet].merge(options)
17
+ output, syntax, lines, style, headers =
18
+ o.values_at(:output, :syntax, :line_numbers, :style, :headers)
19
+
20
+ syntax ||= Uv.syntax_for_file(path).first.first
21
+ code = File.read(path)
22
+
23
+ p [code, output, syntax, lines, style, headers]
24
+ Uv.parse(code, output, syntax, lines, style, headers)
25
+ end
26
+
27
+ # Return absolute path to the css of given name.
28
+ #
29
+ # Usually this will point to somewhere in the gem tree.
30
+ #
31
+ # It seems like Uv will add support for user-defined PATH in the future,
32
+ # so we will, to be future-proof, traverse the Uv.path even though it
33
+ # currently will only have one directory.
34
+
35
+ def ultraviolet_css(theme)
36
+ Uv.path.each do |path|
37
+ Dir[path/"render/xhtml/files/css/*.css"].each do |css|
38
+ return css if File.basename(css, '.css') == theme
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -25,7 +25,7 @@ module Ramaze
25
25
  def user
26
26
  model = ancestral_trait[:user_model] ||= ::User
27
27
  callback = ancestral_trait[:user_callback] ||= nil
28
- Thread.current[:user] ||= Wrapper.new(model, callback)
28
+ STATE[:user] ||= Wrapper.new(model, callback)
29
29
  end
30
30
 
31
31
  # shortcut for user.user_login but default argument are request.params
@@ -51,12 +51,7 @@ module Ramaze
51
51
  # In order to not interfere with the wrapped instance/model we start our
52
52
  # methods with an underscore.
53
53
  # Suggestions on improvements as usual welcome.
54
- class Wrapper
55
- # make it a BlankSlate
56
- instance_methods.each do |meth|
57
- undef_method(meth) unless meth.to_s =~ /^__.+__$/
58
- end
59
-
54
+ class Wrapper < BlankSlate
60
55
  attr_accessor :_model, :_callback, :_user
61
56
 
62
57
  def initialize(model, callback)
@@ -82,14 +77,14 @@ module Ramaze
82
77
  elsif _model.respond_to?(:authenticate)
83
78
  _model.authenticate(creds)
84
79
  else
85
- Log.warn("Helper::User has no callback and model doesn't respond to #authenticate")
80
+ Log.warn("Helper::User has no callback and %p doesn't respond to #authenticate" % _model)
86
81
  nil
87
82
  end
88
83
  end
89
84
 
90
85
  def _logout
91
86
  _persistence.clear
92
- Thread.current[:user] = nil
87
+ STATE[:user] = nil
93
88
  end
94
89
 
95
90
  def _logged_in?
@@ -10,7 +10,7 @@ begin
10
10
  rescue LoadError => ex
11
11
  puts ex
12
12
  puts "For nice colors on windows, please `gem install win32console`"
13
- Ramaze::Informer.trait[:colorize] = false
13
+ Ramaze::Logger::Informer.trait[:colorize] = false
14
14
  end
15
15
 
16
16
  module Ramaze
@@ -22,6 +22,6 @@ module Ramaze
22
22
  autoload :Logger, "ramaze/log/logger.rb"
23
23
 
24
24
  unless defined?(Log)
25
- Log = Logging::LogHub.new(Logging::Logger::Informer)
25
+ Log = Logger::LogHub.new(Logger::Informer)
26
26
  end
27
27
  end
@@ -4,39 +4,37 @@
4
4
  require 'swiftcore/Analogger/Client'
5
5
 
6
6
  module Ramaze
7
- module Logging
8
- module Logger
7
+ module Logger
9
8
 
10
- # Informer for the Swiftcore Analogger logging system.
11
- #
12
- # You can find it at http://analogger.swiftcore.org and install with
13
- # gem install analogger
9
+ # Informer for the Swiftcore Analogger logging system.
10
+ #
11
+ # You can find it at http://analogger.swiftcore.org and install with
12
+ # gem install analogger
14
13
 
15
- class Analogger < ::Swiftcore::Analogger::Client
16
- include Logging
14
+ class Analogger < ::Swiftcore::Analogger::Client
15
+ include Logging
17
16
 
18
- # identifier for your application
19
- trait :name => 'walrus'
17
+ # identifier for your application
18
+ trait :name => 'walrus'
20
19
 
21
- # Host analogger runs on
22
- trait :host => '127.0.0.1'
20
+ # Host analogger runs on
21
+ trait :host => '127.0.0.1'
23
22
 
24
- # Port analogger runs on
25
- trait :port => 6766
23
+ # Port analogger runs on
24
+ trait :port => 6766
26
25
 
27
- # Create a new instance, parameters default to the traits.
26
+ # Create a new instance, parameters default to the traits.
28
27
 
29
- def initialize(name = class_trait[:name], host = class_trait[:host], port = class_trait[:port])
30
- super
31
- end
28
+ def initialize(name = class_trait[:name], host = class_trait[:host], port = class_trait[:port])
29
+ super
30
+ end
32
31
 
33
- # integration to Logging
32
+ # integration to Logging
34
33
 
35
- def log(tag, *args)
36
- log(tag, args.join("\n"))
37
- end
34
+ def log(tag, *args)
35
+ log(tag, args.join("\n"))
38
36
  end
39
-
40
37
  end
38
+
41
39
  end
42
40
  end
@@ -4,37 +4,35 @@
4
4
  require 'ruby-growl'
5
5
 
6
6
  module Ramaze
7
- module Logging
8
- module Logger
7
+ module Logger
9
8
 
10
- # Informer for the growl notification system on OSX.
9
+ # Informer for the growl notification system on OSX.
11
10
 
12
- class Growl < ::Growl
11
+ class Growl < ::Growl
13
12
 
14
- trait :defaults => {
15
- :name => 'walrus',
16
- :host => 'localhost',
17
- :password => 'walrus',
18
- :all_notifies => %w[error warn debug info dev],
19
- :default_notifies => %w[error warn info]
20
- }
13
+ trait :defaults => {
14
+ :name => 'walrus',
15
+ :host => 'localhost',
16
+ :password => 'walrus',
17
+ :all_notifies => %w[error warn debug info dev],
18
+ :default_notifies => %w[error warn info]
19
+ }
21
20
 
22
- # Takes the options from the default trait for merging.
21
+ # Takes the options from the default trait for merging.
23
22
 
24
- def initialize(options = {})
25
- options = class_trait[:defaults].merge(options).values_at(:host, :name, :all_notifies, :default_notifies, :password)
26
- super(*options)
27
- end
23
+ def initialize(options = {})
24
+ options = class_trait[:defaults].merge(options).values_at(:host, :name, :all_notifies, :default_notifies, :password)
25
+ super(*options)
26
+ end
28
27
 
29
- # integration to Logging
28
+ # integration to Logging
30
29
 
31
- def log(tag, *args)
32
- notify(tag.to_s, Time.now.strftime("%X"), args.join("\n")[0..100])
33
- rescue Errno::EMSGSIZE
34
- # Send size was to big (not really), ignore
35
- end
30
+ def log(tag, *args)
31
+ notify(tag.to_s, Time.now.strftime("%X"), args.join("\n")[0..100])
32
+ rescue Errno::EMSGSIZE
33
+ # Send size was to big (not really), ignore
36
34
  end
37
-
38
35
  end
36
+
39
37
  end
40
38
  end