hydra-role-management 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.md +14 -0
- data/README.md +2 -1
- data/hydra-role-management.gemspec +1 -0
- data/lib/generators/roles/roles_generator.rb +12 -30
- data/lib/hydra/role_management/version.rb +1 -1
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: baf9353a04409963f28f95ea224b60c48168db9e
|
4
|
+
data.tar.gz: 29250a4135ab334b0623059089d134cf11d4e774
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a29eccb32ce9505bd897f3eedf45cff5e86d4c18e97c4ee2f27b6aba1df151aee85b3cd29d4ecaa8ade05ff865bae703c0f894072814eba0ca1388aec1d61b
|
7
|
+
data.tar.gz: c1a59c994d0e3a385ab36bc71cbea72ab23cea653e125ffbb07319fc0b02beeda0e431dbd8b54b4f50ae016aa9243319671ff5e8a2bd19f429cba01e727bcf7f
|
data/LICENSE.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
Copyright 2015 Data Curation Experts
|
2
|
+
Additional copyright may be held by others, as reflected in the commit history.
|
3
|
+
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
you may not use this file except in compliance with the License.
|
6
|
+
You may obtain a copy of the License at
|
7
|
+
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
See the License for the specific language governing permissions and
|
14
|
+
limitations under the License.
|
data/README.md
CHANGED
@@ -24,4 +24,5 @@ Given the need to support both Rails 3 and 4, the test suite has been parameteri
|
|
24
24
|
* Set Rails version you want to test against. For example:
|
25
25
|
* ```RAILS_VERSION=3.2.13``` or ```RAILS_VERSION=4.0.0```
|
26
26
|
* Ensure that the correct version of Rails is installed: ```bundle update```
|
27
|
-
* Build test app
|
27
|
+
* Build test app: ```bundle exec engine_cart:generate```
|
28
|
+
* And run tests: ```bundle exec rake spec```
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require 'rails/generators'
|
3
|
-
require 'rails/generators/migration'
|
3
|
+
require 'rails/generators/migration'
|
4
4
|
|
5
5
|
class RolesGenerator < Rails::Generators::Base
|
6
6
|
include Rails::Generators::Migration
|
7
7
|
|
8
8
|
source_root File.expand_path('../templates', __FILE__)
|
9
|
-
|
9
|
+
|
10
10
|
argument :model_name, :type => :string , :default => "user"
|
11
11
|
desc """
|
12
12
|
This generator makes the following changes to your application:
|
13
13
|
1. Creates several database migrations if they do not exist in /db/migrate
|
14
14
|
2. Adds user behavior to the user model
|
15
15
|
2. Adds routes
|
16
|
-
"""
|
16
|
+
"""
|
17
17
|
|
18
18
|
# Implement the required interface for Rails::Generators::Migration.
|
19
19
|
# taken from http://github.com/rails/rails/blob/master/activerecord/lib/generators/active_record.rb
|
@@ -41,18 +41,18 @@ This generator makes the following changes to your application:
|
|
41
41
|
place_marker = if File.read(file_path).match(/include Hydra::User/)
|
42
42
|
/include Hydra::User/
|
43
43
|
elsif File.read(file_path).match(/include Blacklight::User/)
|
44
|
-
/include Blacklight::User/
|
44
|
+
/include Blacklight::User/
|
45
45
|
end
|
46
|
-
if place_marker
|
47
|
-
code = "\n
|
48
|
-
"
|
46
|
+
if place_marker
|
47
|
+
code = "\n # Connects this user object to Role-management behaviors.\n" +
|
48
|
+
" include Hydra::RoleManagement::UserRoles\n\n"
|
49
49
|
inject_into_file file_path, code, { :after => place_marker }
|
50
50
|
else
|
51
51
|
puts " \e[31mFailure\e[0m Hydra::User is not included in #{file_path}. Add 'include Hydra::User' and rerun."
|
52
52
|
end
|
53
53
|
else
|
54
|
-
puts " \e[31mFailure\e[0m hydra-role-management requires a user object. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g roles client"
|
55
|
-
end
|
54
|
+
puts " \e[31mFailure\e[0m hydra-role-management requires a user object. This generators assumes that the model is defined in the file #{file_path}, which does not exist. If you used a different name, please re-run the generator and provide that name as an argument. Such as \b rails -g roles client"
|
55
|
+
end
|
56
56
|
end
|
57
57
|
|
58
58
|
# The engine routes have to come after the devise routes so that /users/sign_in will work
|
@@ -62,22 +62,6 @@ This generator makes the following changes to your application:
|
|
62
62
|
inject_into_file 'config/routes.rb', "\n #{routing_code}\n", { :after => sentinel, :verbose => false }
|
63
63
|
end
|
64
64
|
|
65
|
-
# As of 7.23.2013 cancan support for Rails 4 is weak and requires monkey-patching.
|
66
|
-
# More information can be found at https://github.com/ryanb/cancan/issues/835
|
67
|
-
def rails4_application_controller_patch
|
68
|
-
if Rails::VERSION::MAJOR == 4
|
69
|
-
puts "Adding before_filter to application_controller to help Cancan work with Rails 4."
|
70
|
-
file_path = "app/controllers/application_controller.rb"
|
71
|
-
code = "\n before_filter do" +
|
72
|
-
"\n resource = controller_path.singularize.gsub('/', '_').to_sym \n" +
|
73
|
-
' method = "#{resource}_params"'+
|
74
|
-
"\n params[resource] &&= send(method) if respond_to?(method, true)" +
|
75
|
-
"\n end"
|
76
|
-
|
77
|
-
inject_into_file file_path, code, {after: 'class ApplicationController < ActionController::Base'}
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
65
|
# If this gem is installed under Rails 3, an attr_accessible method is required for the Role model. This
|
82
66
|
# file will be added to config/initializers and the correct code will be added to the model at runtime.
|
83
67
|
def rails3_attr_accessible
|
@@ -87,8 +71,8 @@ This generator makes the following changes to your application:
|
|
87
71
|
end
|
88
72
|
end
|
89
73
|
|
90
|
-
private
|
91
|
-
|
74
|
+
private
|
75
|
+
|
92
76
|
def better_migration_template (file)
|
93
77
|
begin
|
94
78
|
sleep 1 # ensure scripts have different time stamps
|
@@ -98,6 +82,4 @@ This generator makes the following changes to your application:
|
|
98
82
|
end
|
99
83
|
end
|
100
84
|
|
101
|
-
end
|
102
|
-
|
103
|
-
|
85
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hydra-role-management
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Justin Coyne
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bootstrap_form
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- ".travis.yml"
|
120
120
|
- CONTRIBUTING.md
|
121
121
|
- Gemfile
|
122
|
+
- LICENSE.md
|
122
123
|
- README.md
|
123
124
|
- Rakefile
|
124
125
|
- app/controllers/concerns/hydra/role_management/roles_behavior.rb
|
@@ -152,7 +153,8 @@ files:
|
|
152
153
|
- spec/test_app_templates/config/initializers/hydra_config.rb
|
153
154
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
154
155
|
homepage: https://github.com/projecthydra/hydra-role-management
|
155
|
-
licenses:
|
156
|
+
licenses:
|
157
|
+
- Apache 2.0
|
156
158
|
metadata: {}
|
157
159
|
post_install_message:
|
158
160
|
rdoc_options: []
|
@@ -170,7 +172,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
172
|
version: '0'
|
171
173
|
requirements: []
|
172
174
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
175
|
+
rubygems_version: 2.4.8
|
174
176
|
signing_key:
|
175
177
|
specification_version: 4
|
176
178
|
summary: Rails engine to do user roles in an RDBMS for hydra-head
|