activesupport-decorators 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +4 -0
- data/Rakefile +17 -0
- data/lib/active_support_decorators/active_support_decorators.rb +34 -0
- data/lib/active_support_decorators/dependencies_patch.rb +11 -0
- data/lib/active_support_decorators/version.rb +3 -0
- data/lib/activesupport-decorators.rb +2 -0
- metadata +65 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a22f99e79b704ddf3d114c4e995ec75790a96a79
|
4
|
+
data.tar.gz: da8b53bd8f8ed6ce86d96e71cfb0ea06fcd81e36
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ef3fbcc96854c5a9505edd6bcd3636765693450193d2a993fedfc9ac89f438b2f6d1d775d51fdcf1dbbdd3eb3f37ed37bbe68ac6df29cc6e41a9c72d8a574808
|
7
|
+
data.tar.gz: 1924715f6dd6bdfb13a69b146b38095fb62fef5f022c8e421b8005555414a110a1352dba79660c519698d87b634d1e365e2f75134b16c29c9b805627557339f0
|
data/README.md
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'ActiveSupportDecorators'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.rdoc')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
Bundler::GemHelper.install_tasks
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module ActiveSupportDecorators
|
2
|
+
def self.auto_decorate_paths=(path_array)
|
3
|
+
@auto_decorate_paths = path_array
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.auto_decorate_paths
|
7
|
+
@auto_decorate_paths ||= []
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.auto_decorate_provider_paths=(path_array)
|
11
|
+
@auto_decorate_provider_paths = path_array
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.auto_decorate_provider_paths
|
15
|
+
@auto_decorate_provider_paths ||= []
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.load_path_order(file_name)
|
19
|
+
file_name_order = [file_name]
|
20
|
+
|
21
|
+
if auto_decorate_paths.any? { |path| file_name.starts_with?(path) }
|
22
|
+
relative_name = file_name.gsub(Rails.root.to_s, '')
|
23
|
+
|
24
|
+
auto_decorate_provider_paths.each do |path|
|
25
|
+
decorator_file = "#{path}#{relative_name}"
|
26
|
+
if File.file?(decorator_file) || File.file?(decorator_file + '.rb')
|
27
|
+
file_name_order << decorator_file
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
file_name_order
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'active_support/dependencies'
|
2
|
+
|
3
|
+
module ActiveSupport::Dependencies
|
4
|
+
alias_method :require_or_load_without_multiple, :require_or_load
|
5
|
+
|
6
|
+
def require_or_load(file_name, const_path = nil)
|
7
|
+
ActiveSupportDecorators.load_path_order(file_name).each do |path|
|
8
|
+
require_or_load_without_multiple(path, const_path)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activesupport-decorators
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Pierre Pretorius
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-02-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.0'
|
27
|
+
description: Useful when extending functionality with Rails engines.
|
28
|
+
email:
|
29
|
+
- pierre@labs.epiuse.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- lib/active_support_decorators/active_support_decorators.rb
|
35
|
+
- lib/active_support_decorators/dependencies_patch.rb
|
36
|
+
- lib/active_support_decorators/version.rb
|
37
|
+
- lib/activesupport-decorators.rb
|
38
|
+
- Rakefile
|
39
|
+
- README.md
|
40
|
+
homepage: https://github.com/pierre-pretorius/activesupport-decorators
|
41
|
+
licenses:
|
42
|
+
- MIT
|
43
|
+
metadata: {}
|
44
|
+
post_install_message:
|
45
|
+
rdoc_options: []
|
46
|
+
require_paths:
|
47
|
+
- lib
|
48
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
50
|
+
- - '>='
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
53
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
requirements: []
|
59
|
+
rubyforge_project:
|
60
|
+
rubygems_version: 2.0.2
|
61
|
+
signing_key:
|
62
|
+
specification_version: 4
|
63
|
+
summary: Adds the decorator pattern to activesupport class loading.
|
64
|
+
test_files: []
|
65
|
+
has_rdoc:
|