ramaze 2009.07 → 2009.10

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -1,3 +1,5 @@
1
1
  pkg
2
2
  .yardoc
3
3
  ydoc
4
+ *~
5
+ *.swp
data/MANIFEST CHANGED
@@ -240,6 +240,7 @@ lib/ramaze/helper/bench.rb
240
240
  lib/ramaze/helper/blue_form.rb
241
241
  lib/ramaze/helper/cache.rb
242
242
  lib/ramaze/helper/disqus.rb
243
+ lib/ramaze/helper/erector.rb
243
244
  lib/ramaze/helper/flash.rb
244
245
  lib/ramaze/helper/form.rb
245
246
  lib/ramaze/helper/formatting.rb
@@ -327,6 +328,7 @@ lib/ramaze/tool/create.rb
327
328
  lib/ramaze/tool/project_creator.rb
328
329
  lib/ramaze/version.rb
329
330
  lib/ramaze/view.rb
331
+ lib/ramaze/view/erector.rb
330
332
  lib/ramaze/view/erubis.rb
331
333
  lib/ramaze/view/ezamar.rb
332
334
  lib/ramaze/view/gestalt.rb
@@ -339,6 +341,7 @@ lib/ramaze/view/nagoro/render_partial.rb
339
341
  lib/ramaze/view/redcloth.rb
340
342
  lib/ramaze/view/remarkably.rb
341
343
  lib/ramaze/view/sass.rb
344
+ lib/ramaze/view/slippers.rb
342
345
  lib/ramaze/view/tagz.rb
343
346
  lib/ramaze/view/tenjin.rb
344
347
  lib/vendor/etag.rb
@@ -445,6 +448,12 @@ spec/ramaze/session/memcache.rb
445
448
  spec/ramaze/struct.rb
446
449
  spec/ramaze/template/ramaze/external.test
447
450
  spec/ramaze/view.rb
451
+ spec/ramaze/view/erector.rb
452
+ spec/ramaze/view/erector/external.erector
453
+ spec/ramaze/view/erector/invoke_helper_method.erector
454
+ spec/ramaze/view/erector/layout.erector
455
+ spec/ramaze/view/erector/strict_xhtml.erector
456
+ spec/ramaze/view/erector/sum.erector
448
457
  spec/ramaze/view/erubis.rb
449
458
  spec/ramaze/view/erubis/external.rhtml
450
459
  spec/ramaze/view/erubis/sum.rhtml
@@ -471,6 +480,9 @@ spec/ramaze/view/remarkably/external.rem
471
480
  spec/ramaze/view/remarkably/sum.rem
472
481
  spec/ramaze/view/sass.rb
473
482
  spec/ramaze/view/sass/file.css.sass
483
+ spec/ramaze/view/slippers.rb
484
+ spec/ramaze/view/slippers/external.st
485
+ spec/ramaze/view/slippers/sum.st
474
486
  spec/ramaze/view/tagz.rb
475
487
  spec/ramaze/view/tagz/external.tagz
476
488
  spec/ramaze/view/tagz/sum.tagz
data/Rakefile CHANGED
@@ -21,25 +21,34 @@ PROJECT_COPYRIGHT = [
21
21
  ]
22
22
 
23
23
  DEPENDENCIES = {
24
- 'innate' => {:version => '= 2009.07'},
24
+ 'innate' => {:version => '= 2009.10'},
25
25
  }
26
26
 
27
27
  DEVELOPMENT_DEPENDENCIES = {
28
+ 'RedCloth' => {:version => '~> 4.2.2'},
28
29
  'Remarkably' => {:version => '~> 0.5.2', :lib => 'remarkably'},
30
+ 'activesupport' => {:version => '~> 2.3.4'},
31
+ 'addressable' => {:version => '~> 2.1.0'},
29
32
  'bacon' => {:version => '>= 1.1.0'},
33
+ 'erector' => {:version => '~> 0.7.0'},
30
34
  'erubis' => {:version => '>= 2.6.4'},
31
35
  'ezamar' => {:version => '>= 2009.06'},
32
36
  'haml' => {:version => '~> 2.2.1'},
33
37
  'hpricot' => {:version => '>= 0.8.1'},
34
38
  'json' => {:version => '>= 1.1.7'},
39
+ 'less' => {:version => '~> 1.1.13'},
35
40
  'liquid' => {:version => '~> 2.0.0'},
41
+ 'locale' => {:version => '~> 2.0.4'},
36
42
  'localmemcache' => {:version => '~> 0.4.1'},
43
+ 'maruku' => {:version => '~> 0.6.0'},
37
44
  'memcache-client' => {:version => '~> 1.7.4', :lib => 'memcache'},
38
45
  'nagoro' => {:version => '>= 2009.05'},
39
- 'rack-test' => {:version => '>= 0.4.0', :lib => 'rack/test'},
40
46
  'rack-contrib' => {:version => '>= 0.9.2', :lib => 'rack/contrib'},
47
+ 'rack-test' => {:version => '>= 0.4.0', :lib => 'rack/test'},
41
48
  'sequel' => {:version => '= 3.2.0'},
42
- 'tagz' => {:version => '>= 5.0.1'},
49
+ 'slippers' => {:version => '~> 0.0.10'},
50
+ 'sqlite3-ruby' => {:version => '~> 1.2.5', :lib => 'sqlite3'},
51
+ 'tagz' => {:version => '>= 7.1.0'},
43
52
  'tenjin' => {:version => '~> 0.6.1'},
44
53
  }
45
54
 
data/doc/AUTHORS CHANGED
@@ -1,15 +1,16 @@
1
1
  Following persons have contributed to ramaze.
2
2
  (Sorted by number of submitted patches, then alphabetically)
3
3
 
4
- 2641 Michael Fellinger <m.fellinger@gmail.com>
4
+ 2655 Michael Fellinger <m.fellinger@gmail.com>
5
5
  216 Aman Gupta <aman@ramaze.net>
6
6
  87 Jonathan Buch <john@oxyliquit.de>
7
- 75 Pistos <gitsomegrace.5.pistos@geoshell.com>
7
+ 77 Pistos <gitsomegrace.5.pistos@geoshell.com>
8
8
  63 Clive Crous <clive@crous.co.za>
9
9
  27 Keita Yamaguchi <keita.yamaguchi@gmail.com>
10
10
  20 Ryan Grove <ryan@wonko.com>
11
11
  11 TJ Vanderpoel <bougy.man@gmail.com>
12
12
  11 Wang, Jinjing <nfjinjing@gmail.com>
13
+ 8 Mario Gutierrez <mgutz@mgutz-mbp.local>
13
14
  7 Tadahiko Uehara <kikofx@gmail.com>
14
15
  6 Aki Reijonen <aki.reijonen@gmail.com>
15
16
  6 Sam Carr <samcarr@gmail.com>
@@ -23,6 +24,8 @@ Following persons have contributed to ramaze.
23
24
  2 Andrew Farmer <xichekolas@gmail.com>
24
25
  2 Jonathan Buch <jonathan.buch@gmail.com>
25
26
  2 Lars Olsson <lasso@lassoweb.se>
27
+ 2 starapor <me@sarahtaraporewalla.com>
28
+ 2 Yutaka HARA <yutaka.hara+github@gmail.com>
26
29
  1 Aaron Mueller <mail@aaron-mueller.de>
27
30
  1 Ara T. Howard <ara.t.howard@gmail.com>
28
31
  1 Carlo Zottmann <carlo@zottmann.org>
data/doc/CHANGELOG CHANGED
@@ -1,3 +1,121 @@
1
+ [842d47f | Fri Oct 02 15:09:43 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
2
+
3
+ * Version 2009.10
4
+
5
+ [ba23aa6 | Fri Oct 02 15:09:32 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
6
+
7
+ * dependency against latest innate
8
+
9
+ [e4c63be | Fri Oct 02 15:06:41 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
10
+
11
+ * Improve release tasks
12
+
13
+ [6d758f3 | Thu Oct 01 14:39:03 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
14
+
15
+ * Add missing erector spec template
16
+
17
+ [84587e5 | Thu Oct 01 14:38:04 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
18
+
19
+ * Call helper methods from external erector template
20
+
21
+ [a95384c | Thu Oct 01 12:24:32 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
22
+
23
+ * moved erector helper methods from engine into helper
24
+
25
+ [6c10e2a | Tue Sep 29 14:03:07 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
26
+
27
+ * Fix slippers spec
28
+
29
+ [4b31204 | Tue Sep 29 13:55:31 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
30
+
31
+ * Adding slippers as dev dependency
32
+
33
+ [9561d90 | Tue Sep 29 13:46:23 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
34
+
35
+ * Update dependencies
36
+
37
+ [d7d368b | Mon Sep 28 13:14:55 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
38
+
39
+ * Added strict_xhtml Erector method
40
+
41
+ [23ffbd0 | Mon Sep 28 08:01:11 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
42
+
43
+ * Updated Erector dependencies
44
+
45
+ [e70a358 | Sun Sep 27 14:23:03 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
46
+
47
+ * added erector specs
48
+
49
+ [72684cb | Sun Sep 27 07:39:33 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
50
+
51
+ * adding erector engine convenience methods
52
+
53
+ [18501a7 | Sun Sep 27 06:12:25 UTC 2009] Mario Gutierrez <mgutz@mgutz-mbp.local>
54
+
55
+ * adding Erector view engine
56
+
57
+ [98e41a6 | Sat Sep 26 00:53:20 UTC 2009] starapor <me@sarahtaraporewalla.com>
58
+
59
+ * the view_root now uses all the view directories available in teh attribute
60
+
61
+ [b4f6f0e | Sat Sep 26 00:19:12 UTC 2009] starapor <me@sarahtaraporewalla.com>
62
+
63
+ * Adding a view engine for slippers
64
+
65
+ [5dda528 | Sun Aug 16 12:58:31 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
66
+
67
+ * Remove shared mock, fix webrat
68
+
69
+ [f545a47 | Tue Aug 11 03:01:33 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
70
+
71
+ * Fix wrong constant reference
72
+
73
+ [e7732d1 | Tue Aug 11 02:39:37 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
74
+
75
+ * Only try to get win32console on ruby < 1.9, fix logger
76
+
77
+ [8d79efe | Wed Aug 05 12:58:10 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
78
+
79
+ * Provide support for :haml_options trait again
80
+
81
+ [1d21bad | Sat Aug 01 04:07:45 UTC 2009] Pistos <gitsomegrace.5.pistos@geoshell.com>
82
+
83
+ * Don't use system temp dir;
84
+
85
+ ('openid-store' in our case).
86
+
87
+ Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
88
+
89
+ [e417109 | Mon Jul 27 05:00:18 UTC 2009] Pistos <gitsomegrace.5.pistos@geoshell.com>
90
+
91
+ * Fixed error in rdocs of Ramaze::Request#to_instance_variables.
92
+
93
+ Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
94
+
95
+ [3713845 | Sat Aug 01 08:39:25 UTC 2009] Yutaka HARA <yutaka.hara+github@gmail.com>
96
+
97
+ * Added DataMapperPager (does not load all the rows)
98
+
99
+ Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
100
+
101
+ [802c0d9 | Fri Jul 31 09:03:27 UTC 2009] Yutaka HARA <yutaka.hara+github@gmail.com>
102
+
103
+ * paginate helper supports DataMapper
104
+
105
+ Signed-off-by: Michael Fellinger <m.fellinger@gmail.com>
106
+
107
+ [c098591 | Wed Jul 29 13:39:33 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
108
+
109
+ * Require snippets using Find::find instead of Dir::glob
110
+
111
+ [37470de | Sat Jul 25 14:30:04 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
112
+
113
+ * Fixing the auth example by mapping it to /
114
+
115
+ [e95e5f1 | Fri Jul 24 19:04:21 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
116
+
117
+ * Update announcement
118
+
1
119
  [d0267ff | Fri Jul 24 18:56:44 UTC 2009] Michael Fellinger <m.fellinger@gmail.com>
2
120
 
3
121
  * Version 2009.07
@@ -51,6 +51,8 @@ Simple example:
51
51
 
52
52
  - Michael Fellinger (manveru)
53
53
  - Adding support for the less CSS templating engine
54
+ - Adding LRU cache
55
+ - Fixing problems in paginate
54
56
  - Better defaults for proto specs
55
57
  - The Helper::Cache#cache_value optionally takes a block now
56
58
  - Make sure proto/config.ru points to correct location
@@ -11,6 +11,8 @@ module Auth
11
11
 
12
12
  class AuthController < Ramaze::Controller
13
13
  map '/', :auth
14
+ app.location = '/'
15
+
14
16
  helper :auth
15
17
  layout :auth
16
18
  trait :auth_table => USERS
@@ -0,0 +1,58 @@
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
+ require 'erector'
5
+
6
+ module Ramaze
7
+
8
+ # Allows you to use some shortcuts for Erector in your Controller.
9
+
10
+ # use this inside your controller to directly build Erector
11
+ # Refer to the Erector-documentation and testsuite for more examples.
12
+ # Usage:
13
+ # erector { h1 "Apples & Oranges" } #=> "<h1>Apples &amp; Oranges</h1>"
14
+ # erector { h1(:class => 'fruits&floots'){ text 'Apples' } } #=> "<h1 class=\"fruits&amp;floots\">Apples</h1>"
15
+
16
+ module Helper
17
+ module Erector
18
+ include ::Erector::Mixin
19
+
20
+ class ::Erector::Widget
21
+ alias :raw! :rawtext
22
+ alias :old_css :css
23
+
24
+ def strict_xhtml(*args, &block)
25
+ raw! '<?xml version="1.0" encoding="UTF-8"?>'
26
+ raw! '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">'
27
+ html(:xmlns => "http://www.w3.org/1999/xhtml", :"xml:lang" => "en", :lang => "en", &block)
28
+ end
29
+
30
+ def js(src)
31
+ script :src => src
32
+ end
33
+
34
+ def ie_if(expr, &block)
35
+ raw! "<!--[if #{expr}]>"
36
+ yield
37
+ raw! "<![endif]-->"
38
+ end
39
+
40
+ # Diagnostics
41
+ def inspect(elem)
42
+ text elem.inspect
43
+ end
44
+
45
+ def css(href, args = {})
46
+ attrs = {
47
+ :rel => "stylesheet",
48
+ :href => href,
49
+ :type => "text/css"
50
+ }.merge(args)
51
+
52
+ link attrs
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+
@@ -8,7 +8,7 @@ require 'openid/extensions/sreg'
8
8
 
9
9
  module Ramaze
10
10
 
11
- openid_store_file = ::File.join(Dir.tmpdir, 'openid-store')
11
+ openid_store_file = ::File.join(Ramaze.options.roots[0], '/tmp', 'openid-store')
12
12
 
13
13
  # Constant for storing meta-information persistent
14
14
  OpenIDStore = OpenID::Store::Filesystem.new(openid_store_file)
@@ -164,6 +164,8 @@ module Ramaze
164
164
  case obj
165
165
  when Array
166
166
  ArrayPager.new(obj, @page, @limit)
167
+ when (defined?(DataMapper::Collection) and DataMapper::Collection)
168
+ DataMapperPager.new(obj, @page, @limit)
167
169
  else
168
170
  obj.paginate(@page, @limit)
169
171
  end
@@ -196,7 +198,7 @@ module Ramaze
196
198
  end
197
199
 
198
200
  def page_count
199
- pages, rest = @array.size.divmod(@limit)
201
+ pages, rest = size.divmod(@limit)
200
202
  rest == 0 ? pages : pages + 1
201
203
  end
202
204
 
@@ -231,6 +233,30 @@ module Ramaze
231
233
  include Enumerable
232
234
  end
233
235
 
236
+ # Wrapper for DataMapper::Collection to behave like the Sequel
237
+ # pagination.
238
+ # needs 'datamapper' (or 'dm-core' and 'dm-aggregates')
239
+ class DataMapperPager < ArrayPager
240
+
241
+ def initialize(*args)
242
+ unless defined?(DataMapper::Aggregates)
243
+ Ramaze::Log.warn "paginate.rb: it is strongly " +
244
+ "recommended to require 'dm-aggregates'"
245
+ end
246
+
247
+ super
248
+ end
249
+
250
+ def size
251
+ @cached_size ||= @array.count
252
+ end
253
+
254
+ def empty?
255
+ size == 0
256
+ end
257
+
258
+ end
259
+
234
260
  end
235
261
  end
236
262
  end
data/lib/ramaze/log.rb CHANGED
@@ -2,23 +2,10 @@
2
2
  # All files in this distribution are subject to the terms of the Ruby license.
3
3
 
4
4
  require 'ramaze/log/logging'
5
-
6
- module Ramaze
7
- Log = Innate::Log
8
-
9
- module Logger
10
- autoload :Analogger, 'ramaze/log/analogger'
11
- end
12
- end
13
-
14
- __END__
15
-
16
- require 'ramaze/log/logging'
17
- require 'ramaze/log/hub'
18
5
  require 'ramaze/log/informer'
19
6
 
20
7
  begin
21
- require 'win32console' if RUBY_PLATFORM =~ /win32/i
8
+ require 'win32console' if RUBY_PLATFORM =~ /win32/i && RUBY_VERSION < '1.9'
22
9
  rescue LoadError => ex
23
10
  puts ex
24
11
  puts "For nice colors on windows, please `gem install win32console`"
@@ -26,14 +13,14 @@ rescue LoadError => ex
26
13
  end
27
14
 
28
15
  module Ramaze
29
- autoload :Analogger, "ramaze/log/analogger"
30
- autoload :Knotify, "ramaze/log/knotify"
31
- autoload :Syslog, "ramaze/log/syslog"
32
- autoload :Growl, "ramaze/log/growl"
33
- autoload :Xosd, "ramaze/log/xosd"
34
- autoload :Logger, "ramaze/log/logger"
16
+ Log = Innate::Log
35
17
 
36
- unless defined?(Log)
37
- Log = Logger::LogHub.new(Logger::Informer)
18
+ module Logger
19
+ autoload :Analogger, 'ramaze/log/analogger'
20
+ autoload :Knotify, "ramaze/log/knotify"
21
+ autoload :Syslog, "ramaze/log/syslog"
22
+ autoload :Growl, "ramaze/log/growl"
23
+ autoload :Xosd, "ramaze/log/xosd"
24
+ autoload :Logger, "ramaze/log/logger"
38
25
  end
39
26
  end
@@ -9,7 +9,7 @@ module Ramaze
9
9
 
10
10
  class Informer
11
11
  include Logging
12
- include Ramaze::Traited
12
+ include Innate::Traited
13
13
 
14
14
  attr_accessor :out, :colorize, :log_levels
15
15
 
@@ -19,7 +19,7 @@ module Ramaze
19
19
  #
20
20
  # Usage:
21
21
  # request.params # => {'name' => 'manveru', 'q' => 'google', 'lang' => 'de'}
22
- # to_ivs(:name, :q)
22
+ # request.to_ivs(:name, :q)
23
23
  # @q # => 'google'
24
24
  # @name # => 'manveru'
25
25
  # @lang # => nil