CanCanCanSee 0.0.3 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6d0241dc78c6342a701b7775d092b2e8d4084098
4
- data.tar.gz: 8fe35df033c1fc83d1a3e232b4a1f7866e679571
3
+ metadata.gz: 35a223683b0fbd58a5940a756b693ce857971f53
4
+ data.tar.gz: 1687dede8a60c8b7f8a07323b32ddd5d7578f8be
5
5
  SHA512:
6
- metadata.gz: ec0b2aeb7997658741e58b2c0cfb39123dc3518764f578ab687db2e4569408703993191af7540cbb5cca74c42aa0e4e8657992bf0d4c506f7d33d6c91a46c0c2
7
- data.tar.gz: 3c24045eb538da355a73f6fd9ce5413debd8e0336f3568c17919184bec95cb8a203b5f6b49862262f479d1a6b3738010ee157a24c09dde316a6875549127913d
6
+ metadata.gz: 0e988404ed8936bae1f2265dd18bd56bc6555ce97985c1fedc97854c431fa8ad7b1ab437a90443d2592a5a902556169d18f0c1de23727fe807bcff0eb9271e61
7
+ data.tar.gz: 5408c4b0a042a331d2b996cb2e34d70113da86e07b9064fdb43a37b0c7e01933d0d55e2e07d8fc481ed9d82c6b7d5da289fa6475d7a15a2868ca4f325d68aba3
data/README.md CHANGED
@@ -51,7 +51,10 @@ CanCanCanSee.all_abilities[my_slug]
51
51
 
52
52
  ## TODO Before 1.0
53
53
 
54
+ * Cleanup needed for single
55
+ * Pretty Print CLI or something like rake abilities for cli!
54
56
  * Confirm support for single and multiple Ability.rb files
57
+ * Capture blocks passed to abilities as well and store and render them instead of just signifying 'with block'
55
58
  * Create docs to show style guidelines to have gem work
56
59
  * Create post to show layout for slug-based auth
57
60
 
@@ -1,3 +1,3 @@
1
1
  module CanCanCanSee
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.2"
3
3
  end
data/lib/CanCanCanSee.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require "CanCanCanSee/version"
2
2
  require 'pry'
3
-
4
3
  module CanCanCanSee
5
4
 
6
5
  MY_GLOBAL_HOLDER_OF_ABILITY = Hash.new
@@ -66,12 +65,14 @@ module CanCanCanSee
66
65
  counter += 1
67
66
  while counter < role_count
68
67
  chunk_start = chunk_end + 1
68
+ #broke here
69
69
  chunk_end = /when/ =~ @current_file[(chunk_start + 1)..-1]
70
70
  all_text[roles[counter]] = @current_file[chunk_start..chunk_end]
71
71
 
72
72
  counter += 1
73
73
  end
74
-
74
+ #BREAKING NOT PICKING UP REGISTRAR BEFORE HERE
75
+ binding.pry
75
76
  #capture text of ability
76
77
  # cannot_abilities = all_text[[" 'Assistant Registrar'"]].scan(/cannot(.*)($|[ do])/)
77
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|"]]
@@ -164,6 +165,11 @@ module CanCanCanSee
164
165
 
165
166
  end
166
167
 
168
+ def self.establish_variable
169
+ initiate_gem
170
+
171
+ end
172
+
167
173
  def self.all_abilities(desired_slug="all")
168
174
  initiate_gem
169
175
  if desired_slug == "all"
@@ -0,0 +1,37 @@
1
+ task abilities: :environment do
2
+
3
+ CanCanCanSee.establish_variable
4
+ @current_slug_abilities = MY_GLOBAL_HOLDER_OF_ABILITY[Figaro.env.slug]
5
+
6
+ @current_slug_abilities.each do |key, value|
7
+ print "\n\n"
8
+ print "Role: #{key}:\n"
9
+ value.each do |can, can_value|
10
+ print " #{can}\n"
11
+ can_value = can_value.sort
12
+ can_value.each do |can_value_element|
13
+ print " #{can_value_element}\n"
14
+ end
15
+ end
16
+ end
17
+ end
18
+
19
+ task abilities_all_slugs: :environment do
20
+ @current_slug_abilities = MY_GLOBAL_HOLDER_OF_ABILITY
21
+
22
+ @current_slug_abilities.each do |key, value|
23
+ print "\n\n"
24
+ print "Slug: #{key}\n\n"
25
+ value.each do |role_key, role_value|
26
+ print " Role: #{role_key}:\n\n"
27
+ role_value.each do |can, can_value|
28
+ print " #{can}\n"
29
+ can_value = can_value.sort
30
+ can_value.each do |can_value_element|
31
+ print " #{can_value_element}\n"
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ 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.0.3
4
+ version: 0.1.2
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-19 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -87,6 +87,7 @@ files:
87
87
  - bin/setup
88
88
  - lib/CanCanCanSee.rb
89
89
  - lib/CanCanCanSee/version.rb
90
+ - lib/tasks/custom_actions.rake
90
91
  homepage: https://github.com/schwad/cancancansee
91
92
  licenses:
92
93
  - SCHWAD LICENSE