sevencan 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: b84ad07dcbf14ef8f82065bd5b8974ff530f60e4
4
+ data.tar.gz: f85de0cddb78d760650e4a4acf1036b801eb21d9
5
+ SHA512:
6
+ metadata.gz: 45884905ac89883951198b3245905fc75ce4f5d5d9d57af8b73b8f1ebeea2afa5b8140a75a5bc4ff27ca81e189c628a08aaf760ad43da5a29b99fbf96b3a4988
7
+ data.tar.gz: 92f4bfb0f6609efa94dffc2c7bfd41dd5c9174d579dd2940fcb38e2bdee28ed64a1a55626626c62b17caa0d266c1e60ddf4d35d1b4c91aa7d3bfb3ed3edcf0c4
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+
11
+ *.swp
12
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format progress
2
+ --require gem_helper
3
+ --color
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.2.6
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.3
4
+ before_install: gem install bundler -v 1.10.6
@@ -0,0 +1,13 @@
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://gems.ruby-china.org'
2
+
3
+ # Specify your gem's dependencies in seven.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 jiangzhi.xie
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,317 @@
1
+ # Seven
2
+
3
+ Permission manage center
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'sevencan'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install sevencan
20
+
21
+ ## Usage
22
+
23
+ New manager
24
+
25
+ ```
26
+ manager = Seven.new # save dynamic abilities to memory store
27
+ manager = Seven.new(store: {redis: Redis.current}) # redis store
28
+ manager = Seven.new(store: {activerecord: UserAbility}) # db store
29
+ ```
30
+
31
+ Define system rules
32
+
33
+ ```
34
+ # all objects, global rules
35
+ manager.define_rules(Object) do
36
+ can :read_home, :read_topics
37
+ end
38
+
39
+ # Topic and Topic instances
40
+ class MyTopicAbilities
41
+ include Seven::Abilities
42
+
43
+ # Instance methods:
44
+ # current_user:
45
+ # target:
46
+ abilities do
47
+ can(:read_topic)
48
+ can_manager_topic if target_topic.user_id == current_user.id
49
+
50
+ cannot_manager_topic if target_topic.is_lock
51
+ end
52
+
53
+ # if [:admin, :editor].include?(current_user.role)
54
+ abilities :role, [:admin, :editor] do
55
+ can_manager_topic
56
+ end
57
+
58
+ abilities :role, [:reviewer] do
59
+ can :review_topic
60
+ end
61
+
62
+
63
+ def can_manager_topic
64
+ can :edit_topic, :destroy_topic
65
+ end
66
+
67
+ def cannot_manager_topic
68
+ cannot :edit_topic, :destroy_topic
69
+ end
70
+ end
71
+
72
+ manager.define_rules(Topic, MyTopicAbilities)
73
+
74
+ # with block
75
+ manager.define_rules(User) do
76
+ can(:read_user)
77
+ can(:edit_user) if target.id == current_user.id
78
+ can(:destroy_user) if current_user.is_admin?
79
+ end
80
+ ```
81
+
82
+ Manage dynamic rules
83
+
84
+ ```
85
+ manager.add_dynamic_rule(user, :edit_user)
86
+ manager.list_dynamic_rules(user)
87
+ manager.del_dynamic_rules(user, :edit_user)
88
+ ```
89
+
90
+ Check abilities
91
+
92
+ Target is nil
93
+
94
+ ```
95
+ manager.define_rules(Object) { can :read_topics }
96
+ manager.can?(current_user, :read_topics) # true
97
+ manager.can?(nil, :read_topics) # true
98
+ manager.can?(current_user, :read_user) # false
99
+
100
+ manager.can?(current_user, :edit_user) # false
101
+
102
+ manager.add_dynamic_rule(user, :edit_user)
103
+ manager.can?(current_user, :edit_user) # true
104
+ manager.can?(nil, :edit_user) # true
105
+ ```
106
+
107
+ Specify target class
108
+
109
+ ```
110
+ manager.define_rules(Topic) { can :read_topics }
111
+ manager.can?(nil, :read_topics, Topic) # true
112
+ manager.can?(nil, :read_topics, Topic.first) # true
113
+ manager.can?(current_user, :read_topics, Topic.first) # true
114
+ manager.can?(current_user, :read_topics) # false
115
+ manager.can?(nil, :read_topics) # false
116
+
117
+ manager.add_dynamic_rule(user, :edit_user, User)
118
+ manager.can?(current_user, :edit_user, User) # true
119
+ manager.can?(current_user, :edit_user, User.first) # true
120
+ manager.can?(current_user, :edit_user) # false
121
+ manager.can?(nil, :edit_user) # false
122
+ ```
123
+
124
+ Specify instance
125
+
126
+ ```
127
+ manager.define_rules(Topic.first) { can :read_topics }
128
+ manager.can?(nil, :read_topics, Topic) # false
129
+ manager.can?(nil, :read_topics, Topic.first) # true
130
+ manager.can?(current_user, :read_topics, Topic.first) # true
131
+ manager.can?(current_user, :read_topics, Topic.last) # false
132
+ manager.can?(current_user, :read_topics) # false
133
+ manager.can?(nil, :read_topics) # false
134
+
135
+ manager.add_dynamic_rule(user, :edit_user, User.first)
136
+ manager.can?(current_user, :edit_user, User) # false
137
+ manager.can?(current_user, :edit_user, User.first) # true
138
+ manager.can?(current_user, :edit_user, User.last) # false
139
+ manager.can?(current_user, :edit_user) # false
140
+ manager.can?(nil, :edit_user) # false
141
+ ```
142
+
143
+
144
+ ## Rails
145
+
146
+ ### Require methods
147
+
148
+ * `current_user`: return current user
149
+ * `abilities_manager`: return `Seven::Manager` instance
150
+ * `ability_check_callback`: call the method after check
151
+
152
+
153
+ ### ControllerHelpers
154
+
155
+ ```
156
+ class ApplicationController < ActionController::Base
157
+ # define `can?` method and `seven_ability_check` methods
158
+ # define `seven_ability_check_filter` method
159
+ # `seven_ability_check` call `before_action :seven_ability_check_filter`
160
+ include Seven::Rails::ControllerHelpers
161
+
162
+ def abilities_manager
163
+ $my_abilities_manager
164
+ end
165
+
166
+ def ability_check_callback(allowed, ability, target)
167
+ # allowed: true or false, allowed is true when can access
168
+ # ability: checked ability, like :read_topic
169
+ # target: checked target object
170
+ end
171
+ end
172
+ ```
173
+
174
+ Default actions
175
+
176
+ ```
177
+ class TopicController < ApplicationController
178
+ before_action :find_topic
179
+
180
+ # if exist @topic, target is @topic, else use Topic
181
+ seven_ability_check [:@topic, Proc.new { fetch_check_target }, Topic]
182
+
183
+ # auto check current_user allow read_topics of Topic
184
+ def index
185
+ end
186
+
187
+ # auto check current_user allow read_topic of @topic
188
+ def show
189
+ end
190
+
191
+ # Other actions:
192
+ # new: create_topic of Topic
193
+ # create: create_topic of Topic
194
+ # edit: edit_topic of @topic
195
+ # update: edit_topic of @topic
196
+ # destory: delete_topic of @topic
197
+
198
+
199
+ private
200
+
201
+ def find_topic
202
+ @topic = Topic.find(params[:id])
203
+ end
204
+ end
205
+ ```
206
+
207
+ Custom require ability for actions
208
+
209
+ ```
210
+ class TopicController < ApplicationController
211
+ before_action :find_topic
212
+
213
+ # if exist @topic, target is @topic, else use Topic
214
+ seven_ability_check(
215
+ [:@topic, Topic], # default targets
216
+ my_action1: {ability: :custom_ability}, # use default targets
217
+ my_action2: {ability: :custom_ability, target: [:@my_target]}
218
+ )
219
+ # or
220
+ # seven_ability_check(
221
+ # index: {ability: read_my_ability, target: SuperTopic},
222
+ # my_action1: {ability: :custom_ability1}, # use default targets
223
+ # my_action2: {ability: :custom_ability2, target: [:@my_target]}
224
+ # )
225
+
226
+ def index
227
+ end
228
+
229
+ def my_action1
230
+ end
231
+
232
+ def my_action2
233
+ end
234
+
235
+
236
+ private
237
+
238
+ def find_topic
239
+ @topic = Topic.find(params[:id])
240
+ end
241
+ end
242
+ ```
243
+
244
+ Custom resource name
245
+
246
+ ```
247
+ class TopicController < ApplicationController
248
+ before_action :find_topic
249
+
250
+ seven_ability_check [:@topic, Topic], nil, resource_name: :comment
251
+
252
+ # auto check current_user allow read_comments of Topic
253
+ def index
254
+ end
255
+
256
+ # auto check current_user allow read_comment of @topic
257
+ def show
258
+ end
259
+
260
+ # Other actions:
261
+ # new: create_comment of Topic
262
+ # create: create_comment of Topic
263
+ # edit: edit_comment of @topic
264
+ # update: edit_comment of @topic
265
+ # destory: delete_comment of @topic
266
+
267
+
268
+ private
269
+
270
+ def find_topic
271
+ @topic = Topic.find(params[:id])
272
+ end
273
+ end
274
+ ```
275
+
276
+
277
+ Manual check, cannot call `ability_check_callback`
278
+
279
+ ```
280
+ class TopicController < ApplicationController
281
+ before_action :find_topic
282
+
283
+ def my_action1
284
+ raise 'no permission' unless can?(:read_something, @topic)
285
+ # my codes
286
+ end
287
+
288
+
289
+ private
290
+
291
+ def find_topic
292
+ @topic = Topic.find(params[:id])
293
+ end
294
+ end
295
+ ```
296
+
297
+ ## TODO
298
+
299
+ * [x] Rails Helpers
300
+ * [ ] Dynamic rule
301
+
302
+
303
+ ## Development
304
+
305
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
306
+
307
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
308
+
309
+ ## Contributing
310
+
311
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/seven. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
312
+
313
+
314
+ ## License
315
+
316
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
317
+
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "seven"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
data/bin/setup ADDED
@@ -0,0 +1,7 @@
1
+ #!/bin/bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+
5
+ bundle install
6
+
7
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,69 @@
1
+ module Seven
2
+ module Abilities
3
+ class << self
4
+ def warp_proc(rule_proc)
5
+ return unless rule_proc
6
+
7
+ Class.new do
8
+ include Seven::Abilities
9
+ abilities(&rule_proc)
10
+ end
11
+ end
12
+
13
+ def included(cls)
14
+ cls.extend(ClassMethods)
15
+ end
16
+ end
17
+
18
+
19
+ attr_reader :current_user, :target
20
+
21
+ def initialize(current_user, target)
22
+ @current_user = current_user
23
+ @target = target
24
+ @abilities = nil
25
+ end
26
+
27
+ def abilities
28
+ return @abilities if @abilities
29
+ @abilities = []
30
+
31
+ self.class.rule_procs.each do |field, scope, rule_proc|
32
+ if field
33
+ next if current_user.nil? || !scope.include?(current_user.public_send(field))
34
+ end
35
+ instance_eval(&rule_proc)
36
+ end
37
+
38
+ @abilities
39
+ end
40
+
41
+ def can(*some_abilities)
42
+ @abilities.push(*some_abilities.map(&:to_sym))
43
+ end
44
+
45
+ def cannot(*some_abilities)
46
+ syn_abilities = some_abilities.map(&:to_sym)
47
+ @abilities.delete_if {|ability| syn_abilities.include?(ability) }
48
+ end
49
+
50
+
51
+ module ClassMethods
52
+ attr_reader :rule_procs
53
+
54
+ # Params:
55
+ # field: current_user method
56
+ # scope: run rule proc if Array(scope).include?(current_user#{field})
57
+ def abilities(field = nil, scope = nil, &rule_proc)
58
+ if field
59
+ raise Seven::ArgsError, 'Scope cannot be nil' unless scope
60
+ formatted_scope = scope.is_a?(Array) ? scope : [scope]
61
+ end
62
+
63
+ @rule_procs ||= []
64
+ @rule_procs << [field ? field.to_sym : nil, formatted_scope, rule_proc]
65
+ end
66
+ end
67
+ end
68
+ end
69
+
@@ -0,0 +1,8 @@
1
+ module Seven
2
+ class ArgsError < ArgumentError
3
+ end
4
+
5
+ class Error < StandardError
6
+ end
7
+ end
8
+
@@ -0,0 +1,40 @@
1
+ module Seven
2
+ class Manager
3
+ attr_reader :rules
4
+
5
+ def initialize
6
+ @rules = []
7
+ end
8
+
9
+ def define_rules(matcher, rule_class = nil, &rule_proc)
10
+ rule_class ||= Seven::Abilities.warp_proc(rule_proc)
11
+
12
+ if valid_rule_class?(rule_class)
13
+ @rules << [matcher, rule_class]
14
+ else
15
+ raise ArgsError, 'No valid rule_class or rule_proc'
16
+ end
17
+ end
18
+
19
+ def can?(current_user, ability, target = nil)
20
+ matched_rules = rules.select {|m, rc| m === target || m == target }
21
+ return false if matched_rules.empty?
22
+
23
+ # class A; end
24
+ # class B < A; end
25
+ # [A, B, Object].min # => B
26
+ # find last class
27
+ rule_class = matched_rules.min_by(&:first).last
28
+ rule_class.new(current_user, target).abilities.include?(ability.to_sym)
29
+ end
30
+
31
+
32
+ private
33
+
34
+ def valid_rule_class?(rule_class)
35
+ return false unless rule_class && rule_class.is_a?(Class)
36
+ rule_class.included_modules.include?(Seven::Abilities)
37
+ end
38
+ end
39
+ end
40
+
@@ -0,0 +1,122 @@
1
+ module Seven
2
+ module Rails
3
+ module ControllerHelpers
4
+ # reuqire methods
5
+ # current_user
6
+ # abilities_manager
7
+ # ability_check_callback
8
+
9
+ def self.included(cls)
10
+ cls.extend(ClassMethods)
11
+ end
12
+
13
+ def can?(ability, target = nil)
14
+ abilities_manager.can?(current_user, ability, target)
15
+ end
16
+
17
+ def seven_ability_check_filter
18
+ current_action_name = action_name.to_sym
19
+ action_checker = self.class.seven_ability_checker[current_action_name]
20
+
21
+ if action_checker
22
+ target = seven_fetch_target(action_checker[:target])
23
+
24
+ result = can?(action_checker[:ability], target)
25
+ ability_check_callback(result, action_checker[:ability], target)
26
+ else
27
+ ability_check_callback(false, nil, nil)
28
+ end
29
+ end
30
+
31
+ def seven_fetch_target(target_list)
32
+ return if target_list.empty?
33
+
34
+ target_list.each do |t|
35
+ case t
36
+ when Symbol, String
37
+ instance = instance_variable_get(t)
38
+ return instance if instance
39
+ when Proc
40
+ result = instance_eval(&t)
41
+ return result if result
42
+ else
43
+ return t
44
+ end
45
+ end
46
+ end
47
+
48
+
49
+ module ClassMethods
50
+ attr_reader :seven_ability_checker
51
+
52
+ # Examples:
53
+ # ability_check :@topic
54
+ # ability_check [:@topic, Topic]
55
+ # ability_check [:@topic, Topic], show: {ability: :read_t, target: [:user]}
56
+ # ability_check show: {ability: :read_t, target: [:user]}
57
+ # ability_check action1: {something_opts}, action2: {someting_opts}
58
+ # ability_check [:@topic, Topic], nil, resource_name: :comments
59
+ def seven_ability_check(default_target, custom_checker = nil, opts = {})
60
+ @seven_ability_checker = seven_generate_controller_checker(
61
+ default_target, custom_checker, opts
62
+ )
63
+
64
+ before_action :seven_ability_check_filter
65
+ end
66
+
67
+
68
+ private
69
+
70
+ def seven_generate_controller_checker(default_target, custom_checker, opts)
71
+ if default_target.is_a?(Hash)
72
+ raise Seven::ArgsError, 'Invalid arguments' if custom_checker
73
+ seven_format_ability_checker(default_target)
74
+ else
75
+ controller_checker = seven_generate_default_ability_checker(
76
+ default_target, opts[:resource_name] || opts['resource_name']
77
+ )
78
+
79
+ if custom_checker.is_a?(Hash)
80
+ controller_checker.merge(seven_format_ability_checker(custom_checker))
81
+ elsif custom_checker.nil?
82
+ controller_checker
83
+ else
84
+ raise Seven::ArgsError, 'Invalid arguments'
85
+ end
86
+ end
87
+ end
88
+
89
+ def seven_generate_default_ability_checker(target, resource_name)
90
+ resource_name ||= name.demodulize.sub(/Controller$/, '').underscore
91
+ pluralize_name = resource_name.to_s.pluralize
92
+ singularize_name = resource_name.to_s.singularize
93
+
94
+ [
95
+ [:index, :read, pluralize_name],
96
+ [:show, :read, singularize_name],
97
+ [:new, :create, singularize_name],
98
+ [:edit, :edit, singularize_name],
99
+ [:create, :create, singularize_name],
100
+ [:update, :edit, singularize_name],
101
+ [:destroy, :delete, singularize_name]
102
+ ].each_with_object({}) do |data, result|
103
+ action_name, opt, resource_name = data
104
+ result[action_name] = {ability: "#{opt}_#{resource_name}".to_sym, target: target}
105
+ end
106
+ end
107
+
108
+ def seven_format_ability_checker(checker)
109
+ checker.each_with_object({}) do |data, result|
110
+ action_name, action_checker = data
111
+ tmp = result[action_name.to_sym] = action_checker.symbolize_keys
112
+
113
+ unless tmp[:ability] && tmp[:target]
114
+ raise Seven::ArgsError, "Invalid checker #{action_name}: #{action_checker}"
115
+ end
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
121
+ end
122
+
@@ -0,0 +1,6 @@
1
+ module Seven
2
+ module Rails
3
+ autoload :ControllerHelpers, 'seven/rails/controller_helpers'
4
+ end
5
+ end
6
+
@@ -0,0 +1,3 @@
1
+ module Seven
2
+ VERSION = "0.1.2"
3
+ end
data/lib/seven.rb ADDED
@@ -0,0 +1,13 @@
1
+ require "seven/version"
2
+
3
+ require "seven/error"
4
+
5
+ require "active_support"
6
+ require "active_support/core_ext"
7
+
8
+ module Seven
9
+ autoload :Manager, 'seven/manager'
10
+ autoload :Abilities, 'seven/abilities'
11
+ autoload :Rails, 'seven/rails'
12
+ end
13
+
data/lib/sevencan.rb ADDED
@@ -0,0 +1 @@
1
+ require 'seven'
data/seven.gemspec ADDED
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'seven/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "sevencan"
8
+ spec.version = Seven::VERSION
9
+ spec.authors = ["jiangzhi.xie"]
10
+ spec.email = ["xiejiangzhi@gmail.com"]
11
+
12
+ spec.summary = %q{simple permission manager}
13
+ spec.description = %q{simple permission manager}
14
+ spec.homepage = "http://seven.xjz.pw"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_development_dependency "bundler", "~> 1.10"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec"
25
+ spec.add_development_dependency "pry"
26
+
27
+ spec.add_dependency "activesupport"
28
+ end
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sevencan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ platform: ruby
6
+ authors:
7
+ - jiangzhi.xie
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2016-12-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: pry
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: activesupport
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: simple permission manager
84
+ email:
85
+ - xiejiangzhi@gmail.com
86
+ executables: []
87
+ extensions: []
88
+ extra_rdoc_files: []
89
+ files:
90
+ - ".gitignore"
91
+ - ".rspec"
92
+ - ".ruby-version"
93
+ - ".travis.yml"
94
+ - CODE_OF_CONDUCT.md
95
+ - Gemfile
96
+ - LICENSE.txt
97
+ - README.md
98
+ - Rakefile
99
+ - bin/console
100
+ - bin/setup
101
+ - lib/seven.rb
102
+ - lib/seven/abilities.rb
103
+ - lib/seven/error.rb
104
+ - lib/seven/manager.rb
105
+ - lib/seven/rails.rb
106
+ - lib/seven/rails/controller_helpers.rb
107
+ - lib/seven/version.rb
108
+ - lib/sevencan.rb
109
+ - seven.gemspec
110
+ homepage: http://seven.xjz.pw
111
+ licenses:
112
+ - MIT
113
+ metadata: {}
114
+ post_install_message:
115
+ rdoc_options: []
116
+ require_paths:
117
+ - lib
118
+ required_ruby_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: '0'
123
+ required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ requirements: []
129
+ rubyforge_project:
130
+ rubygems_version: 2.4.8
131
+ signing_key:
132
+ specification_version: 4
133
+ summary: simple permission manager
134
+ test_files: []