corral_acl 0.9.0 → 0.9.1

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.
Files changed (111) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +7 -1
  3. data/Gemfile +12 -1
  4. data/LICENSE +1 -1
  5. data/README.md +2 -2
  6. data/Rakefile +34 -0
  7. data/bin/test +9 -0
  8. data/corral.gemspec +12 -12
  9. data/lib/corral/version.rb +1 -1
  10. data/lib/tasks/corral_tasks.rake +4 -0
  11. data/test/corral_test.rb +7 -0
  12. data/test/dummy/Rakefile +6 -0
  13. data/test/dummy/app/assets/config/manifest.js +4 -0
  14. data/test/dummy/app/assets/images/.keep +0 -0
  15. data/test/dummy/app/assets/javascripts/application.js +13 -0
  16. data/test/dummy/app/assets/javascripts/cable.js +13 -0
  17. data/test/dummy/app/assets/javascripts/channels/.keep +0 -0
  18. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  19. data/test/dummy/app/channels/application_cable/channel.rb +4 -0
  20. data/test/dummy/app/channels/application_cable/connection.rb +4 -0
  21. data/test/dummy/app/controllers/application_controller.rb +3 -0
  22. data/test/dummy/app/controllers/concerns/.keep +0 -0
  23. data/test/dummy/app/helpers/application_helper.rb +2 -0
  24. data/test/dummy/app/jobs/application_job.rb +2 -0
  25. data/test/dummy/app/mailers/application_mailer.rb +4 -0
  26. data/test/dummy/app/models/application_record.rb +3 -0
  27. data/test/dummy/app/models/concerns/.keep +0 -0
  28. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  29. data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
  30. data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
  31. data/test/dummy/bin/bundle +3 -0
  32. data/test/dummy/bin/rails +4 -0
  33. data/test/dummy/bin/rake +4 -0
  34. data/test/dummy/bin/setup +34 -0
  35. data/test/dummy/bin/update +29 -0
  36. data/test/dummy/config.ru +5 -0
  37. data/test/dummy/config/application.rb +15 -0
  38. data/test/dummy/config/boot.rb +5 -0
  39. data/test/dummy/config/cable.yml +9 -0
  40. data/test/dummy/config/database.yml +25 -0
  41. data/test/dummy/config/environment.rb +5 -0
  42. data/test/dummy/config/environments/development.rb +54 -0
  43. data/test/dummy/config/environments/production.rb +86 -0
  44. data/test/dummy/config/environments/test.rb +42 -0
  45. data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
  46. data/test/dummy/config/initializers/assets.rb +11 -0
  47. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  48. data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
  49. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  50. data/test/dummy/config/initializers/inflections.rb +16 -0
  51. data/test/dummy/config/initializers/mime_types.rb +4 -0
  52. data/test/dummy/config/initializers/new_framework_defaults.rb +24 -0
  53. data/test/dummy/config/initializers/session_store.rb +3 -0
  54. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  55. data/test/dummy/config/locales/en.yml +23 -0
  56. data/test/dummy/config/puma.rb +47 -0
  57. data/test/dummy/config/routes.rb +3 -0
  58. data/test/dummy/config/secrets.yml +22 -0
  59. data/test/dummy/config/spring.rb +6 -0
  60. data/test/dummy/lib/assets/.keep +0 -0
  61. data/test/dummy/log/.keep +0 -0
  62. data/test/dummy/public/404.html +67 -0
  63. data/test/dummy/public/422.html +67 -0
  64. data/test/dummy/public/500.html +66 -0
  65. data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
  66. data/test/dummy/public/apple-touch-icon.png +0 -0
  67. data/test/dummy/public/favicon.ico +0 -0
  68. data/test/test_helper.rb +20 -0
  69. metadata +90 -51
  70. data/.rspec +0 -2
  71. data/doc/Ability.html +0 -257
  72. data/doc/Corral.html +0 -131
  73. data/doc/Corral/Ability.html +0 -802
  74. data/doc/Corral/AccessDenied.html +0 -146
  75. data/doc/Corral/AuthorizationNotPerformed.html +0 -145
  76. data/doc/Corral/ControllerAdditions.html +0 -513
  77. data/doc/Corral/ControllerAdditions/ClassMethods.html +0 -277
  78. data/doc/Corral/Error.html +0 -141
  79. data/doc/Corral/Generators.html +0 -117
  80. data/doc/Corral/Generators/AbilityGenerator.html +0 -195
  81. data/doc/Corral/NullRule.html +0 -226
  82. data/doc/Corral/SubjectRule.html +0 -406
  83. data/doc/_index.html +0 -194
  84. data/doc/class_list.html +0 -51
  85. data/doc/css/common.css +0 -1
  86. data/doc/css/full_list.css +0 -58
  87. data/doc/css/style.css +0 -474
  88. data/doc/doc/_index.html +0 -87
  89. data/doc/doc/class_list.html +0 -51
  90. data/doc/doc/css/common.css +0 -1
  91. data/doc/doc/css/full_list.css +0 -58
  92. data/doc/doc/css/style.css +0 -474
  93. data/doc/doc/file_list.html +0 -51
  94. data/doc/doc/frames.html +0 -17
  95. data/doc/doc/index.html +0 -87
  96. data/doc/doc/js/app.js +0 -243
  97. data/doc/doc/js/full_list.js +0 -216
  98. data/doc/doc/js/jquery.js +0 -4
  99. data/doc/doc/method_list.html +0 -51
  100. data/doc/doc/top-level-namespace.html +0 -102
  101. data/doc/file.README.html +0 -82
  102. data/doc/file_list.html +0 -56
  103. data/doc/frames.html +0 -17
  104. data/doc/index.html +0 -82
  105. data/doc/js/app.js +0 -243
  106. data/doc/js/full_list.js +0 -216
  107. data/doc/js/jquery.js +0 -4
  108. data/doc/method_list.html +0 -211
  109. data/doc/top-level-namespace.html +0 -114
  110. data/spec/corral/ability_spec.rb +0 -26
  111. data/spec/spec_helper.rb +0 -97
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d80ffade1eeec014fc8c4d662dedc9a1c0a3f8e
4
- data.tar.gz: 4e179a50363c9234992f392d3d3171f7d35ed03a
3
+ metadata.gz: b9fb4dcd8dc3f0d68ecb3614390ef974fc0099f1
4
+ data.tar.gz: 77377b9cdcfdf554221eb7915e0ea5dd0221bccc
5
5
  SHA512:
6
- metadata.gz: 779136d92fbd16dc15132b6a3a9c5969db7a1bc8ebd48358167395cc37cb451bfb86637fa51651afa86140a38b5597ef9339af7fce6844744e7ef3389a7ec581
7
- data.tar.gz: 9dc6ed073e0c32373307e01910b6b8988b35efbcefce91bcca7caf808f94243f8aabe904690f0076328754223a9d9b4b432a59c786324e6add858a95e7dc05a9
6
+ metadata.gz: '0433192143c132b8ddacd566ccfb4ed670f11b323e5b2aa1fb4646892b3a3480b43871bec9c7b88cd4faa289f20a6c8557e9a9f947efa6741db2ea65f15ea659'
7
+ data.tar.gz: db75efabd778d892cbb76602e51e6b4fd6dc549c60c6bf61d6575cdae5b0ef558dd1d96cbb11f10eb9e9625479567bb537271956366d0d8b672f8d21923307f5
data/.gitignore CHANGED
@@ -1 +1,7 @@
1
- .yardoc/
1
+ .bundle/
2
+ log/*.log
3
+ pkg/
4
+ test/dummy/db/*.sqlite3
5
+ test/dummy/db/*.sqlite3-journal
6
+ test/dummy/log/*.log
7
+ test/dummy/tmp/
data/Gemfile CHANGED
@@ -1,3 +1,14 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
 
3
+ # Declare your gem's dependencies in corral.gemspec.
4
+ # Bundler will treat runtime dependencies like base dependencies, and
5
+ # development dependencies will be added by default to the :development group.
3
6
  gemspec
7
+
8
+ # Declare any dependencies that are still in development here instead of in
9
+ # your gemspec. These might include edge Rails or gems from your path or
10
+ # Git. Remember to move these dependencies to your gemspec before releasing
11
+ # your gem to rubygems.org.
12
+
13
+ # To use a debugger
14
+ # gem 'byebug', group: [:development, :test]
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2016 Liam P. White
1
+ Copyright (c) 2016 Elliot Speck
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Corral
2
2
 
3
- A dead-simple, fast, pure Ruby ACL module for Rails applications.
3
+ A dead-simple, fast, very opinionated, pure Ruby ACL module for Rails applications.
4
4
 
5
5
  This project is mostly the Sinatra to Rails's [CanCanCan](https://github.com/CanCanCommunity/cancancan).
6
6
 
7
- This gem was written with speed and very specific requirements in mind. You probably do want CanCanCan, so please check that out first!
7
+ This gem was written with speed and very specific requirements in mind. You probably want CanCanCan, so please check that out first!
data/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Corral'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.md')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+
18
+
19
+
20
+
21
+
22
+ require 'bundler/gem_tasks'
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'lib'
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
32
+
33
+
34
+ task default: :test
data/bin/test ADDED
@@ -0,0 +1,9 @@
1
+ #!/usr/bin/env ruby
2
+ $: << File.expand_path(File.expand_path('../../test', __FILE__))
3
+
4
+ require 'bundler/setup'
5
+ require 'rails/test_unit/minitest_plugin'
6
+
7
+ Rails::TestUnitReporter.executable = 'bin/test'
8
+
9
+ exit Minitest.run(ARGV)
data/corral.gemspec CHANGED
@@ -1,17 +1,17 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'corral/version'
1
+ $:.push File.expand_path("../lib", __FILE__)
5
2
 
3
+ require "corral/version"
6
4
  Gem::Specification.new do |s|
7
- s.name = "corral_acl"
8
- s.version = Corral::VERSION
9
- s.authors = ["Arcaire", "Liam White"]
10
- s.email = "/dev/null"
11
- s.summary = "Extremely simple authorization solution."
12
- s.description = "Yet another authorization solution."
13
- s.license = "MIT"
5
+ s.name = "corral_acl"
6
+ s.version = Corral::VERSION
7
+ s.authors = ["Elliot Speck (Arcaire)"]
8
+ s.email = ["rubygems@elliot.pro"]
9
+ s.homepage = "https://github.com/Arcaire/corral"
10
+ s.summary = "Yet another opinionated ACL framework."
11
+ s.description = "Yet another opinionated ACL framework."
12
+ s.license = "MIT"
14
13
 
15
- s.files = `git ls-files`.split($/)
14
+ s.files = `git ls-files`.split($/)
16
15
  s.require_paths = ["lib"]
16
+ s.add_runtime_dependency 'rails', '~> 4.2', '>= 4.2.0'
17
17
  end
@@ -1,3 +1,3 @@
1
1
  module Corral
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :corral do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class Corral::Test < ActiveSupport::TestCase
4
+ test "truth" do
5
+ assert_kind_of Module, Corral
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require_relative 'config/application'
5
+
6
+ Rails.application.load_tasks
@@ -0,0 +1,4 @@
1
+
2
+ //= link_tree ../images
3
+ //= link_directory ../javascripts .js
4
+ //= link_directory ../stylesheets .css
File without changes
@@ -0,0 +1,13 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file. JavaScript code in this file should be added after the last require_* statement.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require_tree .
@@ -0,0 +1,13 @@
1
+ // Action Cable provides the framework to deal with WebSockets in Rails.
2
+ // You can generate new channels where WebSocket features live using the rails generate channel command.
3
+ //
4
+ //= require action_cable
5
+ //= require_self
6
+ //= require_tree ./channels
7
+
8
+ (function() {
9
+ this.App || (this.App = {});
10
+
11
+ App.cable = ActionCable.createConsumer();
12
+
13
+ }).call(this);
File without changes
@@ -0,0 +1,15 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9
+ * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10
+ * files in this directory. Styles in this file should be added after the last require_* statement.
11
+ * It is generally better to create a new file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Channel < ActionCable::Channel::Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module ApplicationCable
2
+ class Connection < ActionCable::Connection::Base
3
+ end
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery with: :exception
3
+ end
File without changes
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end
@@ -0,0 +1,2 @@
1
+ class ApplicationJob < ActiveJob::Base
2
+ end
@@ -0,0 +1,4 @@
1
+ class ApplicationMailer < ActionMailer::Base
2
+ default from: 'from@example.com'
3
+ layout 'mailer'
4
+ end
@@ -0,0 +1,3 @@
1
+ class ApplicationRecord < ActiveRecord::Base
2
+ self.abstract_class = true
3
+ end
File without changes
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= csrf_meta_tags %>
6
+
7
+ <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8
+ <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9
+ </head>
10
+
11
+ <body>
12
+ <%= yield %>
13
+ </body>
14
+ </html>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
+ <style>
6
+ /* Email styles need to be inline */
7
+ </style>
8
+ </head>
9
+
10
+ <body>
11
+ <%= yield %>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <%= yield %>
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
+ load Gem.bin_path('bundler', 'bundle')
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ APP_PATH = File.expand_path('../config/application', __dir__)
3
+ require_relative '../config/boot'
4
+ require 'rails/commands'
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env ruby
2
+ require_relative '../config/boot'
3
+ require 'rake'
4
+ Rake.application.run
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a starting point to setup your application.
15
+ # Add necessary setup steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ # puts "\n== Copying sample files =="
22
+ # unless File.exist?('config/database.yml')
23
+ # cp 'config/database.yml.sample', 'config/database.yml'
24
+ # end
25
+
26
+ puts "\n== Preparing database =="
27
+ system! 'bin/rails db:setup'
28
+
29
+ puts "\n== Removing old logs and tempfiles =="
30
+ system! 'bin/rails log:clear tmp:clear'
31
+
32
+ puts "\n== Restarting application server =="
33
+ system! 'bin/rails restart'
34
+ end
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ require 'pathname'
3
+ require 'fileutils'
4
+ include FileUtils
5
+
6
+ # path to your application root.
7
+ APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8
+
9
+ def system!(*args)
10
+ system(*args) || abort("\n== Command #{args} failed ==")
11
+ end
12
+
13
+ chdir APP_ROOT do
14
+ # This script is a way to update your development environment automatically.
15
+ # Add necessary update steps to this file.
16
+
17
+ puts '== Installing dependencies =='
18
+ system! 'gem install bundler --conservative'
19
+ system('bundle check') || system!('bundle install')
20
+
21
+ puts "\n== Updating database =="
22
+ system! 'bin/rails db:migrate'
23
+
24
+ puts "\n== Removing old logs and tempfiles =="
25
+ system! 'bin/rails log:clear tmp:clear'
26
+
27
+ puts "\n== Restarting application server =="
28
+ system! 'bin/rails restart'
29
+ end
@@ -0,0 +1,5 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require_relative 'config/environment'
4
+
5
+ run Rails.application
@@ -0,0 +1,15 @@
1
+ require_relative 'boot'
2
+
3
+ require 'rails/all'
4
+
5
+ Bundler.require(*Rails.groups)
6
+ require "corral"
7
+
8
+ module Dummy
9
+ class Application < Rails::Application
10
+ # Settings in config/environments/* take precedence over those specified here.
11
+ # Application configuration should go into files in config/initializers
12
+ # -- all .rb files in that directory are automatically loaded.
13
+ end
14
+ end
15
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../Gemfile', __dir__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../lib', __dir__)
@@ -0,0 +1,9 @@
1
+ development:
2
+ adapter: async
3
+
4
+ test:
5
+ adapter: async
6
+
7
+ production:
8
+ adapter: redis
9
+ url: redis://localhost:6379/1
@@ -0,0 +1,25 @@
1
+ # SQLite version 3.x
2
+ # gem install sqlite3
3
+ #
4
+ # Ensure the SQLite 3 gem is defined in your Gemfile
5
+ # gem 'sqlite3'
6
+ #
7
+ default: &default
8
+ adapter: sqlite3
9
+ pool: 5
10
+ timeout: 5000
11
+
12
+ development:
13
+ <<: *default
14
+ database: db/development.sqlite3
15
+
16
+ # Warning: The database defined as "test" will be erased and
17
+ # re-generated from your development database when you run "rake".
18
+ # Do not set this db to the same as development or production.
19
+ test:
20
+ <<: *default
21
+ database: db/test.sqlite3
22
+
23
+ production:
24
+ <<: *default
25
+ database: db/production.sqlite3