matid-concerned_with 0.1.0

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.
@@ -0,0 +1,2 @@
1
+ *.gemspec
2
+ pkg/
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2008 Jake Howerton
2
+ Copyright (c) 2009 Mateusz Drożdżyński
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining
5
+ a copy of this software and associated documentation files (the
6
+ "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish,
8
+ distribute, sublicense, and/or sell copies of the Software, and to
9
+ permit persons to whom the Software is furnished to do so, subject to
10
+ the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be
13
+ included in all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,40 @@
1
+ ConcernedWith
2
+ =============
3
+
4
+ Simple way to separate model and controller concerns into separate files. Code is from Rick Olson's altered_beast project.
5
+
6
+
7
+ Example
8
+ =======
9
+
10
+ # app/models/user.rb
11
+ class User < ActiveRecord::Base
12
+ concerned_with :validations, :authentication
13
+ end
14
+
15
+ # app/models/user/validations.rb
16
+ class User < ActiveRecord::Base
17
+ validates_presence_of :name
18
+ end
19
+
20
+ #app/models/user/authentication.rb
21
+ class User < ActiveRecord::Base
22
+ def self.authenticate(name, password)
23
+ find_by_name_and_password(name, password)
24
+ end
25
+ end
26
+
27
+ #app/controllers/application_controller.rb
28
+ class ApplicationController < ActionController::Base
29
+ concerned_with :authentication
30
+ end
31
+
32
+ #app/controllers/application/authentication.rb
33
+ class ApplicationController < ActionController::Base
34
+ def logged_in?
35
+ false
36
+ end
37
+ end
38
+
39
+
40
+ Copyright (c) 2008 Jake Howerton, 2009 Mateusz Drożdżynski, released under the MIT license
@@ -0,0 +1,55 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "matid-concerned_with"
8
+ gem.summary = "Simple way to separate model and controller concerns into separate files."
9
+ gem.email = "matid@matid.net"
10
+ gem.homepage = "http://github.com/matid/concerned_with"
11
+ gem.authors = ["Mateusz Drozdzynski"]
12
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
13
+ end
14
+ Jeweler::GemcutterTasks.new
15
+ rescue LoadError
16
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
17
+ end
18
+
19
+ require 'rake/testtask'
20
+ Rake::TestTask.new(:test) do |test|
21
+ test.libs << 'lib' << 'test'
22
+ test.pattern = 'test/**/*_test.rb'
23
+ test.verbose = true
24
+ end
25
+
26
+ begin
27
+ require 'rcov/rcovtask'
28
+ Rcov::RcovTask.new do |test|
29
+ test.libs << 'test'
30
+ test.pattern = 'test/**/*_test.rb'
31
+ test.verbose = true
32
+ end
33
+ rescue LoadError
34
+ task :rcov do
35
+ abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
36
+ end
37
+ end
38
+
39
+ task :test => :check_dependencies
40
+
41
+ task :default => :test
42
+
43
+ require 'rake/rdoctask'
44
+ Rake::RDocTask.new do |rdoc|
45
+ if File.exist?('VERSION')
46
+ version = File.read('VERSION')
47
+ else
48
+ version = ""
49
+ end
50
+
51
+ rdoc.rdoc_dir = 'rdoc'
52
+ rdoc.title = "concerned_with_gem #{version}"
53
+ rdoc.rdoc_files.include('README*')
54
+ rdoc.rdoc_files.include('lib/**/*.rb')
55
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
data/init.rb ADDED
@@ -0,0 +1,2 @@
1
+ # Include hook code here
2
+ require File.dirname(__FILE__) + '/lib/concerned_with'
@@ -0,0 +1 @@
1
+ # Install hook code here
@@ -0,0 +1,21 @@
1
+ # ConcernedWith
2
+ module ConcernedWith
3
+ module ActiveRecord
4
+ def concerned_with(*concerns)
5
+ concerns.each do |concern|
6
+ require_dependency "#{name.underscore}/#{concern}"
7
+ end
8
+ end
9
+ end
10
+
11
+ module ActionController
12
+ def concerned_with(*concerns)
13
+ concerns.each do |concern|
14
+ require_dependency "#{self.name.gsub(/Controller$/, '').downcase}/#{concern}"
15
+ end
16
+ end
17
+ end
18
+ end
19
+
20
+ ActiveRecord::Base.send(:extend, ConcernedWith::ActiveRecord)
21
+ ActionController::Base.send(:extend, ConcernedWith::ActionController)
@@ -0,0 +1,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :concerned_with do
3
+ # # Task goes here
4
+ # end
@@ -0,0 +1,8 @@
1
+ require 'test/unit'
2
+
3
+ class ConcernedWithTest < Test::Unit::TestCase
4
+ # Replace this with your real tests.
5
+ def test_this_plugin
6
+ flunk
7
+ end
8
+ end
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,65 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: matid-concerned_with
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Mateusz Drozdzynski
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-10-09 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description:
17
+ email: matid@matid.net
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - .gitignore
26
+ - MIT-LICENSE
27
+ - README
28
+ - Rakefile
29
+ - VERSION
30
+ - init.rb
31
+ - install.rb
32
+ - lib/concerned_with.rb
33
+ - tasks/concerned_with_tasks.rake
34
+ - test/concerned_with_test.rb
35
+ - uninstall.rb
36
+ has_rdoc: true
37
+ homepage: http://github.com/matid/concerned_with
38
+ licenses: []
39
+
40
+ post_install_message:
41
+ rdoc_options:
42
+ - --charset=UTF-8
43
+ require_paths:
44
+ - lib
45
+ required_ruby_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: "0"
50
+ version:
51
+ required_rubygems_version: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: "0"
56
+ version:
57
+ requirements: []
58
+
59
+ rubyforge_project:
60
+ rubygems_version: 1.3.4
61
+ signing_key:
62
+ specification_version: 3
63
+ summary: Simple way to separate model and controller concerns into separate files.
64
+ test_files:
65
+ - test/concerned_with_test.rb