GitHub Sale: sign up for any paid plan this week and pay nothing until January 1, 2009!  [ hide ]

public
Description: Desert is a component framework for Rails that allows your plugins have a Rails app like directory structure, routes, migrations, and dependencies.
Homepage: http://desert.rubyforge.org
Clone URL: git://github.com/pivotal/desert.git
- Fix template loading on Edge Rails and on Rails 2.1.0


git-svn-id: svn+ssh://rubyforge.org/var/svn/pivotalrb/desert/trunk@1735 
af276e61-6b34-4dac-905b-574b5f35ef33
btakita (author)
Thu Jul 17 11:25:35 -0700 2008
commit  4ab2536cc477090535a0122baa0d44062c31fd19
tree    c0034194f8a2368c90c8ddc41ede14d0937d5bdc
parent  4c5beacb8b30fe2a6c087bf6ed87fd19d1e4ef48
...
 
 
1
2
3
...
1
2
3
4
5
0
@@ -1,3 +1,5 @@
0
+- Fix template loading on Edge Rails and on Rails 2.1.0
0
+
0
 0.3.1
0
 - Fix migration issue with Rails 2.1.0 using timestamps.
0
 
...
7
8
9
10
11
 
 
12
...
7
8
9
 
10
11
12
13
0
@@ -7,4 +7,5 @@ elsif Desert::VersionChecker.rails_version_is_below_rc2?
0
 else
0
   require "#{dir}/plugin_templates/2.0.0/action_mailer"
0
 end
0
-require "#{dir}/plugin_templates/action_view"
0
\ No newline at end of file
0
+require "#{dir}/plugin_templates/action_view"
0
+require "#{dir}/plugin_templates/view_paths"
0
\ No newline at end of file
...
 
1
2
3
4
5
6
7
8
9
10
11
12
13
 
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
 
 
 
 
 
123
 
 
 
 
124
125
126
...
1
2
 
 
 
 
 
 
 
 
 
 
 
 
3
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
6
7
8
9
10
11
12
13
14
15
16
17
0
@@ -1,125 +1,16 @@
0
+dir = File.dirname(__FILE__)
0
 if ActionView.const_defined?(:TemplateFinder)
0
- module ActionView #:nodoc:
0
- class TemplateFinder #:nodoc:
0
- def initialize_with_desert_plugins(*args)
0
- initialize_without_desert_plugins *args
0
-
0
- Desert::Manager.plugins.reverse.each do |plugin|
0
- append_view_path plugin.templates_path
0
- end
0
- end
0
- alias_method_chain :initialize, :desert_plugins
0
- end
0
- end
0
+ require "#{dir}/2.1.0/action_view"
0
 else
0
- module ActionView #:nodoc:
0
- class Base #:nodoc:
0
- if private_instance_methods.include?('find_template_extension_from_handler')
0
- if instance_methods.include?('template_handler_preferences')
0
- # Rails 1.99.0
0
- def find_template_extension_from_handler(template_path, formatted = nil)
0
- checked_template_path = formatted ? "#{template_path}.#{template_format}" : template_path
0
-
0
- view_paths.each do |view_path|
0
- template_handler_preferences.each do |template_type|
0
- extensions =
0
- case template_type
0
- when :javascript
0
- [:rjs]
0
- when :delegate
0
- @@template_handlers.keys
0
- else
0
- [template_type]
0
- end
0
-
0
- extensions.each do |extension|
0
- file_path = File.join(view_path, "#{checked_template_path}.#{extension}")
0
- if File.exist?(file_path)
0
- return formatted ? "#{template_format}.#{extension}" : extension.to_s
0
- end
0
- end
0
- end
0
- end
0
- nil
0
- end
0
- else
0
- # Rails 2.0.2
0
- def find_template_extension_from_handler(template_path, formatted = nil)
0
- checked_template_path = formatted ? "#{template_path}.#{template_format}" : template_path
0
-
0
- view_paths.each do |view_path|
0
- self.class.template_handler_extensions.each do |extension|
0
- file_path = File.join(view_path, "#{checked_template_path}.#{extension}")
0
- if File.exist?(file_path)
0
- return formatted ? "#{template_format}.#{extension}" : extension.to_s
0
- end
0
- end
0
- end
0
- nil
0
- end
0
- end
0
- end
0
-
0
- if instance_methods.include?('view_paths')
0
- def initialize_with_desert_plugins(*args)
0
- initialize_without_desert_plugins *args
0
-
0
- Desert::Manager.plugins.reverse.each do |plugin|
0
- view_paths << plugin.templates_path
0
- end
0
- end
0
- alias_method_chain :initialize, :desert_plugins
0
- else
0
- attr_reader :view_paths
0
- def initialize_with_desert(base_path = nil, assigns_for_first_render = {}, controller = nil)
0
- initialize_without_desert(base_path, assigns_for_first_render, controller)
0
-
0
- @view_paths = [base_path]
0
- Desert::Manager.plugins_and_app.reverse.each do |plugin|
0
- @view_paths << plugin.templates_path
0
- end
0
- end
0
- alias_method_chain :initialize, :desert
0
-
0
- private
0
- def full_path_template_exists?(path, extension)
0
- file_path = "#{path}.#{extension}"
0
- @@method_names.has_key?(file_path) || FileTest.exists?(file_path)
0
- end
0
-
0
- def find_template_extension_for(template_path)
0
- view_paths.each do |view_path|
0
- full_path = "#{view_path}/#{template_path}"
0
- if match = @@template_handlers.find { |k,| full_path_template_exists?(template_path, k) }
0
- return match.first.to_sym
0
- elsif full_path_template_exists?(full_path, :rhtml)
0
- return :rhtml
0
- elsif full_path_template_exists?(full_path, :rxml)
0
- return :rxml
0
- elsif full_path_template_exists?(full_path, :rjs)
0
- return :rjs
0
- end
0
- end
0
- raise ActionViewError, "No rhtml, rxml, rjs or delegate template found for #{template_path} in #{@base_path}"
0
- end
0
-
0
- def full_template_path_with_plugin_routing(template_path, extension)
0
- full_template_path = full_template_path_without_plugin_routing(template_path, extension)
0
-
0
- unless File.exist?(full_template_path)
0
- # Look through the plugins for the template
0
- Desert::Manager.plugins.reverse.each do |plugin|
0
- if plugin_template_path = plugin.find_template("#{template_path}.#{extension}")
0
- full_template_path = plugin_template_path
0
- break
0
- end
0
- end
0
- end
0
-
0
- full_template_path
0
- end
0
- alias_method_chain :full_template_path, :plugin_routing
0
- end
0
+ if ActionView::Base.private_instance_methods.include?('find_template_extension_from_handler')
0
+ if ActionView::Base.instance_methods.include?('template_handler_preferences')
0
+ require "#{dir}/1.99.0/action_view"
0
+ else
0
+ require "#{dir}/2.0.2/action_view"
0
     end
0
+ elsif ActionView.const_defined?(:PathSet)
0
+ require "#{dir}/edge/action_view"
0
+ else
0
+ require "#{dir}/1.2.0/action_view"
0
   end
0
 end
0
\ No newline at end of file
...
2
3
4
5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
7
8
...
2
3
4
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
0
@@ -2,7 +2,37 @@
0
 # migrations feature of ActiveRecord to incrementally modify your database, and
0
 # then regenerate this schema definition.
0
 
0
-ActiveRecord::Schema.define() do
0
+ActiveRecord::Schema.define(:version => 2) do
0
+
0
+ create_table "articles", :force => true do |t|
0
+ t.column "title", :string, :null => false
0
+ t.column "content", :text, :null => false
0
+ t.column "author_id", :integer, :null => false
0
+ end
0
+
0
+ create_table "authors", :force => true do |t|
0
+ t.column "name", :string, :null => false
0
+ end
0
+
0
+ create_table "comments", :force => true do |t|
0
+ t.column "content", :string, :null => false
0
+ t.column "article_id", :integer, :null => false
0
+ end
0
+
0
+ create_table "companies", :force => true do |t|
0
+ t.column "name", :string, :null => false
0
+ end
0
+
0
+ create_table "employees", :force => true do |t|
0
+ t.column "company_id", :integer, :null => false
0
+ t.column "first_name", :string, :null => false
0
+ t.column "last_name", :string, :null => false
0
+ end
0
+
0
+ create_table "plugin_schema_info", :id => false, :force => true do |t|
0
+ t.column "plugin_name", :string
0
+ t.column "version", :integer
0
+ end
0
 
0
 # Could not dump table "sqlite_sequence" because of following StandardError
0
 # Unknown type '' for column 'name'

Comments

    No one has commented yet.