marley 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README.rdoc +3 -8
  2. data/lib/marley.rb +27 -131
  3. data/lib/marley/controllers.rb +12 -7
  4. data/lib/marley/core_ext.rb +8 -0
  5. data/lib/marley/errors.rb +51 -0
  6. data/lib/marley/joint.rb +14 -19
  7. data/lib/marley/joints/forum.rb +88 -0
  8. data/lib/marley/joints/messages.rb +86 -0
  9. data/lib/marley/joints/section.rb +63 -0
  10. data/lib/marley/joints/tags.rb +99 -0
  11. data/lib/marley/joints/user.rb +120 -0
  12. data/lib/marley/plugin.rb +39 -0
  13. data/lib/marley/plugins/orm_rest_convenience.rb +92 -0
  14. data/lib/marley/plugins/rest_convenience.rb +28 -0
  15. data/lib/marley/reggae.rb +5 -2
  16. data/lib/marley/resources.rb +10 -0
  17. data/lib/marley/router.rb +61 -0
  18. data/lib/marley/test_helpers.rb +12 -1
  19. data/lib/marley/utils.rb +57 -25
  20. data/rdoc/example_joint.rb +33 -0
  21. data/rdoc/example_plugin.rb +20 -0
  22. data/rdoc/forum_joint.rb +50 -0
  23. data/rdoc/forum_joint.rdoc +19 -0
  24. data/rdoc/hello.rb +14 -0
  25. data/rdoc/hello.rdoc +14 -0
  26. data/rdoc/joints.rdoc +69 -0
  27. data/rdoc/messages_joint.rb +34 -0
  28. data/rdoc/messages_joint.rdoc +18 -0
  29. data/rdoc/messages_joint/private_messages.rdoc +59 -0
  30. data/rdoc/messages_joint/public_messages.rdoc +65 -0
  31. data/rdoc/orm_rest_convenience_plugin.rb +28 -0
  32. data/rdoc/orm_rest_convenience_plugin.rdoc +99 -0
  33. data/rdoc/plugins.rdoc +35 -0
  34. data/rdoc/reggae.rb +3 -0
  35. data/rdoc/reggae.rdoc +11 -0
  36. data/rdoc/reggae/generate.rdoc +13 -0
  37. data/rdoc/reggae/parse.rdoc +44 -0
  38. data/rdoc/section_joint.rb +13 -0
  39. data/rdoc/section_joint.rdoc +19 -0
  40. data/rdoc/tags_joint.rb +16 -0
  41. data/rdoc/tags_joint.rdoc +22 -0
  42. data/rdoc/tags_joint/announcements.rdoc +64 -0
  43. data/rdoc/tags_joint/secrets.rdoc +65 -0
  44. data/rdoc/user_joint.rb +62 -0
  45. data/rdoc/user_joint.rdoc +13 -0
  46. data/rdoc/user_joint/exiting_users.rdoc +120 -0
  47. data/rdoc/user_joint/no_auth_provided.rdoc +34 -0
  48. data/reggae.ebnf +1 -1
  49. metadata +45 -37
  50. data/Favicon.ico +0 -0
  51. data/Rakefile +0 -14
  52. data/TODO +0 -19
  53. data/examples/blog.rb +0 -26
  54. data/examples/empty.sqlite3 +0 -0
  55. data/examples/forum.css +0 -3
  56. data/examples/forum.js +0 -23
  57. data/examples/forum.rb +0 -20
  58. data/examples/forum.sql +0 -42
  59. data/examples/forum.sqlite3 +0 -0
  60. data/examples/forum_test.sqlite3 +0 -0
  61. data/examples/run.sh +0 -14
  62. data/lib/client/jamaica.css +0 -270
  63. data/lib/client/jamaica.js +0 -353
  64. data/lib/client/jamaica.rb +0 -38
  65. data/lib/client/jquery-1.6.2.js +0 -8981
  66. data/lib/client/jquery.form.js +0 -814
  67. data/lib/joints/basic_menu_system.rb +0 -41
  68. data/lib/joints/basic_messaging.rb +0 -88
  69. data/lib/joints/basic_user.rb +0 -51
  70. data/lib/joints/tagged_messaging.rb +0 -122
  71. data/lib/joints/tagging.rb +0 -56
  72. data/lib/sequel/plugins/rest_auth.rb +0 -53
  73. data/lib/sequel/plugins/rest_convenience.rb +0 -87
  74. data/marley-0.4.0.gem +0 -0
  75. data/marley.gemspec +0 -17
  76. data/test/empty.sqlite3 +0 -0
  77. data/test/menu_tests.rb +0 -9
  78. data/test/tagged_messaging_tests.rb +0 -289
  79. data/test/test.sqlite3 +0 -0
  80. data/test/test_include.rb +0 -16
  81. data/test/user_tests.rb +0 -72
data/Favicon.ico DELETED
File without changes
data/Rakefile DELETED
@@ -1,14 +0,0 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'rake/testtask'
4
-
5
- task :default => [:test]
6
-
7
- Rake::TestTask.new(:test) do |t|
8
- t.ruby_opts=['-r test/test_include']
9
- t.test_files=FileList['test/*_tests.rb']
10
- end
11
-
12
- Rake::TestTask.new(:unit) do |t|
13
- t.test_files=FileList['test/*_unit.rb']
14
- end
data/TODO DELETED
@@ -1,19 +0,0 @@
1
-
2
-
3
- - complete switchover to tdoc
4
- - joint dependencies
5
- - rename client to sth like output
6
- - move all output there
7
- - fix JS
8
- - ditch Sequel dependency
9
- - ORM as a Joint??
10
- - automate sequel plugin loading in options
11
-
12
- -----------------
13
-
14
- - better filtering options for posts
15
- - better logging
16
- - implement instance_list
17
- - expose validation reflections to views
18
- ??? caching protocol for autocompleters/validation options
19
-
data/examples/blog.rb DELETED
@@ -1,26 +0,0 @@
1
- require 'rubygems'
2
- require 'sequel'
3
- require 'digest/sha1'
4
-
5
- $: << "#{File.dirname(__FILE__)}/../lib/"
6
-
7
- APP_DIR=File.dirname(__FILE__)
8
- require "marley"
9
- require "client/jamaica"
10
- #need to automate the following somehow but can't think of anything that isn't ugly ATM
11
- DB=Sequel.sqlite("#{APP_DIR}/forum#{ENV["MARLEY_TESTING"] ? '_test' : ''}.sqlite3")#,:loggers => [Logger.new($stdout)])
12
-
13
- Marley.config({:app_name => 'The Forum',:client => Marley::Client.new({:app_name => 'The Forum'})})
14
-
15
- Marley.joint 'tagged_messaging', {:resources => ['user','admin']}
16
- Marley.joint 'basic_menu_system'
17
-
18
- module Marley
19
- module Resources
20
- class Author < User
21
- def self.requires_user?;true;end
22
- end
23
- class Post < MJ::TaggedMessaging::Resources::Post
24
- end
25
- end
26
- end
Binary file
data/examples/forum.css DELETED
@@ -1,3 +0,0 @@
1
- a.expandCollapse, a.expandCollapseAll{background-color:#398235;color:#fff;text-decoration:none;margin:.5em;font-weight:bold;}
2
- .collapsed > .instance > .colContainer,.collapsed > .instance > .instanceActions{display:none;}
3
- .collapsed > .instance > .post__titleColContainer,.collapsed > .instance > .private_message__titleColContainer{display:block;}
data/examples/forum.js DELETED
@@ -1,23 +0,0 @@
1
- $(function(){
2
- $("body").ajaxComplete(function(){
3
- $(".postInstance,.private_messageInstance").parent().not('.collapsible').prepend(["a",{"href":"#","class":"expandCollapse"},"collapse"].toDom()).prepend(["a",{"href":"#","class":"expandCollapseAll"},"collapse from here"].toDom());
4
- $(".postInstance,.private_messageInstance").parent().not('.collapsible').addClass('collapsible');
5
- });
6
- $(".expandCollapse").live('click',collapseExpand);
7
- $(".expandCollapseAll").live('click',collapseExpandAll);
8
- });
9
-
10
- function collapseExpand() {
11
- $(this).closest('.collapsible').toggleClass('collapsed').toggleClass('expanded');
12
- $(this).html($(this).html()=='collapse' ? 'expand' : 'collapse');
13
- return false;
14
- }
15
- function collapseExpandAll() {
16
- var affected=$(this).closest('.collapsible').find('.collapsible').andSelf();
17
- if ($(this).html().match(/collapse/)){
18
- affected.addClass('collapsed').removeClass('expanded').find('.expandCollapse,.expandCollapseAll').each(function(){$(this).html($(this).html().replace(/collapse/,'expand'))});
19
- } else {
20
- affected.removeClass('collapsed').addClass('expanded').find('.expandCollapse,.expandCollapseAll').each(function(){$(this).html($(this).html().replace(/expand/,'collapse'))});
21
- }
22
- return false;
23
- }
data/examples/forum.rb DELETED
@@ -1,20 +0,0 @@
1
- require 'rubygems'
2
- require 'sequel'
3
- require 'digest/sha1'
4
-
5
- $: << "#{File.dirname(__FILE__)}/../lib/"
6
-
7
- APP_DIR=File.dirname(__FILE__)
8
- require "marley"
9
- require "client/jamaica"
10
- #need to automate the following somehow but can't think of anything that isn't ugly ATM
11
- DB=Sequel.sqlite("#{APP_DIR}/forum#{ENV["MARLEY_TESTING"] ? '_test' : ''}.sqlite3")#,:loggers => [Logger.new($stdout)])
12
-
13
- RESERVED_PM_TAGS=['inbox','sent']
14
- RESERVED_POST_TAGS=['announcement']
15
-
16
- Marley.config({:app_name => 'The Forum',:client => Marley::Client.new({:app_name => 'The Forum'})})
17
-
18
-
19
- Marley.joint 'tagged_messaging'
20
- Marley.joint 'basic_menu_system'
data/examples/forum.sql DELETED
@@ -1,42 +0,0 @@
1
- CREATE TABLE tags (id integer PRIMARY KEY,user_id integer, tag text);
2
- CREATE INDEX tag_user_id on tags(user_id);
3
- CREATE INDEX tag_tag on tags(tag);
4
- CREATE UNIQUE INDEX tag_tag_user_id on tags(user_id,tag);
5
-
6
- CREATE TABLE messages_tags ( id integer PRIMARY KEY, message_id integer, tag_id integer);
7
- CREATE INDEX msg_tag_id on messages_tags(tag_id);
8
- CREATE INDEX tag_msg_id on messages_tags(message_id);
9
-
10
- CREATE TABLE messages (
11
- id integer PRIMARY KEY,
12
- message_type text,
13
- author_id integer,
14
- recipients text,
15
- thread_id integer,
16
- parent_id integer,
17
- date_created datetime,
18
- date_updated datetime,
19
- title text,
20
- message clob
21
- );
22
- CREATE INDEX message on messages(message);
23
- CREATE INDEX message_author on messages(author_id);
24
- CREATE INDEX message_parent on messages(parent_id);
25
- CREATE INDEX message_thread on messages(thread_id);
26
- CREATE INDEX message_title on messages(title);
27
- CREATE INDEX message_type on messages(message_type);
28
- CREATE INDEX thread on messages(thread_id);
29
-
30
- CREATE TABLE users (
31
- id INTEGER PRIMARY KEY,
32
- user_type TEXT,
33
- date_created datetime,
34
- name TEXT,
35
- email TEXT,
36
- pw_hash TEXT,
37
- active boolean default true,
38
- description clob);
39
- CREATE INDEX users_active on users(active);
40
- CREATE UNIQUE INDEX users_email on users(email);
41
- CREATE UNIQUE INDEX users_name on users(name);
42
- CREATE INDEX users_user_type on users(user_type);
Binary file
Binary file
data/examples/run.sh DELETED
@@ -1,14 +0,0 @@
1
- #!/bin/sh
2
-
3
- # directory of the marley base directory
4
- MARLEY_DIR=..
5
-
6
- # directory of the marley libs
7
- MARLEY_LIB=$MARLEY_DIR/lib
8
-
9
- # ruby interpreter to use (1.8, 1.9)
10
- RUBY=ruby
11
- #RUBY=/opt/local/bin/ruby1.9
12
-
13
- RUBYLIB=$MARLEY_LIB $RUBY ./simple_forum.rb run
14
-
@@ -1,270 +0,0 @@
1
- html, body, div, span, h1, p, strong, ul, li, form, label {margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent;}
2
- input {vertical-align:middle;}
3
- h1 {font-weight: bold;}
4
- body {background: #C9DE96; color: #000; font:13px/1.231 sans-serif; *font-size:small;}
5
- input, textarea {font:sans-serif;}
6
- textarea {overflow: auto;}
7
- input[type=submit] {cursor: pointer;}
8
- input, textarea {margin: 0;}
9
- body {height: 100%; min-height: 100%;}
10
- .hidden {display: none;}
11
- .editable {
12
- border: 1px dotted #398235;
13
- cursor: pointer;
14
- padding: 2px 5px;
15
- }
16
- .editable:after {
17
- content: "\270E";
18
- font-size: 125%;
19
- padding: 0 0 0 3px;
20
- }
21
- #signup__section,
22
- #main__section {
23
- background: #fff;
24
- border: 1px solid #398235;
25
- -moz-border-radius: 8px;
26
- border-radius: 8px;
27
- -moz-box-shadow: 0 0 10px rgba(51,51,51,0.5);
28
- box-shadow: 0 0 10px rgba(51,51,51,0.5);
29
- margin: 20px auto;
30
- width: 960px;
31
- }
32
- #signup__section {
33
- height: 350px;
34
- left: 50%;
35
- margin: -175px 0 0 -480px;
36
- position: absolute;
37
- top: 50%;
38
- }
39
- #signup__section h1,
40
- #main__section > h1 {
41
- background: #398235;
42
- border-bottom: 1px solid #398235;
43
- -moz-border-radius-topright: 8px;
44
- -moz-border-radius-topleft: 8px;
45
- border-top-right-radius: 8px;
46
- border-top-left-radius: 8px;
47
- color: #fff;
48
- font: bold 167%/150% "Rockwell STD", Rockwell, serif;
49
- margin: 0 0 1em;
50
- text-align: center;
51
- text-transform: capitalize;
52
- }
53
- #signup__section .sectionDescription {font-weight: bold;}
54
- #signup__section .sectionDescription,
55
- #main__section > .sectionDescription,
56
- #signup_section {margin: 0 20px 20px;}
57
- #signup_section li {
58
- display: inline-block;
59
- vertical-align: top;
60
- width: 440px;
61
- }
62
- #signup_section li:first-child {margin: 0 40px 0 0;}
63
- #signup_navigation li > div {
64
- border: 1px solid #398235;
65
- -moz-border-radius: 8px;
66
- border-radius: 8px;
67
- overflow: hidden;
68
- }
69
- #signup_navigation li .form_description {
70
- background: #398235;
71
- border-bottom: 1px solid #398235;
72
- -moz-border-radius-topright: 8px;
73
- -moz-border-radius-topleft: 8px;
74
- border-top-right-radius: 8px;
75
- border-top-left-radius: 8px;
76
- color: #fff;
77
- font-size: 85%;
78
- font-weight: bold;
79
- line-height: 200%;
80
- margin: 0 0 1.5em;
81
- text-align: center;
82
- }
83
- #signup_section .colContainer {margin: 0 20px 1em;}
84
- #signup_section input {width: 240px;}
85
- #signup_section input[type=submit] {
86
- margin: 0 20px 20px 0;
87
- width: auto;
88
- }
89
- #signup_section label {width: 150px;}
90
- label {
91
- color: #398235;
92
- display: inline-block;
93
- font: bold 85%/1.5em sans-serif;
94
- width: 150px;
95
- }
96
- input,
97
- textarea {
98
- border: 1px solid #398235;
99
- line-height: 1.5em;
100
- }
101
- textarea {
102
- height: 150px;
103
- line-height: 1.25em;
104
- margin: 0 0 1em;
105
- width: 100%;
106
- }
107
- input[type=submit],
108
- #main__section .navigation li a,
109
- .instanceActions a {
110
- background: -moz-linear-gradient(top, #c9de96 0%, #398235 100%);
111
- background: linear-gradient(top, #c9de96 0%,#398235 100%);
112
- border: 1px solid #398235;
113
- -moz-border-radius: 8px;
114
- border-radius: 8px;
115
- color: #fff;
116
- font: bold 93% sans-serif;
117
- margin: 0 0 0 150px;
118
- padding: 5px 10px;
119
- text-decoration: none;
120
- text-transform: uppercase;
121
- width: auto;
122
- }
123
- input[type=submit]:hover,
124
- #main__section .navigation li a:hover,
125
- .instanceActions a:hover {
126
- background: -moz-linear-gradient(top, #398235 0%, #c9de96 100%);
127
- background: linear-gradient(top, #398235 0%,#c9de96 100%);
128
- color: #fff;
129
- cursor: pointer;
130
- font-weight: bold;
131
- }
132
- #main__section #main_navigation {
133
- border-bottom: 1px solid #398235;
134
- margin: 0 20px 20px;
135
- padding: 0 0 20px;
136
- text-align: center;
137
- }
138
- #main__section #main_navigation li {
139
- display: inline-block;
140
- margin: 0 10px;
141
- }
142
- #main__section > #main_navigation li a,
143
- #main__section > .content > .section > .navigation li a {margin: 0;}
144
- #main__section > .content {margin: 20px;}
145
- #main__section > .content > .section {
146
- overflow: hidden;
147
- padding: 0 0 0 225px;
148
- }
149
- #main__section > .content h1,
150
- #main__section > .content .sectionDescription,
151
- #main__section > .content .navigation {
152
- clear: left;
153
- float: left;
154
- margin: 0 0 0 -225px;
155
- width: 200px;
156
- }
157
- #main__section > .content h1 {
158
- color: #398235;
159
- font: bold 167%/150% "Rockwell STD", Rockwell, serif;
160
- text-transform: capitalize;
161
- }
162
- #main__section .navigation li {
163
- display: block;
164
- margin: 0 0 0.25em;
165
- }
166
- #main__section .content .navigation li a {
167
- display: block;
168
- font-size: 77%;
169
- text-transform: none;
170
- }
171
- #main__section > .content > .section > .content {
172
- float: left;
173
- width: 695px;
174
- }
175
- #main__section > .content > .section > .content > .instanceContainer {
176
- border: 1px solid #398235;
177
- -moz-border-radius: 8px;
178
- border-radius: 8px;
179
- margin: 0 0 2em;
180
- }
181
- #main__section > .content > .section > .content .instanceContainer .instanceContainer {
182
- border: 1px solid #398235;
183
- border-width: 1px 0 0 1px;
184
- margin: 0 0 0 5em;
185
- }
186
- #main__section > .content > .section > .content .instance {
187
- overflow: hidden;
188
- padding: 42px 10px 10px 145px;
189
- position: relative;
190
- }
191
- #main__section > .content > .section > .content .private_messageInstance {padding: 10px;}
192
- .post__titleColContainer {
193
- background: #398235;
194
- border-bottom: 1px solid #398235;
195
- color: #fff;
196
- height: 32px;
197
- left: 0;
198
- line-height: 32px;
199
- margin: 0;
200
- overflow: hidden;
201
- position: absolute;
202
- top: 0;
203
- width: 100%;
204
- }
205
- .colContainer label {
206
- font-size: 75%;
207
- padding: 0 5px 0 0;
208
- width: auto;
209
- }
210
- .colContainer div {
211
- display: inline-block;
212
- font-size: 75%;
213
- }
214
- #main__section .content > .instanceContainer > .instance > .post__titleColContainer {
215
- -moz-border-radius-topright: 8px;
216
- -moz-border-radius-topleft: 8px;
217
- border-top-right-radius: 8px;
218
- border-top-left-radius: 8px;
219
- }
220
- .instance .post__titleColContainer label {
221
- color: #fff;
222
- font: bold 85%/32px sans-serif;
223
- padding: 0 10px;
224
- }
225
- .instance .post__titleColContainer div {font-size: 93%;}
226
- .post__idColContainer,
227
- .post__author_idColContainer,
228
- .post__thread_idColContainer,
229
- .post__date_createdColContainer,
230
- .post__date_updatedColContainer {
231
- clear: left;
232
- float: left;
233
- margin: 0 0 0.25em -135px;
234
- width: 125px;
235
- }
236
- .post__messageColContainer {font-size: 125%;}
237
- .post__messageColContainer label {display: none;}
238
- .post__messageColContainer p {margin: 0 0 1.5em;}
239
- .post__tagsColContainer {margin: 0 0 0.75em;}
240
- .post__tagsColContainer .col {
241
- overflow: hidden;
242
- vertical-align: middle;
243
- }
244
- .post__tagsColContainer input[type=text] {width: 120px;}
245
- .post__tagsColContainer input[type=submit] {
246
- float: right;
247
- margin: 0 0 0 10px;
248
- padding: 0 5px;
249
- }
250
- .instanceActions {overflow: hidden;}
251
- .instanceActions a,
252
- .instance input[type=submit] {
253
- float: right;
254
- margin: 0;
255
- width: auto;
256
- }
257
- .editing input[type=text] {
258
- background: #DCFCBD;
259
- padding: 1px 5px;
260
- }
261
- .editing input[type=submit] {
262
- float: none;
263
- margin: 0 0 0 5px;
264
- }
265
- #main__section > .content > .section > .content .private_messageInstance label {width: 100px;}
266
- .errorCol {background: #febebe;}
267
- .errorMsg {
268
- color: #EA8989;
269
- font: bold italic 77% sans-serif;
270
- }