commentem 1.0.0 → 1.0.1
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/Manifest +10 -11
- data/README.rdoc +67 -111
- data/Rakefile +2 -2
- data/commentem.gemspec +30 -30
- metadata +16 -5
data/Manifest
CHANGED
@@ -1,11 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
init.rb
|
5
|
-
lib/commentem.rb
|
6
|
-
lib/commentem/commentable.rb
|
7
|
-
lib/commentem/commenter.rb
|
8
|
-
lib/generators/commentem_generator.rb
|
9
|
-
lib/generators/templates/migration.rb
|
10
|
-
lib/generators/templates/model.rb
|
11
|
-
Manifest
|
1
|
+
Manifest
|
2
|
+
README.rdoc
|
3
|
+
Rakefile
|
4
|
+
init.rb
|
5
|
+
lib/commentem.rb
|
6
|
+
lib/commentem/commentable.rb
|
7
|
+
lib/commentem/commenter.rb
|
8
|
+
lib/generators/commentem_generator.rb
|
9
|
+
lib/generators/templates/migration.rb
|
10
|
+
lib/generators/templates/model.rb
|
data/README.rdoc
CHANGED
@@ -1,112 +1,68 @@
|
|
1
|
-
= Commentem
|
2
|
-
|
3
|
-
Rails gem for building a commenting systems by using Active Records.
|
4
|
-
|
5
|
-
by Peter Wong <peter@peterwongpp.com>
|
6
|
-
|
7
|
-
GitHub Project: http://github.com/peterwongpp/commentem
|
8
|
-
|
9
|
-
-----
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
@
|
50
|
-
|
51
|
-
@
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
# To comment:
|
69
|
-
@user1 = User.find(1) # The user who gives the comment
|
70
|
-
@user2 = User.find(2) # The user who receives the comment
|
71
|
-
|
72
|
-
@user1.comment(@user2, "comment goes to here")
|
73
|
-
|
74
|
-
# To read comments:
|
75
|
-
@user = User.fond(2)
|
76
|
-
|
77
|
-
@user.comments
|
78
|
-
|
79
|
-
---
|
80
|
-
|
81
|
-
# Case 3
|
82
|
-
# A user can comment on users or posts
|
83
|
-
|
84
|
-
class User < ActiveRecord::Base
|
85
|
-
acts_as_commenter
|
86
|
-
acts_as_commentable
|
87
|
-
end
|
88
|
-
|
89
|
-
class Post < ActiveRecord::Base
|
90
|
-
acts_as_commentable
|
91
|
-
end
|
92
|
-
|
93
|
-
# To comment
|
94
|
-
@user = User.find(1)
|
95
|
-
@user2 = User.find(2)
|
96
|
-
@post = Post.find(1)
|
97
|
-
|
98
|
-
@user.comment(@user2, "comment goes to here")
|
99
|
-
@user.comment(@post, "comment goes to here")
|
100
|
-
|
101
|
-
# To read comments:
|
102
|
-
|
103
|
-
@user = User.find(1)
|
104
|
-
@user2 = User.find(2)
|
105
|
-
@post = Post.find(1)
|
106
|
-
|
107
|
-
@user2.comments
|
108
|
-
@post.comments
|
109
|
-
|
110
|
-
@user.comments # retrieve all comments from @user, including on @user2 and @post
|
111
|
-
@user.comments_on(@user2) # same as @user2.comments
|
1
|
+
= Commentem
|
2
|
+
|
3
|
+
Rails gem for building a commenting systems by using Active Records.
|
4
|
+
|
5
|
+
by Peter Wong <peter@peterwongpp.com>
|
6
|
+
|
7
|
+
GitHub Project: http://github.com/peterwongpp/commentem
|
8
|
+
|
9
|
+
-----
|
10
|
+
|
11
|
+
TODO List:
|
12
|
+
|
13
|
+
* Better documentation (Making use of rdoc and ri)
|
14
|
+
* Write tests
|
15
|
+
|
16
|
+
== Installation
|
17
|
+
|
18
|
+
=== Rails 3
|
19
|
+
|
20
|
+
If you would like to install it as gem, put this in your Gemfile:
|
21
|
+
|
22
|
+
gem 'commentem'
|
23
|
+
|
24
|
+
If you would rather like to install it as plugin, run this command in your console:
|
25
|
+
|
26
|
+
rails plugin install git://github.com/peterwongpp/commentem.git
|
27
|
+
|
28
|
+
And then run:
|
29
|
+
|
30
|
+
rake generate commentem
|
31
|
+
rake db:migrate
|
32
|
+
|
33
|
+
== Usage
|
34
|
+
|
35
|
+
Just add `acts_as_commenter` and `acts_as_commentable` to your models. You could mix them in the same model if you like. See the example below:
|
36
|
+
|
37
|
+
# A user can comment on users or posts
|
38
|
+
|
39
|
+
class User < ActiveRecord::Base
|
40
|
+
acts_as_commenter
|
41
|
+
acts_as_commentable
|
42
|
+
end
|
43
|
+
|
44
|
+
class Post < ActiveRecord::Base
|
45
|
+
acts_as_commentable
|
46
|
+
end
|
47
|
+
|
48
|
+
# To comment
|
49
|
+
@user = User.find(1)
|
50
|
+
@user2 = User.find(2)
|
51
|
+
@post = Post.find(1)
|
52
|
+
|
53
|
+
@user.comment(@user2, "comment goes to here")
|
54
|
+
@user.comment(@post, "comment goes to here")
|
55
|
+
@usr.comment(@user, "you could comment on yourself too")
|
56
|
+
|
57
|
+
# To read comments:
|
58
|
+
|
59
|
+
@user = User.find(1)
|
60
|
+
@user2 = User.find(2)
|
61
|
+
@post = Post.find(1)
|
62
|
+
|
63
|
+
@user2.comments
|
64
|
+
@post.comments
|
65
|
+
|
66
|
+
@user.comments # retrieve all comments from @user, including on @user2 and @post
|
67
|
+
@user.comments_on(@user2) # same as @user2.comments
|
112
68
|
@user.comments_on(@post) # same as @post.comments
|
data/Rakefile
CHANGED
@@ -2,9 +2,9 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('commentem', '1.0.
|
5
|
+
Echoe.new('commentem', '1.0.1') do |p|
|
6
6
|
p.description = "A generic commenting system."
|
7
|
-
p.url = "http://github.com/peterwongpp/
|
7
|
+
p.url = "http://github.com/peterwongpp/Commentem"
|
8
8
|
p.author = "Peter Wong"
|
9
9
|
p.email = "peter@peterwongpp.com"
|
10
10
|
p.ignore_pattern = ["tmp/*", "script/*"]
|
data/commentem.gemspec
CHANGED
@@ -1,30 +1,30 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
|
-
Gem::Specification.new do |s|
|
4
|
-
s.name = %q{commentem}
|
5
|
-
s.version = "1.0.
|
6
|
-
|
7
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Peter Wong"]
|
9
|
-
s.date = %q{2011-05-
|
10
|
-
s.description = %q{A generic commenting system.}
|
11
|
-
s.email = %q{peter@peterwongpp.com}
|
12
|
-
s.extra_rdoc_files = ["README.rdoc", "lib/commentem.rb", "lib/commentem/commentable.rb", "lib/commentem/commenter.rb", "lib/generators/commentem_generator.rb", "lib/generators/templates/migration.rb", "lib/generators/templates/model.rb"]
|
13
|
-
s.files = ["Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/commentem.rb", "lib/commentem/commentable.rb", "lib/commentem/commenter.rb", "lib/generators/commentem_generator.rb", "lib/generators/templates/migration.rb", "lib/generators/templates/model.rb", "commentem.gemspec"]
|
14
|
-
s.homepage = %q{http://github.com/peterwongpp/
|
15
|
-
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Commentem", "--main", "README.rdoc"]
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
s.rubyforge_project = %q{commentem}
|
18
|
-
s.rubygems_version = %q{1.3.7}
|
19
|
-
s.summary = %q{A generic commenting system.}
|
20
|
-
|
21
|
-
if s.respond_to? :specification_version then
|
22
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
-
s.specification_version = 3
|
24
|
-
|
25
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
-
else
|
27
|
-
end
|
28
|
-
else
|
29
|
-
end
|
30
|
-
end
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{commentem}
|
5
|
+
s.version = "1.0.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Peter Wong"]
|
9
|
+
s.date = %q{2011-05-20}
|
10
|
+
s.description = %q{A generic commenting system.}
|
11
|
+
s.email = %q{peter@peterwongpp.com}
|
12
|
+
s.extra_rdoc_files = ["README.rdoc", "lib/commentem.rb", "lib/commentem/commentable.rb", "lib/commentem/commenter.rb", "lib/generators/commentem_generator.rb", "lib/generators/templates/migration.rb", "lib/generators/templates/model.rb"]
|
13
|
+
s.files = ["Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/commentem.rb", "lib/commentem/commentable.rb", "lib/commentem/commenter.rb", "lib/generators/commentem_generator.rb", "lib/generators/templates/migration.rb", "lib/generators/templates/model.rb", "commentem.gemspec"]
|
14
|
+
s.homepage = %q{http://github.com/peterwongpp/Commentem}
|
15
|
+
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Commentem", "--main", "README.rdoc"]
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubyforge_project = %q{commentem}
|
18
|
+
s.rubygems_version = %q{1.3.7}
|
19
|
+
s.summary = %q{A generic commenting system.}
|
20
|
+
|
21
|
+
if s.respond_to? :specification_version then
|
22
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
+
s.specification_version = 3
|
24
|
+
|
25
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
26
|
+
else
|
27
|
+
end
|
28
|
+
else
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commentem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
6
10
|
platform: ruby
|
7
11
|
authors:
|
8
12
|
- Peter Wong
|
@@ -10,7 +14,8 @@ autorequire:
|
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
16
|
|
13
|
-
date: 2011-05-
|
17
|
+
date: 2011-05-20 00:00:00 +08:00
|
18
|
+
default_executable:
|
14
19
|
dependencies: []
|
15
20
|
|
16
21
|
description: A generic commenting system.
|
@@ -39,7 +44,8 @@ files:
|
|
39
44
|
- lib/generators/templates/migration.rb
|
40
45
|
- lib/generators/templates/model.rb
|
41
46
|
- commentem.gemspec
|
42
|
-
|
47
|
+
has_rdoc: true
|
48
|
+
homepage: http://github.com/peterwongpp/Commentem
|
43
49
|
licenses: []
|
44
50
|
|
45
51
|
post_install_message:
|
@@ -57,17 +63,22 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
57
63
|
requirements:
|
58
64
|
- - ">="
|
59
65
|
- !ruby/object:Gem::Version
|
66
|
+
segments:
|
67
|
+
- 0
|
60
68
|
version: "0"
|
61
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
70
|
none: false
|
63
71
|
requirements:
|
64
72
|
- - ">="
|
65
73
|
- !ruby/object:Gem::Version
|
74
|
+
segments:
|
75
|
+
- 1
|
76
|
+
- 2
|
66
77
|
version: "1.2"
|
67
78
|
requirements: []
|
68
79
|
|
69
80
|
rubyforge_project: commentem
|
70
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.3.7
|
71
82
|
signing_key:
|
72
83
|
specification_version: 3
|
73
84
|
summary: A generic commenting system.
|