sunrise-comments 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,20 @@
1
+ Copyright 2012 Fodojo http://fodojo.com/
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,7 +1,15 @@
1
1
  = Sunrise Comments
2
2
 
3
+ Comments system module for sunrise-cms
4
+
3
5
  == Install
4
6
 
7
+ gem "sunrise-comments"
8
+
9
+ bundle install
10
+
11
+ rake sunrise_comments_engine:install:migrations
12
+
5
13
  rails generate sunrise:comments:install
6
14
 
7
15
  In generated migration add "comments_count" column for counter cache:
@@ -20,4 +28,4 @@ In generated migration add "comments_count" column for counter cache:
20
28
  include Sunrise::Comments::Author
21
29
  end
22
30
 
23
- Copyright (c) 2011 Aimbulance, released under the MIT license
31
+ Copyright (c) 2011-2012 Fodojo, released under the MIT license
data/Rakefile CHANGED
@@ -23,24 +23,3 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
23
23
  rdoc.rdoc_files.include('README')
24
24
  rdoc.rdoc_files.include('lib/**/*.rb')
25
25
  end
26
-
27
- begin
28
- require 'jeweler'
29
- Jeweler::Tasks.new do |s|
30
- s.name = "sunrise-comments"
31
- s.version = Sunrise::Comments::VERSION.dup
32
- s.summary = "Rails CMS"
33
- s.description = "Sunrise is a Aimbulance CMS"
34
- s.email = "galeta.igor@gmail.com"
35
- s.homepage = "https://github.com/galetahub/sunrise-comments"
36
- s.authors = ["Igor Galeta", "Pavlo Galeta"]
37
- s.files = FileList["[A-Z]*", "{app,config,lib}/**/*"]
38
- s.extra_rdoc_files = FileList["[A-Z]*"] - %w(Gemfile Rakefile)
39
-
40
- s.add_dependency('sunrise-cms')
41
- end
42
-
43
- Jeweler::GemcutterTasks.new
44
- rescue LoadError
45
- puts "Jeweler not available. Install it with: gem install jeweler"
46
- end
@@ -17,6 +17,6 @@ class CommentSweeper < ActionController::Caching::Sweeper
17
17
 
18
18
  def expire(item=nil)
19
19
  expire_fragment(%r{/comments})
20
- StructureSweeper.sweep!
20
+ Sunrise::Utils.clear_cache
21
21
  end
22
22
  end
@@ -1,7 +1,3 @@
1
1
  Rails.application.routes.draw do
2
- resources :comments, :only => [:new, :create, :edit, :update, :destroy]
3
-
4
- namespace :manage do
5
- resources :comments
6
- end
2
+ resources :comments, :only => [:new, :create, :edit, :update, :destroy]
7
3
  end
@@ -1,4 +1,4 @@
1
- class SunriseCreateComments < ActiveRecord::Migration
1
+ class CreateComments < ActiveRecord::Migration
2
2
  def self.up
3
3
  create_table :comments do |t|
4
4
  t.string :user_name, :limit => 50
@@ -1,34 +1,14 @@
1
1
  require 'rails/generators'
2
- require 'rails/generators/migration'
3
2
 
4
3
  module Sunrise
5
4
  module Comments
6
5
  class InstallGenerator < Rails::Generators::Base
7
- include Rails::Generators::Migration
8
-
9
6
  source_root File.expand_path(File.join(File.dirname(__FILE__), 'templates'))
10
- class_option :migrations, :type => :boolean, :default => true, :description => "Generate migrations files"
7
+ desc "Generates comment model"
11
8
 
12
- desc "Generates comment migration and model"
13
-
14
- def self.current_time
15
- @current_time ||= Time.now
16
- @current_time += 1.minute
17
- end
18
-
19
- def self.next_migration_number(dirname)
20
- current_time.strftime("%Y%m%d%H%M%S")
21
- end
22
-
23
9
  def create_model
24
10
  copy_file('comment.rb', 'app/models/comment.rb')
25
11
  end
26
-
27
- def create_migration
28
- if options.migrations
29
- migration_template "create_comments.rb", File.join('db/migrate', "sunrise_create_comments.rb")
30
- end
31
- end
32
12
  end
33
13
  end
34
14
  end
@@ -1,5 +1,5 @@
1
1
  class Comment < ActiveRecord::Base
2
- include Sunrise::Models::Comment
2
+ include Sunrise::Comments::Commentable
3
3
 
4
4
  attr_accessible :user_name, :user_email, :content, :is_follow
5
5
 
@@ -3,6 +3,7 @@ module Sunrise
3
3
  module Comments
4
4
  autoload :Base, 'sunrise/comments/base'
5
5
  autoload :Author, 'sunrise/comments/author'
6
+ autoload :Commentable, 'sunrise/comments/commentable'
6
7
 
7
8
  # Default way to setup Sunrise.
8
9
  def self.setup
@@ -1,7 +1,7 @@
1
1
  # encoding: utf-8
2
2
  module Sunrise
3
- module Models
4
- module Comment
3
+ module Comments
4
+ module Commentable
5
5
  def self.included(base)
6
6
  base.send :include, InstanceMethods
7
7
  base.send :extend, ClassMethods
@@ -1,18 +1,10 @@
1
1
  require 'rails'
2
+ require 'sunrise-cms'
2
3
  require 'sunrise-comments'
3
4
 
4
5
  module Sunrise
5
6
  module Comments
6
7
  class Engine < ::Rails::Engine
7
- config.before_initialize do
8
- Sunrise::Plugin.register :comments do |plugin|
9
- plugin.model = 'sunrise/models/comment'
10
- plugin.menu = false
11
- plugin.version = Sunrise::Comments::VERSION.dup
12
- end
13
-
14
- Sunrise::Plugins.activate(:comments)
15
- end
16
8
  end
17
9
  end
18
10
  end
@@ -1,5 +1,5 @@
1
1
  module Sunrise
2
2
  module Comments
3
- VERSION = "0.1.2".freeze
3
+ VERSION = "0.2.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,103 +1,102 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: sunrise-comments
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Igor Galeta
14
9
  - Pavlo Galeta
15
10
  autorequire:
16
11
  bindir: bin
17
12
  cert_chain: []
18
-
19
- date: 2011-08-16 00:00:00 +03:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
13
+ date: 2012-09-19 00:00:00.000000000 Z
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
23
16
  name: sunrise-cms
17
+ requirement: !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
22
+ version: '0'
23
+ type: :runtime
24
24
  prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ! '>='
29
+ - !ruby/object:Gem::Version
30
+ version: '0'
31
+ - !ruby/object:Gem::Dependency
32
+ name: auto_html
33
+ requirement: !ruby/object:Gem::Requirement
26
34
  none: false
27
- requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- hash: 3
31
- segments:
32
- - 0
33
- version: "0"
35
+ requirements:
36
+ - - ! '>='
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
34
39
  type: :runtime
35
- version_requirements: *id001
36
- description: Sunrise is a Aimbulance CMS
40
+ prerelease: false
41
+ version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ! '>='
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ description: Comments module for sunrise-cms
37
48
  email: galeta.igor@gmail.com
38
49
  executables: []
39
-
40
50
  extensions: []
41
-
42
- extra_rdoc_files:
51
+ extra_rdoc_files:
43
52
  - README.rdoc
44
- files:
45
- - README.rdoc
46
- - Rakefile
47
- - app/controllers/comments_controller.rb
53
+ files:
48
54
  - app/sweepers/comment_sweeper.rb
49
55
  - app/views/comments/_block.html.erb
50
- - app/views/comments/_comment.html.erb
51
56
  - app/views/comments/_form.html.erb
52
- - app/views/comments/create.js.erb
53
57
  - app/views/comments/destroy.js.erb
54
- - config/locales/ru.yml
55
- - config/locales/uk.yml
56
- - config/routes.rb
57
- - lib/generators/sunrise/comments/USAGE
58
- - lib/generators/sunrise/comments/install_generator.rb
59
- - lib/generators/sunrise/comments/templates/comment.rb
60
- - lib/generators/sunrise/comments/templates/create_comments.rb
61
- - lib/sunrise-comments.rb
62
- - lib/sunrise/comments.rb
58
+ - app/views/comments/_comment.html.erb
59
+ - app/views/comments/create.js.erb
60
+ - app/controllers/comments_controller.rb
63
61
  - lib/sunrise/comments/author.rb
62
+ - lib/sunrise/comments/commentable.rb
64
63
  - lib/sunrise/comments/base.rb
65
- - lib/sunrise/comments/engine.rb
66
64
  - lib/sunrise/comments/version.rb
67
- - lib/sunrise/models/comment.rb
68
- has_rdoc: true
65
+ - lib/sunrise/comments/engine.rb
66
+ - lib/sunrise/comments.rb
67
+ - lib/generators/sunrise/comments/install_generator.rb
68
+ - lib/generators/sunrise/comments/templates/comment.rb
69
+ - lib/generators/sunrise/comments/USAGE
70
+ - lib/sunrise-comments.rb
71
+ - config/routes.rb
72
+ - config/locales/uk.yml
73
+ - config/locales/ru.yml
74
+ - db/migrate/20121809170415_create_comments.rb
75
+ - MIT-LICENSE
76
+ - Rakefile
77
+ - README.rdoc
69
78
  homepage: https://github.com/galetahub/sunrise-comments
70
79
  licenses: []
71
-
72
80
  post_install_message:
73
81
  rdoc_options: []
74
-
75
- require_paths:
82
+ require_paths:
76
83
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
84
+ required_ruby_version: !ruby/object:Gem::Requirement
78
85
  none: false
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- hash: 3
83
- segments:
84
- - 0
85
- version: "0"
86
- required_rubygems_version: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
91
  none: false
88
- requirements:
89
- - - ">="
90
- - !ruby/object:Gem::Version
91
- hash: 3
92
- segments:
93
- - 0
94
- version: "0"
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
95
96
  requirements: []
96
-
97
- rubyforge_project:
98
- rubygems_version: 1.6.2
97
+ rubyforge_project: sunrise-comments
98
+ rubygems_version: 1.8.24
99
99
  signing_key:
100
100
  specification_version: 3
101
- summary: Rails CMS
101
+ summary: Comments for sunrise-cms
102
102
  test_files: []
103
-