active_support-dependencies_patch 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.
@@ -0,0 +1,4 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in active_support-dependencies_patch.gemspec
4
+ gemspec
data/README ADDED
@@ -0,0 +1,2 @@
1
+ Allow gems to provide models which are then extended by the app
2
+ Based on code at https://gist.github.com/910368#file_as_dependencies_patch.rb
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,24 @@
1
+ # -*- encoding: utf-8 -*-
2
+ x = File.expand_path( File.join( File.dirname(__FILE__), "lib" ) )
3
+ $:.push x unless $:.member?(x)
4
+ require "active_support-dependencies_patch/version"
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "active_support-dependencies_patch"
8
+ s.version = ActiveSupport::DependenciesPatch::VERSION
9
+ s.authors = ["Mark Lanett"]
10
+ s.email = ["mark.lanett@gmail.com"]
11
+ s.homepage = ""
12
+ s.summary = %q{Allow gems to provide models which are then extended by the app}
13
+ s.description = %q{Based on code at https://gist.github.com/910368#file_as_dependencies_patch.rb}
14
+
15
+ s.rubyforge_project = "active_support-dependencies_patch"
16
+
17
+ s.files = `git ls-files`.split("\n")
18
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
+ s.require_paths = ["lib"]
21
+
22
+ s.add_dependency "activesupport"
23
+ s.add_development_dependency "minitest"
24
+ end
@@ -0,0 +1,59 @@
1
+ require "active_support-dependencies_patch/version"
2
+ require "active_support/deprecation" # must require before dependencies
3
+ require "active_support/dependencies"
4
+
5
+ module ActiveSupport::Dependencies
6
+
7
+ def engine_paths()
8
+ @engine_paths ||= begin
9
+ begin
10
+ # Rails 3.1 onwards
11
+ Rails::Application::Railties.engines.collect { |engine| engine.config.root.to_s }
12
+ rescue
13
+ begin
14
+ # Rails 3.0
15
+ Rails::Application.railties.engines.collect { |engine| engine.config.root.to_s }
16
+ rescue
17
+ # Rails 2.x
18
+ [] # must be manually registered via ActiveSupport::Dependencies.engine_paths << engine
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ # alias new name 'require_or_load_without_multiple' to existing method 'require_or_load'
25
+ alias_method :require_or_load_without_multiple, :require_or_load
26
+
27
+ # redefine the method
28
+ def require_or_load(file_name, const_path = nil)
29
+ if file_name.starts_with?( "#{Rails.root}/app" ) || file_name.starts_with?( "#{Rails.root}/lib" )
30
+ relative_name = file_name.gsub( Rails.root.to_s, '' )
31
+ engine_paths.each do |path|
32
+ engine_file = File.join( path, relative_name )
33
+
34
+ # call the original method
35
+ if File.file?( engine_file ) then
36
+ observe_require( "engine file #{engine_file} path #{const_path}" ) {
37
+ require_or_load_without_multiple( engine_file, const_path )
38
+ }
39
+ end
40
+ end
41
+ end
42
+
43
+ # call the original method
44
+ observe_require( "original file #{file_name} path #{const_path}" ) {
45
+ require_or_load_without_multiple( file_name, const_path )
46
+ }
47
+ end
48
+
49
+ def observe_require( file )
50
+ yield
51
+ rescue => x
52
+ # STDERR.puts "AS:DP Failed to required #{file} due to an error #{x.inspect}"
53
+ raise x
54
+ else
55
+ # STDERR.puts "AS:DP Required #{file}"
56
+ end
57
+ end
58
+
59
+ #puts "AD:SP loaded"
@@ -0,0 +1,5 @@
1
+ module ActiveSupport
2
+ module DependenciesPatch
3
+ VERSION = "0.0.4"
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,74 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: active_support-dependencies_patch
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.4
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Mark Lanett
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-03-10 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: activesupport
16
+ requirement: &70109955996820 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *70109955996820
25
+ - !ruby/object:Gem::Dependency
26
+ name: minitest
27
+ requirement: &70109955996400 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *70109955996400
36
+ description: Based on code at https://gist.github.com/910368#file_as_dependencies_patch.rb
37
+ email:
38
+ - mark.lanett@gmail.com
39
+ executables: []
40
+ extensions: []
41
+ extra_rdoc_files: []
42
+ files:
43
+ - .gitignore
44
+ - Gemfile
45
+ - README
46
+ - Rakefile
47
+ - active_support-dependencies_patch.gemspec
48
+ - lib/active_support-dependencies_patch.rb
49
+ - lib/active_support-dependencies_patch/version.rb
50
+ homepage: ''
51
+ licenses: []
52
+ post_install_message:
53
+ rdoc_options: []
54
+ require_paths:
55
+ - lib
56
+ required_ruby_version: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ required_rubygems_version: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ! '>='
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubyforge_project: active_support-dependencies_patch
70
+ rubygems_version: 1.8.16
71
+ signing_key:
72
+ specification_version: 3
73
+ summary: Allow gems to provide models which are then extended by the app
74
+ test_files: []