simple_auth 0.1.5 → 0.1.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.
data/README.markdown CHANGED
@@ -122,6 +122,12 @@ There are some helpers:
122
122
  current_session # controller & views
123
123
  when_logged(&block) # views
124
124
 
125
+ If you're having problems to use any helper, include the module <tt>SimpleAuth::Helper</tt> to your <tt>ApplicationHelper</tt>.
126
+
127
+ module ApplicationHelper
128
+ include SimpleAuth::Helper
129
+ end
130
+
125
131
  Troubleshooting
126
132
  ---------------
127
133
 
data/init.rb CHANGED
@@ -1,5 +1 @@
1
1
  require "simple_auth"
2
-
3
- config.to_prepare do
4
- ApplicationController.helper SimpleAuthHelper
5
- end
data/lib/simple_auth.rb CHANGED
@@ -3,6 +3,7 @@ require "simple_auth/config"
3
3
  require "simple_auth/action_controller"
4
4
  require "simple_auth/active_record"
5
5
  require "simple_auth/session"
6
+ require "simple_auth/helper"
6
7
  require "simple_auth/version"
7
8
 
8
9
  module SimpleAuth
@@ -15,5 +16,6 @@ end
15
16
  ::ActionController::Base.send :include, SimpleAuth::ActionController::Implementation
16
17
  ::ActionController::Base.send :include, SimpleAuth::ActionController::InstanceMethods
17
18
  ::ActionController::Base.send :extend, SimpleAuth::ActionController::ClassMethods
19
+ ::ApplicationController.helper SimpleAuth::Helper if defined?(::ApplicationController)
18
20
 
19
21
  I18n.load_path += Dir[File.dirname(__FILE__) + "/../config/locales/*.yml"]
@@ -0,0 +1,12 @@
1
+ module SimpleAuth
2
+ module Helper
3
+ # Renders the specified block for logged users.
4
+ #
5
+ # <% when_logged do %>
6
+ # <!-- content for logged users -->
7
+ # <% end %>
8
+ def when_logged(&block)
9
+ capture(&block) if logged_in?
10
+ end
11
+ end
12
+ end
@@ -2,7 +2,7 @@ module SimpleAuth
2
2
  module Version
3
3
  MAJOR = "0"
4
4
  MINOR = "1"
5
- PATCH = "5"
5
+ PATCH = "6"
6
6
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
  end
8
8
  end
data/simple_auth.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{simple_auth}
8
- s.version = "0.1.5"
8
+ s.version = "0.1.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Nando Vieira"]
12
- s.date = %q{2010-03-30}
12
+ s.date = %q{2010-04-09}
13
13
  s.description = %q{When Authlogic & Devise are just too much.
14
14
  }
15
15
  s.email = %q{fnando.vieira@gmail.com}
@@ -19,7 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.files = [
20
20
  "README.markdown",
21
21
  "Rakefile",
22
- "app/helpers/simple_auth_helper.rb",
23
22
  "config/locales/en.yml",
24
23
  "config/locales/pt.yml",
25
24
  "generators/simple_auth/USAGE",
@@ -30,6 +29,7 @@ Gem::Specification.new do |s|
30
29
  "lib/simple_auth/action_controller.rb",
31
30
  "lib/simple_auth/active_record.rb",
32
31
  "lib/simple_auth/config.rb",
32
+ "lib/simple_auth/helper.rb",
33
33
  "lib/simple_auth/session.rb",
34
34
  "lib/simple_auth/version.rb",
35
35
  "simple_auth.gemspec",
@@ -39,11 +39,10 @@ Gem::Specification.new do |s|
39
39
  "spec/simple_auth/action_controller_spec.rb",
40
40
  "spec/simple_auth/active_record_spec.rb",
41
41
  "spec/simple_auth/config_spec.rb",
42
+ "spec/simple_auth/helper_spec.rb",
42
43
  "spec/simple_auth/session_spec.rb",
43
- "spec/simple_auth/simple_auth_helper_spec.rb",
44
44
  "spec/spec_helper.rb"
45
45
  ]
46
- s.has_rdoc = false
47
46
  s.homepage = %q{http://github.com/fnando/simple_auth}
48
47
  s.rdoc_options = ["--charset=UTF-8"]
49
48
  s.require_paths = ["lib"]
@@ -56,8 +55,8 @@ Gem::Specification.new do |s|
56
55
  "spec/simple_auth/action_controller_spec.rb",
57
56
  "spec/simple_auth/active_record_spec.rb",
58
57
  "spec/simple_auth/config_spec.rb",
58
+ "spec/simple_auth/helper_spec.rb",
59
59
  "spec/simple_auth/session_spec.rb",
60
- "spec/simple_auth/simple_auth_helper_spec.rb",
61
60
  "spec/spec_helper.rb"
62
61
  ]
63
62
 
@@ -1,6 +1,10 @@
1
1
  require File.dirname(__FILE__) + "/../spec_helper"
2
2
 
3
- describe SimpleAuthHelper, :type => :helper do
3
+ describe SimpleAuth::Helper, :type => :helper do
4
+ it "should include module" do
5
+ ApplicationController.included_modules.include?(SimpleAuth::Helper)
6
+ end
7
+
4
8
  it "should render block when user is logged" do
5
9
  helper.should_receive(:logged_in?).and_return(true)
6
10
  helper.when_logged { "logged" }.should == "logged"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Nando Vieira
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-30 00:00:00 -03:00
17
+ date: 2010-04-09 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies: []
20
20
 
@@ -31,7 +31,6 @@ extra_rdoc_files:
31
31
  files:
32
32
  - README.markdown
33
33
  - Rakefile
34
- - app/helpers/simple_auth_helper.rb
35
34
  - config/locales/en.yml
36
35
  - config/locales/pt.yml
37
36
  - generators/simple_auth/USAGE
@@ -42,6 +41,7 @@ files:
42
41
  - lib/simple_auth/action_controller.rb
43
42
  - lib/simple_auth/active_record.rb
44
43
  - lib/simple_auth/config.rb
44
+ - lib/simple_auth/helper.rb
45
45
  - lib/simple_auth/session.rb
46
46
  - lib/simple_auth/version.rb
47
47
  - simple_auth.gemspec
@@ -51,10 +51,10 @@ files:
51
51
  - spec/simple_auth/action_controller_spec.rb
52
52
  - spec/simple_auth/active_record_spec.rb
53
53
  - spec/simple_auth/config_spec.rb
54
+ - spec/simple_auth/helper_spec.rb
54
55
  - spec/simple_auth/session_spec.rb
55
- - spec/simple_auth/simple_auth_helper_spec.rb
56
56
  - spec/spec_helper.rb
57
- has_rdoc: false
57
+ has_rdoc: true
58
58
  homepage: http://github.com/fnando/simple_auth
59
59
  licenses: []
60
60
 
@@ -91,6 +91,6 @@ test_files:
91
91
  - spec/simple_auth/action_controller_spec.rb
92
92
  - spec/simple_auth/active_record_spec.rb
93
93
  - spec/simple_auth/config_spec.rb
94
+ - spec/simple_auth/helper_spec.rb
94
95
  - spec/simple_auth/session_spec.rb
95
- - spec/simple_auth/simple_auth_helper_spec.rb
96
96
  - spec/spec_helper.rb
@@ -1,10 +0,0 @@
1
- module SimpleAuthHelper
2
- # Renders the specified block for logged users.
3
- #
4
- # <% when_logged do %>
5
- # <!-- content for logged users -->
6
- # <% end %>
7
- def when_logged(&block)
8
- capture(&block) if logged_in?
9
- end
10
- end