rails_blog_engine 0.0.2 → 0.0.3

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 (38) hide show
  1. data/README.md +29 -31
  2. data/Rakefile +1 -1
  3. data/TODO.txt +1 -14
  4. data/app/controllers/rails_blog_engine/application_controller.rb +10 -5
  5. data/app/helpers/rails_blog_engine/application_helper.rb +30 -1
  6. data/app/views/layouts/rails_blog_engine/_blog_page.html.haml +11 -0
  7. data/app/views/layouts/rails_blog_engine/_sidebar.html.haml +12 -0
  8. data/app/views/rails_blog_engine/comments/_comment.html.haml +2 -1
  9. data/app/views/rails_blog_engine/posts/_post.html.haml +1 -1
  10. data/app/views/rails_blog_engine/posts/edit.html.haml +3 -2
  11. data/app/views/rails_blog_engine/posts/index.atom.builder +1 -1
  12. data/app/views/rails_blog_engine/posts/index.html.haml +8 -6
  13. data/app/views/rails_blog_engine/posts/new.html.haml +3 -2
  14. data/app/views/rails_blog_engine/posts/show.html.haml +2 -3
  15. data/config/routes.rb +1 -1
  16. data/lib/assets/stylesheets/rails_blog_engine/_config.css.scss +8 -0
  17. data/lib/assets/stylesheets/rails_blog_engine/comments.css.scss +33 -0
  18. data/lib/assets/stylesheets/rails_blog_engine/customizations.css.scss +5 -0
  19. data/{app/assets/stylesheets/rails_blog_engine → lib/assets/stylesheets/rails_blog_engine/filters}/code.css.scss +0 -0
  20. data/lib/assets/stylesheets/rails_blog_engine/layout.css.scss +33 -0
  21. data/lib/assets/stylesheets/rails_blog_engine/posts.css.scss +37 -0
  22. data/{app/assets/stylesheets/rails_blog_engine → lib/assets/stylesheets/rails_blog_engine/ui}/bootstrap_extracts.css.scss +1 -1
  23. data/{app/assets/stylesheets/rails_blog_engine → lib/assets/stylesheets/rails_blog_engine/ui}/simple_form.css.scss +1 -1
  24. data/lib/assets/stylesheets/rails_blog_engine.css +12 -0
  25. data/lib/generators/rails_blog_engine/install/install_generator.rb +10 -0
  26. data/lib/generators/rails_blog_engine/install/templates/rails_blog_engine.rb +3 -0
  27. data/lib/rails_blog_engine/engine.rb +15 -0
  28. data/lib/rails_blog_engine/version.rb +1 -1
  29. data/lib/rails_blog_engine.rb +0 -2
  30. data/spec/acceptance/rails_blog_engine/posts_spec.rb +5 -3
  31. data/spec/dummy/app/assets/stylesheets/layout.css.scss +6 -0
  32. data/spec/dummy/app/views/layouts/application.html.erb +3 -1
  33. data/spec/dummy/config/initializers/rails_blog_engine.rb +3 -0
  34. data/spec/lib/generators/rails_blog_engine/install_generator_spec.rb +18 -0
  35. metadata +66 -60
  36. data/app/assets/stylesheets/rails_blog_engine/comments.css.scss +0 -29
  37. data/app/assets/stylesheets/rails_blog_engine/posts.css.scss +0 -46
  38. data/app/assets/stylesheets/rails_blog_engine.css +0 -6
data/README.md CHANGED
@@ -37,7 +37,34 @@ writing the blog. For example:
37
37
  You should now be able to access your blog at `http://0.0.0.0:3000/blog`
38
38
  and start posting!
39
39
 
40
- ## What if I'm not already using `cancan`?
40
+ If you're not using CanCan, keep reading for setup instructions.
41
+
42
+ ## Philosophy and planned features
43
+
44
+ `rails_blog_engine` should...
45
+
46
+ * ...be installable in under 5 minutes.
47
+ * ...be simple and easily hackable.
48
+ * ...be opinionated.
49
+ * ...be customized by overriding templates or forking the source, not by
50
+ adding configuration options.
51
+ * ...be secure.
52
+ * ...follow all white-hat SEO best practices.
53
+ * ...have excellent unit test coverage, including tests for JavaScript.
54
+
55
+ CoffeeScript, SCSS and other standard Rails 3.1 features are fair game, as
56
+ are RSpec, HAML and CanCan.
57
+
58
+ The following features are on my wishlist:
59
+
60
+ * More generators to aid customization
61
+ * Caching
62
+ * A basic editor: Auto-save, with preview and a "Publish" button
63
+
64
+ In other words, we want just enough features to make blogging pleasant, and
65
+ nothing more.
66
+
67
+ ## What if I'm not already using CanCan?
41
68
 
42
69
  You can still use `rails_blog_engine`! First, install `rails_blog_engine`
43
70
  as described above, and then add the following lines to your `Gemfile`:
@@ -71,7 +98,7 @@ Once you have a working user model, you can generate a new
71
98
 
72
99
  ### How can I make this work without a Devise `User` class?
73
100
 
74
- Basically, all `cancan` cares about is whether your controller defines a
101
+ Basically, all CanCan cares about is whether your controller defines a
75
102
  `current_ability` class. So for example, if you don't use Devise, but the
76
103
  currently logged-in administrator is available as `current_admin`, you can
77
104
  edit `app/controllers/application_controller.rb` to override
@@ -114,35 +141,6 @@ Then launch your application using the `foreman start` command. This will
114
141
  require adding the `foreman` gem to your `Gemfile`, and creating a
115
142
  `Procfile`.
116
143
 
117
- ## Philosophy and planned features
118
-
119
- `rails_blog_engine` should...
120
-
121
- * ...be installable in under 5 minutes.
122
- * ...be simple and easily hackable.
123
- * ...be opinionated.
124
- * ...be customized by overriding templates or forking the source, not by
125
- adding configuration options.
126
- * ...be secure.
127
- * ...follow all white-hat SEO best practices.
128
- * ...have excellent unit test coverage, including tests for JavaScript.
129
-
130
- CoffeeScript, SCSS and other standard Rails 3.1 features are fair game, as
131
- are RSpec, HAML and CanCan.
132
-
133
- The following features are on my wishlist:
134
-
135
- * Pagination
136
- * More generators to aid customization
137
- * Caching
138
- * Optional comments, with spam filtering via a 3rd-party service
139
- * Why? Intelligent discussion adds value and may make it easier
140
- for searchers to find your blog posts.
141
- * A basic editor: Auto-save, with preview and a "Publish" button
142
-
143
- In other words, we want just enough features to make blogging pleasant, and
144
- nothing more.
145
-
146
144
  ## Syntax highlighting
147
145
 
148
146
  If you want to be able to display source code snippets with syntax
data/Rakefile CHANGED
@@ -43,7 +43,7 @@ task :routes => 'app:environment' do
43
43
 
44
44
  Rails.application.reload_routes!
45
45
  all_routes = RailsBlogEngine::Engine.routes.routes
46
- prefix = RailsBlogEngine::Engine.routes.url_helpers.root_path.sub(/\/\z/, '')
46
+ prefix = RailsBlogEngine::Engine.routes.url_helpers.blog_path.sub(/\/\z/, '')
47
47
 
48
48
  if ENV['CONTROLLER']
49
49
  all_routes = all_routes.select{ |route| route.defaults[:controller] == ENV['CONTROLLER'] }
data/TODO.txt CHANGED
@@ -1,22 +1,13 @@
1
1
  Before public release
2
2
 
3
- / Spam filtering for comments: rakismet
4
- / Moderation by administrators
5
- / Secure comment fields using attr_accessible
6
- / Secure HTML in comments
7
- X Table changes - Not going to collapse migrations, so there's no rush.
8
- X Comment author_id polymorphic
9
- X Comment state index
10
- X Collapse migrations into 1 giant migration
11
- / Quick refactoring pass
12
3
  , Integrate into Kidd Software site
13
4
 
14
5
  Needed for 3rd-party use
15
6
 
7
+ What should we do about route helpers in the application layout?
16
8
  Generators
17
9
  rails_blog_engine:templates
18
10
  rails_blog_engine:filter
19
- Config class? Either implement or remove initializer
20
11
 
21
12
  Needed for use as a product or company blog
22
13
 
@@ -25,7 +16,3 @@ Needed for use as a product or company blog
25
16
  Auto-save
26
17
  Publish / Unpublish button
27
18
  , SEO best practices
28
-
29
- Needed for 1.0
30
-
31
- Recent articles list
@@ -1,14 +1,19 @@
1
1
  module RailsBlogEngine
2
2
  class ApplicationController < ActionController::Base
3
- # Use our parent application's layout, so that we "auto-blend" into
4
- # the existing look-and-feel of the site.
5
- layout 'application'
3
+ layout :choose_layout
6
4
 
7
5
  helper_method :post_permalink_url
8
6
  helper_method :post_permalink_path
9
7
 
10
8
  protected
11
9
 
10
+ # We normally use one of our parent application's layouts, so that we
11
+ # "auto-blend" into the existing look-and-feel of the site. The
12
+ # specific layout is specified by our initializer.
13
+ def choose_layout
14
+ Rails.configuration.rails_blog_engine.layout
15
+ end
16
+
12
17
  def post_permalink_local_path(post)
13
18
  date = post.published_at.utc
14
19
  sprintf('%04d/%02d/%02d/%s', date.year, date.month,
@@ -16,11 +21,11 @@ module RailsBlogEngine
16
21
  end
17
22
 
18
23
  def post_permalink_path(post)
19
- root_path + post_permalink_local_path(post)
24
+ blog_path + post_permalink_local_path(post)
20
25
  end
21
26
 
22
27
  def post_permalink_url(post)
23
- root_url + post_permalink_local_path(post)
28
+ blog_url + post_permalink_local_path(post)
24
29
  end
25
30
  end
26
31
  end
@@ -1,5 +1,12 @@
1
1
  module RailsBlogEngine
2
2
  module ApplicationHelper
3
+ # Wrap a block of content up as a blog page. This is basically a
4
+ # nested layout with some wrapper classes and a sidebar.
5
+ def blog_page(&block)
6
+ content_for(:rails_blog_engine_content, &block)
7
+ render :partial => 'layouts/rails_blog_engine/blog_page'
8
+ end
9
+
3
10
  # Process a block of text as Markdown, using our filters, and sanitize
4
11
  # any usafe HTML. You can pass <code>:trusted? => true</code> to allow
5
12
  # images and links without nofollow.
@@ -12,7 +19,7 @@ module RailsBlogEngine
12
19
  # The URL of our Atom feed. Rails refuses to generate this in any simple
13
20
  # fashion, so we do it manually.
14
21
  def feed_url
15
- root_url + "posts.atom"
22
+ blog_url + "posts.atom"
16
23
  end
17
24
 
18
25
  # Get extra HTML classes for the specified comment.
@@ -29,6 +36,28 @@ module RailsBlogEngine
29
36
  end
30
37
  end
31
38
 
39
+ # Returns an object providing the standard application helpers for our
40
+ # containing application. This is necessary when we are rendered using
41
+ # an application-wide layout from inside an engine-specific controller,
42
+ # which normally makes it impossible to access the application's helper
43
+ # methods.
44
+ def app_helpers
45
+ @app_helpers ||= Class.new do
46
+ include Rails.application.routes.url_helpers
47
+ include ::ApplicationHelper
48
+ end.new
49
+ end
50
+
51
+ # Intercept calls to our containing application's helpers, and explain
52
+ # to our caller how to make them work.
53
+ def method_missing(name, *args, &block)
54
+ if app_helpers.respond_to?(name)
55
+ raise "Please call #{name} as app_helpers.#{name}"
56
+ else
57
+ super(name, *args, &block)
58
+ end
59
+ end
60
+
32
61
  protected
33
62
 
34
63
  # Choose a configuration for the Sanitizer gem.
@@ -0,0 +1,11 @@
1
+ - content_for :head do
2
+ = auto_discovery_link_tag :atom, feed_url
3
+
4
+ .rails_blog_engine
5
+ .rails_blog_engine_content
6
+ .rails_blog_engine_column
7
+ = content_for(:rails_blog_engine_content)
8
+ .rails_blog_engine_sidebar
9
+ .rails_blog_engine_column.rails_blog_engine_body
10
+ = render :partial => 'layouts/rails_blog_engine/sidebar'
11
+ .clearfix
@@ -0,0 +1,12 @@
1
+ %h3 About ACME, Inc.
2
+
3
+ %p
4
+ Edit <code>_sidebar.html.haml</code> to describe your company, your bio
5
+ or your blog.
6
+
7
+ %h3 Recent Posts
8
+
9
+ %ul
10
+ - RailsBlogEngine::Post.recently_published.limit(10).each do |post|
11
+ %li
12
+ = link_to(post.title, post_permalink_path(post))
@@ -7,4 +7,5 @@
7
7
  said
8
8
  %a{:class => "comment-link", :href => "#comment-#{comment.id}"}= distance_of_time_in_words_to_now(comment.created_at)
9
9
  ago:
10
- %div.body~ markdown(comment.body, :trusted? => comment.author_can_post?)
10
+ %div.rails_blog_engine_body
11
+ ~ markdown(comment.body, :trusted? => comment.author_can_post?)
@@ -9,7 +9,7 @@
9
9
  ago by
10
10
  = post.author_byline
11
11
 
12
- %div.body~ markdown(post.body, :trusted? => true)
12
+ %div.rails_blog_engine_body~ markdown(post.body, :trusted? => true)
13
13
 
14
14
  - if current_page?(post_permalink_path(post))
15
15
  = render(:partial => 'rails_blog_engine/posts/comments_section',
@@ -1,5 +1,6 @@
1
1
  - content_for :title do
2
2
  Edit Post
3
- %h1 Edit Post
4
3
 
5
- = render :partial => 'form', :locals => { :post => @post }
4
+ = blog_page do
5
+ %h1 Edit Post
6
+ = render :partial => 'form', :locals => { :post => @post }
@@ -1,4 +1,4 @@
1
- atom_feed(:root_url => root_url, :url => feed_url) do |feed|
1
+ atom_feed(:root_url => blog_url, :url => feed_url) do |feed|
2
2
  feed.title t('rails_blog_engine.blog.title')
3
3
  feed.updated @posts.map(&:updated_at).sort.reverse.first
4
4
  @posts.each do |post|
@@ -1,15 +1,17 @@
1
1
  - content_for :title do
2
2
  = t('rails_blog_engine.blog.title')
3
+
3
4
  - content_for :head do
4
- = auto_discovery_link_tag :atom, feed_url
5
5
  - if params[:page]
6
6
  -# Don't index pages after the first, but still follow links.
7
7
  - content_for :head do
8
8
  %meta(name="robots" content="noindex, follow")
9
9
 
10
- .rails_blog_engine_posts
11
- - if can?(:create, RailsBlogEngine::Post)
12
- = link_to "New Post", new_post_path, :class => "new_post btn large primary"
10
+ = blog_page do
11
+ .rails_blog_engine_posts
12
+ - if can?(:create, RailsBlogEngine::Post)
13
+ = link_to("New Post", new_post_path,
14
+ :class => "new_post btn large primary")
13
15
 
14
- = render @posts
15
- = paginate @posts
16
+ = render @posts
17
+ = paginate @posts
@@ -1,5 +1,6 @@
1
1
  - content_for :title do
2
2
  New Post
3
- %h1 New Post
4
3
 
5
- = render :partial => 'form', :locals => { :post => @post }
4
+ = blog_page do
5
+ %h1 New Post
6
+ = render :partial => 'form', :locals => { :post => @post }
@@ -2,7 +2,6 @@
2
2
  = @post.title
3
3
 
4
4
  = t('rails_blog_engine.blog.title')
5
- - content_for :head do
6
- = auto_discovery_link_tag :atom, feed_url
7
5
 
8
- = render @post
6
+ = blog_page do
7
+ = render @post
data/config/routes.rb CHANGED
@@ -6,7 +6,7 @@ RailsBlogEngine::Engine.routes.draw do
6
6
  get 'page/:page' => 'posts#index', :constraints => { :page => /\d+/ }
7
7
 
8
8
  # Home page.
9
- root :to => 'posts#index'
9
+ root :to => 'posts#index', :as => :blog
10
10
 
11
11
  # Public article pages.
12
12
  get(':year/:month/:day/:permalink' => 'posts#show',
@@ -0,0 +1,8 @@
1
+ // Configuration parameters for the rails_blog_engine stylesheets. This file
2
+ // should contain no CSS rules, only constants.
3
+
4
+ // How big should a blank line between paragraphs be?
5
+ $blank_line_height: 10px;
6
+
7
+ // How wide should the padding be around a box?
8
+ $box_padding: 10px;
@@ -0,0 +1,33 @@
1
+ @import "rails_blog_engine/config";
2
+
3
+ .rails_blog_engine {
4
+
5
+ .rails_blog_engine_comment.show {
6
+ border: 1px solid lightgrey;
7
+ padding: $box_padding $box_padding
8
+ ($box_padding - $blank_line_height) $box_padding;
9
+ margin-bottom: $blank_line_height*2;
10
+
11
+ &.spam {
12
+ background: lighten(#ffb6c1, 10%);
13
+ border-color: lighten(#ffb6c1, 5%);
14
+ color: darkgrey;
15
+ }
16
+
17
+ >.byline {
18
+ margin-top: 0;
19
+ font-weight: normal;
20
+
21
+ a.comment-link {
22
+ color: inherit;
23
+ &:link, &:visited { text-decoration: none; }
24
+ &:hover, &:active { text-decoration: underline; }
25
+ }
26
+ }
27
+
28
+ >.comment-tools {
29
+ float: right;
30
+ margin: 0 0 $blank_line_height $blank_line_height;
31
+ }
32
+ }
33
+ }
@@ -0,0 +1,5 @@
1
+ @import "rails_blog_engine/config";
2
+
3
+ // Use this file to customize the appearance of your blog.
4
+ .rails_blog_engine {
5
+ }
@@ -0,0 +1,33 @@
1
+ @import "rails_blog_engine/config";
2
+
3
+ // The layout for our blog pages.
4
+ .rails_blog_engine {
5
+ // Customize this element appropriately. For example, if you want the
6
+ // blog to be 960 pixels wide and centered on the page, you could use:
7
+ //width: 960px;
8
+ //margin: 0 auto 0 auto;
9
+
10
+ // Set up a two-column model with 2/3rds of the space for the blog posts,
11
+ // and 1/3rd for the sidebar. These defaults are designed to fit into a
12
+ // 960-pixel grid with 940 pixels of content, and to look reasonable
13
+ // elsewhere. Tweak as needed.
14
+ .rails_blog_engine_content, .rails_blog_engine_sidebar { float: left; }
15
+ .rails_blog_engine_content { width: 66.67%; }
16
+ .rails_blog_engine_sidebar { width: 33.33%; }
17
+
18
+ // We put the column gutters in a separate element so that we can use
19
+ // percentage widths above without messing up the box model. If your grid
20
+ // doesn't leave 10 pixels of padding around each column, repalace this
21
+ // with something more appropriate.
22
+ .rails_blog_engine_column { padding: 0 10px; }
23
+
24
+ // Make a container stretch to contain floating columns.
25
+ .clearfix { clear: both; }
26
+
27
+ // Formatting for post bodies, comment bodies, and sidebar content. We
28
+ // eliminate the top margin, and use the bottom margin to space blocks.
29
+ blockquote, dl, embed, h1, h2, h3, h4, h5, h6, hr, object, ol,
30
+ p, pre, table, ul, aside, figure, header, hgroup, section {
31
+ margin: 0 0 $blank_line_height 0;
32
+ }
33
+ }
@@ -0,0 +1,37 @@
1
+ @import "rails_blog_engine/config";
2
+
3
+ // Place all the styles for posts and lists of posts here. We assume a
4
+ // light background color.
5
+ .rails_blog_engine {
6
+
7
+ // Formatting for lists of posts.
8
+ .rails_blog_engine_posts {
9
+ .new_post.btn, nav {
10
+ margin-bottom: $blank_line_height*2;
11
+ }
12
+ }
13
+
14
+ // Formatting for individual posts, either standalone or in a list.
15
+ .rails_blog_engine_post {
16
+ color: black;
17
+ margin-bottom: $blank_line_height*2;
18
+
19
+ >h1 {
20
+ margin-bottom: 0;
21
+ .btn {
22
+ vertical-align: text-bottom;
23
+ }
24
+ }
25
+
26
+ >p.byline {
27
+ color: grey;
28
+ }
29
+
30
+ // We use this for moderation warnings.
31
+ >.flash.notice {
32
+ border: 1px solid #049cdb;
33
+ background: #c7eefe;
34
+ padding: $box_padding;
35
+ }
36
+ }
37
+ }
@@ -119,7 +119,7 @@ $baseline: 18px;
119
119
  opacity: $opacity / 100;
120
120
  }
121
121
 
122
- .rails_blog_engine_posts, .rails_blog_engine_post {
122
+ .rails_blog_engine {
123
123
 
124
124
  // Base .btn styles
125
125
  .btn {
@@ -1,4 +1,4 @@
1
- .rails_blog_engine_post.simple_form, .rails_blog_engine_post .simple_form {
1
+ .rails_blog_engine .simple_form {
2
2
 
3
3
  // Copied from
4
4
  // https://github.com/plataformatec/simple_form/wiki/CSS-for-simple_form,
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Include the CSS files required by rails_blog_engine.
3
+ *
4
+ *= require rails_blog_engine/ui/bootstrap_extracts
5
+ *= require rails_blog_engine/ui/simple_form
6
+ *= require rails_blog_engine/filters/code
7
+ *
8
+ *= require rails_blog_engine/layout
9
+ *= require rails_blog_engine/posts
10
+ *= require rails_blog_engine/comments
11
+ *= require rails_blog_engine/customizations
12
+ */
@@ -20,6 +20,16 @@ class RailsBlogEngine::InstallGenerator < Rails::Generators::Base
20
20
  copy_matching_files_from_gem('config/locales/rails_blog_engine.*.yml')
21
21
  end
22
22
 
23
+ def copy_sidebar
24
+ copy_matching_files_from_gem('app/views/layouts/rails_blog_engine/_sidebar.html.haml')
25
+ end
26
+
27
+ def copy_stylesheets
28
+ copy_matching_files_from_gem('lib/assets/stylesheets/rails_blog_engine/_config.css.scss')
29
+ copy_matching_files_from_gem('lib/assets/stylesheets/rails_blog_engine/layout.css.scss')
30
+ copy_matching_files_from_gem('lib/assets/stylesheets/rails_blog_engine/customizations.css.scss')
31
+ end
32
+
23
33
  def register_javascripts
24
34
  in_root do
25
35
  append_file("app/assets/javascripts/application.js",
@@ -1,5 +1,8 @@
1
1
  # Configure RailsBlogEngine here.
2
2
 
3
+ # Which application layout should we use to render the blog?
4
+ #Rails.application.config.rails_blog_engine.layout = 'application'
5
+
3
6
  # If you want to activate the built-in spam filter, visit http://akismet.com/
4
7
  # and sign up for an API key.
5
8
  Rails.application.config.rakismet.key = ENV['RAKISMET_KEY']
@@ -1,5 +1,20 @@
1
1
  module RailsBlogEngine
2
2
  class Engine < Rails::Engine
3
3
  isolate_namespace RailsBlogEngine
4
+
5
+ # Define some initialization parameters and their default values.
6
+ config.rails_blog_engine = ActiveSupport::OrderedOptions.new
7
+ config.rails_blog_engine.layout = 'application'
8
+
9
+ config.to_prepare do
10
+ ::ApplicationHelper.class_eval do
11
+ # Returns the current object. This can be called from a layout or
12
+ # view used with rails_blog_engine to access the containing
13
+ # application's helpers.
14
+ def app_helpers
15
+ self
16
+ end
17
+ end
18
+ end
4
19
  end
5
20
  end
@@ -1,3 +1,3 @@
1
1
  module RailsBlogEngine
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -15,6 +15,4 @@ require "rails_blog_engine/ability"
15
15
  require "rails_blog_engine/filters"
16
16
 
17
17
  module RailsBlogEngine
18
- class Railtie < ::Rails::Railtie
19
- end
20
18
  end
@@ -36,14 +36,16 @@ feature 'Posts', %q{
36
36
  end
37
37
 
38
38
  scenario 'Looking for posts on page 2' do
39
- # Force our original post off the front page.
40
- 5.times { RailsBlogEngine::Post.make!(:published) }
39
+ # Force our original post off the front page (and off the recent posts
40
+ # list, too).
41
+ 10.times { RailsBlogEngine::Post.make!(:published) }
41
42
 
42
43
  visit '/blog'
43
44
  page.should_not have_content("Test Post")
44
45
  click_on "Next"
46
+ click_on "Next"
45
47
  page.should have_content("Test Post")
46
- current_path.should == '/blog/page/2'
48
+ current_path.should == '/blog/page/3'
47
49
  end
48
50
 
49
51
  scenario 'Adding a comment' do
@@ -0,0 +1,6 @@
1
+ // Simulate a 960-pixel grid system, so that we have a realistic way to
2
+ // test out application layout.
3
+ .content {
4
+ width: 960px;
5
+ margin: 0 auto 0 auto;
6
+ }
@@ -9,7 +9,9 @@
9
9
  </head>
10
10
  <body>
11
11
 
12
- <%= yield %>
12
+ <div class="content">
13
+ <%= yield %>
14
+ </div>
13
15
 
14
16
  </body>
15
17
  </html>
@@ -1,5 +1,8 @@
1
1
  # Configure RailsBlogEngine here.
2
2
 
3
+ # Which application layout should we use to render the blog?
4
+ #Rails.application.config.rails_blog_engine.layout = 'application'
5
+
3
6
  # If you want to activate the built-in spam filter, visit http://akismet.com/
4
7
  # and sign up for an API key.
5
8
  Rails.application.config.rakismet.key = ENV['RAKISMET_KEY']
@@ -53,6 +53,13 @@ EOD
53
53
  end
54
54
  end
55
55
  end
56
+ directory "views" do
57
+ directory "layouts" do
58
+ directory "rails_blog_engine" do
59
+ file "_sidebar.html.haml"
60
+ end
61
+ end
62
+ end
56
63
  end
57
64
  directory "config" do
58
65
  file "routes.rb" do
@@ -73,6 +80,17 @@ EOD
73
80
  file "20110913190319_add_fields_to_rails_blog_engine_post.rb"
74
81
  end
75
82
  end
83
+ directory "lib" do
84
+ directory "assets" do
85
+ directory "stylesheets" do
86
+ directory "rails_blog_engine" do
87
+ file "_config.css.scss"
88
+ file "layout.css.scss"
89
+ file "customizations.css.scss"
90
+ end
91
+ end
92
+ end
93
+ end
76
94
  }
77
95
  end
78
96
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_blog_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
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: 2011-11-27 00:00:00.000000000Z
12
+ date: 2011-11-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
- requirement: &24056660 !ruby/object:Gem::Requirement
16
+ requirement: &18672980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 3.1.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *24056660
24
+ version_requirements: *18672980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: jquery-rails
27
- requirement: &24056140 !ruby/object:Gem::Requirement
27
+ requirement: &18672480 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '1.0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *24056140
35
+ version_requirements: *18672480
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: sass-rails
38
- requirement: &24055640 !ruby/object:Gem::Requirement
38
+ requirement: &18672020 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '3.1'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *24055640
46
+ version_requirements: *18672020
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: coffee-script
49
- requirement: &24055120 !ruby/object:Gem::Requirement
49
+ requirement: &18671560 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '2.2'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *24055120
57
+ version_requirements: *18671560
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: haml
60
- requirement: &24054660 !ruby/object:Gem::Requirement
60
+ requirement: &18671100 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '3.1'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *24054660
68
+ version_requirements: *18671100
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: kaminari
71
- requirement: &24054180 !ruby/object:Gem::Requirement
71
+ requirement: &18670640 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.12.4
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *24054180
79
+ version_requirements: *18670640
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: cancan
82
- requirement: &24043380 !ruby/object:Gem::Requirement
82
+ requirement: &18670180 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '1.6'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *24043380
90
+ version_requirements: *18670180
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rakismet
93
- requirement: &24042880 !ruby/object:Gem::Requirement
93
+ requirement: &18669720 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '1.1'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *24042880
101
+ version_requirements: *18669720
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: simple_form
104
- requirement: &24042360 !ruby/object:Gem::Requirement
104
+ requirement: &18669260 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '1.4'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *24042360
112
+ version_requirements: *18669260
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: state_machine
115
- requirement: &24041860 !ruby/object:Gem::Requirement
115
+ requirement: &18668800 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: 1.0.0
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *24041860
123
+ version_requirements: *18668800
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rdiscount
126
- requirement: &24041360 !ruby/object:Gem::Requirement
126
+ requirement: &18668340 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ~>
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '1.6'
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *24041360
134
+ version_requirements: *18668340
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: sanitize
137
- requirement: &24040900 !ruby/object:Gem::Requirement
137
+ requirement: &18667880 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ~>
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '2.0'
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *24040900
145
+ version_requirements: *18667880
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: sqlite3
148
- requirement: &24040500 !ruby/object:Gem::Requirement
148
+ requirement: &18667500 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :development
155
155
  prerelease: false
156
- version_requirements: *24040500
156
+ version_requirements: *18667500
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: devise
159
- requirement: &24040020 !ruby/object:Gem::Requirement
159
+ requirement: &18667040 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,10 +164,10 @@ dependencies:
164
164
  version: '0'
165
165
  type: :development
166
166
  prerelease: false
167
- version_requirements: *24040020
167
+ version_requirements: *18667040
168
168
  - !ruby/object:Gem::Dependency
169
169
  name: steak
170
- requirement: &24039600 !ruby/object:Gem::Requirement
170
+ requirement: &18666620 !ruby/object:Gem::Requirement
171
171
  none: false
172
172
  requirements:
173
173
  - - ! '>='
@@ -175,10 +175,10 @@ dependencies:
175
175
  version: '0'
176
176
  type: :development
177
177
  prerelease: false
178
- version_requirements: *24039600
178
+ version_requirements: *18666620
179
179
  - !ruby/object:Gem::Dependency
180
180
  name: foreman
181
- requirement: &24039180 !ruby/object:Gem::Requirement
181
+ requirement: &18666200 !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
184
184
  - - ! '>='
@@ -186,10 +186,10 @@ dependencies:
186
186
  version: '0'
187
187
  type: :development
188
188
  prerelease: false
189
- version_requirements: *24039180
189
+ version_requirements: *18666200
190
190
  - !ruby/object:Gem::Dependency
191
191
  name: capybara-webkit
192
- requirement: &24038660 !ruby/object:Gem::Requirement
192
+ requirement: &18665700 !ruby/object:Gem::Requirement
193
193
  none: false
194
194
  requirements:
195
195
  - - ~>
@@ -197,10 +197,10 @@ dependencies:
197
197
  version: 0.6.1
198
198
  type: :development
199
199
  prerelease: false
200
- version_requirements: *24038660
200
+ version_requirements: *18665700
201
201
  - !ruby/object:Gem::Dependency
202
202
  name: database_cleaner
203
- requirement: &24038240 !ruby/object:Gem::Requirement
203
+ requirement: &18687340 !ruby/object:Gem::Requirement
204
204
  none: false
205
205
  requirements:
206
206
  - - ! '>='
@@ -208,10 +208,10 @@ dependencies:
208
208
  version: '0'
209
209
  type: :development
210
210
  prerelease: false
211
- version_requirements: *24038240
211
+ version_requirements: *18687340
212
212
  - !ruby/object:Gem::Dependency
213
213
  name: shoulda-matchers
214
- requirement: &24037740 !ruby/object:Gem::Requirement
214
+ requirement: &18686880 !ruby/object:Gem::Requirement
215
215
  none: false
216
216
  requirements:
217
217
  - - ! '>='
@@ -219,10 +219,10 @@ dependencies:
219
219
  version: '0'
220
220
  type: :development
221
221
  prerelease: false
222
- version_requirements: *24037740
222
+ version_requirements: *18686880
223
223
  - !ruby/object:Gem::Dependency
224
224
  name: generator_spec
225
- requirement: &24037240 !ruby/object:Gem::Requirement
225
+ requirement: &18686460 !ruby/object:Gem::Requirement
226
226
  none: false
227
227
  requirements:
228
228
  - - ! '>='
@@ -230,10 +230,10 @@ dependencies:
230
230
  version: '0'
231
231
  type: :development
232
232
  prerelease: false
233
- version_requirements: *24037240
233
+ version_requirements: *18686460
234
234
  - !ruby/object:Gem::Dependency
235
235
  name: vcr
236
- requirement: &24036660 !ruby/object:Gem::Requirement
236
+ requirement: &18685960 !ruby/object:Gem::Requirement
237
237
  none: false
238
238
  requirements:
239
239
  - - ! '>='
@@ -241,10 +241,10 @@ dependencies:
241
241
  version: 2.0.0.beta2
242
242
  type: :development
243
243
  prerelease: false
244
- version_requirements: *24036660
244
+ version_requirements: *18685960
245
245
  - !ruby/object:Gem::Dependency
246
246
  name: fakeweb
247
- requirement: &24036240 !ruby/object:Gem::Requirement
247
+ requirement: &18685540 !ruby/object:Gem::Requirement
248
248
  none: false
249
249
  requirements:
250
250
  - - ! '>='
@@ -252,10 +252,10 @@ dependencies:
252
252
  version: '0'
253
253
  type: :development
254
254
  prerelease: false
255
- version_requirements: *24036240
255
+ version_requirements: *18685540
256
256
  - !ruby/object:Gem::Dependency
257
257
  name: guard-rspec
258
- requirement: &24035640 !ruby/object:Gem::Requirement
258
+ requirement: &18685080 !ruby/object:Gem::Requirement
259
259
  none: false
260
260
  requirements:
261
261
  - - ! '>='
@@ -263,10 +263,10 @@ dependencies:
263
263
  version: '0'
264
264
  type: :development
265
265
  prerelease: false
266
- version_requirements: *24035640
266
+ version_requirements: *18685080
267
267
  - !ruby/object:Gem::Dependency
268
268
  name: rb-inotify
269
- requirement: &24034260 !ruby/object:Gem::Requirement
269
+ requirement: &18684660 !ruby/object:Gem::Requirement
270
270
  none: false
271
271
  requirements:
272
272
  - - ! '>='
@@ -274,10 +274,10 @@ dependencies:
274
274
  version: '0'
275
275
  type: :development
276
276
  prerelease: false
277
- version_requirements: *24034260
277
+ version_requirements: *18684660
278
278
  - !ruby/object:Gem::Dependency
279
279
  name: libnotify
280
- requirement: &24033800 !ruby/object:Gem::Requirement
280
+ requirement: &18684240 !ruby/object:Gem::Requirement
281
281
  none: false
282
282
  requirements:
283
283
  - - ! '>='
@@ -285,10 +285,10 @@ dependencies:
285
285
  version: '0'
286
286
  type: :development
287
287
  prerelease: false
288
- version_requirements: *24033800
288
+ version_requirements: *18684240
289
289
  - !ruby/object:Gem::Dependency
290
290
  name: launchy
291
- requirement: &24033360 !ruby/object:Gem::Requirement
291
+ requirement: &18683820 !ruby/object:Gem::Requirement
292
292
  none: false
293
293
  requirements:
294
294
  - - ! '>='
@@ -296,7 +296,7 @@ dependencies:
296
296
  version: '0'
297
297
  type: :development
298
298
  prerelease: false
299
- version_requirements: *24033360
299
+ version_requirements: *18683820
300
300
  description: Rails 3.1 drop-in blog engine for existing Rails applications
301
301
  email:
302
302
  - eric@kiddsoftware.com
@@ -320,12 +320,6 @@ files:
320
320
  - app/assets/javascripts/rails_blog_engine.js
321
321
  - app/assets/javascripts/rails_blog_engine/comments.js
322
322
  - app/assets/javascripts/rails_blog_engine/posts.js
323
- - app/assets/stylesheets/rails_blog_engine.css
324
- - app/assets/stylesheets/rails_blog_engine/bootstrap_extracts.css.scss
325
- - app/assets/stylesheets/rails_blog_engine/code.css.scss
326
- - app/assets/stylesheets/rails_blog_engine/comments.css.scss
327
- - app/assets/stylesheets/rails_blog_engine/posts.css.scss
328
- - app/assets/stylesheets/rails_blog_engine/simple_form.css.scss
329
323
  - app/controllers/rails_blog_engine/application_controller.rb
330
324
  - app/controllers/rails_blog_engine/comments_controller.rb
331
325
  - app/controllers/rails_blog_engine/posts_controller.rb
@@ -334,6 +328,8 @@ files:
334
328
  - app/helpers/rails_blog_engine/posts_helper.rb
335
329
  - app/models/rails_blog_engine/comment.rb
336
330
  - app/models/rails_blog_engine/post.rb
331
+ - app/views/layouts/rails_blog_engine/_blog_page.html.haml
332
+ - app/views/layouts/rails_blog_engine/_sidebar.html.haml
337
333
  - app/views/rails_blog_engine/comments/_comment.html.haml
338
334
  - app/views/rails_blog_engine/comments/_form.html.haml
339
335
  - app/views/rails_blog_engine/comments/_tools.html.haml
@@ -353,6 +349,15 @@ files:
353
349
  - db/migrate/20110912153527_create_rails_blog_engine_posts.rb
354
350
  - db/migrate/20110913190319_add_fields_to_rails_blog_engine_post.rb
355
351
  - db/migrate/20111125111958_create_rails_blog_engine_comments.rb
352
+ - lib/assets/stylesheets/rails_blog_engine.css
353
+ - lib/assets/stylesheets/rails_blog_engine/_config.css.scss
354
+ - lib/assets/stylesheets/rails_blog_engine/comments.css.scss
355
+ - lib/assets/stylesheets/rails_blog_engine/customizations.css.scss
356
+ - lib/assets/stylesheets/rails_blog_engine/filters/code.css.scss
357
+ - lib/assets/stylesheets/rails_blog_engine/layout.css.scss
358
+ - lib/assets/stylesheets/rails_blog_engine/posts.css.scss
359
+ - lib/assets/stylesheets/rails_blog_engine/ui/bootstrap_extracts.css.scss
360
+ - lib/assets/stylesheets/rails_blog_engine/ui/simple_form.css.scss
356
361
  - lib/generators/rails_blog_engine/install/USAGE
357
362
  - lib/generators/rails_blog_engine/install/install_generator.rb
358
363
  - lib/generators/rails_blog_engine/install/templates/rails_blog_engine.rb
@@ -377,6 +382,7 @@ files:
377
382
  - spec/dummy/Rakefile
378
383
  - spec/dummy/app/assets/javascripts/application.js
379
384
  - spec/dummy/app/assets/stylesheets/application.css
385
+ - spec/dummy/app/assets/stylesheets/layout.css.scss
380
386
  - spec/dummy/app/controllers/application_controller.rb
381
387
  - spec/dummy/app/controllers/home_controller.rb
382
388
  - spec/dummy/app/helpers/application_helper.rb
@@ -1,29 +0,0 @@
1
- .rails_blog_engine_comment.show {
2
- border: 1px solid lightgrey;
3
- padding: 10px 10px 0 10px;
4
- margin-bottom: 20px;
5
- max-width: 600px;
6
-
7
- &.spam {
8
- background: lighten(#ffb6c1, 10%);
9
- border-color: lighten(#ffb6c1, 5%);
10
- color: darkgrey;
11
- }
12
-
13
- >.byline {
14
- margin-top: 0;
15
- margin-bottom: 10px;
16
- font-weight: normal;
17
-
18
- a.comment-link {
19
- color: inherit;
20
- &:link, &:visited { text-decoration: none; }
21
- &:hover, &:active { text-decoration: underline; }
22
- }
23
- }
24
-
25
- >.comment-tools {
26
- float: right;
27
- margin: 0 0 10px 10px;
28
- }
29
- }
@@ -1,46 +0,0 @@
1
- // Place all the styles for posts and lists of posts here. We assume a
2
- // light background color.
3
-
4
- .rails_blog_engine_posts {
5
- .new_post.btn, nav {
6
- margin-bottom: 20px;
7
- }
8
- }
9
-
10
- .rails_blog_engine_post {
11
- color: black;
12
- margin-bottom: 20px;
13
-
14
- // Clear top margins. We'll use the bottom margin for spacing.
15
- >h1, >p.byline, >.body {
16
- margin-top: 0;
17
- }
18
-
19
- >h1 {
20
- margin-bottom: 0px;
21
- .btn {
22
- vertical-align: text-bottom;
23
- }
24
- }
25
-
26
- >p.byline {
27
- margin-bottom: 10px;
28
- color: grey;
29
- }
30
-
31
- // This works at both the top level and in nested comments.
32
- .body {
33
- >blockquote, >dl, >embed, >h1, >h2, >h3, >h4, >h5, >h6, >hr, >object, >ol,
34
- >p, >pre, >table, >ul, >aside, >figure, >header, >hgroup, >section {
35
- margin-bottom: 10px;
36
- }
37
- }
38
-
39
- // We use this for moderation warnings.
40
- >.flash.notice {
41
- border: 1px solid #049cdb;
42
- background: #c7eefe;
43
- padding: 10px;
44
- max-width: 600px;
45
- }
46
- }
@@ -1,6 +0,0 @@
1
- /*
2
- * Include the CSS files required by rails_blog_engine.
3
- *
4
- *= require_self
5
- *= require_tree ./rails_blog_engine
6
- */