revelry_auth 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eaafcb8c966e9726b8c3051cc92ef7d600f1e3f9
4
- data.tar.gz: fa08ece2c47abba7f026819048103b4ced38589a
3
+ metadata.gz: efd3137938135a68c2d60c11c7006e2b501297d6
4
+ data.tar.gz: 011cad03b330d3d82b65385d6f751cf17b4358e0
5
5
  SHA512:
6
- metadata.gz: 58d95bba8a0e7c2ac64bb7381eabb7c2de892e2858b55f8edd7e7696d65769b39cac905969932da6af3a7e0ab1c2605af690fd02925b38c37b360b04cb28c6cf
7
- data.tar.gz: 387651d74dba908f8826a5575f6ae99a5cc815f3d574a3ee17f7268be902c24dcd652c3b2014e424db41311269bb245918eb8c6bba64befbc4100bd6be0b4d4f
6
+ metadata.gz: f08f07fba85fc011297faa75f5e638489de8682563e7503674b0fabca1320b4fea70582797ecf0faaf743b7b4c683436c993b588e70fa3951e15d5fe56c4538c
7
+ data.tar.gz: 0f03095357c69155bca4030fcd00994db372af4f5d718638c216bfd4f0055f19b1b9adcbbbab2bd6b2871a738e0b6f1075c7131e524a8a744243bdd649f67208
data/README.md CHANGED
@@ -1 +1,26 @@
1
- # revelry_auth
1
+ # RevelryAuth
2
+
3
+ Revelry Auth is an authentication and authorization engine that is fast and easy
4
+ to install.
5
+
6
+ ## Installation
7
+
8
+ For a new app, run:
9
+
10
+ ```shell
11
+ rails new APPNAME -m https://raw.githubusercontent.com/revelrylabs/revelry_auth/master/template.rb
12
+ ```
13
+
14
+ For an existing app, add the gem to your Gemfile and then do
15
+
16
+ ```shell
17
+ bundle install
18
+ rails g revelry:auth:install
19
+ ```
20
+
21
+ ## Extension & Customization
22
+
23
+ Revelry Auth is built on [Devise](https://github.com/plataformatec/devise),
24
+ [Rolify](https://github.com/RolifyCommunity/rolify) and
25
+ [Pundit](https://github.com/elabs/pundit), so you have access to all the
26
+ customization options those gems provide.
@@ -0,0 +1,21 @@
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
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
8
+ load 'rails/tasks/engine.rake'
9
+
10
+
11
+ load 'rails/tasks/statistics.rake'
12
+
13
+
14
+
15
+ Bundler::GemHelper.install_tasks
16
+ 
17
+ require 'rspec/core/rake_task'
18
+
19
+ RSpec::Core::RakeTask.new(:spec)
20
+
21
+ task :default => :spec
@@ -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.
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,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 styles
10
+ * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
11
+ * file per style scope.
12
+ *
13
+ *= require_tree .
14
+ *= require_self
15
+ */
@@ -0,0 +1,6 @@
1
+ module Revelry
2
+ module Auth
3
+ class ApplicationController < ActionController::Base
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,6 @@
1
+ module Revelry
2
+ module Auth
3
+ module ApplicationHelper
4
+ end
5
+ end
6
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>RevelryAuth</title>
5
+ <%= stylesheet_link_tag "revelry_auth/application", media: "all" %>
6
+ <%= javascript_include_tag "revelry_auth/application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,4 @@
1
+ require 'revelry/auth/engine'
2
+
3
+ Revelry::Auth::Engine.routes.draw do
4
+ end
@@ -0,0 +1,53 @@
1
+ require 'rails/generators/base'
2
+
3
+ module Revelry
4
+ module Generators
5
+ module Auth
6
+ class InstallGenerator < Rails::Generators::Base
7
+ source_root File.expand_path("../templates", __FILE__)
8
+
9
+ def add_gem
10
+ gem 'devise'
11
+ gem 'rolify'
12
+ gem 'pundit'
13
+ gem 'devise_invitable'
14
+ run 'bundle install'
15
+ end
16
+
17
+ def install_devise
18
+ generate 'devise:install'
19
+ end
20
+
21
+ def install_devise_to_user
22
+ generate 'devise user'
23
+ insert_into_file Rails.root.join('app', 'models', 'user.rb'), after: 'validatable' do
24
+ ', :invitable'
25
+ end
26
+ rake 'db:migrate'
27
+ end
28
+
29
+ def install_roles
30
+ generate 'rolify Role User'
31
+ rake 'db:migrate'
32
+ end
33
+
34
+ def add_pundit_to_app_controller
35
+ insert_into_file app_controller_path, after: "ActionController::Base\n" do
36
+ "include Pundit\n"
37
+ end
38
+ end
39
+
40
+ def install_policies
41
+ generate 'pundit:install'
42
+ template 'admins_only_policy.rb', 'app/policies/admins_only_policy.rb'
43
+ end
44
+
45
+ private
46
+
47
+ def app_controller_path
48
+ Rails.root.join('app', 'controllers', 'application_controller.rb')
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,26 @@
1
+ class AdminsOnlyPolicy < ApplicationPolicy
2
+ def initialize(user, model)
3
+ @user = user
4
+ @model = model
5
+ end
6
+
7
+ def index?
8
+ @user.has_role? :admin
9
+ end
10
+
11
+ def create?
12
+ @user.has_role? :admin
13
+ end
14
+
15
+ def update?
16
+ @user.has_role? :admin
17
+ end
18
+
19
+ def edit?
20
+ @user.has_role? :admin
21
+ end
22
+
23
+ def destroy?
24
+ @user.has_role? :admin
25
+ end
26
+ end
@@ -0,0 +1,6 @@
1
+ require 'revelry/auth'
2
+
3
+ module Revelry
4
+ module Auth
5
+ end
6
+ end
@@ -0,0 +1,2 @@
1
+ require 'revelry/auth/engine'
2
+ require 'revelry/auth/concern'
@@ -0,0 +1,9 @@
1
+ module Revelry
2
+ module Auth
3
+ module Concern
4
+ def admins_only
5
+ authorize :admins_only
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ require 'rubygems'
2
+ require 'devise'
3
+ require 'devise_invitable'
4
+ require 'rolify'
5
+ require 'pundit'
6
+
7
+ module Revelry
8
+ module Auth
9
+ class Engine < ::Rails::Engine
10
+ isolate_namespace Revelry::Auth
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ module Revelry
2
+ module Auth
3
+ VERSION = "0.0.1"
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :revelry_auth do
3
+ # # Task goes here
4
+ # end
metadata CHANGED
@@ -1,109 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: revelry_auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  platform: ruby
6
6
  authors:
7
- - Revelry Labs, LLC
7
+ - Adam Clarke
8
+ - Robert Prehn
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-04-18 00:00:00.000000000 Z
12
+ date: 2015-05-12 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: rails
15
16
  requirement: !ruby/object:Gem::Requirement
16
17
  requirements:
17
- - - ~>
18
+ - - "~>"
18
19
  - !ruby/object:Gem::Version
19
20
  version: '4.0'
20
21
  type: :runtime
21
22
  prerelease: false
22
23
  version_requirements: !ruby/object:Gem::Requirement
23
24
  requirements:
24
- - - ~>
25
+ - - "~>"
25
26
  - !ruby/object:Gem::Version
26
27
  version: '4.0'
27
28
  - !ruby/object:Gem::Dependency
28
29
  name: devise
29
30
  requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - ~>
32
+ - - "~>"
32
33
  - !ruby/object:Gem::Version
33
34
  version: 3.4.1
34
35
  type: :runtime
35
36
  prerelease: false
36
37
  version_requirements: !ruby/object:Gem::Requirement
37
38
  requirements:
38
- - - ~>
39
+ - - "~>"
39
40
  - !ruby/object:Gem::Version
40
41
  version: 3.4.1
41
42
  - !ruby/object:Gem::Dependency
42
43
  name: rolify
43
44
  requirement: !ruby/object:Gem::Requirement
44
45
  requirements:
45
- - - ~>
46
+ - - "~>"
46
47
  - !ruby/object:Gem::Version
47
48
  version: 3.5.2
48
49
  type: :runtime
49
50
  prerelease: false
50
51
  version_requirements: !ruby/object:Gem::Requirement
51
52
  requirements:
52
- - - ~>
53
+ - - "~>"
53
54
  - !ruby/object:Gem::Version
54
55
  version: 3.5.2
55
56
  - !ruby/object:Gem::Dependency
56
57
  name: pundit
57
58
  requirement: !ruby/object:Gem::Requirement
58
59
  requirements:
59
- - - ~>
60
+ - - "~>"
60
61
  - !ruby/object:Gem::Version
61
62
  version: 0.3.0
62
63
  type: :runtime
63
64
  prerelease: false
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  requirements:
66
- - - ~>
67
+ - - "~>"
67
68
  - !ruby/object:Gem::Version
68
69
  version: 0.3.0
69
70
  - !ruby/object:Gem::Dependency
70
71
  name: devise_invitable
71
72
  requirement: !ruby/object:Gem::Requirement
72
73
  requirements:
73
- - - ~>
74
+ - - "~>"
74
75
  - !ruby/object:Gem::Version
75
76
  version: 1.3.4
76
77
  type: :runtime
77
78
  prerelease: false
78
79
  version_requirements: !ruby/object:Gem::Requirement
79
80
  requirements:
80
- - - ~>
81
+ - - "~>"
81
82
  - !ruby/object:Gem::Version
82
83
  version: 1.3.4
83
84
  - !ruby/object:Gem::Dependency
84
85
  name: sqlite3
85
86
  requirement: !ruby/object:Gem::Requirement
86
87
  requirements:
87
- - - '>='
88
+ - - ">="
88
89
  - !ruby/object:Gem::Version
89
90
  version: '0'
90
91
  type: :development
91
92
  prerelease: false
92
93
  version_requirements: !ruby/object:Gem::Requirement
93
94
  requirements:
94
- - - '>='
95
+ - - ">="
95
96
  - !ruby/object:Gem::Version
96
97
  version: '0'
97
- description: Based on Devise, Rolify, and Pundit
98
+ - !ruby/object:Gem::Dependency
99
+ name: rspec
100
+ requirement: !ruby/object:Gem::Requirement
101
+ requirements:
102
+ - - ">="
103
+ - !ruby/object:Gem::Version
104
+ version: '0'
105
+ type: :development
106
+ prerelease: false
107
+ version_requirements: !ruby/object:Gem::Requirement
108
+ requirements:
109
+ - - ">="
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ - !ruby/object:Gem::Dependency
113
+ name: rspec-rails
114
+ requirement: !ruby/object:Gem::Requirement
115
+ requirements:
116
+ - - ">="
117
+ - !ruby/object:Gem::Version
118
+ version: '0'
119
+ type: :development
120
+ prerelease: false
121
+ version_requirements: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - ">="
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ description: Authentication and authorization for Revelry toolkit apps using Devise,
127
+ Rolify and Pundit.
98
128
  email:
99
- - hello@revelry.co
129
+ - adam@revelry.co
130
+ - robert@revelry.co
100
131
  executables: []
101
132
  extensions: []
102
133
  extra_rdoc_files: []
103
134
  files:
104
135
  - LICENSE
105
136
  - README.md
106
- homepage: https://github.com/revelrylabs/revelry_auth
137
+ - Rakefile
138
+ - app/assets/javascripts/revelry_auth/application.js
139
+ - app/assets/stylesheets/revelry_auth/application.css
140
+ - app/controllers/revelry_auth/application_controller.rb
141
+ - app/helpers/revelry_auth/application_helper.rb
142
+ - app/views/layouts/revelry_auth/application.html.erb
143
+ - config/routes.rb
144
+ - lib/generators/revelry/auth/install_generator.rb
145
+ - lib/generators/revelry/auth/templates/admins_only_policy.rb
146
+ - lib/revelry.rb
147
+ - lib/revelry/auth.rb
148
+ - lib/revelry/auth/concern.rb
149
+ - lib/revelry/auth/engine.rb
150
+ - lib/revelry/auth/version.rb
151
+ - lib/tasks/revelry_auth_tasks.rake
152
+ homepage: http://toolkit.revelry.co
107
153
  licenses:
108
154
  - BSD
109
155
  metadata: {}
@@ -113,18 +159,18 @@ require_paths:
113
159
  - lib
114
160
  required_ruby_version: !ruby/object:Gem::Requirement
115
161
  requirements:
116
- - - '>='
162
+ - - ">="
117
163
  - !ruby/object:Gem::Version
118
164
  version: '0'
119
165
  required_rubygems_version: !ruby/object:Gem::Requirement
120
166
  requirements:
121
- - - '>='
167
+ - - ">="
122
168
  - !ruby/object:Gem::Version
123
169
  version: '0'
124
170
  requirements: []
125
171
  rubyforge_project:
126
- rubygems_version: 2.0.14
172
+ rubygems_version: 2.2.2
127
173
  signing_key:
128
174
  specification_version: 4
129
- summary: Revelry Standard Authentication Engine
175
+ summary: Authentication and authorization for Revelry toolkit apps.
130
176
  test_files: []