permission 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c5eaa20d648c11930db5a82a78018dbb4a1045d1
4
- data.tar.gz: 895f0cda768111e38677cb7ab489aed0ebd649c4
3
+ metadata.gz: 07fb222ed30cb7aab50606a52b6036344ea2fe46
4
+ data.tar.gz: e2ae602e54108f088d7b0d614a3a50094c337b3d
5
5
  SHA512:
6
- metadata.gz: 350456c935af55054c796f4bdae82c0a8a4ada263c82ec32b920b2410ab39a08e64bf322700f9be63ba3866e7bfdf2928665202cd1a35c5d1e94a342b5e16d96
7
- data.tar.gz: 43af9f41a3ee770a1976e42195cee9c4f2f47cade7615fd53aaa7df1d3c9c58f39c6307d12a426e80b1f12bd468a739e68e020e5559b82091047a62123413a9c
6
+ metadata.gz: 48bc12f8d0d2c3b7151929eff4713ef963244c40b5d3db87e1531d496566085bac769309e50e76a72d9145640a40bfdccf6833eb2be4cb00e5080315218bf95f
7
+ data.tar.gz: abcc717c6505b79af13f2957000b4d6f2cc83c2bbbdef71a602bbbf4c2164a078446e1a5c5ee40dc1b38568c33cc4c88432916edeb084c494f3f66eea280371c
@@ -3,7 +3,7 @@ require 'rails/generators/base'
3
3
  module Permission
4
4
  # module Generators
5
5
  class InstallGenerator < Rails::Generators::Base
6
-
6
+ source_root File.expand_path("../templates", __FILE__)
7
7
  def copy_initializer
8
8
  template "permission_config.rb", "config/initializers/permission.rb"
9
9
  end
@@ -11,13 +11,13 @@ module Permission
11
11
  # create_file Rails.root.join("config", "initializers", "permission.rb"), "This is a test"
12
12
  # end
13
13
 
14
- # def create_migrations
15
- # Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
16
- # name = File.basename(filepath)
17
- # template "migrations/#{name}", "db/migrate/#{name}"
18
- # sleep 1
19
- # end
20
- # end
14
+ def create_migrations
15
+ Dir["#{self.class.source_root}/migrations/*.rb"].sort.each do |filepath|
16
+ name = File.basename(filepath)
17
+ template "migrations/#{name}", "db/migrate/#{name}"
18
+ sleep 1
19
+ end
20
+ end
21
21
 
22
22
  end
23
23
  # end
@@ -1,39 +1,39 @@
1
- # module Permission
2
- # module Generators
3
- # module OrmHelpers
4
- # def model_contents
5
- # buffer = <<-CONTENT
6
- # # Add belongs_to :user here for the permission for.
7
- # belongs_to :user
8
- # CONTENT
9
- # buffer += <<-CONTENT
10
- # # Setup accessible (or protected) attributes for your model
11
- # CONTENT
12
- # buffer
13
- # end
14
- # # def needs_attr_accessible?
15
- # # rails_3? && !strong_parameters_enabled?
16
- # # end
17
- # # def rails_3?
18
- # # Rails::VERSION::MAJOR == 3
19
- # # end
20
- # # def strong_parameters_enabled?
21
- # # defined?(ActionController::StrongParameters)
22
- # # end
1
+ module Permission
2
+ module Generators
3
+ module OrmHelpers
4
+ def model_contents
5
+ buffer = <<-CONTENT
6
+ # Add belongs_to :user here for the permission for.
7
+ belongs_to :user
8
+ CONTENT
9
+ buffer += <<-CONTENT
10
+ # Setup accessible (or protected) attributes for your model
11
+ CONTENT
12
+ buffer
13
+ end
14
+ # def needs_attr_accessible?
15
+ # rails_3? && !strong_parameters_enabled?
16
+ # end
17
+ # def rails_3?
18
+ # Rails::VERSION::MAJOR == 3
19
+ # end
20
+ # def strong_parameters_enabled?
21
+ # defined?(ActionController::StrongParameters)
22
+ # end
23
23
 
24
- # private
25
- # def model_exists?
26
- # File.exists?(File.join(destination_root, model_path))
27
- # end
28
- # def migration_exists?(table_name)
29
- # Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_#{table_name}.rb$/).first
30
- # end
31
- # def migration_path
32
- # @migration_path ||= File.join("db", "migrate")
33
- # end
34
- # def model_path
35
- # @model_path ||= File.join("app", "models", "#{file_path}.rb")
36
- # end
37
- # end
38
- # end
39
- # end
24
+ private
25
+ def model_exists?
26
+ File.exists?(File.join(destination_root, model_path))
27
+ end
28
+ def migration_exists?(table_name)
29
+ Dir.glob("#{File.join(destination_root, migration_path)}/[0-9]*_*.rb").grep(/\d+_#{table_name}.rb$/).first
30
+ end
31
+ def migration_path
32
+ @migration_path ||= File.join("db", "migrate")
33
+ end
34
+ def model_path
35
+ @model_path ||= File.join("app", "models", "#{file_path}.rb")
36
+ end
37
+ end
38
+ end
39
+ end
@@ -1,14 +1,14 @@
1
- # require 'rails/generators/named_base'
2
- # module permission
3
- # module Generators
4
- # class PermissionGenerator < Rails::Generators::NamedBase
5
- # include Rails::Generators::ResourceHelpers
6
- # namespace "permission"
7
- # source_root File.expand_path("../templates", __FILE__)
8
- # desc "Generates a model with the given NAME (if one does not exist) with permission " <<
9
- # "configuration plus a migration file."
10
- # hook_for :orm
11
- # class_option :routes, desc: "Generate routes", type: :boolean, default: true
12
- # end
13
- # end
14
- # end
1
+ require 'rails/generators/named_base'
2
+ module permission
3
+ module Generators
4
+ class PermissionGenerator < Rails::Generators::NamedBase
5
+ include Rails::Generators::ResourceHelpers
6
+ namespace "permission"
7
+ source_root File.expand_path("../templates", __FILE__)
8
+ desc "Generates a model with the given NAME (if one does not exist) with permission " <<
9
+ "configuration plus a migration file."
10
+ hook_for :orm
11
+ class_option :routes, desc: "Generate routes", type: :boolean, default: true
12
+ end
13
+ end
14
+ end
@@ -1,3 +1,3 @@
1
1
  module Permission
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -1 +1 @@
1
- # ::Permission_for = [Page, Category]
1
+ ::Permission_for = [Page, Category]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: permission
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - sunil