kublog 0.0.1.1 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -5
- data/.rspec +2 -0
- data/Gemfile +3 -1
- data/Gemfile.lock +89 -77
- data/README.rdoc +102 -61
- data/Rakefile +5 -10
- data/app/assets/javascripts/kublog/email.js.coffee +24 -9
- data/app/assets/javascripts/kublog/posts.js.coffee +46 -19
- data/app/assets/javascripts/kublog/shared.js.coffee.erb +1 -1
- data/app/assets/javascripts/kublog/wysiwyg.controls.js.coffee +0 -1
- data/app/assets/plugins/kublog/ajaxyupload/javascripts/jquery.ajaxyupload.js +1 -1
- data/app/assets/stylesheets/kublog/posts.css +2 -2
- data/app/controllers/kublog/application_controller.rb +18 -2
- data/app/controllers/kublog/categories_controller.rb +2 -2
- data/app/controllers/kublog/notifications_controller.rb +13 -0
- data/app/controllers/kublog/posts_controller.rb +7 -18
- data/app/helpers/kublog/application_helper.rb +15 -0
- data/app/helpers/kublog/notifications_helper.rb +4 -0
- data/app/helpers/kublog/posts_helper.rb +4 -0
- data/app/jobs/kublog/deliver_comment.rb +14 -0
- data/app/mailers/kublog/comment_mailer.rb +11 -0
- data/app/mailers/kublog/post_mailer.rb +4 -5
- data/app/models/kublog/category.rb +13 -5
- data/app/models/kublog/comment.rb +17 -6
- data/app/models/kublog/notification.rb +27 -0
- data/app/models/kublog/post.rb +11 -6
- data/app/presenters/kublog/post_form_presenter.rb +19 -0
- data/app/presenters/kublog/posts_presenter.rb +7 -1
- data/app/uploaders/kublog/file_uploader.rb +0 -3
- data/app/views/kublog/comment_mailer/new_comment.html.erb +11 -0
- data/app/views/kublog/post_mailer/new_post.html.erb +1 -1
- data/app/views/kublog/post_mailer/new_post.liquid.html.erb +9 -1
- data/app/views/kublog/posts/_email_form.html.erb +27 -9
- data/app/views/kublog/posts/_facebook_form.html.erb +10 -0
- data/app/views/kublog/posts/_form.html.erb +7 -45
- data/app/views/kublog/posts/_twitter_form.html.erb +11 -0
- data/app/views/kublog/posts/edit.html.erb +1 -1
- data/app/views/kublog/posts/index.atom.builder +1 -2
- data/app/views/kublog/posts/index.rss.builder +20 -0
- data/app/views/kublog/posts/new.html.erb +1 -1
- data/config/locales/kublog/en.yml +9 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20110816211552_create_kublog_posts.rb +1 -9
- data/db/migrate/20110901205127_create_kublog_notifications.rb +18 -0
- data/index.html +10 -0
- data/kublog.gemspec +10 -10
- data/lib/generators/kublog/install/USAGE +8 -0
- data/lib/generators/kublog/install/install_generator.rb +78 -0
- data/lib/generators/kublog/install/templates/configuration.rb.tt +45 -0
- data/lib/kublog.rb +43 -13
- data/lib/kublog/author.rb +2 -3
- data/lib/kublog/engine.rb +1 -0
- data/lib/kublog/network/email.rb +113 -0
- data/lib/kublog/network/facebook.rb +54 -0
- data/lib/kublog/network/twitter.rb +55 -0
- data/lib/kublog/notifiable.rb +2 -5
- data/lib/kublog/processor.rb +27 -0
- data/lib/kublog/version.rb +2 -2
- data/script/rails +1 -1
- data/{test → spec}/dummy/Rakefile +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/sessions.js +0 -0
- data/{test → spec}/dummy/app/assets/javascripts/users.js +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/sessions.css +0 -0
- data/{test → spec}/dummy/app/assets/stylesheets/users.css +0 -0
- data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
- data/{test → spec}/dummy/app/controllers/sessions_controller.rb +0 -0
- data/{test → spec}/dummy/app/controllers/users_controller.rb +0 -0
- data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
- data/{test → spec}/dummy/app/helpers/error_messages_helper.rb +0 -0
- data/{test → spec}/dummy/app/helpers/layout_helper.rb +0 -0
- data/{test → spec}/dummy/app/helpers/sessions_helper.rb +0 -0
- data/{test → spec}/dummy/app/helpers/users_helper.rb +0 -0
- data/{test → spec}/dummy/app/mailers/.gitkeep +0 -0
- data/{test → spec}/dummy/app/models/.gitkeep +0 -0
- data/{test → spec}/dummy/app/models/ability.rb +0 -0
- data/{test → spec}/dummy/app/models/user.rb +1 -5
- data/{test → spec}/dummy/app/views/layouts/_account.html.erb +0 -0
- data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
- data/{test → spec}/dummy/app/views/layouts/kublog/application.html.erb +0 -0
- data/{test → spec}/dummy/app/views/sessions/new.html.erb +0 -0
- data/{test → spec}/dummy/app/views/users/new.html.erb +0 -0
- data/{test → spec}/dummy/config.ru +0 -0
- data/{test → spec}/dummy/config/application.rb +0 -0
- data/{test → spec}/dummy/config/boot.rb +0 -0
- data/{test → spec}/dummy/config/database.yml +0 -0
- data/{test → spec}/dummy/config/environment.rb +0 -0
- data/{test → spec}/dummy/config/environments/development.rb +0 -0
- data/{test → spec}/dummy/config/environments/production.rb +0 -0
- data/{test → spec}/dummy/config/environments/test.rb +0 -0
- data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
- data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
- data/spec/dummy/config/initializers/kublog.rb +34 -0
- data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
- data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
- data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
- data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
- data/{test → spec}/dummy/config/locales/en.yml +9 -0
- data/{test → spec}/dummy/config/routes.rb +0 -0
- data/{test → spec}/dummy/db/migrate/20110816225222_create_users.rb +1 -0
- data/{test → spec}/dummy/db/migrate/20110819135547_create_delayed_jobs.rb +0 -0
- data/{test → spec}/dummy/db/schema.rb +16 -10
- data/{test → spec}/dummy/lib/assets/.gitkeep +0 -0
- data/{test → spec}/dummy/log/.gitkeep +0 -0
- data/{test → spec}/dummy/public/404.html +0 -0
- data/{test → spec}/dummy/public/422.html +0 -0
- data/{test → spec}/dummy/public/500.html +0 -0
- data/{test → spec}/dummy/public/favicon.ico +0 -0
- data/{test → spec}/dummy/script/delayed_job +0 -0
- data/{test → spec}/dummy/script/rails +0 -0
- data/spec/factories.rb +54 -0
- data/spec/fixtures/Adrian.png +0 -0
- data/spec/fixtures/rendered_email.html +15 -0
- data/spec/lib/author_spec.rb +25 -0
- data/spec/lib/network/email_spec.rb +113 -0
- data/spec/lib/network/facebook_spec.rb +68 -0
- data/spec/lib/network/twitter_spec.rb +68 -0
- data/spec/lib/notifiable_spec.rb +23 -0
- data/spec/lib/processor_spec.rb +25 -0
- data/spec/models/kublog/category_spec.rb +43 -0
- data/spec/models/kublog/comment_spec.rb +56 -0
- data/spec/models/kublog/image_spec.rb +37 -0
- data/spec/models/kublog/notification_spec.rb +53 -0
- data/spec/models/kublog/post_spec.rb +63 -0
- data/spec/spec_helper.rb +43 -0
- metadata +198 -208
- data/app/assets/stylesheets/kublog/categories.css +0 -4
- data/app/assets/stylesheets/kublog/comments.css +0 -4
- data/lib/kublog/notification/email.rb +0 -86
- data/lib/kublog/notification/email_job.rb +0 -14
- data/lib/kublog/notification/fb_post.rb +0 -43
- data/lib/kublog/notification/fb_post_job.rb +0 -16
- data/lib/kublog/notification/tweet.rb +0 -68
- data/lib/kublog/notification/tweet_job.rb +0 -16
- data/test/dummy/test/fixtures/users.yml +0 -9
- data/test/dummy/test/functional/sessions_controller_test.rb +0 -7
- data/test/dummy/test/functional/users_controller_test.rb +0 -7
- data/test/dummy/test/unit/helpers/sessions_helper_test.rb +0 -4
- data/test/dummy/test/unit/helpers/users_helper_test.rb +0 -4
- data/test/dummy/test/unit/user_test.rb +0 -7
- data/test/factories.rb +0 -9
- data/test/fixtures/kublog/categories.yml +0 -7
- data/test/fixtures/kublog/comments.yml +0 -7
- data/test/fixtures/kublog/images.yml +0 -9
- data/test/fixtures/kublog/posts.yml +0 -9
- data/test/functional/kublog/categories_controller_test.rb +0 -9
- data/test/functional/kublog/comments_controller_test.rb +0 -9
- data/test/functional/kublog/images_controller_test.rb +0 -9
- data/test/functional/kublog/post_mailer_test.rb +0 -9
- data/test/functional/kublog/posts_controller_test.rb +0 -9
- data/test/integration/navigation_test.rb +0 -10
- data/test/kublog_test.rb +0 -7
- data/test/test_helper.rb +0 -12
- data/test/unit/helpers/kublog/categories_helper_test.rb +0 -6
- data/test/unit/helpers/kublog/comments_helper_test.rb +0 -6
- data/test/unit/helpers/kublog/images_helper_test.rb +0 -6
- data/test/unit/helpers/kublog/posts_helper_test.rb +0 -6
- data/test/unit/kublog/category_test.rb +0 -9
- data/test/unit/kublog/comment_test.rb +0 -9
- data/test/unit/kublog/image_test.rb +0 -9
- data/test/unit/kublog/post_test.rb +0 -19
data/.gitignore
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
log/*.log
|
3
3
|
pkg/
|
4
4
|
*.gem
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
test/dummy/config/initializers/kublog.rb
|
5
|
+
spec/dummy/db/*.sqlite3
|
6
|
+
spec/dummy/log/*.log
|
7
|
+
spec/dummy/tmp/
|
8
|
+
spec/dummy/public/uploads/
|
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,111 +1,108 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kublog (0.0
|
5
|
-
carrierwave
|
6
|
-
coffee-script (
|
7
|
-
fb_graph
|
8
|
-
friendly_id (
|
9
|
-
jquery-rails (
|
10
|
-
liquid
|
11
|
-
rails (
|
12
|
-
rmagick
|
13
|
-
sanitize
|
14
|
-
twitter
|
4
|
+
kublog (0.9.0)
|
5
|
+
carrierwave
|
6
|
+
coffee-script (>= 2.2.0)
|
7
|
+
fb_graph
|
8
|
+
friendly_id (>= 4.0.0.beta14)
|
9
|
+
jquery-rails (>= 1.0.13)
|
10
|
+
liquid
|
11
|
+
rails (>= 3.1.0)
|
12
|
+
rmagick
|
13
|
+
sanitize
|
14
|
+
twitter
|
15
15
|
|
16
16
|
GEM
|
17
17
|
remote: http://rubygems.org/
|
18
18
|
specs:
|
19
|
-
actionmailer (3.1.0
|
20
|
-
actionpack (= 3.1.0
|
19
|
+
actionmailer (3.1.0)
|
20
|
+
actionpack (= 3.1.0)
|
21
21
|
mail (~> 2.3.0)
|
22
|
-
actionpack (3.1.0
|
23
|
-
activemodel (= 3.1.0
|
24
|
-
activesupport (= 3.1.0
|
22
|
+
actionpack (3.1.0)
|
23
|
+
activemodel (= 3.1.0)
|
24
|
+
activesupport (= 3.1.0)
|
25
25
|
builder (~> 3.0.0)
|
26
26
|
erubis (~> 2.7.0)
|
27
27
|
i18n (~> 0.6)
|
28
28
|
rack (~> 1.3.2)
|
29
|
-
rack-cache (~> 1.0.
|
30
|
-
rack-mount (~> 0.8.
|
31
|
-
rack-test (~> 0.6.
|
32
|
-
sprockets (~> 2.0.0
|
33
|
-
activemodel (3.1.0
|
34
|
-
activesupport (= 3.1.0
|
35
|
-
bcrypt-ruby (~>
|
29
|
+
rack-cache (~> 1.0.3)
|
30
|
+
rack-mount (~> 0.8.2)
|
31
|
+
rack-test (~> 0.6.1)
|
32
|
+
sprockets (~> 2.0.0)
|
33
|
+
activemodel (3.1.0)
|
34
|
+
activesupport (= 3.1.0)
|
35
|
+
bcrypt-ruby (~> 3.0.0)
|
36
36
|
builder (~> 3.0.0)
|
37
37
|
i18n (~> 0.6)
|
38
|
-
activerecord (3.1.0
|
39
|
-
activemodel (= 3.1.0
|
40
|
-
activesupport (= 3.1.0
|
38
|
+
activerecord (3.1.0)
|
39
|
+
activemodel (= 3.1.0)
|
40
|
+
activesupport (= 3.1.0)
|
41
41
|
arel (~> 2.2.1)
|
42
42
|
tzinfo (~> 0.3.29)
|
43
|
-
activeresource (3.1.0
|
44
|
-
activemodel (= 3.1.0
|
45
|
-
activesupport (= 3.1.0
|
46
|
-
activesupport (3.1.0
|
43
|
+
activeresource (3.1.0)
|
44
|
+
activemodel (= 3.1.0)
|
45
|
+
activesupport (= 3.1.0)
|
46
|
+
activesupport (3.1.0)
|
47
47
|
multi_json (~> 1.0)
|
48
48
|
addressable (2.2.6)
|
49
49
|
archive-tar-minitar (0.5.2)
|
50
50
|
arel (2.2.1)
|
51
51
|
attr_required (0.0.3)
|
52
|
-
bcrypt-ruby (
|
52
|
+
bcrypt-ruby (3.0.0)
|
53
53
|
builder (3.0.0)
|
54
|
-
carrierwave (0.5.
|
54
|
+
carrierwave (0.5.8)
|
55
55
|
activesupport (~> 3.0)
|
56
56
|
coffee-script (2.2.0)
|
57
57
|
coffee-script-source
|
58
58
|
execjs
|
59
|
-
coffee-script-source (1.1.
|
59
|
+
coffee-script-source (1.1.3)
|
60
60
|
columnize (0.3.4)
|
61
61
|
daemons (1.1.4)
|
62
62
|
delayed_job (2.1.4)
|
63
63
|
activesupport (~> 3.0)
|
64
64
|
daemons
|
65
|
+
diff-lcs (1.1.3)
|
65
66
|
erubis (2.7.0)
|
66
|
-
execjs (1.2.
|
67
|
+
execjs (1.2.9)
|
67
68
|
multi_json (~> 1.0)
|
68
|
-
factory_girl (2.0.
|
69
|
+
factory_girl (2.0.5)
|
69
70
|
factory_girl_rails (1.1.0)
|
70
71
|
factory_girl (~> 2.0.0)
|
71
72
|
railties (>= 3.0.0)
|
72
|
-
faraday (0.7.
|
73
|
+
faraday (0.7.5)
|
73
74
|
addressable (~> 2.2.6)
|
74
|
-
multipart-post (~> 1.1.
|
75
|
-
rack (
|
76
|
-
|
77
|
-
faraday (~> 0.7.3)
|
78
|
-
fb_graph (1.9.5)
|
75
|
+
multipart-post (~> 1.1.3)
|
76
|
+
rack (>= 1.1.0, < 2)
|
77
|
+
fb_graph (2.2.2)
|
79
78
|
httpclient (>= 2.2.0.2)
|
80
|
-
rack-oauth2 (>= 0.
|
81
|
-
friendly_id (4.0.0.
|
82
|
-
hashie (1.1.0)
|
79
|
+
rack-oauth2 (>= 0.9.4)
|
80
|
+
friendly_id (4.0.0.beta14)
|
83
81
|
hike (1.2.1)
|
84
|
-
httpclient (2.2.
|
82
|
+
httpclient (2.2.3)
|
85
83
|
i18n (0.6.0)
|
86
|
-
jquery-rails (1.0.
|
84
|
+
jquery-rails (1.0.18)
|
87
85
|
railties (~> 3.0)
|
88
86
|
thor (~> 0.14)
|
89
|
-
json (1.
|
87
|
+
json (1.6.1)
|
90
88
|
linecache19 (0.5.12)
|
91
89
|
ruby_core_source (>= 0.1.4)
|
92
|
-
liquid (2.
|
90
|
+
liquid (2.3.0)
|
93
91
|
mail (2.3.0)
|
94
92
|
i18n (>= 0.4.0)
|
95
93
|
mime-types (~> 1.16)
|
96
94
|
treetop (~> 1.4.8)
|
97
|
-
mime-types (1.
|
95
|
+
mime-types (1.17.2)
|
98
96
|
multi_json (1.0.3)
|
99
|
-
multi_xml (0.2.2)
|
100
97
|
multipart-post (1.1.3)
|
101
98
|
nokogiri (1.5.0)
|
102
|
-
polyglot (0.3.
|
99
|
+
polyglot (0.3.3)
|
103
100
|
rack (1.3.2)
|
104
|
-
rack-cache (1.0.
|
101
|
+
rack-cache (1.0.3)
|
105
102
|
rack (>= 0.4)
|
106
|
-
rack-mount (0.8.
|
103
|
+
rack-mount (0.8.3)
|
107
104
|
rack (>= 1.0.0)
|
108
|
-
rack-oauth2 (0.
|
105
|
+
rack-oauth2 (0.11.0)
|
109
106
|
activesupport (>= 2.3)
|
110
107
|
attr_required (>= 0.0.3)
|
111
108
|
httpclient (>= 2.2.0.2)
|
@@ -116,24 +113,37 @@ GEM
|
|
116
113
|
rack
|
117
114
|
rack-test (0.6.1)
|
118
115
|
rack (>= 1.0)
|
119
|
-
rails (3.1.0
|
120
|
-
actionmailer (= 3.1.0
|
121
|
-
actionpack (= 3.1.0
|
122
|
-
activerecord (= 3.1.0
|
123
|
-
activeresource (= 3.1.0
|
124
|
-
activesupport (= 3.1.0
|
116
|
+
rails (3.1.0)
|
117
|
+
actionmailer (= 3.1.0)
|
118
|
+
actionpack (= 3.1.0)
|
119
|
+
activerecord (= 3.1.0)
|
120
|
+
activeresource (= 3.1.0)
|
121
|
+
activesupport (= 3.1.0)
|
125
122
|
bundler (~> 1.0)
|
126
|
-
railties (= 3.1.0
|
127
|
-
railties (3.1.0
|
128
|
-
actionpack (= 3.1.0
|
129
|
-
activesupport (= 3.1.0
|
123
|
+
railties (= 3.1.0)
|
124
|
+
railties (3.1.0)
|
125
|
+
actionpack (= 3.1.0)
|
126
|
+
activesupport (= 3.1.0)
|
130
127
|
rack-ssl (~> 1.3.2)
|
131
128
|
rake (>= 0.8.7)
|
132
129
|
rdoc (~> 3.4)
|
133
130
|
thor (~> 0.14.6)
|
134
131
|
rake (0.9.2)
|
135
|
-
rdoc (3.9.
|
132
|
+
rdoc (3.9.4)
|
136
133
|
rmagick (2.13.1)
|
134
|
+
rspec (2.6.0)
|
135
|
+
rspec-core (~> 2.6.0)
|
136
|
+
rspec-expectations (~> 2.6.0)
|
137
|
+
rspec-mocks (~> 2.6.0)
|
138
|
+
rspec-core (2.6.4)
|
139
|
+
rspec-expectations (2.6.0)
|
140
|
+
diff-lcs (~> 1.1.2)
|
141
|
+
rspec-mocks (2.6.0)
|
142
|
+
rspec-rails (2.6.1)
|
143
|
+
actionpack (~> 3.0)
|
144
|
+
activesupport (~> 3.0)
|
145
|
+
railties (~> 3.0)
|
146
|
+
rspec (~> 2.6.0)
|
137
147
|
ruby-debug-base19 (0.11.25)
|
138
148
|
columnize (>= 0.3.1)
|
139
149
|
linecache19 (>= 0.5.11)
|
@@ -145,26 +155,27 @@ GEM
|
|
145
155
|
ruby_core_source (0.1.5)
|
146
156
|
archive-tar-minitar (>= 0.5.2)
|
147
157
|
sanitize (2.0.3)
|
148
|
-
nokogiri (
|
158
|
+
nokogiri (>= 1.4.4, < 1.6)
|
149
159
|
simple_oauth (0.1.5)
|
150
|
-
sprockets (2.0.0
|
160
|
+
sprockets (2.0.0)
|
151
161
|
hike (~> 1.2)
|
152
162
|
rack (~> 1.0)
|
153
|
-
tilt (
|
163
|
+
tilt (~> 1.1, != 1.3.0)
|
154
164
|
sqlite3 (1.3.4)
|
155
165
|
thor (0.14.6)
|
156
|
-
tilt (1.3.
|
166
|
+
tilt (1.3.3)
|
157
167
|
treetop (1.4.10)
|
158
168
|
polyglot
|
159
169
|
polyglot (>= 0.3.1)
|
160
|
-
twitter (
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
170
|
+
twitter (2.0.0)
|
171
|
+
activesupport (~> 3.0)
|
172
|
+
faraday (~> 0.7)
|
173
|
+
multi_json (~> 1.0)
|
174
|
+
simple_oauth (~> 0.1)
|
175
|
+
twitter-text (~> 1.4)
|
176
|
+
twitter-text (1.4.13)
|
177
|
+
activesupport
|
178
|
+
tzinfo (0.3.31)
|
168
179
|
|
169
180
|
PLATFORMS
|
170
181
|
ruby
|
@@ -173,5 +184,6 @@ DEPENDENCIES
|
|
173
184
|
delayed_job
|
174
185
|
factory_girl_rails
|
175
186
|
kublog!
|
187
|
+
rspec-rails
|
176
188
|
ruby-debug19
|
177
189
|
sqlite3
|
data/README.rdoc
CHANGED
@@ -1,102 +1,143 @@
|
|
1
1
|
= Kublog
|
2
2
|
|
3
|
-
Kublog is a
|
3
|
+
Kublog is a simple yet complete way to have a Product Blog that integrates with your apps user base. It includes social sharing, atom feeds and moderated comments.
|
4
4
|
|
5
5
|
Built for Rails 3.1, Kublog is a complete stack, fully configurable solution.
|
6
6
|
|
7
|
-
Currently
|
7
|
+
Currently live for Rutanet[http://rutanet.com] on http://rutanet.com/blog and other products at Innku[http://innku.com].
|
8
8
|
|
9
9
|
== Features
|
10
10
|
|
11
11
|
* Publish posts with the most basic and simple wysiwyg
|
12
12
|
* Attach multiple images to your content
|
13
13
|
* Share your posts on your Product's Twitter Page and Facebook Fan Page
|
14
|
-
* E-mail personalized versions of your posts to your users
|
14
|
+
* E-mail personalized versions of your posts to all your users
|
15
15
|
* Optional background processing with Delayed Job
|
16
16
|
* Moderated comments from apps users, apps admins, and visitors
|
17
17
|
* Atom feed for main blog and individual post categories
|
18
18
|
|
19
|
-
==
|
19
|
+
== Kublog Basic Usage
|
20
|
+
|
21
|
+
Kublog is a mountable Engine that assumes you use the following tools for development:
|
20
22
|
|
21
|
-
* Ruby 1.9.x
|
22
23
|
* Rails 3.1
|
23
|
-
*
|
24
|
+
* ActiveRecord
|
24
25
|
|
25
|
-
|
26
|
+
In your Gemfile
|
26
27
|
|
27
|
-
|
28
|
-
|
29
|
-
gem 'kublog', '0.0.1'
|
30
|
-
|
31
|
-
Migrate the Kublog posts into your database
|
28
|
+
gem 'kublog', '0.9.0'
|
32
29
|
|
33
|
-
|
34
|
-
|
35
|
-
|
30
|
+
Generate migrations and all the code you'll likely want to customize.
|
31
|
+
|
32
|
+
rails generate kublog:install
|
33
|
+
|
34
|
+
Run the migrations
|
35
|
+
|
36
|
+
rake db:migrate
|
37
|
+
|
38
|
+
Mount the engine on your routes
|
36
39
|
|
37
40
|
mount Kublog::Engine => "/blog(.:format)"
|
41
|
+
|
42
|
+
Include the author module under the model that will have access to create posts on the blog:
|
43
|
+
|
44
|
+
class User < ActiveRecord::Base
|
45
|
+
include Kublog::Author
|
46
|
+
end
|
47
|
+
|
48
|
+
Configure your blog's basic information on **initializers/kublog.rb**
|
49
|
+
|
50
|
+
Kublog.setup do |config|
|
51
|
+
config.blog_name = 'Example blog'
|
52
|
+
config.blog_description = 'Best blog ever'
|
53
|
+
config.default_url_options = {:host => 'www.exampleblog.com'}
|
54
|
+
end
|
38
55
|
|
39
|
-
|
56
|
+
Kublog uses I18n, the install generator will create the file **locales/kublog/en.yml**, make sure to add its content to your own en.yml file or add the following line on your **application.rb** also include the folders under locales:
|
40
57
|
|
41
|
-
|
58
|
+
config.i18n.load_path += Dir[File.join(Rails.root, 'config', 'locales', '**', '*.{rb,yml}')]
|
42
59
|
|
43
|
-
|
44
|
-
include Kublog::Notifiable
|
60
|
+
To get the most of Kublog you'll want to **Integrate your Users**, **Add E-mail Notifications** and **Configure your Social Networks**.
|
45
61
|
|
46
|
-
|
62
|
+
== Integrate your Users
|
47
63
|
|
48
|
-
|
64
|
+
The install generator will create the file **controllers/kublog/application_controller**.
|
49
65
|
|
50
|
-
|
51
|
-
* is_admin?
|
66
|
+
On this file you will see the definitions of two empty methods **current_user** and **is_admin?**. Since Kublog is an isolated mountable Engine, you **will** need to define this methods, even if you have them on your apps application_controller.
|
52
67
|
|
53
|
-
|
68
|
+
After you finish, it might will look something like this:
|
54
69
|
|
55
|
-
|
70
|
+
def current_user
|
71
|
+
@current_user ||= User.find(session[:user_id])
|
72
|
+
end
|
73
|
+
|
74
|
+
def is_admin?
|
75
|
+
@current_user.admin?
|
76
|
+
end
|
56
77
|
|
57
|
-
|
78
|
+
It's **important** to know that if you're using Devise, you won't need a current_user method. If the model you're using is named something other than user, you can call the controller access method inside of **current_user**.
|
58
79
|
|
59
|
-
|
80
|
+
=== Author#to_s
|
60
81
|
|
61
|
-
|
62
|
-
|
63
|
-
With this line
|
64
|
-
|
65
|
-
include UserIntegration::Devise
|
66
|
-
|
67
|
-
==== Uber custom user integration
|
82
|
+
I recommend you define a to_s method for your Author such as:
|
68
83
|
|
69
|
-
|
84
|
+
def to_s
|
85
|
+
"#{self.name} #{self.last_name}"
|
86
|
+
end
|
70
87
|
|
71
|
-
|
88
|
+
== Add E-mail Notifications
|
72
89
|
|
73
|
-
|
74
|
-
|
75
|
-
|
90
|
+
To add E-mail notifications, include the **Kublog::Notifiable** module into the user class that will be notified.
|
91
|
+
|
92
|
+
class User < ActiveRecord::Base
|
93
|
+
include Kublog::Notifiable
|
94
|
+
end
|
76
95
|
|
77
|
-
|
96
|
+
The E-mail from which they will receive the notification is configured in your **kublog.rb** initializer:
|
97
|
+
|
98
|
+
config.author_email "Kublog Test <test@kublog.com>"
|
99
|
+
|
100
|
+
You may also configure a block to specify that the user receives the notification from the author's E-mail:
|
101
|
+
|
102
|
+
config.author_email do |post|
|
103
|
+
post.user.email
|
104
|
+
end
|
105
|
+
=== Configure your social Networks
|
106
|
+
|
107
|
+
Configuring **Twitter** is pretty easy, you might want to create a twitter app on https://dev.twitter.com/
|
108
|
+
|
109
|
+
You will need to feed Kublog:
|
110
|
+
|
111
|
+
* Consumer Key
|
112
|
+
* Consumer Secret
|
113
|
+
* Oauth Token
|
114
|
+
* Oauth Secret
|
115
|
+
|
116
|
+
=== Sample twitter configuration on initializers/kublog.rb
|
78
117
|
|
79
|
-
Kublog.setup do |config|
|
80
|
-
|
81
|
-
config.blog_name = 'Rutanet'
|
82
|
-
config.default_url_options = {:host => 'www.rutanet.com'}
|
83
|
-
config.notification_processing = :immediate # or :delayed_job
|
84
|
-
|
85
|
-
config.user_kinds = %w(shipper carrier logistics)
|
86
|
-
|
87
|
-
config.image_storage = :file # or :s3
|
88
|
-
|
89
118
|
config.twitter do |twitter|
|
90
|
-
twitter.consumer_key = '
|
91
|
-
twitter.consumer_secret = '
|
92
|
-
twitter.oauth_token = '
|
93
|
-
twitter.oauth_token_secret = '
|
119
|
+
twitter.consumer_key = 'your-consumer-key'
|
120
|
+
twitter.consumer_secret = 'your-consumer-secret'
|
121
|
+
twitter.oauth_token = 'your-oauth-token'
|
122
|
+
twitter.oauth_token_secret = 'your-consumer-secret'
|
94
123
|
end
|
95
|
-
|
96
|
-
config.facebook_page_token = 'xxx'
|
97
|
-
|
98
|
-
end
|
99
|
-
|
100
|
-
TODO: More docs
|
101
124
|
|
102
|
-
|
125
|
+
Configuring **Facebook** Fan page posts is a little trickier, you will only need the access token for your Fan Page.
|
126
|
+
|
127
|
+
Find out how to get it here: https://github.com/innku/authorizefb
|
128
|
+
|
129
|
+
=== Sample Facebook configuration on initializers/kublog.rb
|
130
|
+
|
131
|
+
config.facebook_page_token = 'your-page-token'
|
132
|
+
|
133
|
+
== What's coming
|
134
|
+
|
135
|
+
* Drafts
|
136
|
+
* Captcha for unsigned user notifications
|
137
|
+
* Pagination
|
138
|
+
|
139
|
+
If you wish to work on this. Fork it and pull request, please =)
|
140
|
+
|
141
|
+
== Check out the code
|
142
|
+
|
143
|
+
Kublog is made to be as simple as possible so you can modify fork it, modify it and reuse it. Please do.
|