red_light 0.0.5 → 0.0.6

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.
@@ -3,24 +3,18 @@ require 'red_light/fancy_login'
3
3
  module RedLight
4
4
  class Railtie < Rails::Railtie
5
5
  initializer "red_light.configure_rails_initialization" do |app|
6
- app.middleware.use RedLight::FancyLogin
7
- end
8
-
9
- ActiveSupport.on_load(:action_controller) do
10
6
  ::RED_LIGHT_RULES = Hash.new([])
11
7
 
12
- controllers = Dir.glob("app/controllers/**/*_controller.rb").map do |entry|
13
- File.basename(entry, ".rb").classify.constantize
14
- end
8
+ Dir.glob("app/controllers/**/*_controller.rb").map do |entry|
9
+ controller = File.basename(entry, ".rb").classify.constantize
15
10
 
16
- controllers.each do |c|
17
- filter = c._process_action_callbacks.select{ |callback|
11
+ filter = controller._process_action_callbacks.select{ |callback|
18
12
  callback.filter == :authenticate_user!
19
13
  }.first
20
14
 
21
15
  next if filter.nil?
22
16
 
23
- controller_name = c.to_s.underscore.split("_controller").first
17
+ controller_name = controller.to_s.underscore.split("_controller").first
24
18
  ::RED_LIGHT_RULES[controller_name] = Array(c.action_methods)
25
19
 
26
20
  options = filter.options
@@ -34,6 +28,8 @@ module RedLight
34
28
  end
35
29
 
36
30
  ::RED_LIGHT_RULES.freeze
31
+
32
+ app.middleware.use RedLight::FancyLogin
37
33
  end
38
34
  end
39
35
  end
@@ -1,3 +1,3 @@
1
1
  module RedLight
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: red_light
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-05-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &70303589965440 !ruby/object:Gem::Requirement
16
+ requirement: &70267573477120 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.3'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70303589965440
24
+ version_requirements: *70267573477120
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70303589962020 !ruby/object:Gem::Requirement
27
+ requirement: &70267573474540 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70303589962020
35
+ version_requirements: *70267573474540
36
36
  description: a gem used to add fancy login to your rails application
37
37
  email:
38
38
  - leomayleomay@gmail.com