merb-auth-slice-password 1.1.0 → 1.1.1

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/Rakefile CHANGED
@@ -31,7 +31,7 @@ begin
31
31
  ]
32
32
 
33
33
  # Runtime dependencies
34
- gemspec.add_dependency 'merb-slices', "~> #{Merb::Slices::VERSION}"
34
+ gemspec.add_dependency 'merb-slices', '~> 1.1'
35
35
  gemspec.add_dependency 'merb-auth-core', "~> #{Merb::Auth::Core::VERSION}"
36
36
  gemspec.add_dependency 'merb-auth-more', "~> #{Merb::Auth::More::VERSION}"
37
37
 
@@ -1,5 +1,5 @@
1
1
  class MerbAuthSlicePassword::Application < Merb::Controller
2
-
2
+
3
3
  controller_for_slice
4
-
4
+
5
5
  end
@@ -14,20 +14,20 @@ module MerbAuthSlicePassword::ExceptionsMixin
14
14
  end
15
15
 
16
16
  Merb::Authentication.customize_default do
17
-
17
+
18
18
  Exceptions.class_eval do
19
19
  include Merb::Slices::Support # Required to provide slice_url
20
-
20
+
21
21
  # # This stuff allows us to provide a default view
22
22
  the_view_path = File.expand_path(File.dirname(__FILE__) / ".." / "views")
23
23
  self._template_roots ||= []
24
24
  self._template_roots << [the_view_path, :_template_location]
25
25
  self._template_roots << [Merb.dir_for(:view), :_template_location]
26
-
26
+
27
27
  include MerbAuthSlicePassword::ExceptionsMixin
28
-
28
+
29
29
  show_action :unauthenticated
30
30
 
31
31
  end# Exceptions.class_eval
32
-
32
+
33
33
  end # Customize default
@@ -1,16 +1,16 @@
1
1
  class MerbAuthSlicePassword::Sessions < MerbAuthSlicePassword::Application
2
-
2
+
3
3
  before :_maintain_auth_session_before, :exclude => [:destroy] # Need to hang onto the redirection during the session.abandon!
4
4
  before :_abandon_session, :only => [:update, :destroy]
5
5
  before :_maintain_auth_session_after, :exclude => [:destroy] # Need to hang onto the redirection during the session.abandon!
6
6
  before :ensure_authenticated, :only => [:update]
7
7
 
8
8
  # redirect from an after filter for max flexibility
9
- # We can then put it into a slice and ppl can easily
9
+ # We can then put it into a slice and ppl can easily
10
10
  # customize the action
11
11
  after :redirect_after_login, :only => :update, :if => lambda{ !(300..399).include?(status) }
12
12
  after :redirect_after_logout, :only => :destroy
13
-
13
+
14
14
  def update
15
15
  "Add an after filter to do stuff after login"
16
16
  end
@@ -18,20 +18,20 @@ class MerbAuthSlicePassword::Sessions < MerbAuthSlicePassword::Application
18
18
  def destroy
19
19
  "Add an after filter to do stuff after logout"
20
20
  end
21
-
22
-
23
- private
21
+
22
+
23
+ private
24
24
  # @overwritable
25
25
  def redirect_after_login
26
26
  message[:notice] = "Authenticated Successfully"
27
27
  redirect_back_or "/", :message => message, :ignore => [slice_url(:login), slice_url(:logout)]
28
28
  end
29
-
29
+
30
30
  # @overwritable
31
31
  def redirect_after_logout
32
32
  message[:notice] = "Logged Out"
33
33
  redirect "/", :message => message
34
- end
34
+ end
35
35
 
36
36
  # @private
37
37
  def _maintain_auth_session_before
@@ -40,14 +40,14 @@ class MerbAuthSlicePassword::Sessions < MerbAuthSlicePassword::Application
40
40
  @_maintain_auth_session[k] = session[k]
41
41
  end
42
42
  end
43
-
43
+
44
44
  # @private
45
45
  def _maintain_auth_session_after
46
46
  @_maintain_auth_session.each do |k,v|
47
47
  session[k] = v
48
48
  end
49
49
  end
50
-
50
+
51
51
  # @private
52
52
  def _abandon_session
53
53
  session.abandon!
@@ -1,64 +1,64 @@
1
1
  module Merb
2
2
  module MerbAuthSlicePassword
3
3
  module ApplicationHelper
4
-
4
+
5
5
  # @param *segments<Array[#to_s]> Path segments to append.
6
6
  #
7
- # @return <String>
7
+ # @return <String>
8
8
  # A path relative to the public directory, with added segments.
9
9
  def image_path(*segments)
10
10
  public_path_for(:image, *segments)
11
11
  end
12
-
12
+
13
13
  # @param *segments<Array[#to_s]> Path segments to append.
14
14
  #
15
- # @return <String>
15
+ # @return <String>
16
16
  # A path relative to the public directory, with added segments.
17
17
  def javascript_path(*segments)
18
18
  public_path_for(:javascript, *segments)
19
19
  end
20
-
20
+
21
21
  # @param *segments<Array[#to_s]> Path segments to append.
22
22
  #
23
- # @return <String>
23
+ # @return <String>
24
24
  # A path relative to the public directory, with added segments.
25
25
  def stylesheet_path(*segments)
26
26
  public_path_for(:stylesheet, *segments)
27
27
  end
28
-
28
+
29
29
  # Construct a path relative to the public directory
30
- #
30
+ #
31
31
  # @param <Symbol> The type of component.
32
32
  # @param *segments<Array[#to_s]> Path segments to append.
33
33
  #
34
- # @return <String>
34
+ # @return <String>
35
35
  # A path relative to the public directory, with added segments.
36
36
  def public_path_for(type, *segments)
37
37
  ::MerbAuthSlicePassword.public_path_for(type, *segments)
38
38
  end
39
-
39
+
40
40
  # Construct an app-level path.
41
- #
41
+ #
42
42
  # @param <Symbol> The type of component.
43
43
  # @param *segments<Array[#to_s]> Path segments to append.
44
44
  #
45
- # @return <String>
45
+ # @return <String>
46
46
  # A path within the host application, with added segments.
47
47
  def app_path_for(type, *segments)
48
48
  ::MerbAuthSlicePassword.app_path_for(type, *segments)
49
49
  end
50
-
50
+
51
51
  # Construct a slice-level path.
52
- #
52
+ #
53
53
  # @param <Symbol> The type of component.
54
54
  # @param *segments<Array[#to_s]> Path segments to append.
55
55
  #
56
- # @return <String>
56
+ # @return <String>
57
57
  # A path within the slice source (Gem), with added segments.
58
58
  def slice_path_for(type, *segments)
59
59
  ::MerbAuthSlicePassword.slice_path_for(type, *segments)
60
60
  end
61
-
61
+
62
62
  end
63
63
  end
64
64
  end
@@ -1,19 +1,19 @@
1
1
  #
2
2
  # ==== Standalone MerbAuthSlicePassword configuration
3
- #
4
- # This configuration/environment file is only loaded by bin/slice, which can be
3
+ #
4
+ # This configuration/environment file is only loaded by bin/slice, which can be
5
5
  # used during development of the slice. It has no effect on this slice being
6
6
  # loaded in a host application. To run your slice in standalone mode, just
7
7
  # run 'slice' from its directory. The 'slice' command is very similar to
8
- # the 'merb' command, and takes all the same options, including -i to drop
8
+ # the 'merb' command, and takes all the same options, including -i to drop
9
9
  # into an irb session for example.
10
10
  #
11
11
  # The usual Merb configuration directives and init.rb setup methods apply,
12
12
  # including use_orm and before_app_loads/after_app_loads.
13
13
  #
14
- # If you need need different configurations for different environments you can
14
+ # If you need need different configurations for different environments you can
15
15
  # even create the specific environment file in config/environments/ just like
16
- # in a regular Merb application.
16
+ # in a regular Merb application.
17
17
  #
18
18
  # In fact, a slice is no different from a normal # Merb application - it only
19
19
  # differs by the fact that seamlessly integrates into a so called 'host'
@@ -26,18 +26,18 @@ Merb::Config.use do |c|
26
26
  # Sets up a custom session id key which is used for the session persistence
27
27
  # cookie name. If not specified, defaults to '_session_id'.
28
28
  # c[:session_id_key] = '_session_id'
29
-
29
+
30
30
  # The session_secret_key is only required for the cookie session store.
31
31
  c[:session_secret_key] = '8355682a717c7e6b2f84dd731f7fb338087793b1'
32
-
33
- # There are various options here, by default Merb comes with 'cookie',
34
- # 'memory', 'memcache' or 'container'.
35
- # You can of course use your favorite ORM instead:
32
+
33
+ # There are various options here, by default Merb comes with 'cookie',
34
+ # 'memory', 'memcache' or 'container'.
35
+ # You can of course use your favorite ORM instead:
36
36
  # 'datamapper', 'sequel' or 'activerecord'.
37
37
  c[:session_store] = 'cookie'
38
-
38
+
39
39
  # When running a slice standalone, you're usually developing it,
40
40
  # so enable template reloading by default.
41
41
  c[:reload_templates] = true
42
-
42
+
43
43
  end
@@ -1,13 +1,13 @@
1
1
  namespace :slices do
2
2
  namespace :"merb-auth-slice-password" do
3
-
3
+
4
4
  desc "Install MerbAuthSlicePassword"
5
5
  task :install => [:preflight, :setup_directories, :copy_assets, :migrate]
6
-
6
+
7
7
  desc "Test for any dependencies"
8
8
  task :preflight do # see slicetasks.rb
9
9
  end
10
-
10
+
11
11
  desc "Setup directories"
12
12
  task :setup_directories do
13
13
  puts "Creating directories for host application"
@@ -21,7 +21,7 @@ namespace :slices do
21
21
  end
22
22
  end
23
23
  end
24
-
24
+
25
25
  desc "Copy stub files to host application"
26
26
  task :stubs do
27
27
  puts "Copying stubs for MerbAuthSlicePassword - resolves any collisions"
@@ -30,10 +30,10 @@ namespace :slices do
30
30
  copied.each { |f| puts "- copied #{f}" }
31
31
  preserved.each { |f| puts "! preserved override as #{f}" }
32
32
  end
33
-
33
+
34
34
  desc "Copy stub files and views to host application"
35
35
  task :patch => [ "stubs", "freeze:views" ]
36
-
36
+
37
37
  desc "Copy public assets to host application"
38
38
  task :copy_assets do
39
39
  puts "Copying assets for MerbAuthSlicePassword - resolves any collisions"
@@ -42,16 +42,16 @@ namespace :slices do
42
42
  copied.each { |f| puts "- copied #{f}" }
43
43
  preserved.each { |f| puts "! preserved override as #{f}" }
44
44
  end
45
-
45
+
46
46
  desc "Migrate the database"
47
47
  task :migrate do # see slicetasks.rb
48
48
  end
49
-
50
- desc "Freeze MerbAuthSlicePassword into your app (only merb-auth-slice-password/app)"
49
+
50
+ desc "Freeze MerbAuthSlicePassword into your app (only merb-auth-slice-password/app)"
51
51
  task :freeze => [ "freeze:app" ]
52
52
 
53
53
  namespace :freeze do
54
-
54
+
55
55
  desc "Freezes MerbAuthSlicePassword by installing the gem into application/gems using merb-freezer"
56
56
  task :gem do
57
57
  begin
@@ -60,7 +60,7 @@ namespace :slices do
60
60
  puts "! dependency 'merb-freezer' missing"
61
61
  end
62
62
  end
63
-
63
+
64
64
  desc "Freezes MerbAuthSlicePassword by copying all files from merb-auth-slice-password/app to your application"
65
65
  task :app do
66
66
  puts "Copying all merb-auth-slice-password/app files to your application - resolves any collisions"
@@ -69,8 +69,8 @@ namespace :slices do
69
69
  copied.each { |f| puts "- copied #{f}" }
70
70
  preserved.each { |f| puts "! preserved override as #{f}" }
71
71
  end
72
-
73
- desc "Freeze all views into your application for easy modification"
72
+
73
+ desc "Freeze all views into your application for easy modification"
74
74
  task :views do
75
75
  puts "Copying all view templates to your application - resolves any collisions"
76
76
  copied, preserved = MerbAuthSlicePassword.mirror_files_for :view
@@ -78,8 +78,8 @@ namespace :slices do
78
78
  copied.each { |f| puts "- copied #{f}" }
79
79
  preserved.each { |f| puts "! preserved override as #{f}" }
80
80
  end
81
-
82
- desc "Freeze all models into your application for easy modification"
81
+
82
+ desc "Freeze all models into your application for easy modification"
83
83
  task :models do
84
84
  puts "Copying all models to your application - resolves any collisions"
85
85
  copied, preserved = MerbAuthSlicePassword.mirror_files_for :model
@@ -87,10 +87,10 @@ namespace :slices do
87
87
  copied.each { |f| puts "- copied #{f}" }
88
88
  preserved.each { |f| puts "! preserved override as #{f}" }
89
89
  end
90
-
90
+
91
91
  desc "Freezes MerbAuthSlicePassword as a gem and copies over merb-auth-slice-password/app"
92
92
  task :app_with_gem => [:gem, :app]
93
-
93
+
94
94
  desc "Freezes MerbAuthSlicePassword by unpacking all files into your application"
95
95
  task :unpack do
96
96
  puts "Unpacking MerbAuthSlicePassword files to your application - resolves any collisions"
@@ -99,8 +99,8 @@ namespace :slices do
99
99
  copied.each { |f| puts "- copied #{f}" }
100
100
  preserved.each { |f| puts "! preserved override as #{f}" }
101
101
  end
102
-
102
+
103
103
  end
104
-
104
+
105
105
  end
106
106
  end
@@ -1,18 +1,18 @@
1
1
  namespace :slices do
2
- namespace :"merb-auth-slice-password" do
3
-
2
+ namespace :"merb-auth-slice-password" do
3
+
4
4
  # add your own merb-auth-slice-password tasks here
5
-
5
+
6
6
  # implement this to test for structural/code dependencies
7
7
  # like certain directories or availability of other files
8
8
  desc "Test for any dependencies"
9
9
  task :preflight do
10
10
  end
11
-
11
+
12
12
  # implement this to perform any database related setup steps
13
13
  desc "Migrate the database"
14
14
  task :migrate do
15
15
  end
16
-
16
+
17
17
  end
18
18
  end
@@ -1,21 +1,21 @@
1
1
  require "spec/rake/spectask"
2
2
  namespace :slices do
3
3
  namespace :"merb-auth-slice-password" do
4
-
4
+
5
5
  desc "Run slice specs within the host application context"
6
6
  task :spec => [ "spec:explain", "spec:default" ]
7
-
7
+
8
8
  namespace :spec do
9
-
9
+
10
10
  slice_root = File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
11
-
11
+
12
12
  task :explain do
13
13
  puts "\nNote: By running MerbAuthSlicePassword specs inside the application context any\n" +
14
14
  "overrides could break existing specs. This isn't always a problem,\n" +
15
15
  "especially in the case of views. Use these spec tasks to check how\n" +
16
16
  "well your application conforms to the original slice implementation."
17
17
  end
18
-
18
+
19
19
  Spec::Rake::SpecTask.new('default') do |t|
20
20
  t.spec_opts = ["--format", "specdoc", "--colour"]
21
21
  t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
@@ -36,7 +36,7 @@ namespace :slices do
36
36
  t.spec_opts = ["--format", "specdoc", "--colour"]
37
37
  if(ENV['CONTROLLER'])
38
38
  t.spec_files = Dir["#{slice_root}/spec/controllers/**/#{ENV['CONTROLLER']}_spec.rb"].sort
39
- else
39
+ else
40
40
  t.spec_files = Dir["#{slice_root}/spec/controllers/**/*_spec.rb"].sort
41
41
  end
42
42
  end
@@ -59,8 +59,8 @@ namespace :slices do
59
59
  t.libs = ['lib', 'server/lib' ]
60
60
  t.spec_files = Dir["#{slice_root}/spec/**/*_spec.rb"].sort
61
61
  end
62
-
62
+
63
63
  end
64
-
64
+
65
65
  end
66
66
  end
@@ -32,8 +32,8 @@ Merb::Plugins.config[:merb_slices][:search_path] = File.join(File.dirname(__FI
32
32
  # - testing standalone, without being installed as a gem and no host application
33
33
  # - testing from within the host application; its root will be used
34
34
  Merb.start_environment(
35
- :testing => true,
36
- :adapter => 'runner',
35
+ :testing => true,
36
+ :adapter => 'runner',
37
37
  :environment => ENV['MERB_ENV'] || 'test',
38
38
  :merb_root => Merb.root,
39
39
  :session_store => 'memory'
@@ -42,17 +42,17 @@ Merb.start_environment(
42
42
  module Merb
43
43
  module Test
44
44
  module SliceHelper
45
-
45
+
46
46
  # The absolute path to the current slice
47
47
  def current_slice_root
48
48
  @current_slice_root ||= File.expand_path(File.join(File.dirname(__FILE__), '..'))
49
49
  end
50
-
50
+
51
51
  # Whether the specs are being run from a host application or standalone
52
52
  def standalone?
53
53
  Merb.root == ::MerbAuthSlicePassword.root
54
54
  end
55
-
55
+
56
56
  end
57
57
  end
58
58
  end
@@ -3,17 +3,17 @@ class MerbAuthSlicePassword::Sessions < MerbAuthSlicePassword::Application
3
3
  after :redirect_after_login, :only => :update, :if => lambda{ !(300..399).include?(status) }
4
4
  after :redirect_after_logout, :only => :destroy
5
5
 
6
- private
6
+ private
7
7
  # @overwritable
8
8
  def redirect_after_login
9
9
  message[:notice] = "Authenticated Successfully"
10
10
  redirect_back_or "/", :message => message, :ignore => [slice_url(:login), slice_url(:logout)]
11
11
  end
12
-
12
+
13
13
  # @overwritable
14
14
  def redirect_after_logout
15
15
  message[:notice] = "Logged Out"
16
16
  redirect "/", :message => message
17
17
  end
18
-
18
+
19
19
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merb-auth-slice-password
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 17
4
5
  prerelease: false
5
6
  segments:
6
7
  - 1
7
8
  - 1
8
- - 0
9
- version: 1.1.0
9
+ - 1
10
+ version: 1.1.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Daniel Neighman
@@ -14,58 +15,65 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-03-22 00:00:00 +00:00
18
+ date: 2010-06-15 00:00:00 +01:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: merb-slices
22
23
  prerelease: false
23
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
24
26
  requirements:
25
27
  - - ~>
26
28
  - !ruby/object:Gem::Version
29
+ hash: 13
27
30
  segments:
28
31
  - 1
29
32
  - 1
30
- - 0
31
- version: 1.1.0
33
+ version: "1.1"
32
34
  type: :runtime
33
35
  version_requirements: *id001
34
36
  - !ruby/object:Gem::Dependency
35
37
  name: merb-auth-core
36
38
  prerelease: false
37
39
  requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
38
41
  requirements:
39
42
  - - ~>
40
43
  - !ruby/object:Gem::Version
44
+ hash: 17
41
45
  segments:
42
46
  - 1
43
47
  - 1
44
- - 0
45
- version: 1.1.0
48
+ - 1
49
+ version: 1.1.1
46
50
  type: :runtime
47
51
  version_requirements: *id002
48
52
  - !ruby/object:Gem::Dependency
49
53
  name: merb-auth-more
50
54
  prerelease: false
51
55
  requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
52
57
  requirements:
53
58
  - - ~>
54
59
  - !ruby/object:Gem::Version
60
+ hash: 17
55
61
  segments:
56
62
  - 1
57
63
  - 1
58
- - 0
59
- version: 1.1.0
64
+ - 1
65
+ version: 1.1.1
60
66
  type: :runtime
61
67
  version_requirements: *id003
62
68
  - !ruby/object:Gem::Dependency
63
69
  name: rspec
64
70
  prerelease: false
65
71
  requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
66
73
  requirements:
67
74
  - - ">="
68
75
  - !ruby/object:Gem::Version
76
+ hash: 13
69
77
  segments:
70
78
  - 1
71
79
  - 2
@@ -116,23 +124,27 @@ rdoc_options:
116
124
  require_paths:
117
125
  - lib
118
126
  required_ruby_version: !ruby/object:Gem::Requirement
127
+ none: false
119
128
  requirements:
120
129
  - - ">="
121
130
  - !ruby/object:Gem::Version
131
+ hash: 3
122
132
  segments:
123
133
  - 0
124
134
  version: "0"
125
135
  required_rubygems_version: !ruby/object:Gem::Requirement
136
+ none: false
126
137
  requirements:
127
138
  - - ">="
128
139
  - !ruby/object:Gem::Version
140
+ hash: 3
129
141
  segments:
130
142
  - 0
131
143
  version: "0"
132
144
  requirements: []
133
145
 
134
146
  rubyforge_project:
135
- rubygems_version: 1.3.6
147
+ rubygems_version: 1.3.7
136
148
  signing_key:
137
149
  specification_version: 3
138
150
  summary: Merb Slice that provides UI for password strategy of merb-auth.