ramaze 0.2.1 → 0.3.0
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.
- data/Rakefile +20 -3
- data/bin/ramaze +1 -4
- data/doc/AUTHORS +2 -1
- data/doc/CHANGELOG +539 -32
- data/doc/LEGAL +4 -0
- data/doc/meta/announcement.txt +79 -47
- data/examples/blog/README +2 -2
- data/examples/blog/spec/blog.rb +33 -48
- data/examples/blog/src/controller.rb +15 -13
- data/examples/blog/src/model.rb +28 -10
- data/examples/blog/start.rb +0 -10
- data/examples/blog/template/edit.xhtml +1 -1
- data/examples/blog/template/index.xhtml +2 -2
- data/examples/facebook.rb +152 -0
- data/examples/linking.rb +28 -0
- data/examples/ramaise.rb +4 -11
- data/examples/rammit/spec/rammit.rb +30 -0
- data/examples/rammit/src/controller/main.rb +3 -0
- data/examples/rammit/src/controller/page.rb +16 -0
- data/examples/rammit/src/model.rb +33 -0
- data/examples/rammit/start.rb +7 -0
- data/examples/rammit/template/index.xhtml +14 -0
- data/examples/rammit/template/page/view.xhtml +4 -0
- data/examples/rapaste/Rakefile +28 -0
- data/examples/rapaste/public/css/active4d.css +114 -0
- data/examples/rapaste/public/css/all_hallows_eve.css +72 -0
- data/examples/rapaste/public/css/amy.css +147 -0
- data/examples/rapaste/public/css/blackboard.css +88 -0
- data/examples/rapaste/public/css/brilliance_black.css +605 -0
- data/examples/rapaste/public/css/brilliance_dull.css +599 -0
- data/examples/rapaste/public/css/cobalt.css +149 -0
- data/examples/rapaste/public/css/dawn.css +121 -0
- data/examples/rapaste/public/css/display.css +179 -0
- data/examples/rapaste/public/css/eiffel.css +121 -0
- data/examples/rapaste/public/css/espresso_libre.css +109 -0
- data/examples/rapaste/public/css/idle.css +62 -0
- data/examples/rapaste/public/css/iplastic.css +80 -0
- data/examples/rapaste/public/css/lazy.css +73 -0
- data/examples/rapaste/public/css/mac_classic.css +123 -0
- data/examples/rapaste/public/css/magicwb_amiga.css +104 -0
- data/examples/rapaste/public/css/pastels_on_dark.css +188 -0
- data/examples/rapaste/public/css/slush_poppies.css +85 -0
- data/examples/rapaste/public/css/spacecadet.css +51 -0
- data/examples/rapaste/public/css/sunburst.css +180 -0
- data/examples/rapaste/public/css/twilight.css +137 -0
- data/examples/rapaste/public/css/zenburnesque.css +91 -0
- data/examples/rapaste/public/js/jquery.js +11 -0
- data/examples/rapaste/rapaste.sqlite +0 -0
- data/examples/rapaste/spec/rapaste.rb +49 -0
- data/examples/rapaste/src/controller.rb +69 -0
- data/examples/rapaste/src/model.rb +61 -0
- data/examples/rapaste/start.rb +20 -0
- data/examples/rapaste/template/copy.xhtml +10 -0
- data/examples/rapaste/template/index.xhtml +9 -0
- data/examples/rapaste/template/layout.xhtml +22 -0
- data/examples/rapaste/template/list.xhtml +28 -0
- data/examples/rapaste/template/view.xhtml +37 -0
- data/examples/sourceview/sourceview.rb +3 -3
- data/examples/templates/template_amrita2.rb +1 -3
- data/examples/todolist/spec/todolist.rb +15 -18
- data/examples/whywiki/spec/whywiki.rb +15 -20
- data/examples/whywiki/start.rb +0 -1
- data/examples/wikore/spec/wikore.rb +14 -19
- data/examples/wiktacular/spec/wiktacular.rb +8 -15
- data/lib/proto/{src/controller → controller}/main.rb +4 -4
- data/lib/proto/public/css/ramaze_error.css +39 -3
- data/lib/proto/public/js/jquery.js +2039 -1020
- data/lib/proto/spec/main.rb +27 -0
- data/lib/proto/start.rb +5 -5
- data/lib/proto/view/error.xhtml +62 -0
- data/lib/proto/view/index.xhtml +34 -0
- data/lib/proto/view/page.xhtml +15 -0
- data/lib/ramaze.rb +9 -7
- data/lib/ramaze/action.rb +7 -3
- data/lib/ramaze/action/render.rb +15 -5
- data/lib/ramaze/adapter.rb +5 -5
- data/lib/ramaze/adapter/base.rb +2 -2
- data/lib/ramaze/adapter/cgi.rb +1 -1
- data/lib/ramaze/adapter/evented_mongrel.rb +1 -1
- data/lib/ramaze/adapter/fcgi.rb +2 -2
- data/lib/ramaze/adapter/mongrel.rb +1 -1
- data/lib/ramaze/adapter/swiftiplied_mongrel.rb +1 -1
- data/lib/ramaze/adapter/thin.rb +25 -0
- data/lib/ramaze/adapter/webrick.rb +1 -1
- data/lib/ramaze/cache.rb +3 -2
- data/lib/ramaze/cache/memcached.rb +1 -1
- data/lib/ramaze/cache/memory.rb +1 -1
- data/lib/ramaze/cache/yaml_store.rb +1 -1
- data/lib/ramaze/contrib.rb +1 -1
- data/lib/ramaze/contrib/auto_params.rb +12 -5
- data/lib/ramaze/contrib/auto_params/get_args.rb +1 -0
- data/lib/ramaze/contrib/facebook.rb +23 -0
- data/lib/ramaze/contrib/facebook/facebook.rb +168 -0
- data/lib/ramaze/contrib/gettext.rb +111 -0
- data/lib/ramaze/contrib/gettext/mo.rb +155 -0
- data/lib/ramaze/contrib/gettext/po.rb +109 -0
- data/lib/ramaze/contrib/gzip_filter.rb +1 -1
- data/lib/ramaze/contrib/route.rb +15 -5
- data/lib/ramaze/contrib/sequel/fill.rb +1 -1
- data/lib/ramaze/controller.rb +10 -4
- data/lib/ramaze/controller/error.rb +5 -13
- data/lib/ramaze/controller/main.rb +2 -0
- data/lib/ramaze/controller/resolve.rb +18 -10
- data/lib/ramaze/dispatcher.rb +1 -1
- data/lib/ramaze/dispatcher/action.rb +1 -1
- data/lib/ramaze/dispatcher/directory.rb +3 -2
- data/lib/ramaze/dispatcher/error.rb +5 -5
- data/lib/ramaze/dispatcher/file.rb +13 -2
- data/lib/ramaze/error.rb +1 -1
- data/lib/ramaze/gestalt.rb +2 -2
- data/lib/ramaze/global.rb +5 -5
- data/lib/ramaze/global/dsl.rb +1 -1
- data/lib/ramaze/global/globalstruct.rb +11 -5
- data/lib/ramaze/helper.rb +1 -1
- data/lib/ramaze/helper/aspect.rb +1 -1
- data/lib/ramaze/helper/auth.rb +2 -2
- data/lib/ramaze/helper/cache.rb +1 -1
- data/lib/ramaze/helper/cgi.rb +1 -1
- data/lib/ramaze/helper/file.rb +1 -1
- data/lib/ramaze/helper/flash.rb +1 -1
- data/lib/ramaze/helper/formatting.rb +1 -1
- data/lib/ramaze/helper/identity.rb +1 -1
- data/lib/ramaze/helper/inform.rb +1 -1
- data/lib/ramaze/helper/link.rb +4 -4
- data/lib/ramaze/helper/markaby.rb +1 -1
- data/lib/ramaze/helper/nitroform.rb +1 -1
- data/lib/ramaze/helper/pager.rb +2 -1
- data/lib/ramaze/helper/partial.rb +1 -1
- data/lib/ramaze/helper/redirect.rb +6 -1
- data/lib/ramaze/helper/sequel.rb +54 -0
- data/lib/ramaze/helper/stack.rb +1 -1
- data/lib/ramaze/inform.rb +1 -1
- data/lib/ramaze/inform/analogger.rb +1 -1
- data/lib/ramaze/inform/growl.rb +1 -1
- data/lib/ramaze/inform/hub.rb +1 -1
- data/lib/ramaze/inform/informer.rb +1 -1
- data/lib/ramaze/inform/informing.rb +2 -2
- data/lib/ramaze/inform/knotify.rb +1 -1
- data/lib/ramaze/inform/syslog.rb +1 -1
- data/lib/ramaze/inform/xosd.rb +1 -1
- data/lib/ramaze/snippets.rb +1 -1
- data/lib/ramaze/snippets/array/put_within.rb +1 -1
- data/lib/ramaze/snippets/blankslate.rb +7 -0
- data/lib/ramaze/snippets/dictionary.rb +6 -1
- data/lib/ramaze/snippets/divide.rb +1 -1
- data/lib/ramaze/snippets/kernel/__dir__.rb +1 -1
- data/lib/ramaze/snippets/kernel/acquire.rb +39 -0
- data/lib/ramaze/snippets/kernel/aquire.rb +1 -34
- data/lib/ramaze/snippets/kernel/constant.rb +1 -1
- data/lib/ramaze/snippets/kernel/pretty_inspect.rb +1 -1
- data/lib/ramaze/snippets/numeric/filesize_format.rb +1 -1
- data/lib/ramaze/snippets/object/traits.rb +1 -1
- data/lib/ramaze/snippets/ordered_set.rb +12 -7
- data/lib/ramaze/snippets/ramaze/caller_info.rb +1 -1
- data/lib/ramaze/snippets/ramaze/caller_lines.rb +1 -1
- data/lib/ramaze/snippets/string/camel_case.rb +1 -1
- data/lib/ramaze/snippets/string/color.rb +2 -4
- data/lib/ramaze/snippets/string/each.rb +1 -1
- data/lib/ramaze/snippets/string/ord.rb +15 -0
- data/lib/ramaze/snippets/string/snake_case.rb +1 -1
- data/lib/ramaze/snippets/struct/fill.rb +4 -2
- data/lib/ramaze/snippets/struct/values_at.rb +2 -2
- data/lib/ramaze/snippets/symbol/to_proc.rb +15 -8
- data/lib/ramaze/snippets/thread/into.rb +1 -1
- data/lib/ramaze/sourcereload.rb +4 -3
- data/lib/ramaze/spec/helper.rb +85 -32
- data/lib/ramaze/spec/helper/bacon.rb +7 -0
- data/lib/ramaze/spec/helper/browser.rb +1 -2
- data/lib/ramaze/spec/helper/mock_http.rb +1 -1
- data/lib/ramaze/spec/helper/pretty_output.rb +70 -0
- data/lib/ramaze/spec/helper/requester.rb +1 -1
- data/lib/ramaze/spec/helper/simple_http.rb +5 -4
- data/lib/ramaze/spec/helper/snippets.rb +6 -0
- data/lib/ramaze/store/default.rb +1 -1
- data/lib/ramaze/template.rb +1 -1
- data/lib/ramaze/template/amrita2.rb +6 -5
- data/lib/ramaze/template/erubis.rb +1 -1
- data/lib/ramaze/template/ezamar.rb +1 -1
- data/lib/ramaze/template/ezamar/element.rb +1 -1
- data/lib/ramaze/template/ezamar/engine.rb +1 -1
- data/lib/ramaze/template/ezamar/morpher.rb +1 -1
- data/lib/ramaze/template/ezamar/render_partial.rb +1 -1
- data/lib/ramaze/template/haml.rb +1 -1
- data/lib/ramaze/template/liquid.rb +1 -1
- data/lib/ramaze/template/markaby.rb +1 -1
- data/lib/ramaze/template/nagoro.rb +4 -6
- data/lib/ramaze/template/none.rb +1 -1
- data/lib/ramaze/template/remarkably.rb +1 -1
- data/lib/ramaze/template/sass.rb +1 -1
- data/lib/ramaze/tool.rb +1 -1
- data/lib/ramaze/tool/create.rb +7 -1
- data/lib/ramaze/tool/localize.rb +7 -14
- data/lib/ramaze/tool/mime.rb +1 -1
- data/lib/ramaze/tool/record.rb +1 -1
- data/lib/ramaze/trinity.rb +1 -1
- data/lib/ramaze/trinity/request.rb +4 -2
- data/lib/ramaze/trinity/response.rb +1 -1
- data/lib/ramaze/trinity/session.rb +7 -1
- data/lib/ramaze/version.rb +3 -3
- data/lib/vendor/bacon.rb +317 -0
- data/rake_tasks/conf.rake +1 -1
- data/rake_tasks/maintenance.rake +7 -5
- data/rake_tasks/spec.rake +54 -40
- data/spec/contrib/auto_params.rb +21 -4
- data/spec/contrib/route.rb +31 -4
- data/spec/contrib/sequel/fill.rb +3 -4
- data/spec/examples/caching.rb +5 -2
- data/spec/examples/css.rb +5 -2
- data/spec/examples/element.rb +5 -4
- data/spec/examples/hello.rb +1 -0
- data/spec/examples/linking.rb +18 -0
- data/spec/examples/simple.rb +13 -18
- data/spec/examples/templates/template_amrita2.rb +3 -2
- data/spec/examples/templates/template_erubis.rb +3 -2
- data/spec/examples/templates/template_ezamar.rb +2 -1
- data/spec/examples/templates/template_haml.rb +3 -2
- data/spec/examples/templates/template_liquid.rb +3 -2
- data/spec/examples/templates/template_markaby.rb +3 -2
- data/spec/examples/templates/template_remarkably.rb +3 -2
- data/spec/ramaze/action/basics.rb +4 -4
- data/spec/ramaze/action/cache.rb +11 -13
- data/spec/ramaze/action/layout.rb +47 -3
- data/spec/ramaze/action/render.rb +3 -3
- data/spec/ramaze/action/template/instancevars/layout.xhtml +1 -0
- data/spec/ramaze/adapter.rb +7 -7
- data/spec/ramaze/adapter/mongrel.rb +1 -1
- data/spec/ramaze/adapter/record.rb +7 -7
- data/spec/ramaze/adapter/webrick.rb +1 -1
- data/spec/ramaze/cache.rb +6 -8
- data/spec/ramaze/controller.rb +77 -65
- data/spec/ramaze/controller/resolve.rb +2 -1
- data/spec/ramaze/controller/template_resolving.rb +3 -4
- data/spec/ramaze/dispatcher.rb +3 -4
- data/spec/ramaze/dispatcher/directory.rb +35 -35
- data/spec/ramaze/dispatcher/file.rb +8 -5
- data/spec/ramaze/element.rb +4 -4
- data/spec/ramaze/error.rb +13 -11
- data/spec/ramaze/gestalt.rb +1 -1
- data/spec/ramaze/helper/aspect.rb +2 -1
- data/spec/ramaze/helper/auth.rb +4 -2
- data/spec/ramaze/helper/cache.rb +10 -9
- data/spec/ramaze/helper/cgi.rb +2 -2
- data/spec/ramaze/helper/file.rb +1 -0
- data/spec/ramaze/helper/flash.rb +5 -4
- data/spec/ramaze/helper/formatting.rb +1 -1
- data/spec/ramaze/helper/link.rb +3 -3
- data/spec/ramaze/helper/pager.rb +44 -80
- data/spec/ramaze/helper/partial.rb +2 -3
- data/spec/ramaze/helper/redirect.rb +10 -1
- data/spec/ramaze/helper/stack.rb +4 -3
- data/spec/ramaze/helper/template/loop.xhtml +2 -1
- data/spec/ramaze/inform/informer.rb +2 -2
- data/spec/ramaze/inform/syslog.rb +1 -1
- data/spec/ramaze/localize.rb +26 -26
- data/spec/ramaze/morpher.rb +6 -7
- data/spec/ramaze/params.rb +7 -8
- data/spec/ramaze/request.rb +27 -6
- data/spec/ramaze/request/mongrel.rb +1 -1
- data/spec/ramaze/request/thin.rb +9 -0
- data/spec/ramaze/session.rb +2 -1
- data/spec/ramaze/store/default.rb +14 -17
- data/spec/ramaze/template.rb +5 -7
- data/spec/ramaze/template/amrita2.rb +4 -1
- data/spec/ramaze/template/erubis.rb +2 -1
- data/spec/ramaze/template/ezamar.rb +2 -3
- data/spec/ramaze/template/ezamar/other__index.xhtml +1 -0
- data/spec/ramaze/template/haml.rb +2 -1
- data/spec/ramaze/template/liquid.rb +4 -2
- data/spec/ramaze/template/markaby.rb +4 -2
- data/spec/ramaze/template/nagoro.rb +3 -4
- data/spec/ramaze/template/remarkably.rb +4 -2
- data/spec/ramaze/template/sass.rb +3 -2
- data/spec/ramaze/template/xslt.rb +4 -7
- data/spec/ramaze/trinity/request.rb +4 -3
- data/spec/ramaze/trinity/session.rb +6 -4
- data/spec/snippets/array/put_within.rb +3 -2
- data/spec/snippets/divide.rb +1 -4
- data/spec/snippets/kernel/__dir__.rb +1 -1
- data/spec/snippets/kernel/acquire.rb +71 -0
- data/spec/snippets/kernel/constant.rb +4 -8
- data/spec/snippets/numeric/filesize_format.rb +1 -1
- data/spec/snippets/ordered_set.rb +9 -2
- data/spec/snippets/ramaze/caller_info.rb +3 -3
- data/spec/snippets/ramaze/caller_lines.rb +3 -3
- data/spec/snippets/string/camel_case.rb +1 -1
- data/spec/snippets/string/color.rb +2 -2
- data/spec/snippets/string/snake_case.rb +5 -1
- data/spec/snippets/string/unindent.rb +1 -1
- data/spec/snippets/struct/fill.rb +14 -15
- data/spec/snippets/struct/values_at.rb +15 -10
- data/spec/snippets/symbol/to_proc.rb +13 -0
- data/spec/snippets/thread/into.rb +3 -4
- metadata +458 -386
- data/doc/README.html +0 -729
- data/doc/changes.txt +0 -5044
- data/doc/changes.xml +0 -5046
- data/lib/proto/public/error.zmr +0 -61
- data/lib/proto/src/element/page.rb +0 -17
- data/lib/proto/src/model.rb +0 -6
- data/lib/proto/template/index.xhtml +0 -15
- data/lib/ramaze/spec/helper/layout.rb +0 -58
- data/lib/ramaze/spec/helper/minimal.rb +0 -23
- data/lib/ramaze/spec/helper/wrap.rb +0 -198
- data/spec/snippets/kernel/aquire.rb +0 -71
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c)
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
4
|
module Ramaze
|
|
@@ -23,6 +23,7 @@ module Ramaze
|
|
|
23
23
|
:mongrel => :Mongrel,
|
|
24
24
|
:evented_mongrel => :Mongrel,
|
|
25
25
|
:swiftiplied_mongrel => :Mongrel,
|
|
26
|
+
:thin => :Thin
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
# mapping of :cache => to the right class-name.
|
|
@@ -96,12 +97,17 @@ module Ramaze
|
|
|
96
97
|
sri.interval = interval if sri
|
|
97
98
|
end
|
|
98
99
|
|
|
99
|
-
def template_root
|
|
100
|
-
self[:template_root]
|
|
100
|
+
def template_root
|
|
101
|
+
[ tr = self[:template_root],
|
|
102
|
+
APPDIR/tr,
|
|
103
|
+
APPDIR/'template',
|
|
104
|
+
].find{|path| File.directory?(path) } || self[:template_root]
|
|
101
105
|
end
|
|
102
106
|
|
|
103
|
-
def public_root
|
|
104
|
-
self[:public_root]
|
|
107
|
+
def public_root
|
|
108
|
+
[ pr = self[:public_root],
|
|
109
|
+
APPDIR/pr,
|
|
110
|
+
].find{|path| File.directory?(path) } || self[:public_root]
|
|
105
111
|
end
|
|
106
112
|
|
|
107
113
|
def list_directories=(active)
|
data/lib/ramaze/helper.rb
CHANGED
data/lib/ramaze/helper/aspect.rb
CHANGED
data/lib/ramaze/helper/auth.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c)
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
4
|
require 'digest/sha1'
|
|
@@ -25,7 +25,7 @@ module Ramaze
|
|
|
25
25
|
# if no password given, shows a simple form to input it.
|
|
26
26
|
|
|
27
27
|
def login
|
|
28
|
-
username, password = request
|
|
28
|
+
username, password = request[:username, :password]
|
|
29
29
|
if check_auth(username, password)
|
|
30
30
|
session[:logged_in] = true
|
|
31
31
|
session[:username] = username
|
data/lib/ramaze/helper/cache.rb
CHANGED
data/lib/ramaze/helper/cgi.rb
CHANGED
data/lib/ramaze/helper/file.rb
CHANGED
data/lib/ramaze/helper/flash.rb
CHANGED
data/lib/ramaze/helper/inform.rb
CHANGED
data/lib/ramaze/helper/link.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c)
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
4
|
module Ramaze
|
|
@@ -59,10 +59,10 @@ module Ramaze
|
|
|
59
59
|
|
|
60
60
|
map = Global.mapping.invert
|
|
61
61
|
atoms.map! do |atom|
|
|
62
|
-
if atom.
|
|
63
|
-
map[atom] || atom
|
|
64
|
-
else
|
|
62
|
+
if atom.is_a?(Ramaze::Controller)
|
|
65
63
|
map[atom.class] || atom
|
|
64
|
+
else
|
|
65
|
+
map[atom] || atom
|
|
66
66
|
end
|
|
67
67
|
end
|
|
68
68
|
|
data/lib/ramaze/helper/pager.rb
CHANGED
|
@@ -352,7 +352,8 @@ private
|
|
|
352
352
|
options.update(pager.limit)
|
|
353
353
|
items = items.reload(options)
|
|
354
354
|
return items, pager
|
|
355
|
-
elsif defined?(Og) && items.is_a?(Og::
|
|
355
|
+
elsif defined?(Og::EntityMixin) && items.is_a?(Og::EntityMixin) ||
|
|
356
|
+
defined?(Og::Mixin) && items.is_a?(Og::Mixin) # Og <= 0.41
|
|
356
357
|
pager = Pager.new(request, limit, items.count(options), pager_key)
|
|
357
358
|
options.update(pager.limit)
|
|
358
359
|
items = items.all(options)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c)
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
4
|
module Ramaze
|
|
@@ -47,6 +47,11 @@ module Ramaze
|
|
|
47
47
|
end
|
|
48
48
|
end
|
|
49
49
|
|
|
50
|
+
raw_redirect(target, opts)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def raw_redirect(target, opts = {})
|
|
54
|
+
target = target.to_s
|
|
50
55
|
header = {'Location' => target}
|
|
51
56
|
status = opts[:status] || STATUS_CODE["See Other"]
|
|
52
57
|
body = %{You are being redirected, please follow <a href="#{target}">this link to: #{target}</a>!}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 SequelHelper
|
|
6
|
+
private
|
|
7
|
+
|
|
8
|
+
def paginator(paginated, target)
|
|
9
|
+
page_count = paginated.page_count
|
|
10
|
+
prev_page = paginated.prev_page
|
|
11
|
+
current_page = paginated.current_page
|
|
12
|
+
next_page = paginated.next_page
|
|
13
|
+
|
|
14
|
+
lower = (current_page - 3).abs
|
|
15
|
+
lower = lower == 0 ? 1 : lower
|
|
16
|
+
|
|
17
|
+
out = ['<div class="paginator">']
|
|
18
|
+
|
|
19
|
+
if prev_page
|
|
20
|
+
out << %(<a class="paginator_prev" href="#{Rs(target, prev_page)}">< Prev</a>)
|
|
21
|
+
else
|
|
22
|
+
out << %(<span class="paginator_prev">< Prev</span>)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
if current_page > 3
|
|
26
|
+
out << %(<a class="paginator_page" href="#{Rs(target, 1)}">#{1}</a> ... )
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
lower.upto(current_page) do |pc|
|
|
30
|
+
next if pc == current_page
|
|
31
|
+
out << %(<a class="paginator_page" href="#{Rs(target, pc)}">#{pc}</a>)
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
out << %(<span class="paginator_current">#{current_page}</span>)
|
|
35
|
+
|
|
36
|
+
current_page.upto([page_count, current_page + 3].min) do |pc|
|
|
37
|
+
next if pc == current_page
|
|
38
|
+
out << %(<a class="paginator_page" href="#{Rs(target, pc)}">#{pc}</a>)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
if current_page < (page_count - 3)
|
|
42
|
+
out << %(.. <a class="paginator_page" href="#{Rs(target, page_count)}">#{page_count}</a>)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
if next_page
|
|
46
|
+
out << %(<a class="paginator_next" href="#{Rs(target, next_page)}">Next ></a>)
|
|
47
|
+
else
|
|
48
|
+
out << %(<span class="paginator_next">Next ></span>)
|
|
49
|
+
end
|
|
50
|
+
out << '</div>'
|
|
51
|
+
out.join(" ")
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
data/lib/ramaze/helper/stack.rb
CHANGED
data/lib/ramaze/inform.rb
CHANGED
data/lib/ramaze/inform/growl.rb
CHANGED
data/lib/ramaze/inform/hub.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c)
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
4
|
module Ramaze
|
|
@@ -60,7 +60,7 @@ module Ramaze
|
|
|
60
60
|
def error(ex)
|
|
61
61
|
if ex.respond_to?(:exception)
|
|
62
62
|
message = ex.backtrace[0..Global.backtrace_size]
|
|
63
|
-
message.map{|m| m.gsub!(/^#{Dir.pwd}/, '.') }
|
|
63
|
+
message.map{|m| m.gsub!(/^#{Regexp.escape(Dir.pwd)}/, '.') }
|
|
64
64
|
message.unshift(ex.inspect)
|
|
65
65
|
else
|
|
66
66
|
message = ex.to_s
|
data/lib/ramaze/inform/syslog.rb
CHANGED
data/lib/ramaze/inform/xosd.rb
CHANGED
data/lib/ramaze/snippets.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright (c)
|
|
1
|
+
# Copyright (c) 2008 Michael Fellinger m.fellinger@gmail.com
|
|
2
2
|
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
3
|
|
|
4
4
|
dir = File.join(File.expand_path(File.dirname(__FILE__)), 'snippets')
|
|
@@ -350,7 +350,7 @@ module Ramaze
|
|
|
350
350
|
def inspect
|
|
351
351
|
ary = []
|
|
352
352
|
each {|k,v| ary << k.inspect + "=>" + v.inspect}
|
|
353
|
-
|
|
353
|
+
'{' + ary.join(", ") + '}'
|
|
354
354
|
end
|
|
355
355
|
|
|
356
356
|
def dup
|
|
@@ -374,6 +374,11 @@ module Ramaze
|
|
|
374
374
|
ary
|
|
375
375
|
end
|
|
376
376
|
|
|
377
|
+
def find
|
|
378
|
+
each{|k,v| return k, v if yield(k,v) }
|
|
379
|
+
return nil
|
|
380
|
+
end
|
|
381
|
+
|
|
377
382
|
def first
|
|
378
383
|
@hash[order.first]
|
|
379
384
|
end
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
# Extensions for Kernel
|
|
5
|
+
|
|
6
|
+
module Kernel
|
|
7
|
+
|
|
8
|
+
# Require all .rb and .so files on the given globs, utilizes Dir::[].
|
|
9
|
+
#
|
|
10
|
+
# Examples:
|
|
11
|
+
# # Given following directory structure:
|
|
12
|
+
# # src/foo.rb
|
|
13
|
+
# # src/bar.so
|
|
14
|
+
# # src/foo.yaml
|
|
15
|
+
# # src/foobar/baz.rb
|
|
16
|
+
# # src/foobar/README
|
|
17
|
+
#
|
|
18
|
+
# # requires all files in 'src':
|
|
19
|
+
# acquire 'src/*'
|
|
20
|
+
#
|
|
21
|
+
# # requires all files in 'src' recursive:
|
|
22
|
+
# acquire 'src/**/*'
|
|
23
|
+
#
|
|
24
|
+
# # require 'src/foo.rb' and 'src/bar.so' and 'src/foobar/baz.rb'
|
|
25
|
+
# acquire 'src/*', 'src/foobar/*'
|
|
26
|
+
|
|
27
|
+
def acquire *globs
|
|
28
|
+
globs.flatten.each do |glob|
|
|
29
|
+
Dir[glob].each do |file|
|
|
30
|
+
require file if file =~ /\.(rb|so)$/
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def aquire *globs
|
|
36
|
+
warn "Kernel#aquire is being deprecated, use Kernel#acquire instead"
|
|
37
|
+
acquire *globs
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -1,34 +1 @@
|
|
|
1
|
-
|
|
2
|
-
# All files in this distribution are subject to the terms of the Ruby license.
|
|
3
|
-
|
|
4
|
-
# Extensions for Kernel
|
|
5
|
-
|
|
6
|
-
module Kernel
|
|
7
|
-
|
|
8
|
-
# Require all .rb and .so files on the given globs, utilizes Dir::[].
|
|
9
|
-
#
|
|
10
|
-
# Examples:
|
|
11
|
-
# # Given following directory structure:
|
|
12
|
-
# # src/foo.rb
|
|
13
|
-
# # src/bar.so
|
|
14
|
-
# # src/foo.yaml
|
|
15
|
-
# # src/foobar/baz.rb
|
|
16
|
-
# # src/foobar/README
|
|
17
|
-
#
|
|
18
|
-
# # requires all files in 'src':
|
|
19
|
-
# aquire 'src/*'
|
|
20
|
-
#
|
|
21
|
-
# # requires all files in 'src' recursive:
|
|
22
|
-
# aquire 'src/**/*'
|
|
23
|
-
#
|
|
24
|
-
# # require 'src/foo.rb' and 'src/bar.so' and 'src/foobar/baz.rb'
|
|
25
|
-
# aquire 'src/*', 'src/foobar/*'
|
|
26
|
-
|
|
27
|
-
def aquire *globs
|
|
28
|
-
globs.flatten.each do |glob|
|
|
29
|
-
Dir[glob].each do |file|
|
|
30
|
-
require file if file =~ /\.(rb|so)$/
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'acquire')
|