merbful_authentication 0.1.2 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. data/README +2 -1
  2. data/Rakefile +3 -3
  3. data/activerecord_generators/merbful_authentication_model/merbful_authentication_model_generator.rb +28 -14
  4. data/activerecord_generators/merbful_authentication_model/templates/{model.rb → app/models/%singular_name%.rb} +5 -1
  5. data/activerecord_generators/merbful_authentication_model/templates/{authenticated_system_orm_map.rb → lib/authenticated_system/authenticated_system_orm_map.rb} +0 -0
  6. data/activerecord_generators/merbful_authentication_model/templates/{migration.rb → schema/migrations/%migration_file_name%.rb} +2 -2
  7. data/datamapper_generators/merbful_authentication_model/merbful_authentication_model_generator.rb +20 -30
  8. data/datamapper_generators/merbful_authentication_model/templates/{model.rb → app/models/%singular_name%.rb} +5 -1
  9. data/datamapper_generators/merbful_authentication_model/templates/{authenticated_system_orm_map.rb → lib/authenticated_system/authenticated_system_orm_map.rb} +0 -0
  10. data/merb_generators/authenticated/authenticated_generator.rb +51 -75
  11. data/merb_generators/authenticated/templates/{session_controller.rb → app/controllers/%controller_name%.rb} +6 -5
  12. data/merb_generators/authenticated/templates/{model_controller.rb → app/controllers/%model_controller_name%.rb} +9 -9
  13. data/merb_generators/authenticated/templates/{mail_controller.rb → app/mailers/%singular_name%_mailer.rb} +1 -0
  14. data/merb_generators/authenticated/templates/{activation.html.erb → app/mailers/views/%singular_name%_mailer/activation_notification.html.erb} +0 -0
  15. data/merb_generators/authenticated/templates/{activation.text.erb → app/mailers/views/%singular_name%_mailer/activation_notification.text.erb} +0 -0
  16. data/merb_generators/authenticated/templates/{signup.html.erb → app/mailers/views/%singular_name%_mailer/signup_notification.html.erb} +0 -0
  17. data/merb_generators/authenticated/templates/{signup.text.erb → app/mailers/views/%singular_name%_mailer/signup_notification.text.erb} +0 -0
  18. data/merb_generators/authenticated/templates/{login.html.erb → app/views/%controller_name%/new.html.erb} +0 -0
  19. data/merb_generators/authenticated/templates/{new_model.html.erb → app/views/%model_controller_name%/new.html.erb} +0 -0
  20. data/merb_generators/authenticated/templates/lib/authenticated_system/authenticated_dependencies.rb +7 -0
  21. data/merb_generators/authenticated/templates/lib/authenticated_system/authenticated_routes.rb +9 -0
  22. data/merb_generators/authenticated/templates/{authenticated_system_controller.rb → lib/authenticated_system/authenticated_system_controller.rb} +2 -1
  23. data/merb_generators/authenticated/templates/{authenticated_system_model.rb → lib/authenticated_system/authenticated_system_model.rb} +2 -2
  24. data/rspec_generators/merbful_authentication_tests/merbful_authentication_tests_generator.rb +49 -15
  25. data/rspec_generators/merbful_authentication_tests/templates/{model_spec_helper.rb → spec/%singular_name%_spec_helper.rb} +0 -0
  26. data/rspec_generators/merbful_authentication_tests/templates/spec/authenticated_system_spec_helper.rb +25 -0
  27. data/rspec_generators/merbful_authentication_tests/templates/{session_controller_spec.rb → spec/controllers/%controller_file_path%_spec.rb} +22 -23
  28. data/rspec_generators/merbful_authentication_tests/templates/{model_controller_spec.rb → spec/controllers/%model_controller_file_path%_spec.rb} +13 -18
  29. data/rspec_generators/merbful_authentication_tests/templates/{user_mailer_spec.rb → spec/mailers/%singular_name%_mailer_spec.rb} +0 -0
  30. data/rspec_generators/merbful_authentication_tests/templates/{model_spec.rb → spec/models/%singular_name%_spec.rb} +0 -0
  31. data/sequel_generators/merbful_authentication_model/{merbful_authentication_model_generator.rb → lib/merbful_authentication_model_generator.rb} +0 -0
  32. data/test_unit_generators/merbful_authentication_tests/merbful_authentication_tests_generator.rb +46 -18
  33. data/test_unit_generators/merbful_authentication_tests/templates/{model_test_helper.rb → test/%file_name%_test_helper.rb} +0 -0
  34. data/test_unit_generators/merbful_authentication_tests/templates/{authenticated_system_test_helper.rb → test/authenticated_system_test_helper.rb} +8 -6
  35. data/test_unit_generators/merbful_authentication_tests/templates/{functional_test.rb → test/functional/%controller_file_path%_test.rb} +0 -0
  36. data/test_unit_generators/merbful_authentication_tests/templates/{model_functional_test.rb → test/functional/%model_controller_file_path%_test.rb} +0 -0
  37. data/test_unit_generators/merbful_authentication_tests/templates/{mailer_test.rb → test/mailers/%singular_name%_mailer_test.rb} +0 -0
  38. data/test_unit_generators/merbful_authentication_tests/templates/{unit_test.rb → test/unit/%singular_name%_test.rb} +0 -0
  39. metadata +66 -37
  40. data/rspec_generators/merbful_authentication_tests/templates/authenticated_system_spec_helper.rb +0 -22
data/README CHANGED
@@ -30,7 +30,8 @@ Datamapper
30
30
 
31
31
  === Required Routes
32
32
 
33
- At the moment this version of the plugin requires some named routes
33
+ At the moment this version of the plugin requires some named routes. These are included in
34
+ lib/authenticated_system/authenticated_routes.rb
34
35
 
35
36
  In config/router.rb
36
37
 
data/Rakefile CHANGED
@@ -3,7 +3,7 @@ require 'rake/gempackagetask'
3
3
 
4
4
  PLUGIN = "merbful_authentication"
5
5
  NAME = "merbful_authentication"
6
- VERSION = "0.1.2"
6
+ VERSION = "0.9.0"
7
7
  AUTHOR = "Daniel Neighman"
8
8
  EMAIL = "has.sox@gmail.com"
9
9
  HOMEPAGE = "http://rubyforge.org/projects/merbful-auth/"
@@ -20,8 +20,8 @@ spec = Gem::Specification.new do |s|
20
20
  s.author = AUTHOR
21
21
  s.email = EMAIL
22
22
  s.homepage = HOMEPAGE
23
- s.add_dependency('merb', '>= 0.5.0')
24
- s.add_dependency('merb_helpers', '>= 0.5.0')
23
+ s.add_dependency('merb-core', '>= 0.9.0')
24
+ s.add_dependency('merb-gen')
25
25
  s.require_path = 'lib'
26
26
  s.autorequire = PLUGIN
27
27
  s.files = %w(LICENSE README Rakefile TODO) +
@@ -1,4 +1,4 @@
1
- class MerbfulAuthenticationModelGenerator < RubiGen::Base
1
+ class MerbfulAuthenticationModelGenerator < Merb::GeneratorBase
2
2
 
3
3
  attr_reader :name,
4
4
  :class_name,
@@ -8,31 +8,45 @@ class MerbfulAuthenticationModelGenerator < RubiGen::Base
8
8
  :class_nesting_depth,
9
9
  :plural_name,
10
10
  :singular_name,
11
- :include_activation
11
+ :include_activation,
12
+ :migration_name,
13
+ :migration_file_name
12
14
 
13
15
  def initialize(runtime_args, runtime_options = {})
16
+ @base = File.dirname(__FILE__)
14
17
  super
15
- usage if args.empty?
16
18
  @name = args.shift
17
19
  extract_options
18
- runtime_options.each{ |k,v| self.instance_variable_set("@#{k}", v) }
20
+ runtime_options.each do |k,v|
21
+ ivar_name = "@#{k}"
22
+ self.instance_variable_set("@#{k}", v) unless ivar_name.include?("/")
23
+ end
19
24
  end
20
25
 
21
26
  def manifest
22
27
  record do |m|
23
- # Ensure appropriate folder(s) exists
24
- m.class_collisions [], 'AuthenticatedSystem::OrmMap'
28
+ @m = m
25
29
 
26
- m.directory File.join('app/models', class_path)
27
- m.directory File.join('lib')
30
+ highest_migration = Dir[Dir.pwd+'/schema/migrations/*'].map{|f| File.basename(f) =~ /^(\d+)/; $1}.max
31
+ @migration_file_name = format("%03d_%s", (highest_migration.to_i+1), "create_#{plural_name}")
32
+ @migration_name = "Create#{plural_name.camelcase.gsub(/::/,'')}"
28
33
 
29
- m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
30
- m.template 'authenticated_system_orm_map.rb', "lib/authenticated_system_orm_map.rb"
34
+ @assigns = {
35
+ :name => name,
36
+ :class_name => class_name,
37
+ :class_path => class_path,
38
+ :file_name => file_name,
39
+ :class_nesting => class_nesting,
40
+ :class_nesting_depth => class_nesting_depth,
41
+ :plural_name => plural_name,
42
+ :singular_name => singular_name,
43
+ :include_activation => options[:include_activation],
44
+ :migration_name => migration_name,
45
+ :migration_file_name => migration_file_name
46
+ }
31
47
 
32
- m.migration_template('migration.rb', 'schema/migrations', :migration_file_name => "create_#{plural_name}",
33
- :assigns => {
34
- :migration_name => "Create#{class_name.pluralize.gsub(/::/, '')}"
35
- })
48
+ copy_dirs
49
+ copy_files
36
50
  end
37
51
  end
38
52
 
@@ -1,5 +1,9 @@
1
1
  require 'digest/sha1'
2
- dependency 'authenticated_system_model'
2
+ begin
3
+ require File.join(File.dirname(__FILE__), '..', '..', "lib", "authenticated_system", "authenticated_dependencies")
4
+ rescue
5
+ nil
6
+ end
3
7
  class <%= class_name %> < ActiveRecord::Base
4
8
  include AuthenticatedSystem::Model
5
9
 
@@ -13,8 +13,8 @@ class <%= migration_name %> < ActiveRecord::Migration
13
13
  t.column :activated_at, :datetime<% end %>
14
14
  end
15
15
  end
16
-
16
+
17
17
  def self.down
18
18
  drop_table "<%= singular_name %>"
19
19
  end
20
- end
20
+ end
@@ -1,4 +1,4 @@
1
- class MerbfulAuthenticationModelGenerator < RubiGen::Base
1
+ class MerbfulAuthenticationModelGenerator < Merb::GeneratorBase
2
2
 
3
3
  attr_reader :name,
4
4
  :class_name,
@@ -11,23 +11,31 @@ class MerbfulAuthenticationModelGenerator < RubiGen::Base
11
11
  :include_activation
12
12
 
13
13
  def initialize(runtime_args, runtime_options = {})
14
+ @base = File.dirname(__FILE__)
14
15
  super
15
- usage if args.empty?
16
16
  @name = args.shift
17
- extract_options
18
- runtime_options.each{ |k,v| self.instance_variable_set("@#{k}", v) }
17
+ runtime_options.each do |k,v|
18
+ ivar_name = "@#{k}"
19
+ self.instance_variable_set("@#{k}", v) unless ivar_name.include?("/")
20
+ end
19
21
  end
20
22
 
21
23
  def manifest
22
24
  record do |m|
23
- # Ensure appropriate folder(s) exists
24
- m.class_collisions [], 'AuthenticatedSystem::OrmMap'
25
-
26
- m.directory File.join('app/models', class_path)
27
- m.directory File.join('lib')
28
-
29
- m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
30
- m.template 'authenticated_system_orm_map.rb', "lib/authenticated_system_orm_map.rb"
25
+ @m = m
26
+ @assigns = {
27
+ :name => name,
28
+ :class_name => class_name,
29
+ :class_path => class_path,
30
+ :file_name => file_name,
31
+ :class_nesting => class_nesting,
32
+ :class_nesting_depth => class_nesting_depth,
33
+ :plural_name => plural_name,
34
+ :singular_name => singular_name,
35
+ :include_activation => include_activation
36
+ }
37
+ copy_dirs
38
+ copy_files
31
39
  end
32
40
  end
33
41
 
@@ -39,22 +47,4 @@ Creates a ...
39
47
  USAGE: #{$0} #{spec.name} name"
40
48
  EOS
41
49
  end
42
-
43
- def add_options!(opts)
44
- # opts.separator ''
45
- # opts.separator 'Options:'
46
- # For each option below, place the default
47
- # at the top of the file next to "default_options"
48
- # opts.on("-a", "--author=\"Your Name\"", String,
49
- # "Some comment about this option",
50
- # "Default: none") { |options[:author]| }
51
- # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
52
- end
53
-
54
- def extract_options
55
- # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
56
- # Templates can access these value via the attr_reader-generated methods, but not the
57
- # raw instance variable value.
58
- # @author = options[:author]
59
- end
60
50
  end
@@ -1,5 +1,9 @@
1
1
  require 'digest/sha1'
2
- dependency 'authenticated_system_model'
2
+ begin
3
+ require File.join(File.dirname(__FILE__), '..', '..', "lib", "authenticated_system", "authenticated_dependencies")
4
+ rescue
5
+ nil
6
+ end
3
7
  class <%= class_name %> < DataMapper::Base
4
8
  include AuthenticatedSystem::Model
5
9
 
@@ -1,5 +1,4 @@
1
- require 'merb'
2
- class AuthenticatedGenerator < RubiGen::Base
1
+ class AuthenticatedGenerator < Merb::GeneratorBase
3
2
 
4
3
  default_options :author => nil
5
4
 
@@ -31,10 +30,14 @@ class AuthenticatedGenerator < RubiGen::Base
31
30
  :model_controller_plural_name
32
31
  alias_method :model_controller_file_name, :model_controller_singular_name
33
32
  alias_method :model_controller_table_name, :model_controller_plural_name
34
- attr_reader :include_activation
33
+ attr_reader :include_activation,
34
+ :controller_view_path,
35
+ :model_controller_view_path,
36
+ :controller_full_path,
37
+ :model_controller_full_path
35
38
 
36
39
  def initialize(runtime_args, runtime_options = {})
37
- usage if runtime_args.empty?
40
+ @base = File.dirname(__FILE__)
38
41
  super
39
42
  extract_options
40
43
  assign_names!(runtime_args.shift)
@@ -53,6 +56,8 @@ class AuthenticatedGenerator < RubiGen::Base
53
56
  else
54
57
  @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
55
58
  end
59
+ @controller_full_path = File.join(controller_class_path, controller_file_name)
60
+ @controller_view_path = File.join("app/views", @controller_full_path)
56
61
 
57
62
  # model controller
58
63
  base_name, @model_controller_class_path, @model_controller_file_path, @model_controller_class_nesting, @model_controller_class_nesting_depth = extract_modules(@model_controller_name)
@@ -63,79 +68,33 @@ class AuthenticatedGenerator < RubiGen::Base
63
68
  else
64
69
  @model_controller_class_name = "#{@model_controller_class_nesting}::#{@model_controller_class_name_without_nesting}"
65
70
  end
71
+ @model_controller_full_path = File.join(model_controller_class_path, model_controller_file_name)
72
+ @model_controller_view_path = File.join("app/views", @model_controller_full_path)
66
73
  end
67
74
 
68
75
  def manifest
69
76
  manifest_result = record do |m|
70
- # Check for class naming collisions.
71
- m.class_collisions controller_class_path, "#{controller_class_name}", # Sessions Controller
72
- "Merb::#{controller_class_name}Helper"
73
- m.class_collisions model_controller_class_path, "#{model_controller_class_name}", # Model Controller
74
- "Merb::#{model_controller_class_name}Helper"
75
- m.class_collisions class_path, "#{class_name}", "#{class_name}Mailer"# , "#{class_name}MailerTest", "#{class_name}Observer"
76
- m.class_collisions [], 'AuthenticatedSystem::Controller', 'AuthenticatedSystem::Model'
77
-
78
- # Generate the model first. These can then throw an error when generating if there is no ORM present
79
- model_attributes = {
80
- :class_name => class_name,
81
- :class_path => class_path,
82
- :file_name => file_name,
83
- :class_nesting => class_nesting,
84
- :class_nesting_depth => class_nesting_depth,
85
- :plural_name => plural_name,
86
- :singular_name => singular_name,
87
- :include_activation => options[:include_activation]
88
- }
89
- m.dependency "merbful_authentication_model", [name], model_attributes
90
-
91
-
92
- # Controller, helper, views, and test directories.
93
-
94
- m.directory File.join('app/controllers', controller_class_path)
95
- m.directory File.join('app/controllers', model_controller_class_path)
96
-
97
- m.directory File.join('app/helpers', controller_class_path)
98
- m.directory File.join('app/views', controller_class_path, controller_file_name)
99
-
100
- m.directory File.join('app/controllers', model_controller_class_path)
101
- m.directory File.join('app/helpers', model_controller_class_path)
102
- m.directory File.join('app/views', model_controller_class_path, model_controller_file_name)
103
-
104
- # Generate the authenticated system" libraries
105
- m.directory "lib"
106
- m.template "authenticated_system_controller.rb", "lib/authenticated_system_controller.rb"
107
- m.template "authenticated_system_model.rb", "lib/authenticated_system_model.rb"
108
-
109
- # Mailer directory for activation
110
- if options[:include_activation]
111
- m.directory File.join('app/mailers/views', "#{singular_name}_mailer")
112
- m.template "mail_controller.rb", File.join('app/mailers',
113
- "#{singular_name}_mailer.rb")
114
- [:html, :text].each do |format|
115
- [:signup, :activation].each do |action|
116
- m.template "#{action}.#{format}.erb", File.join('app/mailers/views',
117
- "#{singular_name}_mailer",
118
- "#{action}_notification.#{format}.erb")
119
- end
120
- end
77
+ @m = m
78
+
79
+ @choices = []
80
+ @choices << "app/mailers"
81
+ Dir[File.join(@base, "templates", "app", "mailers", "**", "*")].each do |f|
82
+ @choices << relative(f)
121
83
  end
122
84
 
123
- # Generate the sessions controller
124
- m.template "session_controller.rb", File.join('app/controllers',
125
- controller_class_path,
126
- "#{controller_file_name}.rb")
127
-
128
- # Generate the model controller
129
- m.template "model_controller.rb", File.join('app/controllers',
130
- model_controller_class_path,
131
- "#{model_controller_file_name}.rb")
132
-
133
- # Controller templates
134
- m.template 'login.html.erb', File.join('app/views', controller_class_path, controller_file_name, "new.html.erb")
135
- m.template 'new_model.html.erb', File.join('app/views', model_controller_class_path, model_controller_file_name, "new.html.erb")
136
-
137
-
138
- controller_attributes = {
85
+ @choices.each do |f|
86
+ options[f] = options[:include_activation] ? true : false
87
+ end
88
+
89
+ @assigns = {
90
+ :class_name => class_name,
91
+ :class_path => class_path,
92
+ :file_name => file_name,
93
+ :class_nesting => class_nesting,
94
+ :class_nesting_depth => class_nesting_depth,
95
+ :plural_name => plural_name,
96
+ :singular_name => singular_name,
97
+ :include_activation => options[:include_activation],
139
98
  :controller_name => controller_name,
140
99
  :controller_class_path => controller_class_path,
141
100
  :controller_file_path => controller_file_path,
@@ -152,10 +111,27 @@ class AuthenticatedGenerator < RubiGen::Base
152
111
  :model_controller_class_name => model_controller_class_name,
153
112
  :model_controller_singular_name => model_controller_singular_name,
154
113
  :model_controller_plural_name => model_controller_plural_name,
155
- :include_activation => options[:include_activation]
114
+ :controller_view_path => controller_view_path,
115
+ :model_controller_view_path => model_controller_view_path,
116
+ :controller_full_path => controller_full_path,
117
+ :model_controller_full_path => model_controller_full_path
156
118
  }
157
- # Generate the tests
158
- m.dependency "merbful_authentication_tests", [name], model_attributes.dup.merge!(controller_attributes)
119
+
120
+ # Do these first to allow an error to be raised
121
+ m.dependency "merbful_authentication_tests", [name], @assigns
122
+ m.dependency "merbful_authentication_model", [name], @assigns
123
+
124
+ m.directory File.join('app/controllers', controller_class_path)
125
+ m.directory File.join('app/controllers', model_controller_class_path)
126
+ m.directory File.join('app/helpers', controller_class_path)
127
+ m.directory File.join('app/controllers', model_controller_class_path)
128
+ m.directory File.join('app/helpers', model_controller_class_path)
129
+
130
+ copy_dirs
131
+ copy_files
132
+
133
+
134
+
159
135
  end
160
136
 
161
137
  action = nil
@@ -218,7 +194,7 @@ class AuthenticatedGenerator < RubiGen::Base
218
194
  end
219
195
 
220
196
  def assign_names!(name)
221
- @name = name
197
+ @name = name.singularize
222
198
  base_name, @class_path, @file_name, @class_nesting, @class_nesting_depth = extract_modules(@name)
223
199
  @class_name_without_nesting, @singular_name, @plural_name = inflect_names(base_name)
224
200
  @table_name = @name.pluralize
@@ -1,14 +1,15 @@
1
- dependencies "authenticated_system_controller", "merb_helpers"
1
+ # require 'lib/authenticated_system_controller'
2
+ require File.join(File.dirname(__FILE__), '..', '..', "lib", "authenticated_system", "authenticated_dependencies")
2
3
  class <%= controller_class_name %> < Application
3
-
4
+
4
5
  skip_before :login_required
5
6
 
6
7
  def new
7
8
  render
8
9
  end
9
10
 
10
- def create(login = "", password = "")
11
- self.current_<%= singular_name %> = <%= class_name %>.authenticate(login, password)
11
+ def create
12
+ self.current_<%= singular_name %> = <%= class_name %>.authenticate(params[:login], params[:password])
12
13
  if logged_in?
13
14
  if params[:remember_me] == "1"
14
15
  self.current_<%= singular_name %>.remember_me
@@ -16,7 +17,7 @@ class <%= controller_class_name %> < Application
16
17
  end
17
18
  redirect_back_or_default('/')
18
19
  else
19
- render :action => "new"
20
+ render :new
20
21
  end
21
22
  end
22
23
 
@@ -1,29 +1,29 @@
1
- dependencies "authenticated_system_controller", "merb_helpers"
1
+ require File.join(File.dirname(__FILE__), '..', '..', "lib", "authenticated_system", "authenticated_dependencies")
2
2
  class <%= model_controller_class_name %> < Application
3
3
  provides :xml
4
4
 
5
5
  skip_before :login_required
6
6
 
7
- def new(<%= singular_name %> = {})
7
+ def new
8
8
  only_provides :html
9
- @<%= singular_name %> = <%= class_name %>.new(<%= singular_name %>)
10
- render @<%= singular_name %>
9
+ @<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>] || {})
10
+ display @<%= singular_name %>
11
11
  end
12
12
 
13
- def create(<%= singular_name %>)
13
+ def create
14
14
  cookies.delete :auth_token
15
15
 
16
- @<%= singular_name %> = <%= class_name %>.new(<%= singular_name %>)
16
+ @<%= singular_name %> = <%= class_name %>.new(params[:<%= singular_name %>])
17
17
  if @<%= singular_name %>.save
18
18
  redirect_back_or_default('/')
19
19
  else
20
- render :action => :new
20
+ render :new
21
21
  end
22
22
  end
23
23
 
24
24
  <% if include_activation -%>
25
- def activate(activation_code)
26
- self.current_<%= singular_name %> = <%= class_name %>.find_activated_authenticated_model(activation_code)
25
+ def activate
26
+ self.current_<%= singular_name %> = <%= class_name %>.find_activated_authenticated_model(params[:activation_code])
27
27
  if logged_in? && !current_<%= singular_name %>.active?
28
28
  current_<%= singular_name %>.activate
29
29
  end
@@ -1,3 +1,4 @@
1
+ dependency "merb-mailer", ">= 0.9"
1
2
  class <%= class_name %>Mailer < Merb::MailController
2
3
 
3
4
  def signup_notification
@@ -0,0 +1,7 @@
1
+ dependency 'merb_helpers', '>= 0.9' rescue NoMethodError
2
+
3
+ base = File.dirname(__FILE__)
4
+
5
+ %w(authenticated_routes authenticated_system_controller authenticated_system_model authenticated_system_orm_map).each do |f|
6
+ require File.join(base, f)
7
+ end
@@ -0,0 +1,9 @@
1
+ # Put the correct routes in place
2
+ Merb::BootLoader.after_app_loads do
3
+ Merb::Router.prepend do |r|
4
+ r.match("/login").to(:controller => "<%= controller_class_name %>", :action => "create").name(:login)
5
+ r.match("/logout").to(:controller => "<%= controller_class_name %>", :action => "destroy").name(:logout)
6
+ r.match("/<%= plural_name %>/activate/:activation_code").to(:controller => "<%= model_controller_class_name %>", :action => "activate").name(:<%= singular_name %>_activation)
7
+ r.resources :users
8
+ end
9
+ end
@@ -84,8 +84,9 @@ module AuthenticatedSystem
84
84
  # Redirect to the URI stored by the most recent store_location call or
85
85
  # to the passed default.
86
86
  def redirect_back_or_default(default)
87
- redirect(session[:return_to] || default)
87
+ loc = session[:return_to] || default
88
88
  session[:return_to] = nil
89
+ redirect loc
89
90
  end
90
91
 
91
92
  # Inclusion hook to make #current_<%= singular_name %> and #logged_in?
@@ -1,4 +1,4 @@
1
- dependency 'authenticated_system_orm_map'
1
+
2
2
  module AuthenticatedSystem
3
3
  module Model
4
4
 
@@ -87,7 +87,7 @@ module AuthenticatedSystem
87
87
 
88
88
  # Authenticates a <%= singular_name %> by their login name and unencrypted password. Returns the <%= singular_name %> or nil.
89
89
  def authenticate(login, password)
90
- u = find_activated_authenticated_model_with_login(login.downcase) # need to get the salt
90
+ u = find_activated_authenticated_model_with_login(login) # need to get the salt
91
91
  u && u.authenticated?(password) ? u : nil
92
92
  end
93
93
  end
@@ -1,5 +1,4 @@
1
- class MerbfulAuthenticationTestsGenerator < RubiGen::Base
2
-
1
+ class MerbfulAuthenticationTestsGenerator < Merb::GeneratorBase
3
2
  attr_reader :name,
4
3
  :class_name,
5
4
  :class_path,
@@ -27,30 +26,65 @@ class MerbfulAuthenticationTestsGenerator < RubiGen::Base
27
26
  :include_activation
28
27
 
29
28
  def initialize(runtime_args, runtime_options = {})
29
+ @base = File.dirname(__FILE__)
30
30
  super
31
31
  usage if args.empty?
32
32
  @name = args.shift
33
33
  extract_options
34
- runtime_options.each{ |k,v| self.instance_variable_set("@#{k}", v) }
34
+ runtime_options.each do |k,v|
35
+ ivar_name = "@#{k}"
36
+ self.instance_variable_set("@#{k}", v) unless ivar_name.include?("/")
37
+ end
35
38
  end
36
39
 
37
40
  def manifest
38
41
  record do |m|
42
+
43
+ @m = m
39
44
  # Ensure appropriate folder(s) exists
40
- m.directory "spec"
41
- m.directory "spec/models"
42
- m.directory "spec/controllers"
43
- m.directory "spec/mailers"
44
- # Create stubs
45
- m.template "model_spec_helper.rb", File.join("spec", "#{file_name}_spec_helper.rb")
46
- m.template "authenticated_system_spec_helper.rb", File.join("spec", "authenticated_system_spec_helper.rb")
47
- m.template "session_controller_spec.rb", File.join("spec/controllers", "#{controller_file_path}_spec.rb")
48
- m.template "model_controller_spec.rb", File.join("spec/controllers", "#{model_controller_file_path}_spec.rb")
49
- m.template "model_spec.rb", File.join('spec/models', "#{file_name}_spec.rb")
45
+ @assigns = {
46
+ :name => name,
47
+ :class_name => class_name,
48
+ :class_path => class_path,
49
+ :file_name => file_name,
50
+ :class_nesting => class_nesting,
51
+ :class_nesting_depth => class_nesting_depth,
52
+ :plural_name => plural_name,
53
+ :singular_name => singular_name,
54
+ :controller_name => controller_name,
55
+ :controller_class_path => controller_class_path,
56
+ :controller_file_path => controller_file_path,
57
+ :controller_class_nesting => controller_class_nesting,
58
+ :controller_class_nesting_depth => controller_class_nesting_depth,
59
+ :controller_class_name => controller_class_name,
60
+ :controller_singular_name => controller_singular_name,
61
+ :controller_plural_name => controller_plural_name,
62
+ :model_controller_name => model_controller_name,
63
+ :model_controller_class_path => model_controller_class_path,
64
+ :model_controller_file_path => model_controller_file_path,
65
+ :model_controller_class_nesting => model_controller_class_nesting,
66
+ :model_controller_class_nesting_depth => model_controller_class_nesting_depth,
67
+ :model_controller_class_name => model_controller_class_name,
68
+ :model_controller_singular_name => model_controller_singular_name,
69
+ :model_controller_plural_name => model_controller_plural_name,
70
+ :include_activation => include_activation
71
+ }
50
72
 
51
- if include_activation
52
- m.template "user_mailer_spec.rb", File.join("spec/mailers", "#{singular_name}_mailer_spec.rb")
73
+ @choices = []
74
+ @choices << "spec/mailers"
75
+ Dir[File.join(@base, "spec", "mailers")].each do |f|
76
+ @choices << relative(f)
53
77
  end
78
+
79
+ @choices.each do |f|
80
+ options[f] = include_activation ? true : false
81
+ end
82
+
83
+ m.directory( File.join("spec", "controllers", controller_class_path))
84
+ m.directory( File.join("spec", "controllers", model_controller_class_path))
85
+
86
+ copy_dirs
87
+ copy_files
54
88
  end
55
89
  end
56
90
 
@@ -0,0 +1,25 @@
1
+ Merb::Config.use do |c|
2
+ c[:session_store] = "memory"
3
+ end
4
+
5
+ [Merb::Test::ControllerHelper, Merb::Test::ViewHelper, Merb::Test::RouteHelper].each do |m|
6
+ Merb::Test::Helpers.send(:include, m)
7
+ end
8
+
9
+ <% if include_activation -%>
10
+ class Merb::Mailer
11
+ self.delivery_method = :test_send
12
+ end
13
+ <% end -%>
14
+
15
+ class Hash
16
+
17
+ def with( opts )
18
+ self.merge(opts)
19
+ end
20
+
21
+ def without(*args)
22
+ self.dup.delete_if{ |k,v| args.include?(k)}
23
+ end
24
+
25
+ end
@@ -9,84 +9,83 @@ describe "<%= controller_class_name %> Controller", "index action" do
9
9
  before(:each) do
10
10
  <%= class_name %>.clear_database_table
11
11
  @quentin = <%= class_name %>.create(valid_<%= singular_name %>_hash.with(:login => "quentin", :password => "test", :password_confirmation => "test"))
12
- @controller = <%= controller_class_name %>.build(fake_request)
12
+ @controller = <%= controller_class_name %>.new(fake_request)
13
13
  <% if include_activation -%>
14
14
  @quentin.activate
15
15
  <% end -%>
16
16
  end
17
17
 
18
18
  it "should have a route to <%= controller_class_name %>#new from '/login'" do
19
- with_route("/login") do |params|
19
+ request_to("/login") do |params|
20
20
  params[:controller].should == "<%= controller_class_name %>"
21
21
  params[:action].should == "create"
22
22
  end
23
23
  end
24
24
 
25
25
  it "should route to <%= controller_class_name %>#create from '/login' via post" do
26
- with_route("/login", "POST") do |params|
26
+ request_to("/login", :post) do |params|
27
27
  params[:controller].should == "<%= controller_class_name %>"
28
28
  params[:action].should == "create"
29
29
  end
30
30
  end
31
31
 
32
32
  it "should have a named route :login" do
33
- controller.url(:login).should == "/login"
33
+ @controller.url(:login).should == "/login"
34
34
  end
35
35
 
36
36
  it "should have route to <%= controller_class_name %>#destroy from '/logout' via delete" do
37
- with_route("/logout", "DELETE") do |params|
37
+ request_to("/logout", :delete) do |params|
38
38
  params[:controller].should == "<%= controller_class_name %>"
39
39
  params[:action].should == "destroy"
40
40
  end
41
41
  end
42
42
 
43
43
  it "should route to <%= controller_class_name %>#destroy from '/logout' via get" do
44
- with_route("/logout", "GET") do |params|
44
+ request_to("/logout") do |params|
45
45
  params[:controller].should == "<%= controller_class_name %>"
46
46
  params[:action].should == "destroy"
47
47
  end
48
48
  end
49
49
 
50
50
  it 'logins and redirects' do
51
- post "/login", :login => 'quentin', :password => 'test'
52
- session[:<%= singular_name %>].should_not be_nil
53
- session[:<%= singular_name %>].should == @quentin.id
51
+ controller = post "/login", :login => 'quentin', :password => 'test'
52
+ controller.session[:<%= singular_name %>].should_not be_nil
53
+ controller.session[:<%= singular_name %>].should == @quentin.id
54
54
  controller.should redirect_to("/")
55
55
  end
56
56
 
57
57
  it 'fails login and does not redirect' do
58
- post "/login", :login => 'quentin', :password => 'bad password'
59
- session[:<%= singular_name %>].should be_nil
60
- controller.template.should match(/^new\./)
61
- controller.should be_success
58
+ controller = post "/login", :login => 'quentin', :password => 'bad password'
59
+ controller.session[:<%= singular_name %>].should be_nil
60
+ controller.should be_successful
62
61
  end
63
62
 
64
63
  it 'logs out' do
65
- get("/logout"){|response| response.stub!(:current_<%= singular_name %>).and_return(@quentin) }
66
- session[:<%= singular_name %>].should be_nil
64
+ controller = get("/logout"){|controller| controller.stub!(:current_<%= singular_name %>).and_return(@quentin) }
65
+ controller.session[:<%= singular_name %>].should be_nil
67
66
  controller.should redirect
68
67
  end
69
68
 
70
69
  it 'remembers me' do
71
- post "/login", :login => 'quentin', :password => 'test', :remember_me => "1"
72
- cookies["auth_token"].should_not be_nil
70
+ controller = post "/login", :login => 'quentin', :password => 'test', :remember_me => "1"
71
+ controller.cookies["auth_token"].should_not be_nil
73
72
  end
74
73
 
75
74
  it 'does not remember me' do
76
- post "login", :login => 'quentin', :password => 'test', :remember_me => "0"
77
- cookies["auth_token"].should be_nil
75
+ controller = post "/login", :login => 'quentin', :password => 'test', :remember_me => "0"
76
+ controller.cookies["auth_token"].should be_nil
78
77
  end
79
78
 
80
79
  it 'deletes token on logout' do
81
- get("/logout") {|request| request.stub!(:current_<%= singular_name %>).and_return(@quentin) }
82
- cookies["auth_token"].should == nil
80
+ controller = get("/logout") {|request| request.stub!(:current_<%= singular_name %>).and_return(@quentin) }
81
+ controller.cookies["auth_token"].should == nil
83
82
  end
84
83
 
85
84
 
86
85
  it 'logs in with cookie' do
87
86
  @quentin.remember_me
88
- get "/login" do |request|
89
- request.env[Merb::Const::HTTP_COOKIE] = "auth_token=#{@quentin.remember_token}"
87
+ controller = get "/login" do |c|
88
+ c.request.env[Merb::Const::HTTP_COOKIE] = "auth_token=#{@quentin.remember_token}"
90
89
  end
91
90
  controller.should be_logged_in
92
91
  end
@@ -12,46 +12,46 @@ describe <%= model_controller_class_name %> do
12
12
 
13
13
  it 'allows signup' do
14
14
  lambda do
15
- create_<%= singular_name %>
15
+ controller = create_<%= singular_name %>
16
16
  controller.should redirect
17
17
  end.should change(<%= class_name %>, :count).by(1)
18
18
  end
19
19
 
20
20
  it 'requires login on signup' do
21
21
  lambda do
22
- create_<%= singular_name %>(:login => nil)
22
+ controller = create_<%= singular_name %>(:login => nil)
23
23
  controller.assigns(:<%= singular_name %>).errors.on(:login).should_not be_nil
24
- controller.should be_successful
24
+ controller.should respond_successfully
25
25
  end.should_not change(<%= class_name %>, :count)
26
26
  end
27
27
 
28
28
  it 'requires password on signup' do
29
29
  lambda do
30
- create_<%= singular_name %>(:password => nil)
30
+ controller = create_<%= singular_name %>(:password => nil)
31
31
  controller.assigns(:<%= singular_name %>).errors.on(:password).should_not be_nil
32
- controller.should be_successful
32
+ controller.should respond_successfully
33
33
  end.should_not change(<%= class_name %>, :count)
34
34
  end
35
35
 
36
36
  it 'requires password confirmation on signup' do
37
37
  lambda do
38
- create_<%= singular_name %>(:password_confirmation => nil)
38
+ controller = create_<%= singular_name %>(:password_confirmation => nil)
39
39
  controller.assigns(:<%= singular_name %>).errors.on(:password_confirmation).should_not be_nil
40
- controller.should be_successful
40
+ controller.should respond_successfully
41
41
  end.should_not change(<%= class_name %>, :count)
42
42
  end
43
43
 
44
44
  it 'requires email on signup' do
45
45
  lambda do
46
- create_<%= singular_name %>(:email => nil)
46
+ controller = create_<%= singular_name %>(:email => nil)
47
47
  controller.assigns(:<%= singular_name %>).errors.on(:email).should_not be_nil
48
- controller.should be_successful
48
+ controller.should respond_successfully
49
49
  end.should_not change(<%= class_name %>, :count)
50
50
  end
51
51
 
52
52
  <% if include_activation -%>
53
53
  it "should have a route for <%= singular_name %> activation" do
54
- with_route("/<%= model_controller_plural_name %>/activate/1234") do |params|
54
+ request_to("/<%= model_controller_singular_name %>/activate/1234") do |params|
55
55
  params[:controller].should == "<%= model_controller_class_name %>"
56
56
  params[:action].should == "activate"
57
57
  params[:activation_code].should == "1234"
@@ -59,20 +59,15 @@ describe <%= model_controller_class_name %> do
59
59
  end
60
60
 
61
61
  it 'activates <%= singular_name %>' do
62
- create_<%= singular_name %>(:login => "aaron", :password => "test", :password_confirmation => "test")
62
+ controller = create_<%= singular_name %>(:login => "aaron", :password => "test", :password_confirmation => "test")
63
63
  @<%= singular_name %> = controller.assigns(:<%= singular_name %>)
64
64
  <%= class_name %>.authenticate('aaron', 'test').should be_nil
65
- get "/<%= model_controller_plural_name %>/activate/1234"
65
+ controller = get "/<%= model_controller_singular_name %>/activate/1234"
66
66
  controller.should redirect_to("/")
67
67
  end
68
-
69
- it 'does not activate <%= singular_name %> without key' do
70
- get "/<%= model_controller_plural_name %>/activate"
71
- controller.should be_missing
72
- end
73
68
  <% end -%>
74
69
 
75
70
  def create_<%= singular_name %>(options = {})
76
- post "/<%= model_controller_plural_name %>", :<%= singular_name %> => valid_<%= singular_name %>_hash.merge(options)
71
+ post "/<%= model_controller_singular_name %>", :<%= singular_name %> => valid_<%= singular_name %>_hash.merge(options)
77
72
  end
78
73
  end
@@ -1,4 +1,4 @@
1
- class MerbfulAuthenticationTestsGenerator < RubiGen::Base
1
+ class MerbfulAuthenticationTestsGenerator < Merb::GeneratorBase
2
2
 
3
3
  attr_reader :name,
4
4
  :class_name,
@@ -27,31 +27,59 @@ class MerbfulAuthenticationTestsGenerator < RubiGen::Base
27
27
  :include_activation
28
28
 
29
29
  def initialize(runtime_args, runtime_options = {})
30
+ @base = File.dirname(__FILE__)
30
31
  super
31
- usage if args.empty?
32
32
  @name = args.shift
33
33
  extract_options
34
- runtime_options.each{ |k,v| self.instance_variable_set("@#{k}", v) }
34
+ runtime_options.each do |k,v|
35
+ ivar_name = "@#{k}"
36
+ self.instance_variable_set("@#{k}", v) unless ivar_name.include?("/")
37
+ end
35
38
  end
36
39
 
37
40
  def manifest
38
41
  record do |m|
39
- # Ensure appropriate folder(s) exists
40
- m.directory "test"
41
- m.directory "test/unit"
42
- m.directory "test/functional"
42
+ @m = m
43
+
44
+ @choices = []
45
+ @choices << relative(File.join(@base, "test", "mailers"))
46
+ @choices << relative(File.join(@base, "test", "mailers", "%singular_name%_mailer_test.rb"))
47
+
48
+ @assigns = {
49
+ :name => name,
50
+ :class_name => class_name,
51
+ :class_path => class_path,
52
+ :file_name => file_name,
53
+ :class_nesting => class_nesting,
54
+ :class_nesting_depth => class_nesting_depth,
55
+ :plural_name => plural_name,
56
+ :singular_name => singular_name,
57
+ :controller_name => controller_name,
58
+ :controller_class_path => controller_class_path,
59
+ :controller_file_path => controller_file_path,
60
+ :controller_class_nesting => controller_class_nesting,
61
+ :controller_class_nesting_depth => controller_class_nesting_depth,
62
+ :controller_class_name => controller_class_name,
63
+ :controller_singular_name => controller_singular_name,
64
+ :controller_plural_name => controller_plural_name,
65
+ :model_controller_name => model_controller_name,
66
+ :model_controller_class_path => model_controller_class_path,
67
+ :model_controller_file_path => model_controller_file_path,
68
+ :model_controller_class_nesting => model_controller_class_nesting,
69
+ :model_controller_class_nesting_depth => model_controller_class_nesting_depth,
70
+ :model_controller_class_name => model_controller_class_name,
71
+ :model_controller_singular_name => model_controller_singular_name,
72
+ :model_controller_plural_name => model_controller_plural_name,
73
+ :include_activation => include_activation
74
+ }
75
+
76
+
77
+ m.directory File.join("test", "functional", controller_class_path)
78
+ m.directory File.join("test", "functional", model_controller_class_path)
79
+
80
+ copy_dirs
81
+ copy_files
43
82
 
44
- m.directory "test/mailers" if include_activation
45
- # Create stubs
46
- m.template "model_test_helper.rb", File.join("test", "#{file_name}_test_helper.rb")
47
- m.template "authenticated_system_test_helper.rb", File.join("test", "authenticated_system_test_helper.rb")
48
- m.template "model_functional_test.rb", File.join("test", "functional", "#{model_controller_file_path}_test.rb")
49
- m.template "functional_test.rb", File.join("test", "functional", "#{controller_file_path}_test.rb")
50
- m.template "unit_test.rb", File.join("test", "unit", "#{singular_name}_test.rb")
51
-
52
- if include_activation
53
- m.template "mailer_test.rb", File.join("test/mailers", "#{singular_name}_mailer_test.rb")
54
- end
55
83
  end
56
84
  end
57
85
 
@@ -1,13 +1,16 @@
1
- class Merb::Controller
2
- require "merb/session/memory_session"
3
- Merb::MemorySessionContainer.setup
4
- include ::Merb::SessionMixin
5
- self.session_secret_key = "foo to the bar to the baz"
1
+ Merb::Config.use do |c|
2
+ c[:session_store] = "memory"
6
3
  end
7
4
 
5
+ [Merb::Test::ControllerHelper, Merb::Test::ViewHelper, Merb::Test::RouteHelper].each do |m|
6
+ Merb::Test::Helpers.send(:include, m)
7
+ end
8
+
9
+ <% if include_activation -%>
8
10
  class Merb::Mailer
9
11
  self.delivery_method = :test_send
10
12
  end
13
+ <% end -%>
11
14
 
12
15
  class Hash
13
16
 
@@ -20,7 +23,6 @@ class Hash
20
23
  end
21
24
 
22
25
  end
23
-
24
26
  # Assert difference(s) methods were taken from RubyOnRails to support the port of restful_authentication
25
27
 
26
28
  def assert_difference(expressions, difference = 1, message = nil, &block)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: merbful_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Neighman
@@ -9,26 +9,26 @@ autorequire: merbful_authentication
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-01-18 00:00:00 +11:00
12
+ date: 2008-02-27 00:00:00 +11:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
- name: merb
16
+ name: merb-core
17
17
  version_requirement:
18
18
  version_requirements: !ruby/object:Gem::Requirement
19
19
  requirements:
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.5.0
22
+ version: 0.9.0
23
23
  version:
24
24
  - !ruby/object:Gem::Dependency
25
- name: merb_helpers
25
+ name: merb-gen
26
26
  version_requirement:
27
27
  version_requirements: !ruby/object:Gem::Requirement
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: 0.5.0
31
+ version: "0"
32
32
  version:
33
33
  description: A Merb plugin that is essentially a port of Rick Olsons restful_authentication plugin for rails
34
34
  email: has.sox@gmail.com
@@ -51,53 +51,82 @@ files:
51
51
  - merb_generators/authenticated
52
52
  - merb_generators/authenticated/authenticated_generator.rb
53
53
  - merb_generators/authenticated/templates
54
- - merb_generators/authenticated/templates/activation.html.erb
55
- - merb_generators/authenticated/templates/activation.text.erb
56
- - merb_generators/authenticated/templates/authenticated_system_controller.rb
57
- - merb_generators/authenticated/templates/authenticated_system_model.rb
58
- - merb_generators/authenticated/templates/login.html.erb
59
- - merb_generators/authenticated/templates/mail_controller.rb
60
- - merb_generators/authenticated/templates/model_controller.rb
61
- - merb_generators/authenticated/templates/new_model.html.erb
62
- - merb_generators/authenticated/templates/session_controller.rb
63
- - merb_generators/authenticated/templates/signup.html.erb
64
- - merb_generators/authenticated/templates/signup.text.erb
54
+ - merb_generators/authenticated/templates/app
55
+ - merb_generators/authenticated/templates/app/controllers
56
+ - merb_generators/authenticated/templates/app/controllers/%controller_name%.rb
57
+ - merb_generators/authenticated/templates/app/controllers/%model_controller_name%.rb
58
+ - merb_generators/authenticated/templates/app/mailers
59
+ - merb_generators/authenticated/templates/app/mailers/%singular_name%_mailer.rb
60
+ - merb_generators/authenticated/templates/app/mailers/views
61
+ - merb_generators/authenticated/templates/app/mailers/views/%singular_name%_mailer
62
+ - merb_generators/authenticated/templates/app/mailers/views/%singular_name%_mailer/activation_notification.html.erb
63
+ - merb_generators/authenticated/templates/app/mailers/views/%singular_name%_mailer/activation_notification.text.erb
64
+ - merb_generators/authenticated/templates/app/mailers/views/%singular_name%_mailer/signup_notification.html.erb
65
+ - merb_generators/authenticated/templates/app/mailers/views/%singular_name%_mailer/signup_notification.text.erb
66
+ - merb_generators/authenticated/templates/app/views
67
+ - merb_generators/authenticated/templates/app/views/%controller_name%
68
+ - merb_generators/authenticated/templates/app/views/%controller_name%/new.html.erb
69
+ - merb_generators/authenticated/templates/app/views/%model_controller_name%
70
+ - merb_generators/authenticated/templates/app/views/%model_controller_name%/new.html.erb
71
+ - merb_generators/authenticated/templates/lib
72
+ - merb_generators/authenticated/templates/lib/authenticated_system
73
+ - merb_generators/authenticated/templates/lib/authenticated_system/authenticated_dependencies.rb
74
+ - merb_generators/authenticated/templates/lib/authenticated_system/authenticated_routes.rb
75
+ - merb_generators/authenticated/templates/lib/authenticated_system/authenticated_system_controller.rb
76
+ - merb_generators/authenticated/templates/lib/authenticated_system/authenticated_system_model.rb
65
77
  - merb_generators/authenticated/USAGE
66
78
  - datamapper_generators/merbful_authentication_model
67
79
  - datamapper_generators/merbful_authentication_model/merbful_authentication_model_generator.rb
68
80
  - datamapper_generators/merbful_authentication_model/templates
69
- - datamapper_generators/merbful_authentication_model/templates/authenticated_system_orm_map.rb
70
- - datamapper_generators/merbful_authentication_model/templates/model.rb
81
+ - datamapper_generators/merbful_authentication_model/templates/app
82
+ - datamapper_generators/merbful_authentication_model/templates/app/models
83
+ - datamapper_generators/merbful_authentication_model/templates/app/models/%singular_name%.rb
84
+ - datamapper_generators/merbful_authentication_model/templates/lib
85
+ - datamapper_generators/merbful_authentication_model/templates/lib/authenticated_system
86
+ - datamapper_generators/merbful_authentication_model/templates/lib/authenticated_system/authenticated_system_orm_map.rb
71
87
  - activerecord_generators/merbful_authentication_model
72
88
  - activerecord_generators/merbful_authentication_model/merbful_authentication_model_generator.rb
73
89
  - activerecord_generators/merbful_authentication_model/templates
74
- - activerecord_generators/merbful_authentication_model/templates/authenticated_system_orm_map.rb
75
- - activerecord_generators/merbful_authentication_model/templates/migration.rb
76
- - activerecord_generators/merbful_authentication_model/templates/model.rb
90
+ - activerecord_generators/merbful_authentication_model/templates/app
91
+ - activerecord_generators/merbful_authentication_model/templates/app/models
92
+ - activerecord_generators/merbful_authentication_model/templates/app/models/%singular_name%.rb
93
+ - activerecord_generators/merbful_authentication_model/templates/lib
94
+ - activerecord_generators/merbful_authentication_model/templates/lib/authenticated_system
95
+ - activerecord_generators/merbful_authentication_model/templates/lib/authenticated_system/authenticated_system_orm_map.rb
96
+ - activerecord_generators/merbful_authentication_model/templates/schema
97
+ - activerecord_generators/merbful_authentication_model/templates/schema/migrations
98
+ - activerecord_generators/merbful_authentication_model/templates/schema/migrations/%migration_file_name%.rb
77
99
  - merb_default_generators/merbful_authentication_model
78
100
  - merb_default_generators/merbful_authentication_model/merbful_authentication_model_generator.rb
79
- - merb_default_generators/merbful_authentication_model/templates
80
101
  - sequel_generators/merbful_authentication_model
81
- - sequel_generators/merbful_authentication_model/merbful_authentication_model_generator.rb
82
- - sequel_generators/merbful_authentication_model/templates
102
+ - sequel_generators/merbful_authentication_model/lib
103
+ - sequel_generators/merbful_authentication_model/lib/merbful_authentication_model_generator.rb
83
104
  - rspec_generators/merbful_authentication_tests
84
105
  - rspec_generators/merbful_authentication_tests/merbful_authentication_tests_generator.rb
85
106
  - rspec_generators/merbful_authentication_tests/templates
86
- - rspec_generators/merbful_authentication_tests/templates/authenticated_system_spec_helper.rb
87
- - rspec_generators/merbful_authentication_tests/templates/model_controller_spec.rb
88
- - rspec_generators/merbful_authentication_tests/templates/model_spec.rb
89
- - rspec_generators/merbful_authentication_tests/templates/model_spec_helper.rb
90
- - rspec_generators/merbful_authentication_tests/templates/session_controller_spec.rb
91
- - rspec_generators/merbful_authentication_tests/templates/user_mailer_spec.rb
107
+ - rspec_generators/merbful_authentication_tests/templates/spec
108
+ - rspec_generators/merbful_authentication_tests/templates/spec/%singular_name%_spec_helper.rb
109
+ - rspec_generators/merbful_authentication_tests/templates/spec/authenticated_system_spec_helper.rb
110
+ - rspec_generators/merbful_authentication_tests/templates/spec/controllers
111
+ - rspec_generators/merbful_authentication_tests/templates/spec/controllers/%controller_file_path%_spec.rb
112
+ - rspec_generators/merbful_authentication_tests/templates/spec/controllers/%model_controller_file_path%_spec.rb
113
+ - rspec_generators/merbful_authentication_tests/templates/spec/mailers
114
+ - rspec_generators/merbful_authentication_tests/templates/spec/mailers/%singular_name%_mailer_spec.rb
115
+ - rspec_generators/merbful_authentication_tests/templates/spec/models
116
+ - rspec_generators/merbful_authentication_tests/templates/spec/models/%singular_name%_spec.rb
92
117
  - test_unit_generators/merbful_authentication_tests
93
118
  - test_unit_generators/merbful_authentication_tests/merbful_authentication_tests_generator.rb
94
119
  - test_unit_generators/merbful_authentication_tests/templates
95
- - test_unit_generators/merbful_authentication_tests/templates/authenticated_system_test_helper.rb
96
- - test_unit_generators/merbful_authentication_tests/templates/functional_test.rb
97
- - test_unit_generators/merbful_authentication_tests/templates/mailer_test.rb
98
- - test_unit_generators/merbful_authentication_tests/templates/model_functional_test.rb
99
- - test_unit_generators/merbful_authentication_tests/templates/model_test_helper.rb
100
- - test_unit_generators/merbful_authentication_tests/templates/unit_test.rb
120
+ - test_unit_generators/merbful_authentication_tests/templates/test
121
+ - test_unit_generators/merbful_authentication_tests/templates/test/%file_name%_test_helper.rb
122
+ - test_unit_generators/merbful_authentication_tests/templates/test/authenticated_system_test_helper.rb
123
+ - test_unit_generators/merbful_authentication_tests/templates/test/functional
124
+ - test_unit_generators/merbful_authentication_tests/templates/test/functional/%controller_file_path%_test.rb
125
+ - test_unit_generators/merbful_authentication_tests/templates/test/functional/%model_controller_file_path%_test.rb
126
+ - test_unit_generators/merbful_authentication_tests/templates/test/mailers
127
+ - test_unit_generators/merbful_authentication_tests/templates/test/mailers/%singular_name%_mailer_test.rb
128
+ - test_unit_generators/merbful_authentication_tests/templates/test/unit
129
+ - test_unit_generators/merbful_authentication_tests/templates/test/unit/%singular_name%_test.rb
101
130
  has_rdoc: true
102
131
  homepage: http://rubyforge.org/projects/merbful-auth/
103
132
  post_install_message:
@@ -1,22 +0,0 @@
1
- class Merb::Controller
2
- require "merb/session/memory_session"
3
- Merb::MemorySessionContainer.setup
4
- include ::Merb::SessionMixin
5
- self.session_secret_key = "foo to the bar to the baz"
6
- end
7
-
8
- class Merb::Mailer
9
- self.delivery_method = :test_send
10
- end
11
-
12
- class Hash
13
-
14
- def with( opts )
15
- self.merge(opts)
16
- end
17
-
18
- def without(*args)
19
- self.dup.delete_if{ |k,v| args.include?(k)}
20
- end
21
-
22
- end