make_commentable 0.0.8.1.4.1 → 0.0.8.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,12 @@
1
+ module MakeCommentable
2
+ module Generators
3
+ class ControllerGenerator < Rails::Generators::Base
4
+
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ def create_controller_file
8
+ template "comments_controller.rb", "app/controllers/comments_controller.rb"
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,20 @@
1
+ require 'rails/generators/migration'
2
+
3
+ module MakeCommentable
4
+ module Generators
5
+ class ModelGenerator < Rails::Generators::Base
6
+ include Rails::Generators::Migration
7
+
8
+ source_root File.expand_path("../templates", __FILE__)
9
+
10
+ def self.next_migration_number(path)
11
+ Time.now.utc.strftime("%Y%m%d%H%M%S")
12
+ end
13
+
14
+ def create_model_file
15
+ template "comment.rb", "app/models/comment.rb"
16
+ migration_template "create_comments.rb", "db/migrate/create_comments.rb"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,17 @@
1
+ module MakeCommentable
2
+ module Generators
3
+ class ViewsGenerator < Rails::Generators::Base
4
+
5
+ source_root File.expand_path("../templates", __FILE__)
6
+
7
+ def create_views
8
+ template "views/_comment.html.haml", "app/views/comments/_comment.html.haml"
9
+ template "views/_comment_form.html.haml", "app/views/comments/_comment_form.html.haml"
10
+ end
11
+
12
+ def create_javascripts
13
+ template "javascripts/comments.js", "app/assets/javascripts/comments/comments.js"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -9,12 +9,8 @@ module Make
9
9
  # here you can define some scopes or what else
10
10
  end
11
11
 
12
- # This module contains instance methods
13
- module InstanceMethods
14
- end
15
-
16
12
  module ClassMethods
17
- def mark_as_commentable(options={})
13
+ def make_commentable(options={})
18
14
  has_many :comments, {:as => :commentable, :dependent => :destroy}.merge(options)
19
15
  accepts_nested_attributes_for :comments, :allow_destroy => true
20
16
 
@@ -1,3 +1,3 @@
1
1
  module Commentable
2
- VERSION = "0.0.8.1.4.1"
2
+ VERSION = "0.0.8.1.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: make_commentable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.1.4.1
4
+ version: 0.0.8.1.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -66,13 +66,15 @@ extensions: []
66
66
  extra_rdoc_files: []
67
67
  files:
68
68
  - lib/make_commentable.rb
69
- - lib/generators/comment/templates/javascripts/comments.js
70
- - lib/generators/comment/templates/create_comments.rb
71
- - lib/generators/comment/templates/comment.rb
72
- - lib/generators/comment/templates/comments_controller.rb
73
- - lib/generators/comment/templates/views/_comment_form.html.haml
74
- - lib/generators/comment/templates/views/_comment.html.haml
75
- - lib/generators/comment/comment_generator.rb
69
+ - lib/generators/make_commentable/templates/javascripts/comments.js
70
+ - lib/generators/make_commentable/templates/create_comments.rb
71
+ - lib/generators/make_commentable/templates/comment.rb
72
+ - lib/generators/make_commentable/templates/comments_controller.rb
73
+ - lib/generators/make_commentable/templates/views/_comment_form.html.haml
74
+ - lib/generators/make_commentable/templates/views/_comment.html.haml
75
+ - lib/generators/make_commentable/views_generator.rb
76
+ - lib/generators/make_commentable/controller_generator.rb
77
+ - lib/generators/make_commentable/model_generator.rb
76
78
  - lib/make_commentable/version.rb
77
79
  - lib/make_commentable/commentable_methods.rb
78
80
  - LICENSE
@@ -1,32 +0,0 @@
1
- require 'rails/generators/migration'
2
-
3
- class CommentGenerator < Rails::Generators::Base
4
- #include Rails::Generators::Migration
5
- #include Rails::Generators::ResourceHelpers
6
-
7
- source_root File.expand_path("../templates", __FILE__)
8
-
9
- #desc "Creates a make_commentable files"
10
-
11
- def self.next_migration_number(path)
12
- Time.now.utc.strftime("%Y%m%d%H%M%S")
13
- end
14
-
15
- def create_model_file
16
- template "comment.rb", "app/models/comment.rb"
17
- migration_template "create_comments.rb", "db/migrate/create_comments.rb"
18
- end
19
-
20
- def create_controller_file
21
- template "comments_controler.rb", "app/controllers/comments_controller.rb"
22
- end
23
-
24
- #def create_views
25
- # template "views/_comment.html.haml", "app/views/_comment.html.haml"
26
- # template "views/_comment_form.html.haml", "app/views/_comment_form.html.haml"
27
- #end
28
-
29
- #def create_javascripts
30
- # template "javascripts/comments.js", "app/assets/javascripts/comments/comments.js"
31
- #end
32
- end