kublog 0.0.1.1 → 0.9.0

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.
Files changed (162) hide show
  1. data/.gitignore +4 -5
  2. data/.rspec +2 -0
  3. data/Gemfile +3 -1
  4. data/Gemfile.lock +89 -77
  5. data/README.rdoc +102 -61
  6. data/Rakefile +5 -10
  7. data/app/assets/javascripts/kublog/email.js.coffee +24 -9
  8. data/app/assets/javascripts/kublog/posts.js.coffee +46 -19
  9. data/app/assets/javascripts/kublog/shared.js.coffee.erb +1 -1
  10. data/app/assets/javascripts/kublog/wysiwyg.controls.js.coffee +0 -1
  11. data/app/assets/plugins/kublog/ajaxyupload/javascripts/jquery.ajaxyupload.js +1 -1
  12. data/app/assets/stylesheets/kublog/posts.css +2 -2
  13. data/app/controllers/kublog/application_controller.rb +18 -2
  14. data/app/controllers/kublog/categories_controller.rb +2 -2
  15. data/app/controllers/kublog/notifications_controller.rb +13 -0
  16. data/app/controllers/kublog/posts_controller.rb +7 -18
  17. data/app/helpers/kublog/application_helper.rb +15 -0
  18. data/app/helpers/kublog/notifications_helper.rb +4 -0
  19. data/app/helpers/kublog/posts_helper.rb +4 -0
  20. data/app/jobs/kublog/deliver_comment.rb +14 -0
  21. data/app/mailers/kublog/comment_mailer.rb +11 -0
  22. data/app/mailers/kublog/post_mailer.rb +4 -5
  23. data/app/models/kublog/category.rb +13 -5
  24. data/app/models/kublog/comment.rb +17 -6
  25. data/app/models/kublog/notification.rb +27 -0
  26. data/app/models/kublog/post.rb +11 -6
  27. data/app/presenters/kublog/post_form_presenter.rb +19 -0
  28. data/app/presenters/kublog/posts_presenter.rb +7 -1
  29. data/app/uploaders/kublog/file_uploader.rb +0 -3
  30. data/app/views/kublog/comment_mailer/new_comment.html.erb +11 -0
  31. data/app/views/kublog/post_mailer/new_post.html.erb +1 -1
  32. data/app/views/kublog/post_mailer/new_post.liquid.html.erb +9 -1
  33. data/app/views/kublog/posts/_email_form.html.erb +27 -9
  34. data/app/views/kublog/posts/_facebook_form.html.erb +10 -0
  35. data/app/views/kublog/posts/_form.html.erb +7 -45
  36. data/app/views/kublog/posts/_twitter_form.html.erb +11 -0
  37. data/app/views/kublog/posts/edit.html.erb +1 -1
  38. data/app/views/kublog/posts/index.atom.builder +1 -2
  39. data/app/views/kublog/posts/index.rss.builder +20 -0
  40. data/app/views/kublog/posts/new.html.erb +1 -1
  41. data/config/locales/kublog/en.yml +9 -0
  42. data/config/routes.rb +8 -0
  43. data/db/migrate/20110816211552_create_kublog_posts.rb +1 -9
  44. data/db/migrate/20110901205127_create_kublog_notifications.rb +18 -0
  45. data/index.html +10 -0
  46. data/kublog.gemspec +10 -10
  47. data/lib/generators/kublog/install/USAGE +8 -0
  48. data/lib/generators/kublog/install/install_generator.rb +78 -0
  49. data/lib/generators/kublog/install/templates/configuration.rb.tt +45 -0
  50. data/lib/kublog.rb +43 -13
  51. data/lib/kublog/author.rb +2 -3
  52. data/lib/kublog/engine.rb +1 -0
  53. data/lib/kublog/network/email.rb +113 -0
  54. data/lib/kublog/network/facebook.rb +54 -0
  55. data/lib/kublog/network/twitter.rb +55 -0
  56. data/lib/kublog/notifiable.rb +2 -5
  57. data/lib/kublog/processor.rb +27 -0
  58. data/lib/kublog/version.rb +2 -2
  59. data/script/rails +1 -1
  60. data/{test → spec}/dummy/Rakefile +0 -0
  61. data/{test → spec}/dummy/app/assets/javascripts/application.js +0 -0
  62. data/{test → spec}/dummy/app/assets/javascripts/sessions.js +0 -0
  63. data/{test → spec}/dummy/app/assets/javascripts/users.js +0 -0
  64. data/{test → spec}/dummy/app/assets/stylesheets/application.css +0 -0
  65. data/{test → spec}/dummy/app/assets/stylesheets/sessions.css +0 -0
  66. data/{test → spec}/dummy/app/assets/stylesheets/users.css +0 -0
  67. data/{test → spec}/dummy/app/controllers/application_controller.rb +0 -0
  68. data/{test → spec}/dummy/app/controllers/sessions_controller.rb +0 -0
  69. data/{test → spec}/dummy/app/controllers/users_controller.rb +0 -0
  70. data/{test → spec}/dummy/app/helpers/application_helper.rb +0 -0
  71. data/{test → spec}/dummy/app/helpers/error_messages_helper.rb +0 -0
  72. data/{test → spec}/dummy/app/helpers/layout_helper.rb +0 -0
  73. data/{test → spec}/dummy/app/helpers/sessions_helper.rb +0 -0
  74. data/{test → spec}/dummy/app/helpers/users_helper.rb +0 -0
  75. data/{test → spec}/dummy/app/mailers/.gitkeep +0 -0
  76. data/{test → spec}/dummy/app/models/.gitkeep +0 -0
  77. data/{test → spec}/dummy/app/models/ability.rb +0 -0
  78. data/{test → spec}/dummy/app/models/user.rb +1 -5
  79. data/{test → spec}/dummy/app/views/layouts/_account.html.erb +0 -0
  80. data/{test → spec}/dummy/app/views/layouts/application.html.erb +0 -0
  81. data/{test → spec}/dummy/app/views/layouts/kublog/application.html.erb +0 -0
  82. data/{test → spec}/dummy/app/views/sessions/new.html.erb +0 -0
  83. data/{test → spec}/dummy/app/views/users/new.html.erb +0 -0
  84. data/{test → spec}/dummy/config.ru +0 -0
  85. data/{test → spec}/dummy/config/application.rb +0 -0
  86. data/{test → spec}/dummy/config/boot.rb +0 -0
  87. data/{test → spec}/dummy/config/database.yml +0 -0
  88. data/{test → spec}/dummy/config/environment.rb +0 -0
  89. data/{test → spec}/dummy/config/environments/development.rb +0 -0
  90. data/{test → spec}/dummy/config/environments/production.rb +0 -0
  91. data/{test → spec}/dummy/config/environments/test.rb +0 -0
  92. data/{test → spec}/dummy/config/initializers/backtrace_silencers.rb +0 -0
  93. data/{test → spec}/dummy/config/initializers/inflections.rb +0 -0
  94. data/spec/dummy/config/initializers/kublog.rb +34 -0
  95. data/{test → spec}/dummy/config/initializers/mime_types.rb +0 -0
  96. data/{test → spec}/dummy/config/initializers/secret_token.rb +0 -0
  97. data/{test → spec}/dummy/config/initializers/session_store.rb +0 -0
  98. data/{test → spec}/dummy/config/initializers/wrap_parameters.rb +0 -0
  99. data/{test → spec}/dummy/config/locales/en.yml +9 -0
  100. data/{test → spec}/dummy/config/routes.rb +0 -0
  101. data/{test → spec}/dummy/db/migrate/20110816225222_create_users.rb +1 -0
  102. data/{test → spec}/dummy/db/migrate/20110819135547_create_delayed_jobs.rb +0 -0
  103. data/{test → spec}/dummy/db/schema.rb +16 -10
  104. data/{test → spec}/dummy/lib/assets/.gitkeep +0 -0
  105. data/{test → spec}/dummy/log/.gitkeep +0 -0
  106. data/{test → spec}/dummy/public/404.html +0 -0
  107. data/{test → spec}/dummy/public/422.html +0 -0
  108. data/{test → spec}/dummy/public/500.html +0 -0
  109. data/{test → spec}/dummy/public/favicon.ico +0 -0
  110. data/{test → spec}/dummy/script/delayed_job +0 -0
  111. data/{test → spec}/dummy/script/rails +0 -0
  112. data/spec/factories.rb +54 -0
  113. data/spec/fixtures/Adrian.png +0 -0
  114. data/spec/fixtures/rendered_email.html +15 -0
  115. data/spec/lib/author_spec.rb +25 -0
  116. data/spec/lib/network/email_spec.rb +113 -0
  117. data/spec/lib/network/facebook_spec.rb +68 -0
  118. data/spec/lib/network/twitter_spec.rb +68 -0
  119. data/spec/lib/notifiable_spec.rb +23 -0
  120. data/spec/lib/processor_spec.rb +25 -0
  121. data/spec/models/kublog/category_spec.rb +43 -0
  122. data/spec/models/kublog/comment_spec.rb +56 -0
  123. data/spec/models/kublog/image_spec.rb +37 -0
  124. data/spec/models/kublog/notification_spec.rb +53 -0
  125. data/spec/models/kublog/post_spec.rb +63 -0
  126. data/spec/spec_helper.rb +43 -0
  127. metadata +198 -208
  128. data/app/assets/stylesheets/kublog/categories.css +0 -4
  129. data/app/assets/stylesheets/kublog/comments.css +0 -4
  130. data/lib/kublog/notification/email.rb +0 -86
  131. data/lib/kublog/notification/email_job.rb +0 -14
  132. data/lib/kublog/notification/fb_post.rb +0 -43
  133. data/lib/kublog/notification/fb_post_job.rb +0 -16
  134. data/lib/kublog/notification/tweet.rb +0 -68
  135. data/lib/kublog/notification/tweet_job.rb +0 -16
  136. data/test/dummy/test/fixtures/users.yml +0 -9
  137. data/test/dummy/test/functional/sessions_controller_test.rb +0 -7
  138. data/test/dummy/test/functional/users_controller_test.rb +0 -7
  139. data/test/dummy/test/unit/helpers/sessions_helper_test.rb +0 -4
  140. data/test/dummy/test/unit/helpers/users_helper_test.rb +0 -4
  141. data/test/dummy/test/unit/user_test.rb +0 -7
  142. data/test/factories.rb +0 -9
  143. data/test/fixtures/kublog/categories.yml +0 -7
  144. data/test/fixtures/kublog/comments.yml +0 -7
  145. data/test/fixtures/kublog/images.yml +0 -9
  146. data/test/fixtures/kublog/posts.yml +0 -9
  147. data/test/functional/kublog/categories_controller_test.rb +0 -9
  148. data/test/functional/kublog/comments_controller_test.rb +0 -9
  149. data/test/functional/kublog/images_controller_test.rb +0 -9
  150. data/test/functional/kublog/post_mailer_test.rb +0 -9
  151. data/test/functional/kublog/posts_controller_test.rb +0 -9
  152. data/test/integration/navigation_test.rb +0 -10
  153. data/test/kublog_test.rb +0 -7
  154. data/test/test_helper.rb +0 -12
  155. data/test/unit/helpers/kublog/categories_helper_test.rb +0 -6
  156. data/test/unit/helpers/kublog/comments_helper_test.rb +0 -6
  157. data/test/unit/helpers/kublog/images_helper_test.rb +0 -6
  158. data/test/unit/helpers/kublog/posts_helper_test.rb +0 -6
  159. data/test/unit/kublog/category_test.rb +0 -9
  160. data/test/unit/kublog/comment_test.rb +0 -9
  161. data/test/unit/kublog/image_test.rb +0 -9
  162. 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
- test/dummy/db/*.sqlite3
6
- test/dummy/log/*.log
7
- test/dummy/tmp/
8
- test/dummy/public/uploads/
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
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/Gemfile CHANGED
@@ -4,5 +4,7 @@ gemspec
4
4
 
5
5
  # Optional Gems
6
6
  gem 'delayed_job'
7
- gem 'sprockets', '2.0.0.beta.13' # Only here until official release
7
+
8
+ # Development Gems
9
+ gem 'rspec-rails'
8
10
  gem 'ruby-debug19', :require => 'ruby-debug'
@@ -1,111 +1,108 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kublog (0.0.1)
5
- carrierwave (~> 0.5.7)
6
- coffee-script (~> 2.2.0)
7
- fb_graph (~> 1.9.5)
8
- friendly_id (~> 4.0.0.beta8)
9
- jquery-rails (~> 1.0.13)
10
- liquid (~> 2.2.2)
11
- rails (~> 3.1.0.rc5)
12
- rmagick (~> 2.13.1)
13
- sanitize (~> 2.0.3)
14
- twitter (~> 1.6.2)
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.rc6)
20
- actionpack (= 3.1.0.rc6)
19
+ actionmailer (3.1.0)
20
+ actionpack (= 3.1.0)
21
21
  mail (~> 2.3.0)
22
- actionpack (3.1.0.rc6)
23
- activemodel (= 3.1.0.rc6)
24
- activesupport (= 3.1.0.rc6)
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.2)
30
- rack-mount (~> 0.8.1)
31
- rack-test (~> 0.6.0)
32
- sprockets (~> 2.0.0.beta.12)
33
- activemodel (3.1.0.rc6)
34
- activesupport (= 3.1.0.rc6)
35
- bcrypt-ruby (~> 2.1.4)
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.rc6)
39
- activemodel (= 3.1.0.rc6)
40
- activesupport (= 3.1.0.rc6)
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.rc6)
44
- activemodel (= 3.1.0.rc6)
45
- activesupport (= 3.1.0.rc6)
46
- activesupport (3.1.0.rc6)
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 (2.1.4)
52
+ bcrypt-ruby (3.0.0)
53
53
  builder (3.0.0)
54
- carrierwave (0.5.7)
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.2)
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.4)
67
+ execjs (1.2.9)
67
68
  multi_json (~> 1.0)
68
- factory_girl (2.0.4)
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.4)
73
+ faraday (0.7.5)
73
74
  addressable (~> 2.2.6)
74
- multipart-post (~> 1.1.0)
75
- rack (< 2, >= 1.1.0)
76
- faraday_middleware (0.7.0)
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.8.0)
81
- friendly_id (4.0.0.beta8)
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.1)
82
+ httpclient (2.2.3)
85
83
  i18n (0.6.0)
86
- jquery-rails (1.0.13)
84
+ jquery-rails (1.0.18)
87
85
  railties (~> 3.0)
88
86
  thor (~> 0.14)
89
- json (1.5.3)
87
+ json (1.6.1)
90
88
  linecache19 (0.5.12)
91
89
  ruby_core_source (>= 0.1.4)
92
- liquid (2.2.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.16)
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.2)
99
+ polyglot (0.3.3)
103
100
  rack (1.3.2)
104
- rack-cache (1.0.2)
101
+ rack-cache (1.0.3)
105
102
  rack (>= 0.4)
106
- rack-mount (0.8.2)
103
+ rack-mount (0.8.3)
107
104
  rack (>= 1.0.0)
108
- rack-oauth2 (0.9.2)
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.rc6)
120
- actionmailer (= 3.1.0.rc6)
121
- actionpack (= 3.1.0.rc6)
122
- activerecord (= 3.1.0.rc6)
123
- activeresource (= 3.1.0.rc6)
124
- activesupport (= 3.1.0.rc6)
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.rc6)
127
- railties (3.1.0.rc6)
128
- actionpack (= 3.1.0.rc6)
129
- activesupport (= 3.1.0.rc6)
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.2)
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 (< 1.6, >= 1.4.4)
158
+ nokogiri (>= 1.4.4, < 1.6)
149
159
  simple_oauth (0.1.5)
150
- sprockets (2.0.0.beta.13)
160
+ sprockets (2.0.0)
151
161
  hike (~> 1.2)
152
162
  rack (~> 1.0)
153
- tilt (!= 1.3.0, ~> 1.1)
163
+ tilt (~> 1.1, != 1.3.0)
154
164
  sqlite3 (1.3.4)
155
165
  thor (0.14.6)
156
- tilt (1.3.2)
166
+ tilt (1.3.3)
157
167
  treetop (1.4.10)
158
168
  polyglot
159
169
  polyglot (>= 0.3.1)
160
- twitter (1.6.2)
161
- faraday (~> 0.7.4)
162
- faraday_middleware (~> 0.7.0)
163
- hashie (~> 1.1.0)
164
- multi_json (~> 1.0.0)
165
- multi_xml (~> 0.2.0)
166
- simple_oauth (~> 0.1.5)
167
- tzinfo (0.3.29)
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
@@ -1,102 +1,143 @@
1
1
  = Kublog
2
2
 
3
- Kublog is a complete yet simple way to have a Product Blog that integrates with your apps user base. It includes social sharing, atom feeds and moderated comments.
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 in alpha and under continuous development, hackers welcome.
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
- == What you need
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
- * Bundler
24
+ * ActiveRecord
24
25
 
25
- == Install
26
+ In your Gemfile
26
27
 
27
- Require in your Gemfile
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
- rake kublog:install:migrations
34
-
35
- Mount Kublog on your routes file
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
- == How to Use
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
- On your user model:
58
+ config.i18n.load_path += Dir[File.join(Rails.root, 'config', 'locales', '**', '*.{rb,yml}')]
42
59
 
43
- include Kublog::Author
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
- === User Integration
62
+ == Integrate your Users
47
63
 
48
- Kublog User Integration depends on two functioning methods living on Kublog::ApplicationController
64
+ The install generator will create the file **controllers/kublog/application_controller**.
49
65
 
50
- * current_user
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
- ==== Basic User Management
68
+ After you finish, it might will look something like this:
54
69
 
55
- If you are currently storing your users on session[:user_id] and have the method *admin?* for your user class, things should just work.
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
- ==== Devise
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
- Replace this line
80
+ === Author#to_s
60
81
 
61
- include UserIntegration::Common
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
- Override current_user, is_admin? methods for Kublog::ApplicationController
84
+ def to_s
85
+ "#{self.name} #{self.last_name}"
86
+ end
70
87
 
71
- Override admin? for your Kublog::Author class
88
+ == Add E-mail Notifications
72
89
 
73
- TODO: Better docs
74
-
75
- ==== Custom Integration, Social Networks and Image Uploading
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
- Take a look at this example configuration:
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 = 'xxx'
91
- twitter.consumer_secret = 'xxx'
92
- twitter.oauth_token = 'xxx'
93
- twitter.oauth_token_secret = 'xxx'
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
- Will include much more documentation as development continues, please be patient.
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.