mondo-generators 0.6.4 → 0.6.5
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/VERSION +1 -1
- data/mondo-generators.gemspec +1 -1
- data/rails_generators/mondo_authentication/lib/insert_commands.rb +28 -5
- data/rails_generators/mondo_authentication/mondo_authentication_generator.rb +2 -1
- data/rails_generators/mondo_authentication/templates/views/_form.html.haml +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.6.
|
1
|
+
0.6.5
|
data/mondo-generators.gemspec
CHANGED
@@ -1,4 +1,15 @@
|
|
1
1
|
Rails::Generator::Commands::Create.class_eval do
|
2
|
+
def route_root(route_options = {})
|
3
|
+
sentinel = 'ActionController::Routing::Routes.draw do |map|'
|
4
|
+
|
5
|
+
logger.route "map.root :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
|
6
|
+
unless options[:pretend]
|
7
|
+
gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
|
8
|
+
"#{match}\n map.root :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
2
13
|
def route_resource(*resources)
|
3
14
|
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
|
4
15
|
sentinel = 'ActionController::Routing::Routes.draw do |map|'
|
@@ -14,10 +25,10 @@ Rails::Generator::Commands::Create.class_eval do
|
|
14
25
|
def route_resource_with_options(resource, route_options = {})
|
15
26
|
sentinel = 'ActionController::Routing::Routes.draw do |map|'
|
16
27
|
|
17
|
-
logger.route "map.resource #{resource}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }"
|
28
|
+
logger.route "map.resource #{resource.to_sym.inspect}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }"
|
18
29
|
unless options[:pretend]
|
19
30
|
gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
|
20
|
-
"#{match}\n map.resource #{resource}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }\n"
|
31
|
+
"#{match}\n map.resource #{resource.to_sym.inspect}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }\n"
|
21
32
|
end
|
22
33
|
end
|
23
34
|
end
|
@@ -44,6 +55,14 @@ Rails::Generator::Commands::Create.class_eval do
|
|
44
55
|
end
|
45
56
|
|
46
57
|
Rails::Generator::Commands::Destroy.class_eval do
|
58
|
+
def route_root(route_options = {})
|
59
|
+
look_for = "\n map.root :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
|
60
|
+
logger.route "map.root :controller => '#{route_options[:controller]}', :action => '#{route_options[:action]}'"
|
61
|
+
unless options[:pretend]
|
62
|
+
gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
47
66
|
def route_resource(*resources)
|
48
67
|
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
|
49
68
|
look_for = "\n map.resource #{resource_list}\n"
|
@@ -54,8 +73,8 @@ Rails::Generator::Commands::Destroy.class_eval do
|
|
54
73
|
end
|
55
74
|
|
56
75
|
def route_resource_with_options(resource, route_options = {})
|
57
|
-
look_for = "\n map.resource #{resource}, #{route_options}\n"
|
58
|
-
logger.route "map.resource #{resource}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }"
|
76
|
+
look_for = "\n map.resource #{resource.to_sym.inspect}, #{route_options}\n"
|
77
|
+
logger.route "map.resource #{resource.to_sym.inspect}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }"
|
59
78
|
unless options[:pretend]
|
60
79
|
gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
|
61
80
|
end
|
@@ -78,13 +97,17 @@ Rails::Generator::Commands::Destroy.class_eval do
|
|
78
97
|
end
|
79
98
|
|
80
99
|
Rails::Generator::Commands::List.class_eval do
|
100
|
+
def route_root(route_options = {})
|
101
|
+
logger.route "map.root :controller => '{options[:controller]}', :action => '#{options[:action]}'"
|
102
|
+
end
|
103
|
+
|
81
104
|
def route_resource(*resources)
|
82
105
|
resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
|
83
106
|
logger.route "map.resource #{resource_list}"
|
84
107
|
end
|
85
108
|
|
86
109
|
def route_resource_with_options(resource, route_options = {})
|
87
|
-
logger.route "map.resource #{resource}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }"
|
110
|
+
logger.route "map.resource #{resource.to_sym.inspect}, :member => { #{route_options[:members]} }, :collection => { #{route_options[:collections]} }"
|
88
111
|
end
|
89
112
|
|
90
113
|
def route_name(name, path, options = {})
|
@@ -44,7 +44,8 @@ class MondoAuthenticationGenerator < Rails::Generator::Base
|
|
44
44
|
m.route_name :signup, '/signup', :controller => user_plural_name, :action => 'new'
|
45
45
|
m.route_name :logout, '/logout', :controller => session_plural_name, :action => 'destroy'
|
46
46
|
m.route_name :login, '/login', :controller => session_plural_name, :action => 'new'
|
47
|
-
|
47
|
+
|
48
|
+
m.route_root :controller => 'static_pages', :action => 'home'
|
48
49
|
|
49
50
|
m.route_resources session_plural_name
|
50
51
|
m.route_resource_with_options user_plural_name, :collections => ':mass_new => :get, :mass_create => :post'
|