CanCanCanSee 0.1.11 → 0.1.12
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.
- checksums.yaml +4 -4
- data/lib/CanCanCanSee.rb +49 -21
- data/lib/CanCanCanSee/version.rb +1 -1
- data/lib/tasks/custom_actions.rake +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fd2cb33e78ca8c15f4f9cf8cad44bb2e6700748f
|
4
|
+
data.tar.gz: 8979b8d1cbb49937ffe439745f15f5c7ddd7c520
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91567283ea72155c01e901a83c71b5d57573791e187b0843c78bec395f8224b6efb58c9dda66efee5bf5a300c67d641e51d5cbf7fc717ebb7545141610f754f9
|
7
|
+
data.tar.gz: 7988c217b726efabbd8b39ff8f41ff77f01003aed596c0fd816734e8da44132372870f075378a046bc29da61c99d3019c1d34be7605860586230d05f0ac8c078
|
data/lib/CanCanCanSee.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "CanCanCanSee/version"
|
2
|
+
require 'pry'
|
2
3
|
|
3
4
|
module CanCanCanSee
|
4
5
|
require 'CanCanCanSee/railtie' if defined?(Rails)
|
@@ -42,16 +43,8 @@ module CanCanCanSee
|
|
42
43
|
|
43
44
|
def self.read_file(file, check_slug=nil)
|
44
45
|
|
45
|
-
|
46
46
|
@current_file = file
|
47
47
|
|
48
|
-
#capture in between text
|
49
|
-
# chunk_start = /when/ =~ @current_file
|
50
|
-
# #=> 119
|
51
|
-
# chunk_end = ((/when/ =~ @current_file[(chunk_start + 1)..-1]) + chunk_start)
|
52
|
-
# #=> 2554
|
53
|
-
# role_text = @current_file[chunk_start..chunk_end]
|
54
|
-
|
55
48
|
#capture all roles
|
56
49
|
all_text = Hash.new
|
57
50
|
counter = 0
|
@@ -67,18 +60,15 @@ module CanCanCanSee
|
|
67
60
|
while counter < role_count
|
68
61
|
chunk_start = chunk_end + 1
|
69
62
|
#broke here
|
70
|
-
|
63
|
+
if (/when/ =~ @current_file[(chunk_start + 1)..-1]) == nil
|
64
|
+
chunk_end = @current_file.length - 1 #if there are no more whens
|
65
|
+
else
|
66
|
+
chunk_end = ((/when/ =~ @current_file[(chunk_start + 1)..-1]) + chunk_start)
|
67
|
+
end
|
71
68
|
all_text[roles[counter]] = @current_file[chunk_start..chunk_end]
|
72
69
|
|
73
70
|
counter += 1
|
74
71
|
end
|
75
|
-
#BREAKING NOT PICKING UP REGISTRAR BEFORE HERE
|
76
|
-
#capture text of ability
|
77
|
-
# cannot_abilities = all_text[[" 'Assistant Registrar'"]].scan(/cannot(.*)($|[ do])/)
|
78
|
-
#=> [[" :create_csr, Vessel do |vessel|"], [" [:create, :destroy, :update], [SpecificCertificate, PortStateControl, Certificate, Violation,"], [" [:create, :destroy], Document do |d|"], [" :update, Document do |d|"], [" [:create], [GeneratedCertificates::GeneratedCertificate] do |b|"], [" :read, ExternalNotification do |e|"], [" :manual_verified, Vessel do |e|"], [" [:update], SpecificCertificate do |e|"], [" :manage_inspection_resources, Inspection do |inspection|"], [" [:update, :destroy], Vessel do |v|"], [" [:create], MinimumSafeManning do |msm|"], [" [:update], MinimumSafeManning do |msm|"], [" [:create], MlcShipowner do |ms|"], [" [:update, :destroy], MlcShipowner do |ms|"], [" :update_classification_society, Vessel"], [" :upload_original, [GeneratedCertificates::MlcCertificate, GeneratedCertificates::DocOfComplianceCertificate] do |c|"], [" :destroy, [GeneratedCertificates::MlcCertificate, GeneratedCertificates::DmlcCertificate] do |c|"]]
|
79
|
-
# can_abilities = all_text[[" 'Assistant Registrar'"]].scan(/can (.*)($|[ do])/)
|
80
|
-
#=> [[" :manage, :all"], [" :change_registry, Registry"], ["not :create_csr, Vessel do |vessel|"], ["not [:create, :destroy, :update], [SpecificCertificate, PortStateControl, Certificate, Violation,"], ["not [:create, :destroy], Document do |d|"], ["not :update, Document do |d|"], ["not [:create], [GeneratedCertificates::GeneratedCertificate] do |b|"], ["not :read, ExternalNotification do |e|"], ["not :manual_verified, Vessel do |e|"], ["not [:update], SpecificCertificate do |e|"], [" :manage, Registry do |r|"], [" :manage, [Inspection] do |res|"], ["not :manage_inspection_resources, Inspection do |inspection|"], [" :print_history, Vessel"], ["not [:update, :destroy], Vessel do |v|"], ["not [:create], MinimumSafeManning do |msm|"], ["not [:update], MinimumSafeManning do |msm|"], ["not [:create], MlcShipowner do |ms|"], ["not [:update, :destroy], MlcShipowner do |ms|"], ["not :update_classification_society, Vessel"], ["not :upload_original, [GeneratedCertificates::MlcCertificate, GeneratedCertificates::DocOfComplianceCertificate] do |c|"], ["not :destroy, [GeneratedCertificates::MlcCertificate, GeneratedCertificates::DmlcCertificate] do |c|"]]
|
81
|
-
#store in hash with array in can, array in cannot, array in an array if has condition in text.
|
82
72
|
|
83
73
|
new_counter = 0
|
84
74
|
if check_slug == nil
|
@@ -138,7 +128,7 @@ module CanCanCanSee
|
|
138
128
|
array_of_cannot = []
|
139
129
|
|
140
130
|
#establish cannot
|
141
|
-
cannot_abilities = all_text[roles[new_counter]].scan(/cannot(.*)($|[ do])/)
|
131
|
+
cannot_abilities = all_text[roles[new_counter]].scan(/cannot (.*)($|[ do])/)
|
142
132
|
|
143
133
|
cannot_abilities.each do |cannot_ability|
|
144
134
|
cannot_ability = cannot_ability[0]
|
@@ -159,15 +149,19 @@ module CanCanCanSee
|
|
159
149
|
|
160
150
|
#public methods
|
161
151
|
|
162
|
-
def self.all_roles(desired_slug=nil)
|
163
|
-
initiate_gem
|
164
|
-
return MY_GLOBAL_HOLDER_OF_ABILITY[desired_slug].keys
|
165
152
|
|
153
|
+
|
154
|
+
def self.all_roles(desired_slug="all")
|
155
|
+
initiate_gem
|
156
|
+
if desired_slug == "all"
|
157
|
+
return MY_GLOBAL_HOLDER_OF_ABILITY.keys
|
158
|
+
else
|
159
|
+
return MY_GLOBAL_HOLDER_OF_ABILITY[desired_slug].keys
|
160
|
+
end
|
166
161
|
end
|
167
162
|
|
168
163
|
def self.establish_variable
|
169
164
|
initiate_gem
|
170
|
-
|
171
165
|
end
|
172
166
|
|
173
167
|
def self.all_abilities(desired_slug="all")
|
@@ -179,4 +173,38 @@ module CanCanCanSee
|
|
179
173
|
end
|
180
174
|
end
|
181
175
|
|
176
|
+
def self.pretty_print_abilities(slug="all")
|
177
|
+
initiate_gem
|
178
|
+
if slug == "all"
|
179
|
+
@current_slug_abilities = MY_GLOBAL_HOLDER_OF_ABILITY
|
180
|
+
@current_slug_abilities.each do |key, value|
|
181
|
+
print "\n\n"
|
182
|
+
print "Slug: #{key}\n\n"
|
183
|
+
value.each do |role_key, role_value|
|
184
|
+
print "\n\n"
|
185
|
+
print " Role: #{role_key}\n\n"
|
186
|
+
role_value.each do |can, can_value|
|
187
|
+
print " #{can}\n"
|
188
|
+
can_value = can_value.sort
|
189
|
+
can_value.each do |can_value_element|
|
190
|
+
print " #{can_value_element}\n"
|
191
|
+
end
|
192
|
+
end
|
193
|
+
end
|
194
|
+
end
|
195
|
+
else
|
196
|
+
@current_slug_abilities = MY_GLOBAL_HOLDER_OF_ABILITY[slug]
|
197
|
+
@current_slug_abilities.each do |key, value|
|
198
|
+
print "\n\n"
|
199
|
+
print "Role: #{key}\n"
|
200
|
+
value.each do |can, can_value|
|
201
|
+
print " #{can}\n"
|
202
|
+
can_value = can_value.sort
|
203
|
+
can_value.each do |can_value_element|
|
204
|
+
print " #{can_value_element}\n"
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
end
|
182
210
|
end
|
data/lib/CanCanCanSee/version.rb
CHANGED
@@ -8,7 +8,7 @@ namespace :cancancansee do
|
|
8
8
|
|
9
9
|
@current_slug_abilities.each do |key, value|
|
10
10
|
print "\n\n"
|
11
|
-
print "Role: #{key}
|
11
|
+
print "Role: #{key}\n"
|
12
12
|
value.each do |can, can_value|
|
13
13
|
print " #{can}\n"
|
14
14
|
can_value = can_value.sort
|
@@ -27,16 +27,16 @@ namespace :cancancansee do
|
|
27
27
|
print "\n\n"
|
28
28
|
print "Slug: #{key}\n\n"
|
29
29
|
value.each do |role_key, role_value|
|
30
|
-
print "
|
30
|
+
print "\n\n"
|
31
|
+
print " Role: #{role_key}\n\n"
|
31
32
|
role_value.each do |can, can_value|
|
32
|
-
print "
|
33
|
+
print " #{can}\n"
|
33
34
|
can_value = can_value.sort
|
34
35
|
can_value.each do |can_value_element|
|
35
|
-
print "
|
36
|
+
print " #{can_value_element}\n"
|
36
37
|
end
|
37
38
|
end
|
38
39
|
end
|
39
40
|
end
|
40
|
-
|
41
41
|
end
|
42
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: CanCanCanSee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Schwaderer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|