red_light 0.0.9 → 0.1.0

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.
data/README.md CHANGED
@@ -20,7 +20,8 @@ Or install it yourself as:
20
20
  [fancy-login](http://fancy-login.herokuapp.com)
21
21
 
22
22
  ## Usage
23
- [this](https://github.com/leomayleomay/red_light_example) is an example app built for illustrating how to incorporate red_light within your Rails application.
23
+
24
+ $ rails generate red_light:install
24
25
 
25
26
  ## Contributing
26
27
 
data/TODO CHANGED
@@ -1,5 +0,0 @@
1
- 1, sort out the order of loading RED_LIGHT_RULES and the middleware in
2
- lib/red_light/railtie.rb
3
-
4
- 2, allow user configure authentication methods, now we are using
5
- :authenticate_user! from devise, we should allow the user customize this
@@ -0,0 +1,17 @@
1
+ module RedLight
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates", __FILE__)
5
+
6
+ desc "Copy red light configuration to your application."
7
+
8
+ def copy_config
9
+ template "red_light.rb", "config/initializers/red_light.rb"
10
+ end
11
+
12
+ def show_readme
13
+ readme "README" if behavior == :invoke
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,5 @@
1
+ =================================================================
2
+
3
+ 1. edit config/initializers/red_light.rb to specify the authentication methods
4
+
5
+ =================================================================
@@ -0,0 +1,3 @@
1
+ RedLight.setup do |config|
2
+ config.authentications = [:authenticate_user!]
3
+ end
@@ -2,5 +2,10 @@ require "red_light/version"
2
2
  require 'red_light/railtie' if defined?(Rails)
3
3
 
4
4
  module RedLight
5
- end
5
+ mattr_accessor :authentications
6
+ @@authentications = []
6
7
 
8
+ def self.setup
9
+ yield self
10
+ end
11
+ end
@@ -71,7 +71,7 @@ module RedLight
71
71
  controller = File.basename(entry, ".rb").classify.constantize
72
72
 
73
73
  filter = controller._process_action_callbacks.select{ |callback|
74
- callback.filter == :authenticate_user!
74
+ RedLight.authentications.include?(callback.filter)
75
75
  }.first
76
76
 
77
77
  next if filter.nil?
@@ -1,3 +1,3 @@
1
1
  module RedLight
2
- VERSION = "0.0.9"
2
+ VERSION = "0.1.0"
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.9
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2013-05-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
- requirement: &70212116389180 !ruby/object:Gem::Requirement
16
+ requirement: &70215895456320 !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: *70212116389180
24
+ version_requirements: *70215895456320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70212116385820 !ruby/object:Gem::Requirement
27
+ requirement: &70215895452900 !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: *70212116385820
35
+ version_requirements: *70215895452900
36
36
  description: a gem used to add fancy login to your rails application
37
37
  email:
38
38
  - leomayleomay@gmail.com
@@ -47,6 +47,9 @@ files:
47
47
  - README.md
48
48
  - Rakefile
49
49
  - TODO
50
+ - lib/generators/red_light/install_generator.rb
51
+ - lib/generators/templates/README
52
+ - lib/generators/templates/red_light.rb
50
53
  - lib/red_light.rb
51
54
  - lib/red_light/fancy_login.rb
52
55
  - lib/red_light/railtie.rb