controller_concerned 0.0.3 → 0.0.4

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/README CHANGED
@@ -4,9 +4,16 @@ I know, the better way is to refactor your controller code to avoid masses of li
4
4
  but if you haven't enough time for refactoring, try this.
5
5
 
6
6
  class UsersController < ApplicationController
7
- controller_concerned
7
+ concerned_with :searching
8
8
  end
9
9
 
10
- For UsersController controller_concerned will include all *.rb files
11
- found in controller/users_concerns
10
+ concerned_with will require files at controller/users/
11
+ Just add a file to controller/users/ and thats it.
12
+
13
+ name: searching.rb
14
+
15
+ class UsersController
16
+ def search
17
+ end
18
+ end
12
19
 
@@ -1,3 +1,7 @@
1
- require File.expand_path("../controller_concerned/base", __FILE__)
2
-
3
- ActionController::Base.send(:include, ControllerConcerned::Base)
1
+ class << ActionController::Base
2
+ def concerned_with(*concerns)
3
+ concerns.each do |concern|
4
+ require_dependency "#{name.underscore.gsub("_controller", "")}/#{concern}"
5
+ end
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module ControllerConcerned
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: controller_concerned
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.3
5
+ version: 0.0.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - Matthias Zirnstein
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-05-10 00:00:00 Z
13
+ date: 2011-05-11 00:00:00 Z
14
14
  dependencies: []
15
15
 
16
16
  description: ""
@@ -29,7 +29,6 @@ files:
29
29
  - Rakefile
30
30
  - controller_concerned.gemspec
31
31
  - lib/controller_concerned.rb
32
- - lib/controller_concerned/base.rb
33
32
  - lib/controller_concerned/version.rb
34
33
  homepage: https://github.com/zirni/controller_concerned
35
34
  licenses: []
@@ -54,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
54
53
  requirements: []
55
54
 
56
55
  rubyforge_project: controller_concerned
57
- rubygems_version: 1.7.2
56
+ rubygems_version: 1.8.1
58
57
  signing_key:
59
58
  specification_version: 3
60
59
  summary: Organize your controller and place each action/functionality in a separate file
@@ -1,22 +0,0 @@
1
- module ControllerConcerned
2
- module Base
3
- def self.included(base)
4
- base.class_eval do
5
- extend ClassMethods
6
- end
7
- end
8
-
9
- module ClassMethods
10
- def controller_concerned
11
- module_name = self.name.underscore.gsub(/_controller$/, "") << "_concerns"
12
- concerned_path = Rails.root.join("app", "controllers", module_name)
13
-
14
- Dir.glob("#{concerned_path}/*.rb").each do |file|
15
- file = Pathname.new(file).basename.to_s
16
- camelized = "#{module_name}/#{file.gsub(".rb", "")}".camelize
17
- self.send :include, camelized.constantize
18
- end
19
- end
20
- end
21
- end
22
- end