active_blog 0.0.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +11 -1
- data/app/assets/javascripts/active_blog/active_admin.js +23 -0
- data/app/assets/stylesheets/active_blog/active_admin.css.scss +21 -0
- data/app/assets/stylesheets/active_blog/application.css +2 -1
- data/app/assets/stylesheets/active_blog/blog_posts.css +8 -0
- data/app/controllers/active_blog/blog_posts_controller.rb +33 -2
- data/app/helpers/active_blog/application_helper.rb +27 -4
- data/app/helpers/active_blog/blog_posts_helper.rb +27 -1
- data/app/models/active_blog/blog_post.rb +30 -38
- data/app/views/active_blog/active_admin/_blog_post_form.html.erb +16 -0
- data/app/views/active_blog/active_admin/_blog_post_show.html.erb +18 -0
- data/app/views/active_blog/active_admin/_show.html.erb +2 -0
- data/app/views/active_blog/blog_posts/_blog_post.html.erb +32 -0
- data/app/views/active_blog/blog_posts/_blog_post_schema.html.erb +5 -0
- data/app/views/active_blog/blog_posts/_sidebar.html.erb +11 -0
- data/app/views/active_blog/blog_posts/archives.html.erb +12 -0
- data/app/views/active_blog/blog_posts/atom.xml.builder +21 -0
- data/app/views/active_blog/blog_posts/index.html.erb +18 -13
- data/app/views/active_blog/blog_posts/preview.js.erb +1 -0
- data/app/views/active_blog/blog_posts/show.html.erb +7 -10
- data/db/migrate/20111116040223_create_active_blog_blog_posts.rb +3 -2
- data/lib/active_blog/ext/string.rb +39 -0
- data/lib/active_blog/mapper.rb +13 -2
- data/lib/active_blog/version.rb +1 -1
- data/lib/active_blog.rb +25 -4
- data/lib/generators/active_blog/install/install_generator.rb +4 -0
- data/lib/generators/active_blog/install/templates/README +17 -0
- data/lib/generators/active_blog/install/templates/active_blog.rb +18 -3
- data/lib/generators/active_blog/install/templates/blog_posts.rb +3 -8
- data/test/dummy/config/application.rb +1 -0
- data/test/dummy/config/routes.rb +2 -0
- data/test/dummy/db/development.sqlite3 +0 -0
- data/test/dummy/db/schema.rb +5 -1
- data/test/dummy/db/test.sqlite3 +0 -0
- data/test/dummy/log/development.log +74 -0
- data/test/dummy/log/test.log +1252 -0
- data/test/functional/active_blog/blog_posts_controller_test.rb +9 -9
- data/test/functional/active_blog/routing_test.rb +25 -0
- data/test/unit/active_blog/blog_post_test.rb +32 -3
- data/test/unit/active_blog/sample_renderer_test.rb +22 -0
- metadata +40 -14
@@ -2,15 +2,15 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module ActiveBlog
|
4
4
|
class BlogPostsControllerTest < ActionController::TestCase
|
5
|
-
test "should get index" do
|
6
|
-
|
7
|
-
|
8
|
-
end
|
9
|
-
|
10
|
-
test "should get show" do
|
11
|
-
|
12
|
-
|
13
|
-
end
|
5
|
+
# test "should get index" do
|
6
|
+
# get :index
|
7
|
+
# assert_response :success
|
8
|
+
# end
|
9
|
+
#
|
10
|
+
# test "should get show" do
|
11
|
+
# get :show
|
12
|
+
# assert_response :success
|
13
|
+
# end
|
14
14
|
|
15
15
|
end
|
16
16
|
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module ActiveBlog
|
4
|
+
class RoutingTest < ActionController::TestCase
|
5
|
+
# Tests the following routes:
|
6
|
+
#
|
7
|
+
# active_blog /blog(.:format)
|
8
|
+
# active_blog_preview POST|PUT /blog/-/preview(.:format) {:controller=>"active_blog/blog_posts", :action=>"preview"}
|
9
|
+
# active_blog_feed GET /blog/-/feed(.:format) {:controller=>"active_blog/blog_posts", :action=>"feed"}
|
10
|
+
# active_blog_post /blog/:cached_slug(.:format) {:controller=>"active_blog/blog_posts", :action=>"show"}
|
11
|
+
|
12
|
+
test "should route /blog" do
|
13
|
+
assert_routing '/blog', {:controller=>"active_blog/blog_posts", :action=>"index"}
|
14
|
+
end
|
15
|
+
test "should route /blog/-/preview" do
|
16
|
+
assert_routing({:path => '/blog/-/preview', :method => :post}, {:controller=>"active_blog/blog_posts", :action=>"preview"})
|
17
|
+
end
|
18
|
+
test "should route /blog/atom.xml" do
|
19
|
+
assert_routing '/blog/atom.xml', {:controller=>"active_blog/blog_posts", :action=>"atom",:format=>:xml}
|
20
|
+
end
|
21
|
+
test "should route /blog/:cached_slug" do
|
22
|
+
assert_routing '/blog/my-blog-post-title', {:controller=>"active_blog/blog_posts", :action=>"show", :cached_slug=>"my-blog-post-title"}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -2,8 +2,37 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
module ActiveBlog
|
4
4
|
class BlogPostTest < ActiveSupport::TestCase
|
5
|
-
|
6
|
-
|
7
|
-
|
5
|
+
test "titles may not begin with '-'" do
|
6
|
+
bp = BlogPost.new(:title => "-What is the Meaning of Life?")
|
7
|
+
bp.save
|
8
|
+
assert_equal "cannot start with a dash", bp.errors.messages[:title].first
|
9
|
+
end
|
10
|
+
|
11
|
+
test "slugify before create" do
|
12
|
+
bp = BlogPost.new(:title => "The title is great")
|
13
|
+
bp.save
|
14
|
+
assert_equal "the-title-is-great", bp.cached_slug
|
15
|
+
end
|
16
|
+
|
17
|
+
test "resaving title does not change title" do
|
18
|
+
bp = BlogPost.new(:title => "The title is great")
|
19
|
+
bp.save
|
20
|
+
assert_equal "the-title-is-great", bp.cached_slug
|
21
|
+
|
22
|
+
bp.title = "Yet another title"
|
23
|
+
bp.save
|
24
|
+
assert_equal "the-title-is-great", bp.cached_slug
|
25
|
+
end
|
26
|
+
|
27
|
+
test "default published_at is now" do
|
28
|
+
bp = BlogPost.new
|
29
|
+
assert_not_nil bp.published_at
|
30
|
+
end
|
31
|
+
|
32
|
+
test "title can't have 'archives' in it" do
|
33
|
+
bp = BlogPost.new(:title => 'archives')
|
34
|
+
bp.save
|
35
|
+
assert_equal "cannot be named 'archives'", bp.errors.messages[:title].first
|
36
|
+
end
|
8
37
|
end
|
9
38
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
require 'pp'
|
3
|
+
|
4
|
+
class SampleRenderer < Redcarpet::Render::HTML
|
5
|
+
def preprocess(fulldoc)
|
6
|
+
# pp [:fulldoc, fulldoc]
|
7
|
+
fulldoc
|
8
|
+
end
|
9
|
+
def entity(text)
|
10
|
+
# pp [:text, text]
|
11
|
+
text
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module ActiveBlog
|
16
|
+
class SampleRendererTest < ActiveSupport::TestCase
|
17
|
+
test "rendering" do
|
18
|
+
markdown = Redcarpet::Markdown.new(SampleRenderer)
|
19
|
+
assert_equal("<p>This is <em>bongos</em>, indeed.</p>\n", markdown.render("This is *bongos*, indeed."))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_blog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2012-01-14 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
|
-
requirement: &
|
16
|
+
requirement: &70173231998820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,21 @@ dependencies:
|
|
21
21
|
version: 3.1.1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70173231998820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: redcarpet
|
27
|
-
requirement: &
|
27
|
+
requirement: &70173231998320 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.0.0b5
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70173231998320
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: kaminari
|
38
|
+
requirement: &70173231997940 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '0'
|
33
44
|
type: :runtime
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70173231997940
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: sqlite3
|
38
|
-
requirement: &
|
49
|
+
requirement: &70173231997480 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ! '>='
|
@@ -43,7 +54,7 @@ dependencies:
|
|
43
54
|
version: '0'
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70173231997480
|
47
58
|
description: ActiveBlog is a Rails Engine for Blogging
|
48
59
|
email:
|
49
60
|
- mchung@gmail.com
|
@@ -51,26 +62,39 @@ executables: []
|
|
51
62
|
extensions: []
|
52
63
|
extra_rdoc_files: []
|
53
64
|
files:
|
65
|
+
- app/assets/javascripts/active_blog/active_admin.js
|
54
66
|
- app/assets/javascripts/active_blog/application.js
|
55
67
|
- app/assets/javascripts/active_blog/blog_posts.js
|
68
|
+
- app/assets/stylesheets/active_blog/active_admin.css.scss
|
56
69
|
- app/assets/stylesheets/active_blog/application.css
|
57
70
|
- app/assets/stylesheets/active_blog/blog_posts.css
|
58
71
|
- app/controllers/active_blog/blog_posts_controller.rb
|
59
72
|
- app/helpers/active_blog/application_helper.rb
|
60
73
|
- app/helpers/active_blog/blog_posts_helper.rb
|
61
74
|
- app/models/active_blog/blog_post.rb
|
75
|
+
- app/views/active_blog/active_admin/_blog_post_form.html.erb
|
76
|
+
- app/views/active_blog/active_admin/_blog_post_show.html.erb
|
77
|
+
- app/views/active_blog/active_admin/_show.html.erb
|
78
|
+
- app/views/active_blog/blog_posts/_blog_post.html.erb
|
79
|
+
- app/views/active_blog/blog_posts/_blog_post_schema.html.erb
|
80
|
+
- app/views/active_blog/blog_posts/_sidebar.html.erb
|
81
|
+
- app/views/active_blog/blog_posts/archives.html.erb
|
82
|
+
- app/views/active_blog/blog_posts/atom.xml.builder
|
62
83
|
- app/views/active_blog/blog_posts/index.html.erb
|
84
|
+
- app/views/active_blog/blog_posts/preview.js.erb
|
63
85
|
- app/views/active_blog/blog_posts/show.html.erb
|
64
86
|
- app/views/layouts/active_blog/application.html.erb
|
65
87
|
- config/routes.rb
|
66
88
|
- db/migrate/20111116040223_create_active_blog_blog_posts.rb
|
67
89
|
- lib/active_blog/engine.rb
|
90
|
+
- lib/active_blog/ext/string.rb
|
68
91
|
- lib/active_blog/mapper.rb
|
69
92
|
- lib/active_blog/version.rb
|
70
93
|
- lib/active_blog.rb
|
71
94
|
- lib/generators/active_blog/install/install_generator.rb
|
72
95
|
- lib/generators/active_blog/install/templates/active_blog.rb
|
73
96
|
- lib/generators/active_blog/install/templates/blog_posts.rb
|
97
|
+
- lib/generators/active_blog/install/templates/README
|
74
98
|
- lib/generators/active_blog/install/USAGE
|
75
99
|
- lib/tasks/active_blog_tasks.rake
|
76
100
|
- MIT-LICENSE
|
@@ -100,7 +124,9 @@ files:
|
|
100
124
|
- test/dummy/config.ru
|
101
125
|
- test/dummy/db/development.sqlite3
|
102
126
|
- test/dummy/db/schema.rb
|
127
|
+
- test/dummy/db/test.sqlite3
|
103
128
|
- test/dummy/log/development.log
|
129
|
+
- test/dummy/log/test.log
|
104
130
|
- test/dummy/public/404.html
|
105
131
|
- test/dummy/public/422.html
|
106
132
|
- test/dummy/public/500.html
|
@@ -109,9 +135,11 @@ files:
|
|
109
135
|
- test/dummy/script/rails
|
110
136
|
- test/fixtures/active_blog/blog_posts.yml
|
111
137
|
- test/functional/active_blog/blog_posts_controller_test.rb
|
138
|
+
- test/functional/active_blog/routing_test.rb
|
112
139
|
- test/integration/navigation_test.rb
|
113
140
|
- test/test_helper.rb
|
114
141
|
- test/unit/active_blog/blog_post_test.rb
|
142
|
+
- test/unit/active_blog/sample_renderer_test.rb
|
115
143
|
- test/unit/helpers/active_blog/blog_posts_helper_test.rb
|
116
144
|
homepage: http://github.com/mchung/active_blog
|
117
145
|
licenses: []
|
@@ -125,18 +153,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
153
|
- - ! '>='
|
126
154
|
- !ruby/object:Gem::Version
|
127
155
|
version: '0'
|
128
|
-
segments:
|
129
|
-
- 0
|
130
|
-
hash: 871724993310899684
|
131
156
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
157
|
none: false
|
133
158
|
requirements:
|
134
159
|
- - ! '>='
|
135
160
|
- !ruby/object:Gem::Version
|
136
161
|
version: '0'
|
137
|
-
segments:
|
138
|
-
- 0
|
139
|
-
hash: 871724993310899684
|
140
162
|
requirements: []
|
141
163
|
rubyforge_project:
|
142
164
|
rubygems_version: 1.8.6
|
@@ -168,7 +190,9 @@ test_files:
|
|
168
190
|
- test/dummy/config.ru
|
169
191
|
- test/dummy/db/development.sqlite3
|
170
192
|
- test/dummy/db/schema.rb
|
193
|
+
- test/dummy/db/test.sqlite3
|
171
194
|
- test/dummy/log/development.log
|
195
|
+
- test/dummy/log/test.log
|
172
196
|
- test/dummy/public/404.html
|
173
197
|
- test/dummy/public/422.html
|
174
198
|
- test/dummy/public/500.html
|
@@ -177,7 +201,9 @@ test_files:
|
|
177
201
|
- test/dummy/script/rails
|
178
202
|
- test/fixtures/active_blog/blog_posts.yml
|
179
203
|
- test/functional/active_blog/blog_posts_controller_test.rb
|
204
|
+
- test/functional/active_blog/routing_test.rb
|
180
205
|
- test/integration/navigation_test.rb
|
181
206
|
- test/test_helper.rb
|
182
207
|
- test/unit/active_blog/blog_post_test.rb
|
208
|
+
- test/unit/active_blog/sample_renderer_test.rb
|
183
209
|
- test/unit/helpers/active_blog/blog_posts_helper_test.rb
|