admin_engine 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ class AdminController < ApplicationController
2
+ skip_before_filter :authorize
3
+ before_filter :authorize_admin
4
+
5
+ def home
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ class ApplicationController < ActionController::Base
2
+ private
3
+
4
+ def authorize_admin
5
+ unless current_user && current_user.admin?
6
+ raise AbstractController::ActionNotFound
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,2 @@
1
+ class Admin < ActiveRecord::Base
2
+ end
@@ -0,0 +1,5 @@
1
+ class User < ActiveRecord::Base
2
+ def admin?
3
+ Admin.exists? :user_id => self
4
+ end
5
+ end
@@ -0,0 +1,4 @@
1
+ %h2 Admin
2
+ %br
3
+ %br
4
+ Customize this page by implementing views/admin/home.
data/config/routes.rb ADDED
@@ -0,0 +1,3 @@
1
+ Rails.application.routes.draw do
2
+ match 'admin', :to => 'admin#home'
3
+ end
@@ -0,0 +1,9 @@
1
+ class CreateAdmins < ActiveRecord::Migration
2
+ def change
3
+ create_table :admins do |t|
4
+ t.references :user, :null => false
5
+ end
6
+
7
+ add_index :admins, [:user_id], :unique => true
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module AdminEngine
2
- VERSION = "0.0.0"
2
+ VERSION = "0.0.1"
3
3
  end
@@ -0,0 +1,3 @@
1
+ module AdminEngine
2
+ VERSION = "0.0.0"
3
+ end
data/lib/admin_engine.rb CHANGED
@@ -1,2 +1,13 @@
1
+ require 'haml'
2
+ require 'user_authentication'
3
+
1
4
  module AdminEngine
5
+ class Engine < Rails::Engine
6
+ engine_name 'admin_engine'
7
+
8
+ config.after_initialize do
9
+ require File.expand_path('../../app/controllers/application_controller', __FILE__)
10
+ require File.expand_path('../../app/models/user', __FILE__)
11
+ end
12
+ end
2
13
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: admin_engine
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,24 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-27 00:00:00.000000000 Z
12
+ date: 2013-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: haml
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.1.4
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.1.4
14
30
  - !ruby/object:Gem::Dependency
15
31
  name: rails
16
32
  requirement: !ruby/object:Gem::Requirement
@@ -27,6 +43,38 @@ dependencies:
27
43
  - - ~>
28
44
  - !ruby/object:Gem::Version
29
45
  version: 3.2.1
46
+ - !ruby/object:Gem::Dependency
47
+ name: user_authentication
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 0.0.6
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 0.0.6
62
+ - !ruby/object:Gem::Dependency
63
+ name: factory_girl_rails
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '4.0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '4.0'
30
78
  - !ruby/object:Gem::Dependency
31
79
  name: rspec-rails
32
80
  requirement: !ruby/object:Gem::Requirement
@@ -43,6 +91,54 @@ dependencies:
43
91
  - - ! '>='
44
92
  - !ruby/object:Gem::Version
45
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: specstar-controllers
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ~>
100
+ - !ruby/object:Gem::Version
101
+ version: 0.0.5
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ~>
108
+ - !ruby/object:Gem::Version
109
+ version: 0.0.5
110
+ - !ruby/object:Gem::Dependency
111
+ name: specstar-models
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 0.0.6
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ~>
124
+ - !ruby/object:Gem::Version
125
+ version: 0.0.6
126
+ - !ruby/object:Gem::Dependency
127
+ name: specstar-support-random
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ~>
132
+ - !ruby/object:Gem::Version
133
+ version: 0.0.1
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ~>
140
+ - !ruby/object:Gem::Version
141
+ version: 0.0.1
46
142
  - !ruby/object:Gem::Dependency
47
143
  name: sqlite3
48
144
  requirement: !ruby/object:Gem::Requirement
@@ -59,6 +155,22 @@ dependencies:
59
155
  - - ! '>='
60
156
  - !ruby/object:Gem::Version
61
157
  version: '0'
158
+ - !ruby/object:Gem::Dependency
159
+ name: webrat
160
+ requirement: !ruby/object:Gem::Requirement
161
+ none: false
162
+ requirements:
163
+ - - ! '>='
164
+ - !ruby/object:Gem::Version
165
+ version: '0'
166
+ type: :development
167
+ prerelease: false
168
+ version_requirements: !ruby/object:Gem::Requirement
169
+ none: false
170
+ requirements:
171
+ - - ! '>='
172
+ - !ruby/object:Gem::Version
173
+ version: '0'
62
174
  description:
63
175
  email:
64
176
  - sujoyg@gmail.com
@@ -66,7 +178,15 @@ executables: []
66
178
  extensions: []
67
179
  extra_rdoc_files: []
68
180
  files:
181
+ - app/controllers/admin_controller.rb
182
+ - app/controllers/application_controller.rb
183
+ - app/models/admin.rb
184
+ - app/models/user.rb
185
+ - app/views/admin/home.html.haml
186
+ - config/routes.rb
187
+ - db/migrate/20121029000000_create_admins.rb
69
188
  - lib/admin_engine/version.rb
189
+ - lib/admin_engine/version.rb~
70
190
  - lib/admin_engine.rb
71
191
  - lib/tasks/admin_engine_tasks.rake
72
192
  - MIT-LICENSE