before_actions 1.0.3 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/lib/before_actions.rb +3 -8
  3. data/lib/before_actions/controller/controller.rb +18 -0
  4. data/lib/before_actions/controller/scope.rb +24 -0
  5. data/lib/before_actions/monkey_patching.rb +5 -0
  6. data/lib/before_actions/version.rb +1 -1
  7. data/spec/controllers/bunny_controller_spec.rb +29 -0
  8. data/spec/controllers/cat_controller_spec.rb +29 -0
  9. data/spec/controllers/dog_controller_spec.rb +29 -0
  10. data/spec/controllers/squirrel_controller_spec.rb +29 -0
  11. data/spec/dummy/app/controllers/admin_foos_controller.rb +5 -5
  12. data/spec/dummy/app/controllers/bunny_controller.rb +24 -0
  13. data/spec/dummy/app/controllers/cat_controller.rb +19 -0
  14. data/spec/dummy/app/controllers/dog_controller.rb +18 -0
  15. data/spec/dummy/app/controllers/foos_controller.rb +6 -6
  16. data/spec/dummy/app/controllers/squirrel_controller.rb +16 -0
  17. data/spec/dummy/app/views/bunny/one.html.erb +2 -0
  18. data/spec/dummy/app/views/bunny/three.html.erb +2 -0
  19. data/spec/dummy/app/views/bunny/two.html.erb +2 -0
  20. data/spec/dummy/app/views/cat/one.html.erb +2 -0
  21. data/spec/dummy/app/views/cat/three.html.erb +2 -0
  22. data/spec/dummy/app/views/cat/two.html.erb +2 -0
  23. data/spec/dummy/app/views/dog/one.html.erb +2 -0
  24. data/spec/dummy/app/views/dog/three.html.erb +2 -0
  25. data/spec/dummy/app/views/dog/two.html.erb +2 -0
  26. data/spec/dummy/app/views/squirrel/one.html.erb +2 -0
  27. data/spec/dummy/app/views/squirrel/three.html.erb +2 -0
  28. data/spec/dummy/app/views/squirrel/two.html.erb +2 -0
  29. data/spec/dummy/config/routes.rb +18 -2
  30. data/spec/dummy/lib/templates/rails/scaffold_controller/controller.rb +25 -21
  31. data/spec/dummy/log/test.log +2700 -0
  32. metadata +47 -6
  33. data/app/controllers/before_actions/foo_controller.rb +0 -8
  34. data/lib/before_actions/controller.rb +0 -47
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: before_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Pinto
@@ -72,33 +72,42 @@ dependencies:
72
72
  - - ">="
73
73
  - !ruby/object:Gem::Version
74
74
  version: '0'
75
- description: Organize your controllers by grouping your before and after filter.
75
+ description: Organize your code by grouping your controller callbacks.
76
76
  email:
77
- - tjamespinto@gmail.com
77
+ - thejamespinto@gmail.com
78
78
  executables: []
79
79
  extensions: []
80
80
  extra_rdoc_files: []
81
81
  files:
82
82
  - README.md
83
83
  - Rakefile
84
- - app/controllers/before_actions/foo_controller.rb
85
84
  - lib/before_actions.rb
86
- - lib/before_actions/controller.rb
85
+ - lib/before_actions/controller/controller.rb
86
+ - lib/before_actions/controller/scope.rb
87
87
  - lib/before_actions/engine.rb
88
+ - lib/before_actions/monkey_patching.rb
88
89
  - lib/before_actions/version.rb
89
90
  - lib/generators/before_actions/USAGE
90
91
  - lib/generators/before_actions/install_generator.rb
91
92
  - lib/generators/before_actions/templates/controller.rb
92
93
  - lib/tasks/before_actions_tasks.rake
93
94
  - spec/controllers/admin_foos_controller_spec.rb
95
+ - spec/controllers/bunny_controller_spec.rb
96
+ - spec/controllers/cat_controller_spec.rb
97
+ - spec/controllers/dog_controller_spec.rb
94
98
  - spec/controllers/foos_controller_spec.rb
99
+ - spec/controllers/squirrel_controller_spec.rb
95
100
  - spec/dummy/README.rdoc
96
101
  - spec/dummy/Rakefile
97
102
  - spec/dummy/app/assets/javascripts/application.js
98
103
  - spec/dummy/app/assets/stylesheets/application.css
99
104
  - spec/dummy/app/controllers/admin_foos_controller.rb
100
105
  - spec/dummy/app/controllers/application_controller.rb
106
+ - spec/dummy/app/controllers/bunny_controller.rb
107
+ - spec/dummy/app/controllers/cat_controller.rb
108
+ - spec/dummy/app/controllers/dog_controller.rb
101
109
  - spec/dummy/app/controllers/foos_controller.rb
110
+ - spec/dummy/app/controllers/squirrel_controller.rb
102
111
  - spec/dummy/app/helpers/application_helper.rb
103
112
  - spec/dummy/app/models/admin_foo.rb
104
113
  - spec/dummy/app/models/foo.rb
@@ -107,12 +116,24 @@ files:
107
116
  - spec/dummy/app/views/admin_foos/index.html.erb
108
117
  - spec/dummy/app/views/admin_foos/new.html.erb
109
118
  - spec/dummy/app/views/admin_foos/show.html.erb
119
+ - spec/dummy/app/views/bunny/one.html.erb
120
+ - spec/dummy/app/views/bunny/three.html.erb
121
+ - spec/dummy/app/views/bunny/two.html.erb
122
+ - spec/dummy/app/views/cat/one.html.erb
123
+ - spec/dummy/app/views/cat/three.html.erb
124
+ - spec/dummy/app/views/cat/two.html.erb
125
+ - spec/dummy/app/views/dog/one.html.erb
126
+ - spec/dummy/app/views/dog/three.html.erb
127
+ - spec/dummy/app/views/dog/two.html.erb
110
128
  - spec/dummy/app/views/foos/_form.html.erb
111
129
  - spec/dummy/app/views/foos/edit.html.erb
112
130
  - spec/dummy/app/views/foos/index.html.erb
113
131
  - spec/dummy/app/views/foos/new.html.erb
114
132
  - spec/dummy/app/views/foos/show.html.erb
115
133
  - spec/dummy/app/views/layouts/application.html.erb
134
+ - spec/dummy/app/views/squirrel/one.html.erb
135
+ - spec/dummy/app/views/squirrel/three.html.erb
136
+ - spec/dummy/app/views/squirrel/two.html.erb
116
137
  - spec/dummy/bin/bundle
117
138
  - spec/dummy/bin/rails
118
139
  - spec/dummy/bin/rake
@@ -170,15 +191,23 @@ rubyforge_project:
170
191
  rubygems_version: 2.2.2
171
192
  signing_key:
172
193
  specification_version: 4
173
- summary: Rails Gem to organize your controllers
194
+ summary: Organize Your Rails Controllers
174
195
  test_files:
175
196
  - spec/controllers/admin_foos_controller_spec.rb
197
+ - spec/controllers/bunny_controller_spec.rb
198
+ - spec/controllers/cat_controller_spec.rb
199
+ - spec/controllers/dog_controller_spec.rb
176
200
  - spec/controllers/foos_controller_spec.rb
201
+ - spec/controllers/squirrel_controller_spec.rb
177
202
  - spec/dummy/app/assets/javascripts/application.js
178
203
  - spec/dummy/app/assets/stylesheets/application.css
179
204
  - spec/dummy/app/controllers/admin_foos_controller.rb
180
205
  - spec/dummy/app/controllers/application_controller.rb
206
+ - spec/dummy/app/controllers/bunny_controller.rb
207
+ - spec/dummy/app/controllers/cat_controller.rb
208
+ - spec/dummy/app/controllers/dog_controller.rb
181
209
  - spec/dummy/app/controllers/foos_controller.rb
210
+ - spec/dummy/app/controllers/squirrel_controller.rb
182
211
  - spec/dummy/app/helpers/application_helper.rb
183
212
  - spec/dummy/app/models/admin_foo.rb
184
213
  - spec/dummy/app/models/foo.rb
@@ -187,12 +216,24 @@ test_files:
187
216
  - spec/dummy/app/views/admin_foos/index.html.erb
188
217
  - spec/dummy/app/views/admin_foos/new.html.erb
189
218
  - spec/dummy/app/views/admin_foos/show.html.erb
219
+ - spec/dummy/app/views/bunny/one.html.erb
220
+ - spec/dummy/app/views/bunny/three.html.erb
221
+ - spec/dummy/app/views/bunny/two.html.erb
222
+ - spec/dummy/app/views/cat/one.html.erb
223
+ - spec/dummy/app/views/cat/three.html.erb
224
+ - spec/dummy/app/views/cat/two.html.erb
225
+ - spec/dummy/app/views/dog/one.html.erb
226
+ - spec/dummy/app/views/dog/three.html.erb
227
+ - spec/dummy/app/views/dog/two.html.erb
190
228
  - spec/dummy/app/views/foos/_form.html.erb
191
229
  - spec/dummy/app/views/foos/edit.html.erb
192
230
  - spec/dummy/app/views/foos/index.html.erb
193
231
  - spec/dummy/app/views/foos/new.html.erb
194
232
  - spec/dummy/app/views/foos/show.html.erb
195
233
  - spec/dummy/app/views/layouts/application.html.erb
234
+ - spec/dummy/app/views/squirrel/one.html.erb
235
+ - spec/dummy/app/views/squirrel/three.html.erb
236
+ - spec/dummy/app/views/squirrel/two.html.erb
196
237
  - spec/dummy/bin/bundle
197
238
  - spec/dummy/bin/rails
198
239
  - spec/dummy/bin/rake
@@ -1,8 +0,0 @@
1
- require_dependency "before_actions/application_controller"
2
-
3
- module BeforeActions
4
- class FooController < ApplicationController
5
- def bar
6
- end
7
- end
8
- end
@@ -1,47 +0,0 @@
1
- module BeforeActions
2
- module Controller
3
- extend ActiveSupport::Concern
4
-
5
- module ClassMethods
6
- def before_actions(&block)
7
- TheBefore.new(self).instance_eval(&block)
8
- end
9
- def after_actions(&block)
10
- TheAfter.new(self).instance_eval(&block)
11
- end
12
- end
13
-
14
- class TheBefore
15
-
16
- def initialize(controller)
17
- @controller = controller
18
- end
19
-
20
- def actions(*list, &block)
21
- if list.empty?
22
- @controller.before_action(&block)
23
- else
24
- @controller.before_action({only: list}, &block)
25
- end
26
- end
27
-
28
- end
29
-
30
- class TheAfter
31
-
32
- def initialize(controller)
33
- @controller = controller
34
- end
35
-
36
- def actions(*list, &block)
37
- if list.empty?
38
- @controller.after_action(&block)
39
- else
40
- @controller.after_action({only: list}, &block)
41
- end
42
- end
43
-
44
- end
45
-
46
- end
47
- end