admin_engine 0.1.0 → 1.0.0

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: 041eb3fa0a124c4b871408d123693c7f1fa5b2c3
4
- data.tar.gz: 099edac614280afde3b46fadd42469283ea77904
3
+ metadata.gz: 791cf1c1288b7fafc5563b84e481c4c255025aec
4
+ data.tar.gz: 48e0b35192b52905ba5e448223e16f48b19ffe6e
5
5
  SHA512:
6
- metadata.gz: c3e8d4400217373765df7cc611e53c40cb3b8c1323cd95e1e97800f6fd988ca4f0f7606ea9e0c3b9f9f4e5549c3be70b4b3b6886af02af04e352ef1914563210
7
- data.tar.gz: f6edae1bc9689368a254f06c2d7725905f104916c5120a311eafc3320c5af1541fb2b18d1e951fbf8a93e9849dcf16de177cdb838996172fc486a078db108725
6
+ metadata.gz: 509841a70ef6862acbb759da0bec79c39e3d0f017fd91343b5a5037f4a92309e6664b2cd0ccb5ef75564be627242863679e13808910f2de604660edbd2990916
7
+ data.tar.gz: 1a3e7389ee6de4d1653a7facb7a47b7825f8048bc3ce74125eb7cf94829404dc231177d3bc2dc23da878e4620550e20779b033d359fe7391df1064075e9a75ae
data/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  # AdminEngine
2
+ ## Usage
2
3
 
3
4
  Install the database migration to create an admins table.
4
5
 
@@ -8,20 +9,20 @@ Run the database migration.
8
9
 
9
10
  bundle exec rake db:migrate
10
11
 
11
- Use a before_filter for actions that require the logged in user to be admin.
12
+ Use a before_filter for actions that require the logged in account to be admin.
12
13
 
13
14
  before_filter :authorize_admin
14
15
 
15
16
  Visit http://localhost:3000/admin
16
17
 
17
- If the logged in user is not an admin, you will see the following:
18
+ If the logged in account is not an admin, you will see the following:
18
19
 
19
20
  ### Unknown action
20
21
 
21
22
  AbstractController::ActionNotFound
22
23
  <br>
23
24
  <hr>
24
- Make the logged in user an admin by adding an entry in the admins table.
25
+ Make the logged in account an admin by adding an entry in the admins table.
25
26
 
26
27
  Now you will see the following:
27
28
 
@@ -29,3 +30,18 @@ Now you will see the following:
29
30
 
30
31
  Customize this page by implementing views/admin/home.
31
32
  <hr>
33
+ ## Development
34
+ ### Prepare the "dummy" app
35
+ pushd spec/dummy
36
+ rake user_authentication:install:migrations
37
+ rake admin_engine:install:migrations
38
+ rake db:drop
39
+ rake db:create
40
+ rake db:migrate
41
+ rake db:test:prepare
42
+ popd
43
+
44
+ ### Run specs
45
+ rspec
46
+
47
+
@@ -2,7 +2,7 @@ class ApplicationController < ActionController::Base
2
2
  private
3
3
 
4
4
  def authorize_admin
5
- unless current_user && current_user.admin?
5
+ unless current_account && current_account.admin?
6
6
  raise AbstractController::ActionNotFound
7
7
  end
8
8
  end
@@ -0,0 +1,5 @@
1
+ class Account < ActiveRecord::Base
2
+ def admin?
3
+ Admin.exists? :account_id => self
4
+ end
5
+ end
@@ -1,9 +1,9 @@
1
1
  class CreateAdmins < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :admins do |t|
4
- t.references :user, :null => false
4
+ t.references :account, :null => false
5
5
  end
6
6
 
7
- add_index :admins, [:user_id], :unique => true
7
+ add_index :admins, [:account_id], :unique => true
8
8
  end
9
9
  end
@@ -1,3 +1,3 @@
1
1
  module AdminEngine
2
- VERSION = "0.1.0"
2
+ VERSION = "1.0.0"
3
3
  end
data/lib/admin_engine.rb CHANGED
@@ -7,7 +7,7 @@ module AdminEngine
7
7
 
8
8
  config.after_initialize do
9
9
  require File.expand_path('../../app/controllers/application_controller', __FILE__)
10
- require File.expand_path('../../app/models/user', __FILE__)
10
+ require File.expand_path('../../app/models/account', __FILE__)
11
11
  end
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sujoy Gupta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-09 00:00:00.000000000 Z
11
+ date: 2015-04-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: haml
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 4.0.5
19
+ version: '4.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 4.0.5
26
+ version: '4.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rails
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 4.1.6
33
+ version: '4.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 4.1.6
40
+ version: '4.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: user_authentication
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.2.2
47
+ version: '1.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.2.2
54
+ version: '1.0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: factory_girl_rails
56
+ name: capybara
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '4.0'
61
+ version: '2.4'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '4.0'
68
+ version: '2.4'
69
69
  - !ruby/object:Gem::Dependency
70
- name: rspec-rails
70
+ name: factory_girl_rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0'
75
+ version: '4.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0'
82
+ version: '4.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: specstar-controllers
84
+ name: rspec-rails
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.0.5
89
+ version: '3.1'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.0.5
96
+ version: '3.1'
97
97
  - !ruby/object:Gem::Dependency
98
- name: specstar-models
98
+ name: specstar-controllers
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: 0.0.6
103
+ version: '0.1'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: 0.0.6
110
+ version: '0.1'
111
111
  - !ruby/object:Gem::Dependency
112
- name: specstar-support-random
112
+ name: specstar-models
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.0.1
117
+ version: '0.2'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.0.1
124
+ version: '0.2'
125
125
  - !ruby/object:Gem::Dependency
126
- name: sqlite3
126
+ name: specstar-support-random
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
- version: '0'
131
+ version: '0.1'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
- version: '0'
138
+ version: '0.1'
139
139
  - !ruby/object:Gem::Dependency
140
- name: webrat
140
+ name: sqlite3
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: A rails engine for adding admin functionality.
@@ -157,19 +157,19 @@ executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
+ - MIT-LICENSE
161
+ - README.md
162
+ - Rakefile
160
163
  - app/controllers/admin_controller.rb
161
164
  - app/controllers/application_controller.rb
165
+ - app/models/account.rb
162
166
  - app/models/admin.rb
163
- - app/models/user.rb
164
167
  - app/views/admin/home.html.haml
165
168
  - config/routes.rb
166
169
  - db/migrate/20121029000000_create_admins.rb
167
- - lib/admin_engine/version.rb
168
170
  - lib/admin_engine.rb
171
+ - lib/admin_engine/version.rb
169
172
  - lib/tasks/admin_engine_tasks.rake
170
- - MIT-LICENSE
171
- - Rakefile
172
- - README.md
173
173
  homepage: http://www.github.com/sujoyg/admin_engine
174
174
  licenses:
175
175
  - MIT
@@ -180,17 +180,17 @@ require_paths:
180
180
  - lib
181
181
  required_ruby_version: !ruby/object:Gem::Requirement
182
182
  requirements:
183
- - - '>='
183
+ - - ">="
184
184
  - !ruby/object:Gem::Version
185
185
  version: '0'
186
186
  required_rubygems_version: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - '>='
188
+ - - ">="
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  requirements: []
192
192
  rubyforge_project:
193
- rubygems_version: 2.1.4
193
+ rubygems_version: 2.2.2
194
194
  signing_key:
195
195
  specification_version: 4
196
196
  summary: A rails engine for adding admin functionality.
data/app/models/user.rb DELETED
@@ -1,5 +0,0 @@
1
- class User < ActiveRecord::Base
2
- def admin?
3
- Admin.exists? :user_id => self
4
- end
5
- end