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.
- checksums.yaml +7 -0
- data/README.md +3 -1
- data/Rakefile +8 -24
- data/app/controllers/blogit/application_controller.rb +5 -16
- data/app/controllers/blogit/comments_controller.rb +7 -5
- data/app/controllers/blogit/posts_controller.rb +30 -17
- data/app/helpers/blogit/posts_helper.rb +1 -1
- data/app/models/blogit/comment.rb +23 -27
- data/app/models/blogit/post.rb +24 -23
- data/app/views/blogit/comments/_admin_links.html.erb +2 -2
- data/app/views/blogit/comments/create.js.erb +2 -2
- data/app/views/blogit/posts/_empty.html.erb +0 -3
- data/app/views/blogit/posts/_form.html.erb +9 -3
- data/app/views/blogit/posts/_post_links.html.erb +3 -2
- data/app/views/blogit/posts/_related.html.erb +1 -1
- data/config/locales/de.yml +50 -0
- data/config/locales/en.yml +2 -5
- data/config/locales/fr.yml +0 -4
- data/config/routes.rb +3 -3
- data/db/migrate/20110814091434_create_blogit_posts.rb +15 -0
- data/db/migrate/{20110814093229_create_blog_comments.rb → 20110814093229_create_blogit_comments.rb} +3 -3
- data/lib/blogit/configuration.rb +26 -1
- data/lib/blogit/version.rb +1 -1
- data/lib/blogit.rb +1 -2
- data/lib/generators/blogit/table_name_migration_generator.rb +15 -0
- data/lib/generators/templates/blogit.rb +12 -6
- data/lib/generators/templates/rename_blogit_tables.rb +21 -0
- data/spec/controllers/blogit/comments_controller_spec.rb +1 -1
- data/spec/controllers/blogit/posts_controller_spec.rb +57 -13
- data/spec/dummy/app/views/layouts/custom.html.erb +34 -0
- data/spec/dummy/config/application.rb +12 -7
- data/spec/dummy/config/database.yml +28 -24
- data/spec/dummy/config/environments/development.rb +23 -14
- data/spec/dummy/config/environments/production.rb +55 -22
- data/spec/dummy/config/environments/test.rb +17 -16
- data/spec/dummy/config/initializers/blogit.rb +5 -8
- data/spec/dummy/config/initializers/secret_token.rb +11 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- 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
- data/spec/dummy/db/migrate/20140511174025_add_missing_unique_indices.acts_as_taggable_on_engine.rb +20 -0
- data/spec/dummy/db/migrate/20140511174026_add_taggings_counter_cache_to_tags.acts_as_taggable_on_engine.rb +15 -0
- data/spec/dummy/db/migrate/20140511174028_create_blogit_posts.blogit.rb +16 -0
- data/spec/dummy/db/migrate/20140511174029_create_blogit_comments.blogit.rb +16 -0
- data/spec/dummy/db/schema.rb +32 -29
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +1444 -2970
- data/spec/dummy/log/test.log +9631 -29732
- data/spec/dummy/tmp/cache/assets/CB5/DD0/sprockets%2F346324d2a51df58457807bee661c449c +0 -0
- data/spec/dummy/tmp/cache/assets/CB6/ED0/sprockets%2F4390d06699f3ad4262e342be530f9f91 +0 -0
- data/spec/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/CE7/230/sprockets%2F6f493a817d97133a8dbf674bcd322670 +0 -0
- data/spec/dummy/tmp/cache/assets/{D35/E90/sprockets%2F9542f66fea1d10b7924f3b6b31e1e2e0 → CEA/490/sprockets%2F9697d4fb1ed26d80f3c715611c8d4373} +0 -0
- data/spec/dummy/tmp/cache/assets/CEE/310/sprockets%2F89642af8492e579dcd7162a0e2b7f155 +0 -0
- data/spec/dummy/tmp/cache/assets/D01/8C0/sprockets%2F332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
- data/spec/dummy/tmp/cache/assets/D11/CC0/sprockets%2F3a12dfa6665b5318fa99d097203ac7e7 +0 -0
- data/spec/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/{D67/C10/sprockets%2Fa58c567f1eae28b401a6e9a0b3b71d93 → D3D/1E0/sprockets%2Ffbaabd57fa2c9d426f0c318156705667} +0 -0
- data/spec/dummy/tmp/cache/assets/D3E/920/sprockets%2F3efa8d0fc958c223647cb704183b65ca +0 -0
- data/spec/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/D61/6F0/sprockets%2F02da53eeca228bcef0c49278517111fe +0 -0
- data/spec/dummy/tmp/cache/assets/DCA/9B0/sprockets%2Fdf0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
- data/spec/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/E02/A60/sprockets%2Fb32faeede196f7a933c3a2794e7ed0bd +0 -0
- data/spec/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/02da53eeca228bcef0c49278517111fe +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/2ff93f9f5ed9970021c7704ff93237c8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/332d5a9ce3e800c6c4a7a99058023ba2 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/346324d2a51df58457807bee661c449c +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/3a12dfa6665b5318fa99d097203ac7e7 +0 -0
- data/spec/dummy/tmp/cache/assets/{D74/A60/sprockets%2F2add607cdb6c0b17fd866aac28895485 → development/sprockets/3ed52366904e135bd833590814b6ac6d} +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/4390d06699f3ad4262e342be530f9f91 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/6f493a817d97133a8dbf674bcd322670 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/89642af8492e579dcd7162a0e2b7f155 +0 -0
- data/spec/dummy/tmp/cache/assets/{D09/740/sprockets%2F7a82d51e72434ef73fabb4a26131d945 → development/sprockets/89dc196c51ae83634b664c0c33052008} +0 -0
- data/spec/dummy/tmp/cache/assets/{DD2/6F0/sprockets%2Ffbe80717facec3dd9ea7ac008719c843 → development/sprockets/8dd8236b00c868ba248fe30cd9c14c2a} +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/9239a04d094a872c1cf77ac391072ea8 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/b3ffb6bd243399012806331ce393ae4f +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/spec/dummy/tmp/cache/assets/{D78/4E0/sprockets%2F3d4e761a135f6b6e50b24defce90f798 → development/sprockets/d53accc3e58037ee4005e41221b8846b} +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/df0e8f8a85e5d4056b3fe1cec3b7131a +0 -0
- data/spec/dummy/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/spec/factories.rb +5 -1
- data/spec/helpers/blogit/posts_helper_spec.rb +5 -5
- data/spec/lib/blogs_spec.rb +0 -6
- data/spec/lib/configuration_spec.rb +17 -1
- data/spec/models/blogit/post_spec.rb +29 -9
- data/spec/spec_helper.rb +6 -5
- metadata +177 -174
- data/app/sweepers/blogit/blogit_sweeper.rb +0 -33
- data/db/migrate/20110814091434_create_blog_posts.rb +0 -12
- data/spec/dummy/test/fixtures/people.yml +0 -7
- data/spec/dummy/test/fixtures/users.yml +0 -9
- data/spec/dummy/test/functional/people_controller_test.rb +0 -49
- data/spec/dummy/test/functional/sessions_controller_test.rb +0 -9
- data/spec/dummy/test/functional/users_controller_test.rb +0 -49
- data/spec/dummy/test/unit/helpers/people_helper_test.rb +0 -4
- data/spec/dummy/test/unit/helpers/sessions_helper_test.rb +0 -4
- data/spec/dummy/test/unit/helpers/users_helper_test.rb +0 -4
- data/spec/dummy/test/unit/person_test.rb +0 -7
- data/spec/dummy/test/unit/user_test.rb +0 -7
- data/spec/dummy/tmp/cache/assets/CAA/340/sprockets%2Fa9991211287db8645603e5ba17008bbe +0 -0
- data/spec/dummy/tmp/cache/assets/D3D/D30/sprockets%2Ff1ebd04d570b12945debea975941815b +0 -0
- data/spec/dummy/tmp/cache/assets/D66/900/sprockets%2F52de1b25e110e8a937b9e30b0a9e8da7 +0 -0
- data/spec/dummy/tmp/cache/assets/DA7/D70/sprockets%2Fc627f052aaee94e9b24815d5aee4ff38 +0 -0
- data/spec/dummy/tmp/pids/server.pid +0 -1
- data/spec/lib/action_dispatch/http/url_spec.rb +0 -21
data/lib/blogit/configuration.rb
CHANGED
@@ -87,7 +87,20 @@ module Blogit
|
|
87
87
|
# when posts are created, updated or destroyed?
|
88
88
|
# Defaults to false
|
89
89
|
attr_accessor :ping_search_engines
|
90
|
-
|
90
|
+
|
91
|
+
# The layout to be used by the posts controller
|
92
|
+
# Defaults to nil
|
93
|
+
attr_accessor :layout
|
94
|
+
|
95
|
+
# list of states that will be visible to the public
|
96
|
+
attr_accessor :active_states
|
97
|
+
|
98
|
+
# list of states that will hide the posts from the public.
|
99
|
+
attr_accessor :hidden_states
|
100
|
+
|
101
|
+
# list of states for the Post state machine in order or lifecycle, aggregation of hidden_states and active_states
|
102
|
+
#attr_accessor :post_states
|
103
|
+
|
91
104
|
# When using redcarpet as content parser, pass these options as defaults.
|
92
105
|
REDCARPET_OPTIONS = {
|
93
106
|
hard_wrap: true,
|
@@ -98,6 +111,12 @@ module Blogit
|
|
98
111
|
gh_blockcode: true,
|
99
112
|
}
|
100
113
|
|
114
|
+
#default values for active_state
|
115
|
+
ACTIVE_STATES = [:published]
|
116
|
+
|
117
|
+
#default values for hidden_state
|
118
|
+
HIDDEN_STATES = [:draft, :archive]
|
119
|
+
|
101
120
|
def initialize
|
102
121
|
@include_comments = :active_record
|
103
122
|
@disqus_shortname = ""
|
@@ -119,6 +138,8 @@ module Blogit
|
|
119
138
|
@rss_feed_description = "#{Rails.application.engine_name.titleize} Blog Posts"
|
120
139
|
@ping_search_engines = false
|
121
140
|
@redcarpet_options = REDCARPET_OPTIONS
|
141
|
+
@active_states = ACTIVE_STATES
|
142
|
+
@hidden_states = HIDDEN_STATES
|
122
143
|
end
|
123
144
|
|
124
145
|
def default_parser_class
|
@@ -147,6 +168,10 @@ module Blogit
|
|
147
168
|
blogit_warn "#{self.class}#rss_feed_language has been deprecated. You can remove this from your blogit.rb configuration file"
|
148
169
|
end
|
149
170
|
|
171
|
+
def cache_pages=(value)
|
172
|
+
blogit_warn "config.cache_pages is deprecated. Please remove this from your blogit.rb file"
|
173
|
+
end
|
174
|
+
|
150
175
|
private
|
151
176
|
|
152
177
|
def blogit_warn(message)
|
data/lib/blogit/version.rb
CHANGED
data/lib/blogit.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
# Third-party requirements
|
2
|
-
require "acts-as-taggable-on"
|
3
2
|
require "kaminari"
|
4
3
|
require "redcarpet"
|
5
4
|
require "pingr"
|
@@ -10,9 +9,9 @@ require "blogit/engine"
|
|
10
9
|
require "blogit/parsers"
|
11
10
|
|
12
11
|
require "validators"
|
12
|
+
|
13
13
|
module Blogit
|
14
14
|
|
15
|
-
autoload :ActsAsTaggableOn, "acts-as-taggable-on"
|
16
15
|
autoload :Kaminari, "kaminari"
|
17
16
|
|
18
17
|
# Exception raised when gem may not be configured properly
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Blogit
|
2
|
+
module Generators
|
3
|
+
class TableNameMigrationGenerator < Rails::Generators::Base
|
4
|
+
|
5
|
+
source_root File.expand_path('../../templates', __FILE__)
|
6
|
+
|
7
|
+
desc "Creates a Blogit initializer in your application's config/initializers dir"
|
8
|
+
|
9
|
+
def copy_migration_file
|
10
|
+
template "rename_blogit_tables.rb", "db/migrate/#{Time.now.to_s(:number)}_rename_blogit_tables.rb"
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -24,9 +24,6 @@ Blogit.configure do |config|
|
|
24
24
|
# Which DateTime::FORMATS format do we use to display blog and comment publish time
|
25
25
|
# config.datetime_format = :short
|
26
26
|
|
27
|
-
# Should the controllers cache the blog pages as HTML?
|
28
|
-
# config.cache_pages = false
|
29
|
-
|
30
27
|
# No. of posts to show per page
|
31
28
|
# config.posts_per_page = 5
|
32
29
|
|
@@ -62,13 +59,13 @@ Blogit.configure do |config|
|
|
62
59
|
|
63
60
|
# Should blogit ping search engines with your sitemap
|
64
61
|
# when posts are created, updated or destroyed?
|
65
|
-
#
|
62
|
+
#
|
66
63
|
# Can pass true to ping all supported search engines, or an array of search
|
67
64
|
# engine names. e.g. [:google, :bing]
|
68
|
-
#
|
65
|
+
#
|
69
66
|
# Defaults to false
|
70
67
|
# config.ping_search_engines = false
|
71
|
-
|
68
|
+
|
72
69
|
# When using redcarpet as content parser, pass these options as defaults.
|
73
70
|
# @see here for more options: https://github.com/tanoku/redcarpet
|
74
71
|
# config.redcarpet_options = {
|
@@ -87,4 +84,13 @@ Blogit.configure do |config|
|
|
87
84
|
# app's named routes are missing.
|
88
85
|
# config.inline_main_app_named_routes = true
|
89
86
|
|
87
|
+
# If this is set, Blogit::PostsController will use the layout named here
|
88
|
+
# config.layout = "custom_layout"
|
89
|
+
|
90
|
+
# List of states that will be visible to the public
|
91
|
+
# config.active_states = [:published]
|
92
|
+
|
93
|
+
# List of states that will hide the posts from the public.
|
94
|
+
# config.hidden_states = [:draft, :archive]
|
95
|
+
|
90
96
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
class RenameBlogitTables < ActiveRecord::Migration
|
2
|
+
def change
|
3
|
+
if table_exists?('blog_posts')
|
4
|
+
rename_table('blog_posts', 'blogit_posts')
|
5
|
+
else
|
6
|
+
report_missing_table("blog_posts")
|
7
|
+
end
|
8
|
+
|
9
|
+
if table_exists?('blog_comments')
|
10
|
+
rename_table('blog_comments', 'blogit_comments')
|
11
|
+
else
|
12
|
+
report_missing_table("blog_posts")
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def report_missing_table(t_name)
|
19
|
+
warn "Table named: #{t_name} not found. Have you run the initial blogit migrations yet?"
|
20
|
+
end
|
21
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe PostsController do
|
3
|
+
describe Blogit::PostsController do
|
4
4
|
|
5
5
|
before do
|
6
6
|
reset_configuration
|
@@ -16,16 +16,60 @@ describe PostsController do
|
|
16
16
|
get :index, :use_route => :blogit, page: page.to_s
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
19
|
+
context 'when user is logged in' do
|
20
|
+
|
21
|
+
before(:each) do
|
22
|
+
controller.stubs(:is_blogger_logged_in?).returns(false)
|
23
|
+
Blogit::Post.stubs(:active).returns(posts)
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'should set posts to Blogit::Post.active.for_index' do
|
27
|
+
Blogit::Post.stubs(:for_index).returns(posts)
|
28
|
+
Blogit::Post.active.expects(:for_index).returns(posts)
|
29
|
+
do_get
|
30
|
+
assigns(:posts).should == posts
|
31
|
+
end
|
32
|
+
|
33
|
+
it 'should pass the page param to Blogit::Post.active.for_index' do
|
34
|
+
Blogit::Post.stubs(:for_index).with('2').returns(posts)
|
35
|
+
Blogit::Post.active.expects(:for_index).with('2').returns(posts)
|
36
|
+
do_get('2')
|
37
|
+
assigns(:posts).should == posts
|
38
|
+
end
|
23
39
|
end
|
24
40
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
41
|
+
context 'when user is not logged in' do
|
42
|
+
before(:each) do
|
43
|
+
controller.stubs(:is_blogger_logged_in?).returns(true)
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'sets posts to Blogit::Post.for_index' do
|
47
|
+
Blogit::Post.expects(:for_index).returns(posts)
|
48
|
+
do_get
|
49
|
+
assigns(:posts).should == posts
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'should pass the page param to Blogit::Post.active.for_index' do
|
53
|
+
Blogit::Post.expects(:for_index).with('2').returns(posts)
|
54
|
+
do_get('2')
|
55
|
+
assigns(:posts).should == posts
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
describe "when layout is set" do
|
60
|
+
|
61
|
+
# TODO: Think of a way to test this. The PostsController is being cached
|
62
|
+
# because cache-classes is set to true but that means the layout is not
|
63
|
+
# being changed.
|
64
|
+
#
|
65
|
+
# This works in practice but not in testing
|
66
|
+
# it "should use the specified layout" do
|
67
|
+
# reset_configuration
|
68
|
+
# Blogit.configuration.layout = "custom"
|
69
|
+
# do_get
|
70
|
+
# response.should.should render_template("layouts/custom")
|
71
|
+
# end
|
72
|
+
|
29
73
|
end
|
30
74
|
|
31
75
|
end
|
@@ -40,7 +84,8 @@ describe PostsController do
|
|
40
84
|
end
|
41
85
|
|
42
86
|
it "should load all posts in reverse date order" do
|
43
|
-
Blogit::Post.
|
87
|
+
Blogit::Post.stubs(:active).returns(posts)
|
88
|
+
Blogit::Post.active.expects(:order).with('created_at DESC').returns(posts)
|
44
89
|
do_get
|
45
90
|
assigns(:posts).should == posts
|
46
91
|
end
|
@@ -148,7 +193,6 @@ describe PostsController do
|
|
148
193
|
|
149
194
|
end
|
150
195
|
|
151
|
-
|
152
196
|
describe "GET 'edit'" do
|
153
197
|
|
154
198
|
context "when logged in" do
|
@@ -193,7 +237,7 @@ describe PostsController do
|
|
193
237
|
context "when logged in" do
|
194
238
|
|
195
239
|
before do
|
196
|
-
@post_attributes = {
|
240
|
+
@post_attributes = {"title" => "Something new"}
|
197
241
|
mock_login
|
198
242
|
@current_blogger.expects(:blog_posts).returns(@blog_posts = [])
|
199
243
|
@blog_posts.expects(:find).with("1").returns(blog_post)
|
@@ -249,7 +293,7 @@ describe PostsController do
|
|
249
293
|
context "when not logged in" do
|
250
294
|
|
251
295
|
before do
|
252
|
-
@post_attributes = {
|
296
|
+
@post_attributes = {"title" => "Something new"}
|
253
297
|
end
|
254
298
|
|
255
299
|
def do_put
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Dummy</title>
|
5
|
+
<%= stylesheet_link_tag "blogit", "application" %>
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
|
10
|
+
<div id="content">
|
11
|
+
|
12
|
+
<% if current_user %>
|
13
|
+
<%= link_to("log out", main_app.session_path, method: :delete) %>
|
14
|
+
<% else %>
|
15
|
+
<%= link_to("log in", main_app.new_session_path) %>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<h1><%= link_to("My Awesome Blog", blogit.blog_root_path) %></h1>
|
19
|
+
|
20
|
+
<%= yield %>
|
21
|
+
</div>
|
22
|
+
|
23
|
+
<div id="sidebar">
|
24
|
+
<%= blog_posts_archive_tag('archive-year', 'archive-month', 'archive-post') do |post| %>
|
25
|
+
<% link_to(post.title, blogit.post_path(post)) %>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<footer id="custom_footer">
|
30
|
+
By <%= link_to("Gavin Morrice", "http://gavinmorrice.com") %>
|
31
|
+
</footer>
|
32
|
+
<%= javascript_include_tag "application", "blogit" %>
|
33
|
+
</body>
|
34
|
+
</html>
|
@@ -2,18 +2,22 @@ require File.expand_path('../boot', __FILE__)
|
|
2
2
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
|
-
|
5
|
+
# Require the gems listed in Gemfile, including any gems
|
6
|
+
# you've limited to :test, :development, or :production.
|
7
|
+
Bundler.require(:default, Rails.env)
|
6
8
|
|
7
9
|
require "blogit"
|
8
|
-
require
|
10
|
+
require 'jquery-rails'
|
9
11
|
|
10
12
|
module Dummy
|
11
13
|
class Application < Rails::Application
|
12
|
-
#
|
13
|
-
|
14
|
+
# Settings in config/environments/* take precedence over those specified here.
|
15
|
+
# Application configuration should go into files in config/initializers
|
16
|
+
# -- all .rb files in that directory are automatically loaded.
|
14
17
|
|
15
|
-
#
|
16
|
-
|
18
|
+
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
19
|
+
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
20
|
+
# config.time_zone = 'Central Time (US & Canada)'
|
17
21
|
|
18
22
|
# Version of your assets, change this if you want to expire all your assets
|
19
23
|
config.assets.version = '1.0'
|
@@ -21,6 +25,7 @@ module Dummy
|
|
21
25
|
|
22
26
|
# Enable the asset pipeline
|
23
27
|
config.assets.enabled = true
|
28
|
+
|
29
|
+
config.i18n.enforce_available_locales = false
|
24
30
|
end
|
25
31
|
end
|
26
|
-
|
@@ -1,25 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
1
|
+
sqlite: &sqlite
|
2
|
+
adapter: sqlite3
|
3
|
+
database: db/<%= Rails.env %>.sqlite3
|
4
|
+
|
5
|
+
mysql: &mysql
|
6
|
+
adapter: mysql2
|
7
|
+
username: root
|
8
|
+
password:
|
9
|
+
database: blogit_app_<%= Rails.env %>
|
10
|
+
|
11
|
+
postgresql: &postgresql
|
12
|
+
adapter: postgresql
|
13
|
+
username: postgres
|
14
|
+
password:
|
15
|
+
database: blogit_app_<%= Rails.env %>
|
16
|
+
min_messages: ERROR
|
17
|
+
|
18
|
+
defaults: &defaults
|
19
|
+
pool: 5
|
20
|
+
timeout: 5000
|
21
|
+
host: localhost
|
22
|
+
# Use sqlite by default
|
23
|
+
<<: *<%= ENV['DB'] || "sqlite" %>
|
24
|
+
|
25
|
+
development:
|
26
|
+
<<: *defaults
|
27
|
+
|
15
28
|
test:
|
16
|
-
|
17
|
-
database: db/test.sqlite3
|
18
|
-
pool: 5
|
19
|
-
timeout: 5000
|
20
|
-
|
21
|
-
production:
|
22
|
-
adapter: sqlite3
|
23
|
-
database: db/production.sqlite3
|
24
|
-
pool: 5
|
25
|
-
timeout: 5000
|
29
|
+
<<: *defaults
|
@@ -1,30 +1,39 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# In the development environment your application's code is reloaded on
|
5
|
-
# every request.
|
5
|
+
# every request. This slows down response time but is perfect for development
|
6
6
|
# since you don't have to restart the web server when you make code changes.
|
7
7
|
config.cache_classes = false
|
8
8
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
if Rails.version =~ /\A3/
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Only use best-standards-support built into browsers
|
14
|
+
config.action_dispatch.best_standards_support = :builtin
|
15
|
+
|
16
|
+
# Do not compress assets
|
17
|
+
config.assets.compress = false
|
18
|
+
end
|
19
|
+
|
20
|
+
if Rails.version =~ /\A4/
|
21
|
+
config.eager_load = false
|
22
|
+
|
23
|
+
# Raise an error on page load if there are pending migrations
|
24
|
+
config.active_record.migration_error = :page_load
|
25
|
+
end
|
26
|
+
|
27
|
+
# Show full error reports and disable caching.
|
13
28
|
config.consider_all_requests_local = true
|
14
29
|
config.action_controller.perform_caching = false
|
15
30
|
|
16
|
-
# Don't care if the mailer can't send
|
31
|
+
# Don't care if the mailer can't send.
|
17
32
|
config.action_mailer.raise_delivery_errors = false
|
18
33
|
|
19
|
-
# Print deprecation notices to the Rails logger
|
34
|
+
# Print deprecation notices to the Rails logger.
|
20
35
|
config.active_support.deprecation = :log
|
21
36
|
|
22
|
-
# Only use best-standards-support built into browsers
|
23
|
-
config.action_dispatch.best_standards_support = :builtin
|
24
|
-
|
25
|
-
# Do not compress assets
|
26
|
-
config.assets.compress = false
|
27
|
-
|
28
37
|
# Expands the lines which load the assets
|
29
38
|
config.assets.debug = true
|
30
39
|
end
|
@@ -1,51 +1,84 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
|
-
# Code is not reloaded between requests
|
4
|
+
# Code is not reloaded between requests.
|
5
5
|
config.cache_classes = true
|
6
6
|
|
7
|
-
#
|
7
|
+
# Eager load code on boot. This eager loads most of Rails and
|
8
|
+
# your application in memory, allowing both thread web servers
|
9
|
+
# and those relying on copy on write to perform better.
|
10
|
+
# Rake tasks automatically ignore this option for performance.
|
11
|
+
config.eager_load = true
|
12
|
+
|
13
|
+
# Full error reports are disabled and caching is turned on.
|
8
14
|
config.consider_all_requests_local = false
|
9
15
|
config.action_controller.perform_caching = true
|
10
16
|
|
11
|
-
#
|
17
|
+
# Enable Rack::Cache to put a simple HTTP cache in front of your application
|
18
|
+
# Add `rack-cache` to your Gemfile before enabling this.
|
19
|
+
# For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
|
20
|
+
# config.action_dispatch.rack_cache = true
|
21
|
+
|
22
|
+
# Disable Rails's static asset server (Apache or nginx will already do this).
|
12
23
|
config.serve_static_assets = false
|
13
24
|
|
14
|
-
# Compress JavaScripts and CSS
|
15
|
-
config.assets.
|
25
|
+
# Compress JavaScripts and CSS.
|
26
|
+
config.assets.js_compressor = :uglifier
|
27
|
+
# config.assets.css_compressor = :sass
|
28
|
+
|
29
|
+
# Do not fallback to assets pipeline if a precompiled asset is missed.
|
30
|
+
config.assets.compile = false
|
31
|
+
|
32
|
+
# Generate digests for assets URLs.
|
33
|
+
config.assets.digest = true
|
34
|
+
|
35
|
+
# Version of your assets, change this if you want to expire all your assets.
|
36
|
+
config.assets.version = '1.0'
|
16
37
|
|
17
|
-
# Specifies the header that your server uses for sending files
|
18
|
-
#
|
19
|
-
config.action_dispatch.x_sendfile_header =
|
38
|
+
# Specifies the header that your server uses for sending files.
|
39
|
+
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
|
40
|
+
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
|
41
|
+
|
42
|
+
if Rails.version =~ /\A4/
|
43
|
+
config.eager_load = true
|
44
|
+
end
|
20
45
|
|
21
46
|
# Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
|
22
47
|
# config.force_ssl = true
|
23
48
|
|
24
|
-
#
|
25
|
-
|
49
|
+
# Set to :debug to see everything in the log.
|
50
|
+
config.log_level = :info
|
51
|
+
|
52
|
+
# Prepend all log lines with the following tags.
|
53
|
+
# config.log_tags = [ :subdomain, :uuid ]
|
26
54
|
|
27
|
-
# Use a different logger for distributed setups
|
28
|
-
# config.logger = SyslogLogger.new
|
55
|
+
# Use a different logger for distributed setups.
|
56
|
+
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
|
29
57
|
|
30
|
-
# Use a different cache store in production
|
58
|
+
# Use a different cache store in production.
|
31
59
|
# config.cache_store = :mem_cache_store
|
32
60
|
|
33
|
-
# Enable serving of images, stylesheets, and JavaScripts from an asset server
|
61
|
+
# Enable serving of images, stylesheets, and JavaScripts from an asset server.
|
34
62
|
# config.action_controller.asset_host = "http://assets.example.com"
|
35
63
|
|
36
|
-
# Precompile additional assets
|
64
|
+
# Precompile additional assets.
|
65
|
+
# application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
|
37
66
|
# config.assets.precompile += %w( search.js )
|
38
67
|
|
39
|
-
#
|
68
|
+
# Ignore bad email addresses and do not raise email delivery errors.
|
69
|
+
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
|
40
70
|
# config.action_mailer.raise_delivery_errors = false
|
41
71
|
|
42
|
-
# Enable threaded mode
|
43
|
-
# config.threadsafe!
|
44
|
-
|
45
72
|
# Enable locale fallbacks for I18n (makes lookups for any locale fall back to
|
46
|
-
# the I18n.default_locale when a translation can not be found)
|
73
|
+
# the I18n.default_locale when a translation can not be found).
|
47
74
|
config.i18n.fallbacks = true
|
48
75
|
|
49
|
-
# Send deprecation notices to registered listeners
|
76
|
+
# Send deprecation notices to registered listeners.
|
50
77
|
config.active_support.deprecation = :notify
|
78
|
+
|
79
|
+
# Disable automatic flushing of the log to improve performance.
|
80
|
+
# config.autoflush_log = false
|
81
|
+
|
82
|
+
# Use default logging formatter so that PID and timestamp are not suppressed.
|
83
|
+
config.log_formatter = ::Logger::Formatter.new
|
51
84
|
end
|
@@ -1,39 +1,40 @@
|
|
1
1
|
Dummy::Application.configure do
|
2
|
-
# Settings specified here will take precedence over those in config/application.rb
|
2
|
+
# Settings specified here will take precedence over those in config/application.rb.
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
5
|
-
# test suite.
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
6
|
# your test database is "scratch space" for the test suite and is wiped
|
7
|
-
# and recreated between test runs.
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
11
|
config.serve_static_assets = true
|
12
12
|
config.static_cache_control = "public, max-age=3600"
|
13
|
+
|
14
|
+
if Rails.version =~ /\A3/
|
15
|
+
# Log error messages when you accidentally call methods on nil
|
16
|
+
config.whiny_nils = true
|
17
|
+
end
|
13
18
|
|
14
|
-
|
15
|
-
|
19
|
+
if Rails.version =~ /\A4/
|
20
|
+
config.eager_load = false
|
21
|
+
end
|
16
22
|
|
17
|
-
# Show full error reports and disable caching
|
23
|
+
# Show full error reports and disable caching.
|
18
24
|
config.consider_all_requests_local = true
|
19
25
|
config.action_controller.perform_caching = false
|
20
26
|
|
21
|
-
# Raise exceptions instead of rendering exception templates
|
27
|
+
# Raise exceptions instead of rendering exception templates.
|
22
28
|
config.action_dispatch.show_exceptions = false
|
23
29
|
|
24
|
-
# Disable request forgery protection in test environment
|
25
|
-
config.action_controller.allow_forgery_protection
|
30
|
+
# Disable request forgery protection in test environment.
|
31
|
+
config.action_controller.allow_forgery_protection = false
|
26
32
|
|
27
33
|
# Tell Action Mailer not to deliver emails to the real world.
|
28
34
|
# The :test delivery method accumulates sent emails in the
|
29
35
|
# ActionMailer::Base.deliveries array.
|
30
|
-
|
36
|
+
config.action_mailer.delivery_method = :test
|
31
37
|
|
32
|
-
#
|
33
|
-
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
34
|
-
# like if you have constraints or database-specific column types
|
35
|
-
# config.active_record.schema_format = :sql
|
36
|
-
|
37
|
-
# Print deprecation notices to the stderr
|
38
|
+
# Print deprecation notices to the stderr.
|
38
39
|
config.active_support.deprecation = :stderr
|
39
40
|
end
|
@@ -25,9 +25,6 @@ Blogit.configure do |config|
|
|
25
25
|
# Which DateTime::FORMATS format do we use to display blog and comment publish time
|
26
26
|
# config.datetime_format = :short
|
27
27
|
|
28
|
-
# Should the controllers cache the blog pages as HTML?
|
29
|
-
# config.cache_pages = false
|
30
|
-
|
31
28
|
# No. of posts to show per page
|
32
29
|
# config.posts_per_page = 5
|
33
30
|
|
@@ -46,7 +43,7 @@ Blogit.configure do |config|
|
|
46
43
|
# If set to true, links for new posts, editing posts and deleting comments
|
47
44
|
# will be available. If set to false, you'll have to set these
|
48
45
|
# yourself in the templates.
|
49
|
-
# config.include_admin_links =
|
46
|
+
# config.include_admin_links = false
|
50
47
|
|
51
48
|
# The default format for parsing the blog content.
|
52
49
|
# config.default_parser = :markdown
|
@@ -63,13 +60,13 @@ Blogit.configure do |config|
|
|
63
60
|
|
64
61
|
# Should blogit ping search engines with your sitemap
|
65
62
|
# when posts are created, updated or destroyed?
|
66
|
-
#
|
63
|
+
#
|
67
64
|
# Can pass true to ping all supported search engines, or an array of search
|
68
65
|
# engine names. e.g. [:google, :bing]
|
69
|
-
#
|
66
|
+
#
|
70
67
|
# Defaults to false
|
71
68
|
config.ping_search_engines = true
|
72
|
-
|
69
|
+
|
73
70
|
# When using redcarpet as content parser, pass these options as defaults.
|
74
71
|
# @see here for more options: https://github.com/tanoku/redcarpet
|
75
72
|
# config.redcarpet_options = {
|
@@ -88,4 +85,4 @@ Blogit.configure do |config|
|
|
88
85
|
# app's named routes are missing.
|
89
86
|
# config.inline_main_app_named_routes = true
|
90
87
|
|
91
|
-
end
|
88
|
+
end
|