ramaze 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/doc/LEGAL
CHANGED
data/doc/meta/announcement.txt
CHANGED
@@ -1,47 +1,80 @@
|
|
1
|
-
This time we are proud to announce Version 0.
|
2
|
-
|
1
|
+
This time we are proud to announce Version 0.3.0 of Ramaze, the light and
|
2
|
+
modular open source web framework.
|
3
3
|
|
4
|
-
This release features a lot of work directly from our community and
|
5
|
-
greatful for everybody who helped in testing, patching and contributing
|
6
|
-
exciting features.
|
4
|
+
This release features a lot of work directly from our community and we are
|
5
|
+
really greatful for everybody who helped in testing, patching and contributing
|
6
|
+
new exciting features.
|
7
7
|
|
8
|
-
|
9
|
-
implementation and usage.
|
10
|
-
production
|
8
|
+
Our extensive set of specs and docs now covers almost every detail of
|
9
|
+
implementation and usage. Ramaze is under development by a growing community
|
10
|
+
and in production use at companies.
|
11
11
|
|
12
|
-
Special (alphabetic) thanks go to:
|
13
12
|
|
14
|
-
|
15
|
-
|
16
|
-
Riku Räisänen - as usual, extensive testing
|
17
|
-
Pistos - submitted his first patch
|
18
|
-
Stephan Maka - XSLT templating, implementation, specs and examples
|
13
|
+
Home page: http://ramaze.net
|
14
|
+
Screencasts: http://ramaze.net/screencasts
|
19
15
|
|
16
|
+
View source: http://source.ramaze.net
|
17
|
+
Darcsweb: http://darcs.ramaze.net
|
20
18
|
|
21
|
-
Home page: http://ramaze.rubyforge.org
|
22
19
|
IRC: #ramaze on irc.freenode.net
|
23
20
|
|
24
21
|
|
25
|
-
|
22
|
+
Simple example:
|
23
|
+
|
24
|
+
require 'ramaze'
|
25
|
+
|
26
|
+
class MainController
|
27
|
+
def index
|
28
|
+
'Hello, World!'
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
Ramaze.start
|
33
|
+
|
34
|
+
|
35
|
+
Special (alphabetic) thanks go to:
|
36
|
+
|
37
|
+
Aman 'tmm1' Gupta - lots of patches and friendly support
|
38
|
+
Antonio Cangiano - Article: http://tiny.cc/tRLfm
|
39
|
+
Carlo Zottmann - First patch!
|
40
|
+
Jonathan 'Kashia' Buch - patches for gettext and Og support
|
41
|
+
Pistos - PR through awesome screencasts
|
42
|
+
|
43
|
+
|
44
|
+
Selected summary of the 118 patches from 0.2.1 to 0.3.0:
|
45
|
+
|
46
|
+
- Specs switched from RSpec to bacon; Ramaze now runs on Ruby 1.9.
|
47
|
+
|
48
|
+
- /lib/proto (pregenerated base source code) updated to a new structure.
|
49
|
+
|
50
|
+
- Oddities in gem version of bin/ramaze fixed (hopefully? :) )
|
51
|
+
|
52
|
+
- Layouts fixed so the method on the right controller is called.
|
53
|
+
|
54
|
+
- contrib/facebook and simple facebook app example added.
|
26
55
|
|
27
|
-
-
|
56
|
+
- Lambda router support added to contrib/route.
|
28
57
|
|
29
|
-
-
|
58
|
+
- examples/rapaste added.
|
30
59
|
|
31
|
-
-
|
60
|
+
- gettext contrib added; localize ramaze via gettext.
|
32
61
|
|
33
|
-
-
|
62
|
+
- Adapter for Thin Ruby webserver added.
|
34
63
|
|
35
|
-
-
|
64
|
+
- Index files can now be put into public directories and subdirectories.
|
36
65
|
|
37
|
-
-
|
66
|
+
- examples/blog switched from Og to Sequel.
|
38
67
|
|
39
|
-
-
|
68
|
+
- view/ is now the subdirectory for templates; if not found, Ramaze falls
|
69
|
+
back to template/.
|
40
70
|
|
41
|
-
-
|
71
|
+
- Default error pages updated: colour gradient removed; textmate link added;
|
72
|
+
Javascript optimized; CSS tweaked.
|
42
73
|
|
74
|
+
- Templates are no longer searched for in public/.
|
43
75
|
|
44
|
-
A complete Changelog is available at
|
76
|
+
A complete Changelog is available at
|
77
|
+
http://darcs.ramaze.net/ramaze/doc/CHANGELOG
|
45
78
|
|
46
79
|
|
47
80
|
Known issues:
|
@@ -49,36 +82,35 @@ Known issues:
|
|
49
82
|
- none yet, waiting for your reports :)
|
50
83
|
|
51
84
|
|
52
|
-
Features:
|
85
|
+
Ramaze Features:
|
53
86
|
- Builds on top of the Rack library, which provides easy use of adapters like
|
54
|
-
Mongrel, WEBrick, CGI or FCGI.
|
87
|
+
Mongrel, WEBrick, LiteSpeed, Thin, CGI or FCGI.
|
55
88
|
|
56
|
-
- Supports a wide range of templating-engines like:
|
57
|
-
|
58
|
-
|
89
|
+
- Supports a wide range of templating-engines like: Amrita2, Erubis, Haml,
|
90
|
+
Liquid, Markaby, Remarkably and its own engine called Ezamar and (still
|
91
|
+
unofficial) Nagoro.
|
59
92
|
|
60
|
-
- Highly modular structure
|
61
|
-
|
93
|
+
- Highly modular structure: you can just use the parts you like. This also
|
94
|
+
means that it's very simple to add your own customizations.
|
62
95
|
|
63
96
|
- A variety of helpers is already available, giving you things like advanced
|
64
|
-
|
65
|
-
|
97
|
+
caching, OpenID-authentication or aspect-oriented programming for your
|
98
|
+
controllers.
|
66
99
|
|
67
|
-
- It is possible to use the ORM you like, be it
|
68
|
-
|
100
|
+
- It is possible to use the ORM you like, be it Sequel, DataMapper,
|
101
|
+
ActiveRecord, Og, Kansas or something more simplistic like DBI, or a
|
102
|
+
wrapper around YAML::Store.
|
69
103
|
|
70
|
-
- Good documentation: although we don't have 100%
|
71
|
-
|
72
|
-
|
73
|
-
|
104
|
+
- Good documentation: although we don't have 100% documentation right now
|
105
|
+
(dcov says around 75%), just about every part of Ramaze is covered with
|
106
|
+
basic and advanced docs. There are a variety of examples, screencasts and a
|
107
|
+
tutorial available.
|
74
108
|
|
75
|
-
- Friendly community:
|
76
|
-
|
77
|
-
info.
|
109
|
+
- Friendly community: there are people from all over the world using Ramaze,
|
110
|
+
so you can get almost instant help and info.
|
78
111
|
|
79
112
|
|
80
|
-
For more information please come to http://ramaze.
|
81
|
-
|
113
|
+
For more information please come to http://ramaze.net or ask directly on IRC
|
114
|
+
irc://irc.freenode.net/#ramaze
|
82
115
|
|
83
|
-
Thank you,
|
84
|
-
Michael 'manveru' Fellinger and the Ramaze community
|
116
|
+
Thank you, Michael 'manveru' Fellinger and the Ramaze community
|
data/examples/blog/README
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
A simple blog engine that uses Sequel as the persistence layer.
|
2
|
+
Sequel uses sqlite as the default DBMS engine and will create the database
|
3
3
|
automatically on startup.
|
data/examples/blog/spec/blog.rb
CHANGED
@@ -1,50 +1,44 @@
|
|
1
1
|
require 'ramaze'
|
2
2
|
require 'ramaze/spec/helper'
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
testcase_requires 'hpricot'
|
8
|
-
|
9
|
-
# Og sets this in the global namespace and uses the STDERR to write messages
|
10
|
-
# We can replace it with Ramaze's logger that does The Right Thing (TM)
|
11
|
-
class Logger
|
12
|
-
@@global_logger = Ramaze::Inform
|
13
|
-
end
|
14
|
-
$:.unshift 'examples/blog'
|
4
|
+
spec_require 'hpricot', 'sequel'
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift base = __DIR__/'..'
|
15
7
|
require 'start'
|
16
8
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
end
|
9
|
+
describe 'Blog' do
|
10
|
+
behaves_like 'http'
|
11
|
+
ramaze :public_root => base/:public,
|
12
|
+
:template_root => base/:template
|
22
13
|
|
23
|
-
|
14
|
+
after do
|
15
|
+
Entry.each{|e| e.delete unless e.id == 1 }
|
16
|
+
end
|
24
17
|
|
25
|
-
def check_page(name)
|
26
|
-
page = get(
|
18
|
+
def check_page(name = '')
|
19
|
+
page = get("/#{name}")
|
27
20
|
page.status.should == 200
|
28
|
-
page.body.
|
21
|
+
page.body.should.not == nil
|
29
22
|
|
30
23
|
doc = Hpricot(page.body)
|
31
24
|
doc.at('title').inner_html.should == 'bl_Og'
|
32
25
|
doc.at('h1').inner_html.should == 'bl_Og'
|
33
26
|
|
34
|
-
doc.search('div#entries').
|
27
|
+
doc.search('div#entries').size.should == 1
|
35
28
|
|
36
29
|
doc
|
37
30
|
end
|
38
31
|
|
39
|
-
|
40
|
-
|
41
|
-
|
32
|
+
def create_page(title,content)
|
33
|
+
page = post('/create','title'=>title,'content'=>content)
|
34
|
+
page.status.should == 303
|
35
|
+
page.location.should == '/'
|
42
36
|
end
|
43
37
|
|
44
38
|
it 'should have main page' do
|
45
|
-
doc = check_page
|
39
|
+
doc = check_page
|
46
40
|
doc.at('div#actions>a').inner_html.should == 'new entry'
|
47
|
-
doc.search('div.entry').
|
41
|
+
doc.search('div.entry').size.should == 1
|
48
42
|
end
|
49
43
|
|
50
44
|
it 'should have new entry page' do
|
@@ -54,18 +48,12 @@ describe 'blog' do
|
|
54
48
|
form.at('textarea').inner_html.should == ''
|
55
49
|
form.at('input[@type=submit]')['value'].should == 'Add Entry'
|
56
50
|
end
|
57
|
-
|
58
|
-
def create_page(title,content)
|
59
|
-
page = post('/create','title'=>title,'content'=>content)
|
60
|
-
page.status.should == 303
|
61
|
-
page.location.should == '/'
|
62
|
-
end
|
63
51
|
|
64
52
|
it 'should add new pages' do
|
65
53
|
create_page('new page', 'cool! a new page')
|
66
|
-
doc = check_page
|
54
|
+
doc = check_page
|
67
55
|
entry = doc.search('div.entry')
|
68
|
-
entry.
|
56
|
+
entry.size.should == 2
|
69
57
|
entry = entry.last
|
70
58
|
|
71
59
|
entry.at('div.title').inner_html == 'new page'
|
@@ -74,11 +62,11 @@ describe 'blog' do
|
|
74
62
|
|
75
63
|
it 'should edit existing pages' do
|
76
64
|
create_page('new page', 'cool! a new page')
|
77
|
-
post('/save','
|
78
|
-
doc = check_page
|
79
|
-
|
80
|
-
|
81
|
-
entry =
|
65
|
+
post('/save','id'=>'2','title'=>'new title','content'=>'bla bla')
|
66
|
+
doc = check_page
|
67
|
+
entries = doc/'div.entry'
|
68
|
+
entries.size.should == 2
|
69
|
+
entry = entries.first
|
82
70
|
|
83
71
|
entry.at('div.title').inner_html == 'new title'
|
84
72
|
entry.at('div.content').inner_html == 'bla bla'
|
@@ -86,17 +74,14 @@ describe 'blog' do
|
|
86
74
|
|
87
75
|
it 'should delete existing pages' do
|
88
76
|
create_page("page to delete", 'content')
|
89
|
-
check_page
|
90
|
-
|
77
|
+
entries = check_page/'div.entry'
|
78
|
+
entries.size.should == 2
|
79
|
+
delete_link = entries.last.at("a:contains('delete')")
|
80
|
+
page = get(delete_link[:href])
|
91
81
|
page.status.should == 303
|
92
82
|
page.location.should == '/'
|
93
|
-
check_page
|
94
|
-
end
|
95
|
-
|
96
|
-
after do
|
97
|
-
Entry.all.each do |e|
|
98
|
-
e.delete unless e.oid == 1
|
99
|
-
end
|
83
|
+
(check_page/'div.entry').size.should == 1
|
100
84
|
end
|
101
85
|
|
86
|
+
FileUtils.rm_f(__DIR__/'../blog.db')
|
102
87
|
end
|
@@ -1,25 +1,27 @@
|
|
1
|
-
class MainController < Controller
|
1
|
+
class MainController < Ramaze::Controller
|
2
2
|
def index
|
3
|
-
@entries = Entry.
|
3
|
+
@entries = Entry.order(:created.DESC).all
|
4
4
|
end
|
5
|
-
|
6
|
-
|
5
|
+
|
6
|
+
def delete id
|
7
|
+
entry = Entry[id]
|
8
|
+
entry.delete
|
7
9
|
redirect :/
|
8
10
|
end
|
9
|
-
|
10
|
-
|
11
|
+
|
12
|
+
def edit id
|
13
|
+
@entry = Entry[id]
|
14
|
+
redirect_referrer unless @entry
|
11
15
|
end
|
16
|
+
|
12
17
|
def create
|
13
|
-
Entry.
|
18
|
+
Entry.add(*request[:title, :content])
|
14
19
|
redirect :/
|
15
20
|
end
|
21
|
+
|
16
22
|
def save
|
17
|
-
redirect_referer unless
|
18
|
-
entry
|
19
|
-
entry.title = request['title']
|
20
|
-
entry.content = request['content']
|
21
|
-
entry.updated = Time.now
|
22
|
-
entry.save
|
23
|
+
redirect_referer unless entry = Entry[request[:id]]
|
24
|
+
entry.update(*request[:title, :content])
|
23
25
|
redirect :/
|
24
26
|
end
|
25
27
|
end
|
data/examples/blog/src/model.rb
CHANGED
@@ -1,12 +1,30 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
1
|
+
require 'sequel'
|
2
|
+
|
3
|
+
DB = Sequel("sqlite:///#{__DIR__}/../blog.db")
|
4
|
+
|
5
|
+
class Entry < Sequel::Model(:entry)
|
6
|
+
set_schema do
|
7
|
+
primary_key :id
|
8
|
+
|
9
|
+
time :created
|
10
|
+
time :updated
|
11
|
+
text :title
|
12
|
+
text :content
|
11
13
|
end
|
14
|
+
|
15
|
+
def self.add(title, content)
|
16
|
+
create :title => title, :content => content,
|
17
|
+
:created => Time.now, :updated => Time.now
|
18
|
+
end
|
19
|
+
|
20
|
+
def update(title = title, content = content)
|
21
|
+
self.title, self.content, self.updated = title, content, Time.now
|
22
|
+
save
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
Entry.create_table! unless Entry.table_exists?
|
27
|
+
|
28
|
+
if Entry.empty?
|
29
|
+
Entry.add 'Blog created', 'Exciting news today, this blog was created'
|
12
30
|
end
|
data/examples/blog/start.rb
CHANGED
@@ -1,17 +1,7 @@
|
|
1
|
-
$DBG = true # turn on debugging in Og
|
2
|
-
|
3
1
|
require 'ramaze'
|
4
|
-
require 'og'
|
5
|
-
|
6
|
-
include Ramaze
|
7
2
|
|
8
3
|
require 'src/model'
|
9
4
|
require 'src/view'
|
10
5
|
require 'src/controller'
|
11
6
|
|
12
|
-
Og.setup :evolve_schema => :full
|
13
|
-
|
14
|
-
Entry.create "Blog created", "Exciting news today, this blog was created!" if
|
15
|
-
Entry.count == 0
|
16
|
-
|
17
7
|
Ramaze.start
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<div id="entries">
|
4
4
|
<div class="entry">
|
5
5
|
<form method="post" action="#{R self,:save}">
|
6
|
-
<input name="
|
6
|
+
<input name="id" type="hidden" value="#{@entry.id}"/>
|
7
7
|
<div class="header">
|
8
8
|
<div class="title">
|
9
9
|
<input name="title" type="text" value="#{@entry.title}"/>
|
@@ -7,8 +7,8 @@
|
|
7
7
|
<div class="title">#{entry.title}</div>
|
8
8
|
<div class="created">Created: #{entry.created}</div>
|
9
9
|
<ul>
|
10
|
-
<li>#{A 'edit', :href => Rs(:edit, entry.
|
11
|
-
<li>#{A 'delete', :href => Rs(:delete, entry.
|
10
|
+
<li>#{A 'edit', :href => Rs(:edit, entry.id)}</li>
|
11
|
+
<li>#{A 'delete', :href => Rs(:delete, entry.id)}</li>
|
12
12
|
</ul>
|
13
13
|
</div>
|
14
14
|
<div class="content">#{entry.content}</div>
|
@@ -0,0 +1,152 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'ramaze'
|
3
|
+
|
4
|
+
Ramaze.contrib :facebook
|
5
|
+
|
6
|
+
# Settings for your facebook app
|
7
|
+
# SERVER: where this ramaze app is running
|
8
|
+
# URL: the apps.facebook.com url to your app
|
9
|
+
# KEY: API key for your app
|
10
|
+
# SECRET: Secret key for your app
|
11
|
+
# ID: Your app's ID (from the about page url)
|
12
|
+
# ADMINS: uids of facebook users that are admins
|
13
|
+
# SESSION: an admin's session key
|
14
|
+
#
|
15
|
+
# These vars are used by the Facebook Helper are are also useful
|
16
|
+
# within your controller and templates. For example,
|
17
|
+
# <a href="#{Facebook::URL}/search">click here to search</a>
|
18
|
+
#
|
19
|
+
# In addition, set the following options on your app's 'Edit Settings' page:
|
20
|
+
# Callback URL: http://myapp.domain.com:7000/ (trailing slash required)
|
21
|
+
# Canvas Page URL: ramazing
|
22
|
+
# Can your app be added on Facebook: Yes
|
23
|
+
# Who can add your app: Users
|
24
|
+
# Post-Add URL: http://apps.facebook.com/ramazing/install
|
25
|
+
# Post-Remove URL: http://myapp.domain.com:7000/uninstall
|
26
|
+
# Side Nav URL: http://apps.facebook.com/ramazing
|
27
|
+
|
28
|
+
module Facebook
|
29
|
+
SERVER = 'http://myapp.domain.com:7000'
|
30
|
+
URL = 'http://apps.facebook.com/ramazing'
|
31
|
+
KEY = 'b32f58685c06a7f8107bc7915354bd89'
|
32
|
+
SECRET = 'e0f9........................9429'
|
33
|
+
ID = 2502696782
|
34
|
+
ADMINS = [ 15601088 ]
|
35
|
+
SESSION = ''
|
36
|
+
end unless defined? Facebook::ID
|
37
|
+
|
38
|
+
# The facebook helper (included your controller using +helper :facebook+)
|
39
|
+
# defines a +facebook+ object, which is also aliased to +fb+.
|
40
|
+
#
|
41
|
+
# POST parameters sent by the facebook servers can be accessed via fb.params
|
42
|
+
# and also fb[]. Wherever possible, values will be converted to native ruby
|
43
|
+
# types (Time objects, true/false, arrays)
|
44
|
+
#
|
45
|
+
# fb.params = { :api_key => "b32f58685c06a7f8107bc7915354bd89",
|
46
|
+
# :added => true,
|
47
|
+
# :profile_update_time => Mon Oct 15 15:07:28 -0400 2007,
|
48
|
+
# :friends => [1,2,3],
|
49
|
+
# :session_key => "f7bed6aefaa5467b3a6344f2-15601088",
|
50
|
+
# :time => Sat Dec 01 02:02:50 -0500 2007,
|
51
|
+
# :user => 15601088,
|
52
|
+
# :position_fix => false,
|
53
|
+
# :expires => 0,
|
54
|
+
# :in_canvas => true }
|
55
|
+
#
|
56
|
+
# fb[:user] == facebook[:user] == facebook.params[:user]
|
57
|
+
#
|
58
|
+
# The facebook object can also be used to make API calls. Native ruby types (true, false, strings, hashes and arrays)
|
59
|
+
# will be returned. If facebook returns an array with only one element, that element will be returned instead.
|
60
|
+
#
|
61
|
+
# facebook.auth.createToken # => "41b5dc65792ba4bf405faf857a17267c"
|
62
|
+
# fb.users.getInfo :uids => 15601088, :fields => [:name] # => {"name"=>"Aman Gupta", "uid"=>15601088}
|
63
|
+
# fb.profile.setFBML :uid => 15601088, :markup => 'Hi!' # => true
|
64
|
+
#
|
65
|
+
# API calls will use the current viewing users' session key (from fb[:session_key]) if present,
|
66
|
+
# or Facebook::SESSION, which should be set to one of the admin's keys. You can also provide another
|
67
|
+
# session key yourself from your users database:
|
68
|
+
#
|
69
|
+
# fb.feed.publishActionOfUser :session_key => "the user's session key", :title => 'is using Ramaze!'
|
70
|
+
#
|
71
|
+
# Finally, you can use the following facebook object methods:
|
72
|
+
#
|
73
|
+
# facebook.valid? # verify fb_sig, if invalid fb.params will return {}
|
74
|
+
# facebook.redirect '/url' # redirect to /url using <fb:redirect/>
|
75
|
+
# facebook.addurl # return the add url for the current app
|
76
|
+
# facebook.addurl '/url' # add url for app that redirects to /url after successful install
|
77
|
+
|
78
|
+
class MainController < Ramaze::Controller
|
79
|
+
helper :formatting # for time_diff
|
80
|
+
helper :facebook
|
81
|
+
|
82
|
+
before_all {
|
83
|
+
# show some information about current user in logs
|
84
|
+
# INFO Facebook {:user=>15601088, :in_canvas=>true, :added=>true}
|
85
|
+
inform :info, "Facebook " + fb.params.reject{|k,v| k.to_s !~ /^(in|is|user|added)/}.inspect if fb[:user]
|
86
|
+
|
87
|
+
# suggest setting SESSION key if one is not set, and current user is an admin
|
88
|
+
# INFO Set a default session key: SESSION = 'b3638446fa02466210c49f42-15601088'
|
89
|
+
if Facebook::SESSION.empty? and Facebook::ADMINS.include? fb[:user]
|
90
|
+
inform :info, "Set a default session key: SESSION = '#{fb[:session_key]}'"
|
91
|
+
end
|
92
|
+
nil
|
93
|
+
}
|
94
|
+
|
95
|
+
def install
|
96
|
+
inform :info, "#{fb[:user]} installed app" if request['installed'] == '1'
|
97
|
+
facebook.profile.setFBML :uid => fb[:user], :markup => "Isn't this a great surprise!?"
|
98
|
+
facebook.redirect request['next'] || '/'
|
99
|
+
end
|
100
|
+
|
101
|
+
def uninstall
|
102
|
+
inform :info, "#{fb[:user]} uninstalled app"
|
103
|
+
end
|
104
|
+
|
105
|
+
def main
|
106
|
+
fb.redirect '/index' unless fb[:user]
|
107
|
+
@userinfo = facebook.users.getInfo :uids => facebook[:user], :fields => [:name, :pic_square]
|
108
|
+
%q(
|
109
|
+
Hey there #{@userinfo['name']}. You look like this: <img src="#{@userinfo['pic_square']}"/>. <br/>
|
110
|
+
You updated your profile #{time_diff fb[:profile_update_time]} ago. You have #{fb[:friends].size} friends. <br/>
|
111
|
+
<p>
|
112
|
+
<?r unless fb[:added] ?>
|
113
|
+
I know you already logged in, but you should really <a href="#{facebook.addurl}">add this app</a>.
|
114
|
+
You'll get a real nifty surprise on your profile if you do.
|
115
|
+
<?r else ?>
|
116
|
+
Now that you added this app, I can access your profile and news feed. <br/>
|
117
|
+
Did you see the cool surprise I left on <a href="http://www.facebook.com/profile.php?id=#{fb[:user]}">your profile</a>?
|
118
|
+
<?r end ?>
|
119
|
+
</p>
|
120
|
+
)
|
121
|
+
end
|
122
|
+
|
123
|
+
def index
|
124
|
+
facebook.redirect '/main' if facebook[:user]
|
125
|
+
%q(
|
126
|
+
This is a great app. Here are some reasons you'll like it:
|
127
|
+
<ul>
|
128
|
+
<li>It's on facebook</li>
|
129
|
+
<li>It's written in Ramaze</li>
|
130
|
+
</ul>
|
131
|
+
<a href="#{Facebook::URL}/main" requirelogin="true">Login</a> to start using it. Or, to
|
132
|
+
get the full benefit, you should <a href="#{facebook.addurl '/main'}">add it</a> so we have
|
133
|
+
access to your newsfeed and can add a box to your profile.
|
134
|
+
)
|
135
|
+
end
|
136
|
+
|
137
|
+
def layout
|
138
|
+
%q(
|
139
|
+
<fb:dashboard>
|
140
|
+
<?r unless fb[:added] ?>
|
141
|
+
<fb:create-button href="#{facebook.addurl '/main'}">Add App</fb:create-button>
|
142
|
+
<?r end ?>
|
143
|
+
</fb:dashboard>
|
144
|
+
<div id="content" style="margin: 0 2em 2em 2em">
|
145
|
+
#@content
|
146
|
+
</div>
|
147
|
+
)
|
148
|
+
end
|
149
|
+
layout :layout
|
150
|
+
end
|
151
|
+
|
152
|
+
Ramaze.start :adapter => :mongrel
|