rails_warden 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,2 @@
1
+ pkg
2
+ pkg/*
data/Rakefile CHANGED
@@ -1,34 +1,30 @@
1
1
  require 'rubygems'
2
- require 'rake/gempackagetask'
3
- require 'rubygems/specification'
4
2
  require 'date'
5
3
  require 'spec/rake/spectask'
6
4
 
7
5
  GEM = "rails_warden"
8
- GEM_VERSION = "0.1.1"
9
- AUTHOR = "Daniel Neighman"
6
+ AUTHORS = ["Daniel Neighman"]
10
7
  EMAIL = "has.sox@gmail.com"
11
8
  HOMEPAGE = "http://github.com/hassox/rails_warden"
12
9
  SUMMARY = "A gem that provides authenitcation via the Warden framework"
13
10
 
14
- spec = Gem::Specification.new do |s|
15
- s.name = GEM
16
- s.version = GEM_VERSION
17
- s.platform = Gem::Platform::RUBY
18
- s.has_rdoc = true
19
- s.extra_rdoc_files = ["README.textile", "LICENSE", 'TODO']
20
- s.summary = SUMMARY
21
- s.description = s.summary
22
- s.author = AUTHOR
23
- s.email = EMAIL
24
- s.homepage = HOMEPAGE
25
-
26
- # Uncomment this to add a dependency
27
- s.add_dependency "warden"
28
-
29
- s.require_path = 'lib'
30
- s.autorequire = GEM
31
- s.files = %w(LICENSE README.textile Rakefile TODO) + Dir.glob("{lib,spec}/**/*")
11
+ begin
12
+ require 'jeweler'
13
+ Jeweler::Tasks.new do |gem|
14
+ gem.name = GEM
15
+ gem.email = EMAIL
16
+ gem.has_rdoc = true
17
+ gem.extra_rdoc_files = ["README.textile", "LICENSE", 'TODO']
18
+ gem.summary = SUMMARY
19
+ gem.description = SUMMARY
20
+ gem.authors = AUTHORS
21
+ gem.email = EMAIL
22
+ gem.homepage = HOMEPAGE
23
+ gem.rubyforge_project = "warden"
24
+ gem.add_dependency "warden", "> 0.2"
25
+ end
26
+ rescue LoadError
27
+ puts "Jeweler (or a dependency) not available. Install with: sudo gem install jeweler"
32
28
  end
33
29
 
34
30
  task :default => :spec
@@ -37,21 +33,4 @@ desc "Run specs"
37
33
  Spec::Rake::SpecTask.new do |t|
38
34
  t.spec_files = FileList['spec/**/*_spec.rb']
39
35
  t.spec_opts = %w(-fs --color)
40
- end
41
-
42
-
43
- Rake::GemPackageTask.new(spec) do |pkg|
44
- pkg.gem_spec = spec
45
- end
46
-
47
- desc "install the gem locally"
48
- task :install => [:package] do
49
- sh %{sudo gem install pkg/#{GEM}-#{GEM_VERSION}}
50
- end
51
-
52
- desc "create a gemspec file"
53
- task :make_spec do
54
- File.open("#{GEM}.gemspec", "w") do |file|
55
- file.puts spec.to_ruby
56
- end
57
36
  end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.2.0
@@ -1,29 +1,12 @@
1
1
  module RailsWarden
2
- module ControllerMixin
3
-
4
- def self.included(base)
5
- base.send(:include, InstanceMethods)
6
- end
7
-
8
- module InstanceMethods
2
+ module Mixins
3
+ module HelperMethods
9
4
  # The main accessor for the warden proxy instance
10
5
  # :api: public
11
6
  def warden
12
7
  request.env['warden']
13
8
  end
14
9
 
15
- # Proxy to the authenticate method on warden
16
- # :api: public
17
- def authenticate(*args)
18
- warden.authenticate(*args)
19
- end
20
-
21
- # Proxy to the authenticate method on warden
22
- # :api: public
23
- def authenticate!(*args)
24
- warden.authenticate!(*args)
25
- end
26
-
27
10
  # Proxy to the authenticated? method on warden
28
11
  # :api: public
29
12
  def authenticated?(*args)
@@ -38,11 +21,31 @@ module RailsWarden
38
21
  end
39
22
  alias_method :current_user, :user
40
23
 
24
+ def user=(user)
25
+ warder.set_user user
26
+ end
27
+ alias_method :current_user=, :user=
28
+ end # Helper Methods
29
+
30
+ module ControllerOnlyMethods
41
31
  # Logout the current user
42
32
  # :api: public
43
33
  def logout(*args)
44
34
  warden.logout(*args)
45
35
  end
36
+
37
+ # Proxy to the authenticate method on warden
38
+ # :api: public
39
+ def authenticate(*args)
40
+ warden.authenticate(*args)
41
+ end
42
+
43
+ # Proxy to the authenticate method on warden
44
+ # :api: public
45
+ def authenticate!(*args)
46
+ warden.authenticate!(*args)
47
+ end
48
+
46
49
  end
47
50
  end
48
51
  end
@@ -4,7 +4,7 @@ module RailsWarden
4
4
  def self.new(app, opts = {}, &block)
5
5
  # Get the failure application
6
6
  opts[:failure_app] = opts[:failure_app].to_s.classify.constantize if opts[:failure_app]
7
- opts[:defaults] = [opts[:defaults]].flatten if opts[:defaults]
7
+ opts[:default_strategies] = [opts[:defaults]].flatten if opts[:defaults]
8
8
 
9
9
  # Set the default user
10
10
  if user = opts.delete(:default_user)
data/lib/rails_warden.rb CHANGED
@@ -14,7 +14,14 @@ end
14
14
 
15
15
  if defined?(Rails)
16
16
  Rails.configuration.after_initialize do
17
- ActionController::Base.class_eval{ include RailsWarden::ControllerMixin }
17
+ class ActionController::Base
18
+ include RailsWarden::Mixins::HelperMethods
19
+ include RailsWarden::Mixins::ControllerOnlyMethods
20
+ end
21
+
22
+ module ApplicationHelper
23
+ include RailsWarden::Mixins::HelperMethods
24
+ end
18
25
  end
19
26
  end
20
27
 
@@ -0,0 +1,59 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{rails_warden}
5
+ s.version = "0.2.0"
6
+
7
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
+ s.authors = ["Daniel Neighman"]
9
+ s.date = %q{2009-07-12}
10
+ s.description = %q{A gem that provides authenitcation via the Warden framework}
11
+ s.email = %q{has.sox@gmail.com}
12
+ s.extra_rdoc_files = [
13
+ "LICENSE",
14
+ "README.textile",
15
+ "TODO"
16
+ ]
17
+ s.files = [
18
+ ".gitignore",
19
+ "LICENSE",
20
+ "README.textile",
21
+ "Rakefile",
22
+ "TODO",
23
+ "VERSION",
24
+ "lib/rails_warden.rb",
25
+ "lib/rails_warden/controller_mixin.rb",
26
+ "lib/rails_warden/manager.rb",
27
+ "lib/rails_warden/rails_settings.rb",
28
+ "rails_warden.gemspec",
29
+ "script/destroy",
30
+ "script/generate",
31
+ "spec/controller_mixin_spec.rb",
32
+ "spec/rails_warden_spec.rb",
33
+ "spec/spec_helper.rb"
34
+ ]
35
+ s.homepage = %q{http://github.com/hassox/rails_warden}
36
+ s.rdoc_options = ["--charset=UTF-8"]
37
+ s.require_paths = ["lib"]
38
+ s.rubyforge_project = %q{warden}
39
+ s.rubygems_version = %q{1.3.3}
40
+ s.summary = %q{A gem that provides authenitcation via the Warden framework}
41
+ s.test_files = [
42
+ "spec/controller_mixin_spec.rb",
43
+ "spec/rails_warden_spec.rb",
44
+ "spec/spec_helper.rb"
45
+ ]
46
+
47
+ if s.respond_to? :specification_version then
48
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
49
+ s.specification_version = 3
50
+
51
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
52
+ s.add_runtime_dependency(%q<warden>, ["> 0.2"])
53
+ else
54
+ s.add_dependency(%q<warden>, ["> 0.2"])
55
+ end
56
+ else
57
+ s.add_dependency(%q<warden>, ["> 0.2"])
58
+ end
59
+ end
data/script/destroy ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
data/script/generate ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:newgem_simple, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -12,7 +12,8 @@ describe "rails_warden controller mixin" do
12
12
  end
13
13
 
14
14
  class MockController
15
- include RailsWarden::ControllerMixin
15
+ include RailsWarden::Mixins::HelperMethods
16
+ include RailsWarden::Mixins::ControllerOnlyMethods
16
17
  attr_accessor :env
17
18
  def request
18
19
  self
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_warden
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Neighman
8
- autorequire: rails_warden
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-06-10 00:00:00 +10:00
12
+ date: 2009-07-12 00:00:00 +10:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -18,9 +18,9 @@ dependencies:
18
18
  version_requirement:
19
19
  version_requirements: !ruby/object:Gem::Requirement
20
20
  requirements:
21
- - - ">="
21
+ - - ">"
22
22
  - !ruby/object:Gem::Version
23
- version: "0"
23
+ version: "0.2"
24
24
  version:
25
25
  description: A gem that provides authenitcation via the Warden framework
26
26
  email: has.sox@gmail.com
@@ -29,18 +29,23 @@ executables: []
29
29
  extensions: []
30
30
 
31
31
  extra_rdoc_files:
32
- - README.textile
33
32
  - LICENSE
33
+ - README.textile
34
34
  - TODO
35
35
  files:
36
+ - .gitignore
36
37
  - LICENSE
37
38
  - README.textile
38
39
  - Rakefile
39
40
  - TODO
41
+ - VERSION
42
+ - lib/rails_warden.rb
40
43
  - lib/rails_warden/controller_mixin.rb
41
44
  - lib/rails_warden/manager.rb
42
45
  - lib/rails_warden/rails_settings.rb
43
- - lib/rails_warden.rb
46
+ - rails_warden.gemspec
47
+ - script/destroy
48
+ - script/generate
44
49
  - spec/controller_mixin_spec.rb
45
50
  - spec/rails_warden_spec.rb
46
51
  - spec/spec_helper.rb
@@ -49,8 +54,8 @@ homepage: http://github.com/hassox/rails_warden
49
54
  licenses: []
50
55
 
51
56
  post_install_message:
52
- rdoc_options: []
53
-
57
+ rdoc_options:
58
+ - --charset=UTF-8
54
59
  require_paths:
55
60
  - lib
56
61
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -67,10 +72,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
72
  version:
68
73
  requirements: []
69
74
 
70
- rubyforge_project:
75
+ rubyforge_project: warden
71
76
  rubygems_version: 1.3.3
72
77
  signing_key:
73
78
  specification_version: 3
74
79
  summary: A gem that provides authenitcation via the Warden framework
75
- test_files: []
76
-
80
+ test_files:
81
+ - spec/controller_mixin_spec.rb
82
+ - spec/rails_warden_spec.rb
83
+ - spec/spec_helper.rb