parlement 0.6 → 0.7
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/CHANGES +13 -0
- data/README +51 -38
- data/app/controllers/account_controller.rb +65 -37
- data/app/controllers/application.rb +1 -1
- data/app/controllers/elt_controller.rb +1 -0
- data/app/models/elt.rb +25 -14
- data/app/models/mail.rb +36 -35
- data/app/models/mail_notify.rb +23 -0
- data/app/views/account/_login.rhtml +1 -1
- data/app/views/account/_show.rhtml +22 -5
- data/app/views/elt/_elt.rhtml +44 -47
- data/app/views/elt/_listByDate.rhtml +7 -7
- data/app/views/elt/show.rhtml +3 -3
- data/app/views/layouts/top.rhtml +1 -0
- data/app/views/person/show.rhtml +5 -0
- data/config/environment.rb +1 -1
- data/db/ROOT/parlement/Parlement_fr.txt +46 -0
- data/db/ROOT/parlement/news/Version_06.txt +25 -0
- data/db/ROOT/parlement/news/Version_07.txt +12 -0
- data/db/ROOT/parlement/test.txt +14 -5
- data/db/ROOT/parlement.txt +2 -0
- data/db/development_structure.sql +119 -44
- data/db/migrate/004_people_image.rb +9 -0
- data/lib/data_import.rb +9 -13
- data/public/javascripts/mybehaviour.js +41 -0
- data/test/fixtures/img.png +0 -0
- data/test/fixtures/mail/avatar +249 -0
- data/test/fixtures/people.yml +1 -1
- data/test/functional/account_controller_test.rb +108 -56
- data/test/functional/elt_controller_test.rb +6 -6
- data/test/unit/elt_test.rb +1 -1
- data/test/unit/mail_test.rb +17 -0
- data/vendor/plugins/engines/CHANGELOG +91 -53
- data/vendor/plugins/engines/README +1 -1
- data/vendor/plugins/engines/generators/engine/templates/init_engine.erb +6 -4
- data/vendor/plugins/engines/generators/engine/templates/test/test_helper.erb +5 -1
- data/vendor/plugins/engines/init.rb +8 -3
- data/vendor/plugins/engines/lib/engines/action_mailer_extensions.rb +6 -5
- data/vendor/plugins/engines/lib/engines/action_view_extensions.rb +10 -6
- data/vendor/plugins/engines/lib/engines/active_record_extensions.rb +3 -1
- data/vendor/plugins/engines/lib/engines/dependencies_extensions.rb +27 -16
- data/vendor/plugins/engines/lib/engines/routing_extensions.rb +28 -0
- data/vendor/plugins/engines/lib/engines/testing_extensions.rb +6 -2
- data/vendor/plugins/engines/lib/engines.rb +77 -12
- data/vendor/plugins/engines/tasks/deprecated_engines.rake +7 -0
- data/vendor/plugins/engines/tasks/engines.rake +25 -10
- data/vendor/plugins/login_engine/CHANGELOG +8 -0
- data/vendor/plugins/login_engine/README +2 -2
- data/vendor/plugins/login_engine/app/controllers/user_controller.rb +4 -1
- data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +1 -1
- data/vendor/plugins/login_engine/init_engine.rb +6 -5
- data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +1 -1
- data/vendor/plugins/output_compression/CHANGELOG +0 -0
- data/vendor/plugins/output_compression/MIT-LICENSE +20 -0
- data/vendor/plugins/output_compression/README +4 -4
- data/vendor/plugins/output_compression/init.rb +1 -2
- data/vendor/plugins/output_compression/lib/output_compression.rb +84 -66
- data/vendor/plugins/output_compression/{Rakefile → rakefile} +22 -22
- data/vendor/plugins/output_compression/test/output_test.rb +11 -0
- data/vendor/plugins/output_compression/test/test_controller.rb +3 -0
- data/vendor/plugins/output_compression/test/test_helper.rb +14 -0
- data/vendor/plugins/responds_to_parent/MIT-LICENSE +20 -0
- data/vendor/plugins/responds_to_parent/README +42 -0
- data/vendor/plugins/responds_to_parent/Rakefile +22 -0
- data/vendor/plugins/responds_to_parent/init.rb +1 -0
- data/vendor/plugins/responds_to_parent/lib/responds_to_parent.rb +45 -0
- data/vendor/plugins/responds_to_parent/test/responds_to_parent_test.rb +115 -0
- metadata +33 -16
- data/vendor/plugins/login_engine/tasks/tasks.rake +0 -4
- data/vendor/plugins/output_compression/tasks/output_compression_tasks.rake +0 -4
- data/vendor/plugins/output_compression/test/output_compression_test.rb +0 -8
- /data/db/ROOT/parlement/news/{release0.1.txt → Version_01.txt} +0 -0
- /data/db/ROOT/parlement/news/{release0.2.txt → Version_02.txt} +0 -0
- /data/db/ROOT/parlement/news/{release0.3.txt → Version_03.txt} +0 -0
- /data/db/ROOT/parlement/news/{release0.4.txt → Version_04.txt} +0 -0
- /data/db/ROOT/parlement/news/{release0.5.txt → Version_05.txt} +0 -0
data/test/unit/mail_test.rb
CHANGED
@@ -210,5 +210,22 @@ class MailTest < Test::Unit::TestCase
|
|
210
210
|
assert_equal 1, eltChild2.result
|
211
211
|
assert_equal 1, elt.result
|
212
212
|
end
|
213
|
+
|
214
|
+
def test_receive_avatar
|
215
|
+
mail = TMail::Mail.parse(read_fixture('avatar').to_s)
|
216
|
+
elt = Mail.receive(mail).elt
|
217
|
+
assert elt.person.image.match(/^\/attachment\/file\/Re_people\/#{mail.parts.last.disposition_param('filename')}$/)
|
218
|
+
end
|
219
|
+
|
220
|
+
def test_send_avatar
|
221
|
+
ActionMailer::Base.deliveries = []
|
222
|
+
deliveredMailsCount = ActionMailer::Base.deliveries.size
|
223
|
+
mail = TMail::Mail.parse(read_fixture('avatar').to_s)
|
224
|
+
elt = Mail.receive(mail).elt
|
225
|
+
assert_equal deliveredMailsCount + 2, ActionMailer::Base.deliveries.size
|
226
|
+
assert_equal 1, elt.attachments.size
|
227
|
+
assert_equal "image/jpeg", elt.attachments.first.content_type
|
228
|
+
assert_equal 2, ActionMailer::Base.deliveries.last.parts.size
|
229
|
+
end
|
213
230
|
end
|
214
231
|
|
@@ -1,99 +1,137 @@
|
|
1
1
|
*SVN*
|
2
2
|
|
3
3
|
|
4
|
+
-----
|
5
|
+
1.1.4
|
6
|
+
|
7
|
+
Fixed creation of multipart emails (Ticket #190)
|
8
|
+
Added a temporary fix to the code-mixing issue. In your engine's test/test_helper.rb, please add the following lines:
|
9
|
+
|
10
|
+
# Ensure that the code mixing and view loading from the application is disabled
|
11
|
+
Engines.disable_app_views_loading = true
|
12
|
+
Engines.disable_app_code_mixing = true
|
13
|
+
|
14
|
+
is will prevent code mixing for controllers and helpers, and loading views from the application. One thing to remember is to load any controllers/helpers using 'require_or_load' in your tests, to ensure that the engine behaviour is respected (Ticket #135)
|
15
|
+
Added tasks to easily test engines individually (Ticket #120)
|
16
|
+
Fixture extensions will now fail with an exception if the corresponding class cannot be loaded (Ticket #138)
|
17
|
+
Patch for new routing/controller loading in Rails 1.1.6. The routing code is now replaced with the contents of config.controller_paths, along with controller paths from any started engines (Ticket #196)
|
18
|
+
Rails' Configuration instance is now stored, and available from all engines and plugins.
|
19
|
+
|
20
|
+
|
21
|
+
-----
|
22
|
+
1.1.3
|
23
|
+
|
24
|
+
Fixed README to show 'models' rather than 'model' class (Ticket #167)
|
25
|
+
Fixed dependency loading to work with Rails 1.1.4 (Ticket #180)
|
26
|
+
|
27
|
+
|
28
|
+
-----
|
29
|
+
1.1.2
|
30
|
+
|
31
|
+
Added better fix to version checking (Ticket #130, jdell@gbdev.com).
|
32
|
+
Fixed generated init_engine.rb so that VERSION module doesn't cause probems (Ticket #131, japgolly@gmail.com)
|
33
|
+
Fixed error with Rails 1.0 when trying to ignore the engine_schema_info table (Ticket #132, snowblink@gmail.com)
|
34
|
+
Re-added old style rake tasks (Ticket #133)
|
35
|
+
No longer adding all subdirectories of <engine>/app or <engine>/lib, as this can cause issues when files are grouped in modules (Ticket #149, kasatani@gmail.com)
|
36
|
+
Fixed engine precidence ordering for Rails 1.1 (Ticket #146)
|
37
|
+
Added new Engines.each method to assist in processing the engines in the desired order (Ticket #146)
|
38
|
+
Fixed annoying error message at appears when starting the console in development mode (Ticket #134)
|
39
|
+
Engines is now super-careful about loading the correct version of Rails from vendor (Ticket #154)
|
40
|
+
|
41
|
+
|
4
42
|
-----
|
5
43
|
1.1.1
|
6
44
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
45
|
+
Fixed migration rake task failing when given a specific version (Ticket #115)
|
46
|
+
Added new rake task "test:engines" which will test engines (and other plugins) but ensure that the test database is cloned from development beforehand (Ticket #125)
|
47
|
+
Fixed issue where 'engine_schema_info' table was included in schema dumps (Ticket #87)
|
48
|
+
Fixed multi-part emails (Ticket #121)
|
49
|
+
Added an 'install.rb' file to new engines created by the bundled generator, which installs the engines plugin automatically if it doesn't already exist (Ticket #122)
|
50
|
+
Added a default VERSION module to generated engines (Ticket #123)
|
51
|
+
Refactored copying of engine's public files to a method of an Engine instance. You can now call Engines.get(:engine_name).copy_public_files (Ticket #108)
|
52
|
+
Changed engine generator templates from .rb files to .erb files (Ticket #106)
|
53
|
+
Fixed the test_helper.erb file to use the correct testing extensions and not load any schema - the schema will be cloned automatically via rake test:engines
|
54
|
+
Fixed problem when running with Rails 1.1.1 where version wasn't determined correctly (Ticket #129)
|
55
|
+
Fixed bug preventing engines from loading when both Rails 1.1.0 and 1.1.1 gems are installed and in use.
|
56
|
+
Updated version (d'oh!)
|
19
57
|
|
20
58
|
|
21
59
|
-----
|
22
60
|
1.1.0
|
23
61
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
62
|
+
Improved regexp matching for Rails 1.0 engines with peculiar paths
|
63
|
+
Engine instance objects can be accessed via Engines[:name], an alias for Engines.get(:name) (Ticket #99)
|
64
|
+
init_engine.rb is now processed as the final step in the Engine.start process, so it can access files within the lib directory, which is now in the $LOAD_PATH at that point. (Ticket #99)
|
65
|
+
Clarified MIT license (Ticket #98)
|
66
|
+
Updated Rake tasks to integrate smoothly with Rails 1.1 namespaces
|
67
|
+
Changed the version to "1.1.0 (svn)"
|
68
|
+
Added more information about using the plugin with Edge Rails to the README
|
69
|
+
moved extensions into lib/engines/ directory to enable use of Engines module in extension code.
|
70
|
+
Added conditional require_or_load method which attempts to detect the current Rails version. To use the Edge Rails version of the loading mechanism, add the line:
|
71
|
+
Engines.config :edge, true
|
72
|
+
to your environment.rb file.
|
73
|
+
Merged changes from /branches/edge and /branches/rb_1.0 into /trunk
|
74
|
+
engine_schema_info now respects the prefix/suffixes set for ActiveRecord::Base (Ticket #67)
|
75
|
+
added ActiveRecord::Base.wrapped_table_name(name) method to assist in determining the correct table name
|
38
76
|
|
39
77
|
|
40
78
|
-----
|
41
79
|
1.0.6
|
42
80
|
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
81
|
+
Added ability to determine version information for engines: rake engine_info
|
82
|
+
Added a custom logger for the Engines module, to stop pollution of the Rails logs.
|
83
|
+
Added some more tests (in particular, see rails_engines/applications/engines_test).
|
84
|
+
Another attempt at solving Ticket #53 - controllers and helpers should now be loadable from modules, and if a full path (including RAILS_ROOT/ENGINES_ROOT) is given, it should be safely stripped from the require filename such that corresponding files can be located in any active engines. In other words, controller/helper overloading should now completely work, even if the controllers/helpers are in modules.
|
85
|
+
Added (finally) patch from Ticket #22 - ActionMailer helpers should now load
|
86
|
+
Removed support for Engines.start :engine, :engine_name => 'whatever'. It was pointless.
|
87
|
+
Fixed engine name referencing; engine_stylesheet/engine_javascript can now happily use shorthand engine names (i.e. :test == :test_engine) (Ticket #45)
|
88
|
+
Fixed minor documentation error ('Engine.start' ==> 'Engines.start') (Ticket #57)
|
89
|
+
Fixed double inclusion of RAILS_ROOT in engine_migrate rake task (Ticket #61)
|
90
|
+
Added ability to force config values even if given as a hash (Ticket #62)
|
53
91
|
|
54
92
|
|
55
93
|
-----
|
56
94
|
1.0.5
|
57
95
|
|
58
|
-
|
96
|
+
Fixed bug stopping fixtures from loading with PostgreSQL
|
59
97
|
|
60
98
|
|
61
99
|
-----
|
62
100
|
1.0.4
|
63
101
|
|
64
|
-
|
102
|
+
Another attempt at loading controllers within modules (Ticket #56)
|
65
103
|
|
66
104
|
|
67
105
|
-----
|
68
106
|
1.0.3
|
69
107
|
|
70
|
-
|
108
|
+
Fixed serious dependency bug stopping controllers being loaded (Ticket #56)
|
71
109
|
|
72
110
|
|
73
111
|
-----
|
74
112
|
1.0.2
|
75
113
|
|
76
|
-
|
77
|
-
|
78
|
-
|
114
|
+
Fixed bug with overloading controllers in modules from /app directory
|
115
|
+
Fixed exception thrown when public files couldn't be created; exception is now logged (Ticket #52)
|
116
|
+
Fixed problem with generated test_helper.rb file via File.expand_path (Ticket #50)
|
79
117
|
|
80
118
|
|
81
119
|
-----
|
82
120
|
1.0.1
|
83
121
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
122
|
+
Added engine generator for creation of new engines
|
123
|
+
Fixed 'Engine' typo in README
|
124
|
+
Fixed bug in fixtures extensions
|
125
|
+
Fixed /lib path management bug
|
126
|
+
Added method to determine public directory location from Engine object
|
127
|
+
Fixed bug in the error message in get_engine_dir()
|
128
|
+
Added proper component loading
|
129
|
+
Added preliminary tests for the config() methods module
|
92
130
|
|
93
131
|
|
94
132
|
-----
|
95
133
|
pre-v170
|
96
134
|
|
97
|
-
|
98
|
-
|
99
|
-
|
135
|
+
Fixed copyright notices to point to DHH, rather than me.
|
136
|
+
Moved extension require statements into lib/engines.rb, so the will be loaded if another module/file calls require 'engines
|
137
|
+
Added a CHANGELOG file (this file)
|
@@ -1,9 +1,11 @@
|
|
1
1
|
<%= license %>
|
2
2
|
|
3
|
-
module <%= engine_class_name
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
module <%= engine_class_name %>
|
4
|
+
module VERSION
|
5
|
+
Major = 0 # change implies compatibility breaking with previous versions
|
6
|
+
Minor = 1 # change implies backwards-compatible change to API
|
7
|
+
Release = 0 # incremented with bug-fixes, updates, etc.
|
8
|
+
end
|
7
9
|
end
|
8
10
|
|
9
11
|
Engines.current.version = <%= engine_class_name %>::VERSION
|
@@ -3,6 +3,10 @@ require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper
|
|
3
3
|
# ensure that the Engines testing enhancements are loaded.
|
4
4
|
require File.join(Engines.config(:root), "engines", "lib", "engines", "testing_extensions")
|
5
5
|
|
6
|
+
# Ensure that the code mixing and view loading from the application is disabled
|
7
|
+
Engines.disable_app_views_loading = true
|
8
|
+
Engines.disable_app_code_mixing = true
|
9
|
+
|
6
10
|
# force these config values
|
7
11
|
module <%= engine_class_name %>
|
8
12
|
# config :some_option, "some_value"
|
@@ -10,4 +14,4 @@ end
|
|
10
14
|
|
11
15
|
# set up the fixtures location
|
12
16
|
Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
|
13
|
-
$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
|
17
|
+
$LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
|
@@ -25,17 +25,17 @@
|
|
25
25
|
# = IN OTHER WORDS:
|
26
26
|
#
|
27
27
|
# You are free to use this software as you please, but if it breaks you'd
|
28
|
-
# come a'cryin...
|
28
|
+
# best not come a'cryin...
|
29
29
|
#++
|
30
30
|
|
31
|
-
|
31
|
+
# Load the engines & bundles extensions
|
32
32
|
require 'engines'
|
33
33
|
require 'bundles'
|
34
34
|
|
35
35
|
module ::Engines::Version
|
36
36
|
Major = 1 # change implies compatibility breaking with previous versions
|
37
37
|
Minor = 1 # change implies backwards-compatible change to API
|
38
|
-
Release =
|
38
|
+
Release = 4 # incremented with bug-fixes, updates, etc.
|
39
39
|
end
|
40
40
|
|
41
41
|
#--
|
@@ -46,3 +46,8 @@ if !File.exist?(Engines.config(:root))
|
|
46
46
|
FileUtils.mkdir_p(Engines.config(:root))
|
47
47
|
end
|
48
48
|
|
49
|
+
# Keep a hold of the Rails Configuration object
|
50
|
+
Engines.rails_config = config
|
51
|
+
|
52
|
+
# Initialize the routing (controller_paths)
|
53
|
+
Engines.initialize_routing
|
@@ -51,9 +51,11 @@ module ActionMailer
|
|
51
51
|
# normal template exists (or if there were no implicit parts) we render
|
52
52
|
# it.
|
53
53
|
template_exists = @parts.empty?
|
54
|
-
#template_exists ||= Dir.glob("#{template_path}/#{@template}.*").any? { |i| i.split(".").length == 2 }
|
55
|
-
template_exists ||= templates.any?
|
56
|
-
|
54
|
+
# template_exists ||= Dir.glob("#{template_path}/#{@template}.*").any? { |i| i.split(".").length == 2 }
|
55
|
+
template_exists ||= templates.any? do |i|
|
56
|
+
arr = File.basename(i).split(".")
|
57
|
+
(arr.length == 2) && (arr[0] == @template)
|
58
|
+
end
|
57
59
|
@body = render_message(@template, @body) if template_exists
|
58
60
|
|
59
61
|
# Finally, if there are other message parts and a textual body exists,
|
@@ -86,7 +88,7 @@ module ActionMailer
|
|
86
88
|
# Return all ActionView template paths from the app and all Engines
|
87
89
|
def template_paths
|
88
90
|
paths = [template_path]
|
89
|
-
Engines.
|
91
|
+
Engines.each { |engine|
|
90
92
|
# add a path for every engine if one exists.
|
91
93
|
engine_template_path = File.join(engine.root, "app", "views", mailer_name)
|
92
94
|
paths << engine_template_path if File.exists?(engine_template_path)
|
@@ -129,7 +131,6 @@ module ActionMailer
|
|
129
131
|
# template root
|
130
132
|
def initialize_template_class(assigns, method_name)
|
131
133
|
engine_template = find_template_root_for(method_name)
|
132
|
-
#ActionView::Base.new(engine_template, assigns, self)
|
133
134
|
action_view_class = Class.new(ActionView::Base).send(:include, master_helper_module)
|
134
135
|
action_view_class.new(engine_template, assigns, self)
|
135
136
|
end
|
@@ -2,18 +2,22 @@ require 'fileutils'
|
|
2
2
|
|
3
3
|
module ::ActionView
|
4
4
|
class Base
|
5
|
+
|
5
6
|
private
|
6
7
|
def full_template_path(template_path, extension)
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
unless Engines.disable_app_views_loading
|
10
|
+
# If the template exists in the normal application directory,
|
11
|
+
# return that path
|
12
|
+
default_template = "#{@base_path}/#{template_path}.#{extension}"
|
13
|
+
return default_template if File.exist?(default_template)
|
14
|
+
end
|
12
15
|
|
13
16
|
# Otherwise, check in the engines to see if the template can be found there.
|
14
17
|
# Load this in order so that more recently started Engines will take priority.
|
15
|
-
Engines.
|
16
|
-
site_specific_path = File.join(engine.root, 'app', 'views',
|
18
|
+
Engines.each(:precidence_order) do |engine|
|
19
|
+
site_specific_path = File.join(engine.root, 'app', 'views',
|
20
|
+
template_path.to_s + '.' + extension.to_s)
|
17
21
|
return site_specific_path if File.exist?(site_specific_path)
|
18
22
|
end
|
19
23
|
|
@@ -16,4 +16,6 @@ module ::ActiveRecord
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# Set ActiveRecord to ignore the engine_schema_info table by default
|
19
|
-
::
|
19
|
+
unless Rails::VERSION::STRING =~ /^1\.0\./
|
20
|
+
::ActiveRecord::SchemaDumper.ignore_tables << 'engine_schema_info'
|
21
|
+
end
|
@@ -8,9 +8,11 @@ module ::Dependencies
|
|
8
8
|
def require_or_load(file_name)
|
9
9
|
if Engines.config(:edge)
|
10
10
|
rails_edge_require_or_load(file_name)
|
11
|
+
|
11
12
|
elsif Rails::VERSION::STRING =~ /^1.1/
|
12
13
|
# otherwise, assume we're on trunk (1.1 at the moment)
|
13
14
|
rails_1_1_require_or_load(file_name)
|
15
|
+
|
14
16
|
elsif Rails::VERSION::STRING =~ /^1.0/
|
15
17
|
# use the old dependency load method
|
16
18
|
rails_1_0_require_or_load(file_name)
|
@@ -22,37 +24,42 @@ module ::Dependencies
|
|
22
24
|
end
|
23
25
|
|
24
26
|
def rails_1_1_require_or_load(file_name)
|
25
|
-
file_name = $1 if file_name =~ /^(.*)\.rb$/
|
26
|
-
|
27
27
|
Engines.log.debug("Engines 1.1 require_or_load: #{file_name}")
|
28
28
|
|
29
|
+
found = false
|
30
|
+
|
29
31
|
# try and load the engine code first
|
30
32
|
# can't use model, as there's nothing in the name to indicate that the file is a 'model' file
|
31
33
|
# rather than a library or anything else.
|
32
34
|
['controller', 'helper'].each do |type|
|
33
35
|
# if we recognise this type
|
34
|
-
|
36
|
+
# (this regexp splits out the module/filename from any instances of app/#{type}, so that
|
37
|
+
# modules are still respected.)
|
38
|
+
if file_name =~ /^(.*app\/#{type}s\/)?(.*_#{type})(\.rb)?$/
|
35
39
|
|
36
|
-
# ... go through the active engines from
|
37
|
-
|
40
|
+
# ... go through the active engines from first started to last, so that
|
41
|
+
# code with a high precidence (started later) will override lower precidence
|
42
|
+
# implementations
|
43
|
+
Engines.each(:load_order) do |engine|
|
38
44
|
|
39
|
-
engine_file_name = File.expand_path(File.join(engine.root, 'app', "#{type}s",
|
40
|
-
engine_file_name = $1 if engine_file_name =~ /^(.*)\.rb$/
|
41
|
-
Engines.log.debug("
|
45
|
+
engine_file_name = File.expand_path(File.join(engine.root, 'app', "#{type}s", $2))
|
46
|
+
#engine_file_name = $1 if engine_file_name =~ /^(.*)\.rb$/
|
47
|
+
Engines.log.debug("checking engine '#{engine.name}' for '#{engine_file_name}'")
|
42
48
|
if File.exist?("#{engine_file_name}.rb")
|
43
49
|
Engines.log.debug("==> loading from engine '#{engine.name}'")
|
44
50
|
rails_pre_engines_require_or_load(engine_file_name)
|
51
|
+
found = true
|
45
52
|
end
|
46
53
|
end
|
47
54
|
end
|
48
55
|
end
|
49
56
|
|
50
57
|
# finally, load any application-specific controller classes using the 'proper'
|
51
|
-
# rails load mechanism
|
52
|
-
|
58
|
+
# rails load mechanism, EXCEPT when we're testing engines and could load this file
|
59
|
+
# from an engine
|
60
|
+
rails_pre_engines_require_or_load(file_name) unless Engines.disable_app_code_mixing && found
|
53
61
|
end
|
54
62
|
|
55
|
-
|
56
63
|
def rails_1_0_require_or_load(file_name)
|
57
64
|
file_name = $1 if file_name =~ /^(.*)\.rb$/
|
58
65
|
|
@@ -61,16 +68,17 @@ module ::Dependencies
|
|
61
68
|
# if the file_name ends in "_controller" or "_controller.rb", strip all
|
62
69
|
# path information out of it except for module context, and load it. Ditto
|
63
70
|
# for helpers.
|
64
|
-
if file_name =~ /_controller(.rb)?$/
|
71
|
+
found = if file_name =~ /_controller(.rb)?$/
|
65
72
|
require_engine_files(file_name, 'controller')
|
66
73
|
elsif file_name =~ /_helper(.rb)?$/ # any other files we can do this with?
|
67
74
|
require_engine_files(file_name, 'helper')
|
68
75
|
end
|
69
76
|
|
70
77
|
# finally, load any application-specific controller classes using the 'proper'
|
71
|
-
# rails load mechanism
|
78
|
+
# rails load mechanism, EXCEPT when we're testing engines and could load this file
|
79
|
+
# from an engine
|
72
80
|
Engines.log.debug("--> loading from application: '#{file_name}'")
|
73
|
-
rails_pre_engines_require_or_load(file_name)
|
81
|
+
rails_pre_engines_require_or_load(file_name) unless Engines.disable_app_code_mixing && found
|
74
82
|
Engines.log.debug("--> Done loading.")
|
75
83
|
end
|
76
84
|
|
@@ -86,10 +94,11 @@ module ::Dependencies
|
|
86
94
|
# then you might have trouble. Sorry, just please don't have your web application
|
87
95
|
# running under a path like that.
|
88
96
|
def require_engine_files(file_name, type='')
|
97
|
+
found = false
|
89
98
|
Engines.log.debug "requiring #{type} file '#{file_name}'"
|
90
99
|
processed_file_name = file_name.gsub(/[\w\W\/\.]*app\/#{type}s\//, '')
|
91
100
|
Engines.log.debug "--> rewrote to '#{processed_file_name}'"
|
92
|
-
Engines.
|
101
|
+
Engines.each(:load_order) do |engine|
|
93
102
|
engine_file_name = File.join(engine.root, 'app', "#{type}s", processed_file_name)
|
94
103
|
engine_file_name += '.rb' unless ! load? || engine_file_name[-3..-1] == '.rb'
|
95
104
|
Engines.log.debug "--> checking '#{engine.name}' for #{engine_file_name}"
|
@@ -97,8 +106,10 @@ module ::Dependencies
|
|
97
106
|
(engine_file_name[-3..-1] != '.rb' && File.exist?(engine_file_name + '.rb'))
|
98
107
|
Engines.log.debug "--> found, loading from engine '#{engine.name}'"
|
99
108
|
rails_pre_engines_require_or_load(engine_file_name)
|
109
|
+
found = true
|
100
110
|
end
|
101
|
-
end
|
111
|
+
end
|
112
|
+
found
|
102
113
|
end
|
103
114
|
end
|
104
115
|
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module ActionController
|
2
|
+
module Routing
|
3
|
+
|
4
|
+
class << self
|
5
|
+
# This holds the global list of valid controller paths
|
6
|
+
attr_accessor :controller_paths
|
7
|
+
end
|
8
|
+
|
9
|
+
class ControllerComponent
|
10
|
+
class << self
|
11
|
+
protected
|
12
|
+
def safe_load_paths #:nodoc:
|
13
|
+
if defined?(RAILS_ROOT)
|
14
|
+
paths = $LOAD_PATH.select do |base|
|
15
|
+
base = File.expand_path(base)
|
16
|
+
# Check that the path matches one of the allowed paths in controller_paths
|
17
|
+
base.match(/^#{ActionController::Routing.controller_paths.map { |p| File.expand_path(p) } * '|'}/)
|
18
|
+
end
|
19
|
+
Engines.log.debug "Engines safe_load_paths: #{paths.inspect}"
|
20
|
+
paths
|
21
|
+
else
|
22
|
+
$LOAD_PATH
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -83,8 +83,12 @@ class Fixtures < YAML::Omap
|
|
83
83
|
if load_instances
|
84
84
|
ActiveRecord::Base.silence do
|
85
85
|
fixtures.each do |name, fixture|
|
86
|
-
|
87
|
-
|
86
|
+
begin
|
87
|
+
if model = fixture.find
|
88
|
+
object.instance_variable_set "@#{name}", model
|
89
|
+
end
|
90
|
+
rescue FixtureClassNotFound
|
91
|
+
# Let's hope the developer has included it himself
|
88
92
|
end
|
89
93
|
end
|
90
94
|
end
|