blogit 0.8.0 → 1.0.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +3 -1
  3. data/Rakefile +8 -24
  4. data/app/controllers/blogit/application_controller.rb +5 -16
  5. data/app/controllers/blogit/comments_controller.rb +7 -5
  6. data/app/controllers/blogit/posts_controller.rb +30 -17
  7. data/app/helpers/blogit/posts_helper.rb +1 -1
  8. data/app/models/blogit/comment.rb +23 -27
  9. data/app/models/blogit/post.rb +24 -23
  10. data/app/views/blogit/comments/_admin_links.html.erb +2 -2
  11. data/app/views/blogit/comments/create.js.erb +2 -2
  12. data/app/views/blogit/posts/_empty.html.erb +0 -3
  13. data/app/views/blogit/posts/_form.html.erb +9 -3
  14. data/app/views/blogit/posts/_post_links.html.erb +3 -2
  15. data/app/views/blogit/posts/_related.html.erb +1 -1
  16. data/config/locales/de.yml +50 -0
  17. data/config/locales/en.yml +2 -5
  18. data/config/locales/fr.yml +0 -4
  19. data/config/routes.rb +3 -3
  20. data/db/migrate/20110814091434_create_blogit_posts.rb +15 -0
  21. data/db/migrate/{20110814093229_create_blog_comments.rb → 20110814093229_create_blogit_comments.rb} +3 -3
  22. data/lib/blogit/configuration.rb +26 -1
  23. data/lib/blogit/version.rb +1 -1
  24. data/lib/blogit.rb +1 -2
  25. data/lib/generators/blogit/table_name_migration_generator.rb +15 -0
  26. data/lib/generators/templates/blogit.rb +12 -6
  27. data/lib/generators/templates/rename_blogit_tables.rb +21 -0
  28. data/spec/controllers/blogit/comments_controller_spec.rb +1 -1
  29. data/spec/controllers/blogit/posts_controller_spec.rb +57 -13
  30. data/spec/dummy/app/views/layouts/custom.html.erb +34 -0
  31. data/spec/dummy/config/application.rb +12 -7
  32. data/spec/dummy/config/database.yml +28 -24
  33. data/spec/dummy/config/environments/development.rb +23 -14
  34. data/spec/dummy/config/environments/production.rb +55 -22
  35. data/spec/dummy/config/environments/test.rb +17 -16
  36. data/spec/dummy/config/initializers/blogit.rb +5 -8
  37. data/spec/dummy/config/initializers/secret_token.rb +11 -2
  38. data/spec/dummy/db/development.sqlite3 +0 -0
  39. data/{db/migrate/20110814103306_acts_as_taggable_on_migration.rb → spec/dummy/db/migrate/20140511174024_acts_as_taggable_on_migration.acts_as_taggable_on_engine.rb} +6 -3
  40. data/spec/dummy/db/migrate/20140511174025_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
  41. data/spec/dummy/db/migrate/20140511174026_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
  42. data/spec/dummy/db/migrate/20140511174028_create_blogit_posts.blogit.rb +16 -0
  43. data/spec/dummy/db/migrate/20140511174029_create_blogit_comments.blogit.rb +16 -0
  44. data/spec/dummy/db/schema.rb +32 -29
  45. data/spec/dummy/db/test.sqlite3 +0 -0
  46. data/spec/dummy/log/development.log +1444 -2970
  47. data/spec/dummy/log/test.log +9631 -29732
  48. data/spec/dummy/tmp/cache/assets/CB5/DD0/sprockets%2F346324d2a51df58457807bee661c449c +0 -0
  49. data/spec/dummy/tmp/cache/assets/CB6/ED0/sprockets%2F4390d06699f3ad4262e342be530f9f91 +0 -0
  50. data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  51. data/spec/dummy/tmp/cache/assets/CE7/230/sprockets%2F6f493a817d97133a8dbf674bcd322670 +0 -0
  52. data/spec/dummy/tmp/cache/assets/{D35/E90/sprockets%2F9542f66fea1d10b7924f3b6b31e1e2e0 → CEA/490/sprockets%2F9697d4fb1ed26d80f3c715611c8d4373} +0 -0
  53. data/spec/dummy/tmp/cache/assets/CEE/310/sprockets%2F89642af8492e579dcd7162a0e2b7f155 +0 -0
  54. data/spec/dummy/tmp/cache/assets/D01/8C0/sprockets%2F332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
  55. data/spec/dummy/tmp/cache/assets/D11/CC0/sprockets%2F3a12dfa6665b5318fa99d097203ac7e7 +0 -0
  56. data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  57. data/spec/dummy/tmp/cache/assets/{D67/C10/sprockets%2Fa58c567f1eae28b401a6e9a0b3b71d93 → D3D/1E0/sprockets%2Ffbaabd57fa2c9d426f0c318156705667} +0 -0
  58. data/spec/dummy/tmp/cache/assets/D3E/920/sprockets%2F3efa8d0fc958c223647cb704183b65ca +0 -0
  59. data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  60. data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  61. data/spec/dummy/tmp/cache/assets/D61/6F0/sprockets%2F02da53eeca228bcef0c49278517111fe +0 -0
  62. data/spec/dummy/tmp/cache/assets/DCA/9B0/sprockets%2Fdf0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
  63. data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  64. data/spec/dummy/tmp/cache/assets/E02/A60/sprockets%2Fb32faeede196f7a933c3a2794e7ed0bd +0 -0
  65. data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  66. data/spec/dummy/tmp/cache/assets/development/sprockets/02da53eeca228bcef0c49278517111fe +0 -0
  67. data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  68. data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  69. data/spec/dummy/tmp/cache/assets/development/sprockets/2ff93f9f5ed9970021c7704ff93237c8 +0 -0
  70. data/spec/dummy/tmp/cache/assets/development/sprockets/332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
  71. data/spec/dummy/tmp/cache/assets/development/sprockets/346324d2a51df58457807bee661c449c +0 -0
  72. data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  73. data/spec/dummy/tmp/cache/assets/development/sprockets/3a12dfa6665b5318fa99d097203ac7e7 +0 -0
  74. data/spec/dummy/tmp/cache/assets/{D74/A60/sprockets%2F2add607cdb6c0b17fd866aac28895485 → development/sprockets/3ed52366904e135bd833590814b6ac6d} +0 -0
  75. data/spec/dummy/tmp/cache/assets/development/sprockets/4390d06699f3ad4262e342be530f9f91 +0 -0
  76. data/spec/dummy/tmp/cache/assets/development/sprockets/6f493a817d97133a8dbf674bcd322670 +0 -0
  77. data/spec/dummy/tmp/cache/assets/development/sprockets/89642af8492e579dcd7162a0e2b7f155 +0 -0
  78. data/spec/dummy/tmp/cache/assets/{D09/740/sprockets%2F7a82d51e72434ef73fabb4a26131d945 → development/sprockets/89dc196c51ae83634b664c0c33052008} +0 -0
  79. data/spec/dummy/tmp/cache/assets/{DD2/6F0/sprockets%2Ffbe80717facec3dd9ea7ac008719c843 → development/sprockets/8dd8236b00c868ba248fe30cd9c14c2a} +0 -0
  80. data/spec/dummy/tmp/cache/assets/development/sprockets/9239a04d094a872c1cf77ac391072ea8 +0 -0
  81. data/spec/dummy/tmp/cache/assets/development/sprockets/b3ffb6bd243399012806331ce393ae4f +0 -0
  82. data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  83. data/spec/dummy/tmp/cache/assets/{D78/4E0/sprockets%2F3d4e761a135f6b6e50b24defce90f798 → development/sprockets/d53accc3e58037ee4005e41221b8846b} +0 -0
  84. data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  85. data/spec/dummy/tmp/cache/assets/development/sprockets/df0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
  86. data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  87. data/spec/factories.rb +5 -1
  88. data/spec/helpers/blogit/posts_helper_spec.rb +5 -5
  89. data/spec/lib/blogs_spec.rb +0 -6
  90. data/spec/lib/configuration_spec.rb +17 -1
  91. data/spec/models/blogit/post_spec.rb +29 -9
  92. data/spec/spec_helper.rb +6 -5
  93. metadata +177 -174
  94. data/app/sweepers/blogit/blogit_sweeper.rb +0 -33
  95. data/db/migrate/20110814091434_create_blog_posts.rb +0 -12
  96. data/spec/dummy/test/fixtures/people.yml +0 -7
  97. data/spec/dummy/test/fixtures/users.yml +0 -9
  98. data/spec/dummy/test/functional/people_controller_test.rb +0 -49
  99. data/spec/dummy/test/functional/sessions_controller_test.rb +0 -9
  100. data/spec/dummy/test/functional/users_controller_test.rb +0 -49
  101. data/spec/dummy/test/unit/helpers/people_helper_test.rb +0 -4
  102. data/spec/dummy/test/unit/helpers/sessions_helper_test.rb +0 -4
  103. data/spec/dummy/test/unit/helpers/users_helper_test.rb +0 -4
  104. data/spec/dummy/test/unit/person_test.rb +0 -7
  105. data/spec/dummy/test/unit/user_test.rb +0 -7
  106. data/spec/dummy/tmp/cache/assets/CAA/340/sprockets%2Fa9991211287db8645603e5ba17008bbe +0 -0
  107. data/spec/dummy/tmp/cache/assets/D3D/D30/sprockets%2Ff1ebd04d570b12945debea975941815b +0 -0
  108. data/spec/dummy/tmp/cache/assets/D66/900/sprockets%2F52de1b25e110e8a937b9e30b0a9e8da7 +0 -0
  109. data/spec/dummy/tmp/cache/assets/DA7/D70/sprockets%2Fc627f052aaee94e9b24815d5aee4ff38 +0 -0
  110. data/spec/dummy/tmp/pids/server.pid +0 -1
  111. data/spec/lib/action_dispatch/http/url_spec.rb +0 -21
@@ -1,7 +1,16 @@
1
1
  # Be sure to restart your server when you modify this file.
2
2
 
3
- # Your secret key for verifying the integrity of signed cookies.
3
+ # Your secret key is used for verifying the integrity of signed cookies.
4
4
  # If you change this key, all old signed cookies will become invalid!
5
+
5
6
  # Make sure the secret is at least 30 characters and all random,
6
7
  # no regular words or you'll be exposed to dictionary attacks.
7
- Dummy::Application.config.secret_token = 'b4bfcb0cc0064008add1ac3db2123467882dfdfbdd5e66487bf83c671792a03a18c7795ef8371a9ccf18d19f497b08d2d2f7e81fb993cf43f3443ae1838bab25'
8
+ # You can use `rake secret` to generate a secure secret key.
9
+
10
+ # Make sure your secret_key_base is kept private
11
+ # if you're sharing your code publicly.
12
+ if Rails.version =~ /\A3/
13
+ Dummy::Application.config.secret_token = 'f72bc586e221e4d19f9746f9a4ca38a75cce2deaabf584fb378e5f30e0c226e14dbb8245befed1060092c74d2e6804a50a531c351f994b7a10edf2bdbd6fbefd'
14
+ else
15
+ Dummy::Application.config.secret_key_base = 'f72bc586e221e4d19f9746f9a4ca38a75cce2deaabf584fb378e5f30e0c226e14dbb8245befed1060092c74d2e6804a50a531c351f994b7a10edf2bdbd6fbefd'
16
+ end
Binary file
@@ -1,3 +1,4 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 1)
1
2
  class ActsAsTaggableOnMigration < ActiveRecord::Migration
2
3
  def self.up
3
4
  create_table :tags do |t|
@@ -9,10 +10,12 @@ class ActsAsTaggableOnMigration < ActiveRecord::Migration
9
10
 
10
11
  # You should make sure that the column created is
11
12
  # long enough to store the required class names.
12
- t.references :taggable, :polymorphic => true
13
- t.references :tagger, :polymorphic => true
13
+ t.references :taggable, polymorphic: true
14
+ t.references :tagger, polymorphic: true
14
15
 
15
- t.string :context
16
+ # Limit is created to prevent MySQL error on index
17
+ # length for MyISAM table type: http://bit.ly/vgW2Ql
18
+ t.string :context, limit: 128
16
19
 
17
20
  t.datetime :created_at
18
21
  end
@@ -0,0 +1,20 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 2)
2
+ class AddMissingUniqueIndices < ActiveRecord::Migration
3
+ def self.up
4
+ add_index :tags, :name, unique: true
5
+
6
+ remove_index :taggings, :tag_id
7
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
8
+ add_index :taggings,
9
+ [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type],
10
+ unique: true, name: 'taggings_idx'
11
+ end
12
+
13
+ def self.down
14
+ remove_index :tags, :name
15
+
16
+ remove_index :taggings, name: 'taggings_idx'
17
+ add_index :taggings, :tag_id
18
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
19
+ end
20
+ end
@@ -0,0 +1,15 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 3)
2
+ class AddTaggingsCounterCacheToTags < ActiveRecord::Migration
3
+ def self.up
4
+ add_column :tags, :taggings_count, :integer, default: 0
5
+
6
+ ActsAsTaggableOn::Tag.reset_column_information
7
+ ActsAsTaggableOn::Tag.find_each do |tag|
8
+ ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings)
9
+ end
10
+ end
11
+
12
+ def self.down
13
+ remove_column :tags, :taggings_count
14
+ end
15
+ end
@@ -0,0 +1,16 @@
1
+ # This migration comes from blogit (originally 20110814091434)
2
+ class CreateBlogitPosts < ActiveRecord::Migration
3
+ def change
4
+ create_table :blogit_posts do |t|
5
+ t.with_options(null: false) do |r|
6
+ r.string :title
7
+ r.text :body
8
+ r.string :state, default: Blogit::configuration.hidden_states.first.to_s
9
+ r.integer :comments_count, default: 0
10
+ end
11
+ t.references :blogger, polymorphic: true
12
+ t.timestamps
13
+ end
14
+ add_index :blogit_posts, [:blogger_type, :blogger_id]
15
+ end
16
+ end
@@ -0,0 +1,16 @@
1
+ # This migration comes from blogit (originally 20110814093229)
2
+ class CreateBlogitComments < ActiveRecord::Migration
3
+ def change
4
+ create_table :blogit_comments do |t|
5
+ t.string :name, null: false
6
+ t.string :email, null: false
7
+ t.string :website
8
+ t.text :body, null: false
9
+ t.references :post, null: false
10
+ t.string :state
11
+
12
+ t.timestamps
13
+ end
14
+ add_index :blogit_comments, :post_id
15
+ end
16
+ end
@@ -9,63 +9,66 @@
9
9
  # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
10
  # you'll amass, the slower it'll run and the greater likelihood for issues).
11
11
  #
12
- # It's strongly recommended to check this file into your version control system.
12
+ # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(:version => 20110819103335) do
14
+ ActiveRecord::Schema.define(version: 20140511174029) do
15
15
 
16
- create_table "blog_comments", :force => true do |t|
17
- t.string "name", :null => false
18
- t.string "email", :null => false
16
+ create_table "blogit_comments", force: true do |t|
17
+ t.string "name", null: false
18
+ t.string "email", null: false
19
19
  t.string "website"
20
- t.text "body", :null => false
21
- t.integer "post_id", :null => false
20
+ t.text "body", null: false
21
+ t.integer "post_id", null: false
22
22
  t.string "state"
23
- t.datetime "created_at", :null => false
24
- t.datetime "updated_at", :null => false
23
+ t.datetime "created_at"
24
+ t.datetime "updated_at"
25
25
  end
26
26
 
27
- add_index "blog_comments", ["post_id"], :name => "index_blog_comments_on_post_id"
27
+ add_index "blogit_comments", ["post_id"], name: "index_blogit_comments_on_post_id"
28
28
 
29
- create_table "blog_posts", :force => true do |t|
30
- t.string "title", :null => false
31
- t.text "body", :null => false
29
+ create_table "blogit_posts", force: true do |t|
30
+ t.string "title", null: false
31
+ t.text "body", null: false
32
+ t.string "state", default: "draft", null: false
33
+ t.integer "comments_count", default: 0, null: false
32
34
  t.integer "blogger_id"
33
35
  t.string "blogger_type"
34
- t.integer "comments_count", :default => 0, :null => false
35
- t.datetime "created_at", :null => false
36
- t.datetime "updated_at", :null => false
36
+ t.datetime "created_at"
37
+ t.datetime "updated_at"
37
38
  end
38
39
 
39
- add_index "blog_posts", ["blogger_type", "blogger_id"], :name => "index_blog_posts_on_blogger_type_and_blogger_id"
40
+ add_index "blogit_posts", ["blogger_type", "blogger_id"], name: "index_blogit_posts_on_blogger_type_and_blogger_id"
40
41
 
41
- create_table "people", :force => true do |t|
42
+ create_table "people", force: true do |t|
42
43
  t.string "name"
43
- t.datetime "created_at", :null => false
44
- t.datetime "updated_at", :null => false
44
+ t.datetime "created_at"
45
+ t.datetime "updated_at"
45
46
  end
46
47
 
47
- create_table "taggings", :force => true do |t|
48
+ create_table "taggings", force: true do |t|
48
49
  t.integer "tag_id"
49
50
  t.integer "taggable_id"
50
51
  t.string "taggable_type"
51
52
  t.integer "tagger_id"
52
53
  t.string "tagger_type"
53
- t.string "context"
54
+ t.string "context", limit: 128
54
55
  t.datetime "created_at"
55
56
  end
56
57
 
57
- add_index "taggings", ["tag_id"], :name => "index_taggings_on_tag_id"
58
- add_index "taggings", ["taggable_id", "taggable_type", "context"], :name => "index_taggings_on_taggable_id_and_taggable_type_and_context"
58
+ add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true
59
59
 
60
- create_table "tags", :force => true do |t|
61
- t.string "name"
60
+ create_table "tags", force: true do |t|
61
+ t.string "name"
62
+ t.integer "taggings_count", default: 0
62
63
  end
63
64
 
64
- create_table "users", :force => true do |t|
65
+ add_index "tags", ["name"], name: "index_tags_on_name", unique: true
66
+
67
+ create_table "users", force: true do |t|
65
68
  t.string "username"
66
69
  t.string "password"
67
- t.datetime "created_at", :null => false
68
- t.datetime "updated_at", :null => false
70
+ t.datetime "created_at"
71
+ t.datetime "updated_at"
69
72
  end
70
73
 
71
74
  end
Binary file