marley 0.8.1 → 0.8.2
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/lib/marley/joints/forum.rb +1 -5
- data/lib/marley/plugins/orm_materialized_path.rb +5 -4
- data/rdoc/forum_joint.rb +1 -2
- data/rdoc/forum_load.rb +8 -7
- data/reggae.ebnf +1 -1
- metadata +2 -2
data/lib/marley/joints/forum.rb
CHANGED
@@ -36,11 +36,7 @@ module Marley
|
|
36
36
|
def thread_vals;values_tree;end
|
37
37
|
def thread; tree;end
|
38
38
|
def write_cols
|
39
|
-
new? ? super.push(:
|
40
|
-
end
|
41
|
-
def before_save
|
42
|
-
super
|
43
|
-
self.topic_id||=self.class.max(:topic_id).to_i+1
|
39
|
+
new? ? super.push(:path) : super
|
44
40
|
end
|
45
41
|
def reply
|
46
42
|
new_child(:title => "re: #{title}")
|
@@ -30,17 +30,18 @@ module Marley
|
|
30
30
|
def children_path_arr; children_path.split(SEP).map &:to_i; end
|
31
31
|
def new_child(vals={}); self.class.new({PATH_COL => children_path}.update(vals)); end
|
32
32
|
def depth; path_arr.length; end
|
33
|
+
def rest_cols;super - [PATH_COL];end
|
33
34
|
|
34
35
|
def tree
|
35
|
-
res=block_given? ? (yield self) : [self,[]]
|
36
|
+
res=[block_given? ? (yield self) : [self,[]]]
|
36
37
|
tree_ds.all.sort {|x,y| x.children_path_arr <=> y.children_path_arr}.each do |node|
|
37
|
-
node.path_arr.inject(res) {|arr,i| arr[-1]} << (block_given? ? (yield node) : [node,[]])
|
38
|
+
(1..(node.path_arr.length*2)).inject(res) {|arr,i| arr[-1]} << (block_given? ? (yield node) : [node,[]])
|
38
39
|
end
|
39
|
-
res
|
40
|
+
res[0]
|
40
41
|
end
|
41
42
|
def values_tree
|
42
43
|
tree do |n|
|
43
|
-
|
44
|
+
n.rest_cols.map{|c| n.send(c)} << []
|
44
45
|
end
|
45
46
|
end
|
46
47
|
end
|
data/rdoc/forum_joint.rb
CHANGED
@@ -13,13 +13,12 @@ DB.create_table :users do
|
|
13
13
|
end
|
14
14
|
DB.create_table :messages do
|
15
15
|
primary_key :id
|
16
|
-
integer :topic_id, :index => true
|
17
16
|
text :path, :index => true
|
18
17
|
integer :user_id, :index => true
|
19
18
|
datetime :date_created, :index => true
|
20
19
|
text :message_type, :index => true
|
21
20
|
text :title, :index => true,:null => false
|
22
|
-
clob :
|
21
|
+
clob :message
|
23
22
|
end
|
24
23
|
DB.create_table :messages_users do
|
25
24
|
primary_key :id
|
data/rdoc/forum_load.rb
CHANGED
@@ -6,11 +6,11 @@ require 'factory_girl'
|
|
6
6
|
Sequel::Model.send(:alias_method, :save!, :save)
|
7
7
|
|
8
8
|
USERS=5
|
9
|
-
TOPICS=
|
9
|
+
TOPICS=40
|
10
10
|
TAGS=3
|
11
|
-
REPLIES=
|
11
|
+
REPLIES=4
|
12
12
|
FactoryGirl.define do
|
13
|
-
[:name,:title,:tag,:
|
13
|
+
[:name,:title,:tag,:message].each do |seq|
|
14
14
|
sequence seq do |n|
|
15
15
|
"#{seq.to_s}#{n}"
|
16
16
|
end
|
@@ -23,7 +23,7 @@ FactoryGirl.define do
|
|
23
23
|
factory :post,:class => MR::PublicMessage do |n|
|
24
24
|
user
|
25
25
|
title
|
26
|
-
|
26
|
+
message
|
27
27
|
_public_tags ''
|
28
28
|
_private_tags ''
|
29
29
|
end
|
@@ -31,7 +31,7 @@ FactoryGirl.define do
|
|
31
31
|
user
|
32
32
|
recipients ''
|
33
33
|
title
|
34
|
-
|
34
|
+
message
|
35
35
|
_private_tags ''
|
36
36
|
end
|
37
37
|
factory :public_tag,:class => MR::PublicTag do |n|
|
@@ -50,10 +50,11 @@ USERS.times do
|
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
53
|
-
REPLIES.
|
53
|
+
REPLIES.times do
|
54
54
|
MR::PublicMessage.all.each do |m|
|
55
55
|
rep=m.reply
|
56
|
-
rep.user_id=m[:id].modulo
|
56
|
+
rep.user_id=m[:id].modulo(USERS) + 1
|
57
|
+
rep.message='asdfasdfasdfasdfasdfasdf'
|
57
58
|
rep.save
|
58
59
|
end
|
59
60
|
end
|
data/reggae.ebnf
CHANGED
@@ -35,7 +35,7 @@ new_rec_value ::= boolean_value
|
|
35
35
|
|
36
36
|
search_value ::= boolean_value
|
37
37
|
|
38
|
-
schema_value ::= '[' col_spec |
|
38
|
+
schema_value ::= '[' col_spec | instance_value | instance_list_value (',' colspec | instance_value | instance_list_value)? ']'
|
39
39
|
|
40
40
|
items_value ::= '[' '[' col_value (',' col_value)* ']' (',' '[' col_value (',' col_value)* ']')* ']'
|
41
41
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marley
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Herb Daily
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-01 00:00:00 -03:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|