governor_comments 0.1.1 → 0.1.2
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.
- data/Gemfile.lock +2 -2
- data/{README.markdown → README.rdoc} +20 -25
- data/VERSION +1 -1
- data/governor_comments.gemspec +6 -4
- data/lib/generators/governor/create_comments_generator.rb +6 -0
- data/lib/generators/governor/templates/migrations/create_comments.rb +1 -1
- data/lib/governor_comments.rb +4 -1
- data/spec/governor_comments_spec.rb +0 -7
- data/spec/models/article_spec.rb +8 -0
- metadata +8 -6
    
        data/Gemfile.lock
    CHANGED
    
    
| @@ -1,48 +1,45 @@ | |
| 1 | 
            -
            governor_comments
         | 
| 2 | 
            -
            =================
         | 
| 1 | 
            +
            = governor_comments
         | 
| 3 2 |  | 
| 4 | 
            -
             | 
| 3 | 
            +
            *Governor[http://carpeliam.github.com/governor/]* (named after Rod
         | 
| 5 4 | 
             
            Blagojevich) is the pluggable blogging platform for Rails, built for people
         | 
| 6 5 | 
             
            who want to build their blog into their website, not build their website into
         | 
| 7 6 | 
             
            their blog.
         | 
| 8 7 |  | 
| 9 | 
            -
             | 
| 8 | 
            +
            *governor_comments* is a plugin for Governor, allowing users and guests to
         | 
| 10 9 | 
             
            comment on your blog.
         | 
| 11 10 |  | 
| 12 | 
            -
            Dependencies
         | 
| 13 | 
            -
            ------------
         | 
| 11 | 
            +
            == Dependencies
         | 
| 14 12 |  | 
| 15 | 
            -
            * Governor, version 0.2. | 
| 16 | 
            -
              class (or whatever classes can be associated with an article) have  | 
| 17 | 
            -
               | 
| 13 | 
            +
            * Governor, version 0.2.2 or higher. In addition, it requires that your User
         | 
| 14 | 
            +
              class (or whatever classes can be associated with an article) have +name+,
         | 
| 15 | 
            +
              +email+, and +website+ fields.
         | 
| 18 16 | 
             
            * ActiveRecord
         | 
| 19 | 
            -
            * Optional: [ | 
| 17 | 
            +
            * Optional: Rakismet[https://github.com/joshfrench/rakismet/] to integrate
         | 
| 20 18 | 
             
              Akismet spam filtering.
         | 
| 21 19 |  | 
| 22 | 
            -
            Setting Up
         | 
| 23 | 
            -
            ----------
         | 
| 20 | 
            +
            == Setting Up
         | 
| 24 21 |  | 
| 25 | 
            -
            First, install [ | 
| 22 | 
            +
            First, install Governor[http://carpeliam.github.com/governor/]. Then, in
         | 
| 26 23 | 
             
            your Gemfile, add the following:
         | 
| 27 24 |  | 
| 28 25 | 
             
                gem 'governor_comments'
         | 
| 29 26 |  | 
| 30 27 | 
             
            Once you've installed the gem into your app, you need to run the generator:
         | 
| 31 28 |  | 
| 32 | 
            -
                rails generate governor:create_comments
         | 
| 29 | 
            +
                rails generate governor:create_comments [RESOURCE]
         | 
| 33 30 |  | 
| 34 | 
            -
             | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 31 | 
            +
            If you've only created one type of resource (which is typical), then you won't
         | 
| 32 | 
            +
            need any arguments. Otherwise, you'll need to specify which model you want to
         | 
| 33 | 
            +
            add comments to. This will create a Comment class and associated migration.
         | 
| 34 | 
            +
            Make sure to add the +name+, +email+, and +website+ fields to your User model
         | 
| 35 | 
            +
            if they don't exist already.
         | 
| 37 36 |  | 
| 38 | 
            -
            Usage
         | 
| 39 | 
            -
            -----
         | 
| 37 | 
            +
            == Usage
         | 
| 40 38 |  | 
| 41 39 | 
             
            Now, when you browse to an article, you'll see places to add comments right in
         | 
| 42 40 | 
             
            the page. You really don't have to do anything special at this point.
         | 
| 43 41 |  | 
| 44 | 
            -
            Contributing to governor_comments
         | 
| 45 | 
            -
            ---------------------------------
         | 
| 42 | 
            +
            == Contributing to governor_comments
         | 
| 46 43 |  | 
| 47 44 | 
             
            * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
         | 
| 48 45 | 
             
            * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
         | 
| @@ -52,8 +49,6 @@ Contributing to governor_comments | |
| 52 49 | 
             
            * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
         | 
| 53 50 | 
             
            * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
         | 
| 54 51 |  | 
| 55 | 
            -
            Copyright
         | 
| 56 | 
            -
            ---------
         | 
| 57 | 
            -
             | 
| 58 | 
            -
            Copyright © 2011 Liam Morley. See LICENSE.txt for further details.
         | 
| 52 | 
            +
            == Copyright
         | 
| 59 53 |  | 
| 54 | 
            +
            Copyright (c) 2011 Liam Morley. See LICENSE.txt for further details.
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.1. | 
| 1 | 
            +
            0.1.2
         | 
    
        data/governor_comments.gemspec
    CHANGED
    
    | @@ -5,16 +5,16 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{governor_comments}
         | 
| 8 | 
            -
              s.version = "0.1. | 
| 8 | 
            +
              s.version = "0.1.2"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Liam Morley"]
         | 
| 12 | 
            -
              s.date = %q{2011-04- | 
| 12 | 
            +
              s.date = %q{2011-04-12}
         | 
| 13 13 | 
             
              s.description = %q{Comments plugin for the Rails 3-based Governor blogging system.}
         | 
| 14 14 | 
             
              s.email = %q{liam@carpeliam.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
| 16 16 | 
             
                "LICENSE.txt",
         | 
| 17 | 
            -
                "README. | 
| 17 | 
            +
                "README.rdoc"
         | 
| 18 18 | 
             
              ]
         | 
| 19 19 | 
             
              s.files = [
         | 
| 20 20 | 
             
                ".document",
         | 
| @@ -22,7 +22,7 @@ Gem::Specification.new do |s| | |
| 22 22 | 
             
                "Gemfile",
         | 
| 23 23 | 
             
                "Gemfile.lock",
         | 
| 24 24 | 
             
                "LICENSE.txt",
         | 
| 25 | 
            -
                "README. | 
| 25 | 
            +
                "README.rdoc",
         | 
| 26 26 | 
             
                "Rakefile",
         | 
| 27 27 | 
             
                "VERSION",
         | 
| 28 28 | 
             
                "app/controllers/governor/comments_controller.rb",
         | 
| @@ -44,6 +44,7 @@ Gem::Specification.new do |s| | |
| 44 44 | 
             
                "script/rails",
         | 
| 45 45 | 
             
                "spec/controllers/governor/comments_controller_spec.rb",
         | 
| 46 46 | 
             
                "spec/governor_comments_spec.rb",
         | 
| 47 | 
            +
                "spec/models/article_spec.rb",
         | 
| 47 48 | 
             
                "spec/rails_app/.gitignore",
         | 
| 48 49 | 
             
                "spec/rails_app/Gemfile",
         | 
| 49 50 | 
             
                "spec/rails_app/Gemfile.lock",
         | 
| @@ -111,6 +112,7 @@ Gem::Specification.new do |s| | |
| 111 112 | 
             
              s.test_files = [
         | 
| 112 113 | 
             
                "spec/controllers/governor/comments_controller_spec.rb",
         | 
| 113 114 | 
             
                "spec/governor_comments_spec.rb",
         | 
| 115 | 
            +
                "spec/models/article_spec.rb",
         | 
| 114 116 | 
             
                "spec/rails_app/app/controllers/application_controller.rb",
         | 
| 115 117 | 
             
                "spec/rails_app/app/controllers/home_controller.rb",
         | 
| 116 118 | 
             
                "spec/rails_app/app/helpers/application_helper.rb",
         | 
| @@ -4,6 +4,7 @@ module Governor | |
| 4 4 | 
             
              class CreateCommentsGenerator < Rails::Generators::Base
         | 
| 5 5 | 
             
                include Rails::Generators::Migration
         | 
| 6 6 | 
             
                source_root File.expand_path('../templates', __FILE__)
         | 
| 7 | 
            +
                argument :resource, :type => :string, :default => Governor.default_resource.plural.to_s
         | 
| 7 8 |  | 
| 8 9 | 
             
                def self.next_migration_number(dirname)
         | 
| 9 10 | 
             
                  if ActiveRecord::Base.timestamped_migrations
         | 
| @@ -21,5 +22,10 @@ module Governor | |
| 21 22 | 
             
                def create_migration_file
         | 
| 22 23 | 
             
                  migration_template 'migrations/create_comments.rb', "db/migrate/governor_create_comments.rb", :skip => true
         | 
| 23 24 | 
             
                end
         | 
| 25 | 
            +
                
         | 
| 26 | 
            +
                private
         | 
| 27 | 
            +
                def mapping
         | 
| 28 | 
            +
                  Governor.resources[resource.pluralize.to_sym]
         | 
| 29 | 
            +
                end
         | 
| 24 30 | 
             
              end
         | 
| 25 31 | 
             
            end
         | 
    
        data/lib/governor_comments.rb
    CHANGED
    
    | @@ -4,12 +4,15 @@ require 'governor_comments/rails' | |
| 4 4 | 
             
            comments = Governor::Plugin.new('comments')
         | 
| 5 5 | 
             
            comments.add_migration(File.join(File.dirname(__FILE__), 'templates', 'create_comments.rb'))
         | 
| 6 6 | 
             
            comments.set_routes do
         | 
| 7 | 
            -
              resources :comments do
         | 
| 7 | 
            +
              resources :comments, :module => :governor do
         | 
| 8 8 | 
             
                member do
         | 
| 9 9 | 
             
                  put 'mark_spam', 'not_spam'
         | 
| 10 10 | 
             
                end
         | 
| 11 11 | 
             
              end
         | 
| 12 12 | 
             
            end
         | 
| 13 | 
            +
            comments.register_model_callback do |base|
         | 
| 14 | 
            +
              base.has_many :comments, :dependent => :destroy
         | 
| 15 | 
            +
            end
         | 
| 13 16 | 
             
            comments.add_helper "GovernorCommentsHelper"
         | 
| 14 17 | 
             
            comments.register_partial :after_article_whole, 'articles/comments'
         | 
| 15 18 | 
             
            comments.register_partial :after_article_description, 'articles/comment_link'
         | 
| @@ -5,12 +5,5 @@ module Governor | |
| 5 5 | 
             
                it "registers the plugin" do
         | 
| 6 6 | 
             
                  Governor::PluginManager.plugins.size == 1
         | 
| 7 7 | 
             
                end
         | 
| 8 | 
            -
              
         | 
| 9 | 
            -
                it "registers one child resource" do
         | 
| 10 | 
            -
                  PluginManager.resources(:child_resources).size.should == 1
         | 
| 11 | 
            -
                  options = PluginManager.resources(:child_resources)[:comments]
         | 
| 12 | 
            -
                  options.keys.should == [:block]
         | 
| 13 | 
            -
                  options[:block].should be_a Proc
         | 
| 14 | 
            -
                end
         | 
| 15 8 | 
             
              end
         | 
| 16 9 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: governor_comments
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 31
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 1
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.1. | 
| 9 | 
            +
              - 2
         | 
| 10 | 
            +
              version: 0.1.2
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Liam Morley
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2011-04- | 
| 18 | 
            +
            date: 2011-04-12 00:00:00 -04:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| @@ -219,14 +219,14 @@ extensions: [] | |
| 219 219 |  | 
| 220 220 | 
             
            extra_rdoc_files: 
         | 
| 221 221 | 
             
            - LICENSE.txt
         | 
| 222 | 
            -
            - README. | 
| 222 | 
            +
            - README.rdoc
         | 
| 223 223 | 
             
            files: 
         | 
| 224 224 | 
             
            - .document
         | 
| 225 225 | 
             
            - .rspec
         | 
| 226 226 | 
             
            - Gemfile
         | 
| 227 227 | 
             
            - Gemfile.lock
         | 
| 228 228 | 
             
            - LICENSE.txt
         | 
| 229 | 
            -
            - README. | 
| 229 | 
            +
            - README.rdoc
         | 
| 230 230 | 
             
            - Rakefile
         | 
| 231 231 | 
             
            - VERSION
         | 
| 232 232 | 
             
            - app/controllers/governor/comments_controller.rb
         | 
| @@ -248,6 +248,7 @@ files: | |
| 248 248 | 
             
            - script/rails
         | 
| 249 249 | 
             
            - spec/controllers/governor/comments_controller_spec.rb
         | 
| 250 250 | 
             
            - spec/governor_comments_spec.rb
         | 
| 251 | 
            +
            - spec/models/article_spec.rb
         | 
| 251 252 | 
             
            - spec/rails_app/.gitignore
         | 
| 252 253 | 
             
            - spec/rails_app/Gemfile
         | 
| 253 254 | 
             
            - spec/rails_app/Gemfile.lock
         | 
| @@ -343,6 +344,7 @@ summary: Comments plugin for the Rails 3-based Governor blogging system. | |
| 343 344 | 
             
            test_files: 
         | 
| 344 345 | 
             
            - spec/controllers/governor/comments_controller_spec.rb
         | 
| 345 346 | 
             
            - spec/governor_comments_spec.rb
         | 
| 347 | 
            +
            - spec/models/article_spec.rb
         | 
| 346 348 | 
             
            - spec/rails_app/app/controllers/application_controller.rb
         | 
| 347 349 | 
             
            - spec/rails_app/app/controllers/home_controller.rb
         | 
| 348 350 | 
             
            - spec/rails_app/app/helpers/application_helper.rb
         |