public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
change plugin class/module to Mephisto::Plugin and Mephisto::Plugins

git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2748 
567b1171-46fb-0310-a4c9-b4bef9110e78
technoweenie (author)
Mon Feb 19 06:52:00 -0800 2007
commit  0c829edb61b99cd570589d4e5bdce80bba006dd1
tree    d1260c571778e46573c7519ffa6ffdd97f6455a1
parent  766a3050f8030fe06b94e563cdafb838e1ed17ce
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 * SVN *
0
 
0
+* Change plugin class/module to Mephisto::Plugin and Mephisto::Plugins. Sorry for the breakage (still technically experimental!)
0
+
0
 * Fix admin overview date timezone. [Ben Wyrosdick]
0
 
0
 * Extract template rendering code to separate handler class, add support for alternate template handlers. [Pascal Belloncle]
...
2
3
4
5
 
6
7
8
...
19
20
21
22
 
23
24
25
...
2
3
4
 
5
6
7
8
...
19
20
21
 
22
23
24
25
0
@@ -2,7 +2,7 @@ class Admin::PluginsController < Admin::BaseController
0
   before_filter :find_plugin, :except => :index
0
 
0
   def index
0
- @plugins = DirectoryPlugin.scan
0
+ @plugins = Mephisto::DirectoryPlugin.scan
0
   end
0
   
0
   def update
0
@@ -19,6 +19,6 @@ class Admin::PluginsController < Admin::BaseController
0
   
0
   protected
0
     def find_plugin
0
- @plugin = MephistoPlugin[params[:id]]
0
+ @plugin = Mephisto::Plugin[params[:id]]
0
     end
0
 end
0
\ No newline at end of file
...
31
32
33
34
 
35
36
37
...
41
42
43
44
 
45
46
47
...
31
32
33
 
34
35
36
37
...
41
42
43
 
44
45
46
47
0
@@ -31,7 +31,7 @@
0
             <li><%= link_to 'Overview', :controller => '/admin/overview' %></li>
0
             <li><%= link_to 'Articles', :controller => '/admin/articles' %></li>
0
             <li><%= link_to 'Assets', :controller => '/admin/assets' %></li>
0
- <% MephistoPlugin.tabs.each do |tab| -%>
0
+ <% Mephisto::Plugin.tabs.each do |tab| -%>
0
             <li><%= link_to tab.first, tab.last %></li>
0
           <% end -%>
0
           </ul>
0
@@ -41,7 +41,7 @@
0
             <li><%= link_to 'Design', :controller => '/admin/design' %></li>
0
             <li><%= link_to "Users", :controller => "users" %></li>
0
             <li><%= link_to 'Plugins', :controller => '/admin/plugins' %></li>
0
- <% MephistoPlugin.admin_tabs.each do |tab| -%>
0
+ <% Mephisto::Plugin.admin_tabs.each do |tab| -%>
0
             <li><%= link_to tab.first, tab.last %></li>
0
           <% end -%>
0
           </ul>
...
25
26
27
28
 
29
30
31
...
25
26
27
 
28
29
30
31
0
@@ -25,7 +25,7 @@ module Mephisto
0
       map.connect ':controller/:action/:id/:version', :version => nil, :controller => /routing_navigator|account|(admin\/\w+)/, :id => /[^\/]*/
0
 
0
       yield if block_given?
0
- MephistoPlugin.custom_routes.each do |path, options|
0
+ Mephisto::Plugin.custom_routes.each do |path, options|
0
         map.connect path, options
0
       end
0
       
...
1
2
3
4
5
6
7
8
 
 
 
 
 
 
 
 
 
 
9
10
11
...
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
0
@@ -1,10 +1,12 @@
0
-module MephistoPlugins
0
- class TestPlugin < MephistoPlugin
0
- homepage 'http://foo.com'
0
- author 'Captain Problematic'
0
- version 'deathstar'
0
-
0
- option :config, 'one' => 'test'
0
- option :notes, 'notes'
0
+module Mephisto
0
+ module Plugins
0
+ class TestPlugin < Mephisto::Plugin
0
+ homepage 'http://foo.com'
0
+ author 'Captain Problematic'
0
+ version 'deathstar'
0
+
0
+ option :config, 'one' => 'test'
0
+ option :notes, 'notes'
0
+ end
0
   end
0
 end
0
\ No newline at end of file
...
35
36
37
38
 
39
40
41
...
35
36
37
 
38
39
40
41
0
@@ -35,7 +35,7 @@ class Admin::PluginsControllerTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_should_show_plugin
0
- assert_not_nil MephistoPlugins::TestPlugin.new
0
+ assert_not_nil Mephisto::Plugins::TestPlugin.new
0
     get :show, :id => 'test_plugin'
0
     assert_response :success
0
   end
...
122
123
124
125
126
 
 
127
...
122
123
124
 
125
126
127
128
0
@@ -122,4 +122,5 @@ ActiveRecord::Base.class_eval do
0
   expiring_attr_reader :referenced_cache_key, '"[#{[id, self.class.name] * ":"}]"'
0
 end
0
 
0
-Liquid::For.send :include, Mephisto::Liquid::ForWithSorting
0
\ No newline at end of file
0
+Liquid::For.send :include, Mephisto::Liquid::ForWithSorting
0
+Dependencies.autoloaded_constants.delete "Mephisto"
0
\ No newline at end of file
...
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
...
51
52
53
54
55
56
57
 
 
 
 
58
59
60
61
62
 
63
64
65
66
 
67
68
69
...
71
72
73
74
75
 
 
76
77
78
...
80
81
82
83
 
84
85
86
...
94
95
96
97
 
98
99
100
...
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
...
51
52
53
 
 
 
 
54
55
56
57
58
59
60
61
 
62
63
64
65
 
66
67
68
69
...
71
72
73
 
 
74
75
76
77
78
...
80
81
82
 
83
84
85
86
...
94
95
96
 
97
98
99
100
0
@@ -4,35 +4,35 @@ class PluginTest < Test::Unit::TestCase
0
   fixtures :mephisto_plugins
0
 
0
   def test_should_create_plugin_name
0
- assert_equal 'plugin_whammy_jammy', MephistoPlugins::PluginWhammyJammy.plugin_name
0
+ assert_equal 'plugin_whammy_jammy', Mephisto::Plugins::PluginWhammyJammy.plugin_name
0
   end
0
   
0
   def test_should_find_plugin_class_by_name
0
- assert_equal MephistoPlugins::PluginWhammyJammy, MephistoPlugin.find_class(:plugin_whammy_jammy)
0
+ assert_equal Mephisto::Plugins::PluginWhammyJammy, Mephisto::Plugin.find_class(:plugin_whammy_jammy)
0
   end
0
   
0
   def test_should_not_find_missing_class
0
     assert_raises NameError do
0
- MephistoPlugin[:blah]
0
+ Mephisto::Plugin[:blah]
0
     end
0
   end
0
   
0
   def test_should_not_find_a_non_model
0
- assert MephistoPlugins.const_defined?(:NonPlugin)
0
+ assert Mephisto::Plugins.const_defined?(:NonPlugin)
0
     assert_raises NameError do
0
- MephistoPlugin[:non_plugin]
0
+ Mephisto::Plugin[:non_plugin]
0
     end
0
   end
0
   
0
   def test_plugin_option_defaults
0
- plugin = MephistoPlugins::PluginWhammyJammy.new
0
+ plugin = Mephisto::Plugins::PluginWhammyJammy.new
0
     assert_equal 'one', plugin.foo
0
     assert_equal 2, plugin.bar
0
     assert_equal [3], plugin.baz
0
   end
0
   
0
   def test_should_set_plugin_options
0
- plugin = MephistoPlugins::PluginWhammyJammy.new
0
+ plugin = Mephisto::Plugins::PluginWhammyJammy.new
0
     
0
     plugin.foo = 'two'
0
     plugin.bar = 3
0
@@ -51,19 +51,19 @@ class PluginTest < Test::Unit::TestCase
0
   def test_should_get_and_set_plugin_properties
0
     properties = %w(notes author version homepage)
0
     properties.each do |property|
0
- assert_nil MephistoPlugins::PluginWhammyJammy.send(property)
0
- MephistoPlugins::PluginWhammyJammy.send(property, 'foo')
0
- assert_equal 'foo', MephistoPlugins::PluginWhammyJammy.send(property)
0
- assert_equal 'foo', MephistoPlugins::PluginWhammyJammy.new.send(property)
0
+ assert_nil Mephisto::Plugins::PluginWhammyJammy.send(property)
0
+ Mephisto::Plugins::PluginWhammyJammy.send(property, 'foo')
0
+ assert_equal 'foo', Mephisto::Plugins::PluginWhammyJammy.send(property)
0
+ assert_equal 'foo', Mephisto::Plugins::PluginWhammyJammy.new.send(property)
0
     end
0
   end
0
   
0
   def test_should_find_plugin
0
- assert_equal MephistoPlugins::PluginWhammyJammy.find(1), MephistoPlugin[:plugin_whammy_jammy]
0
+ assert_equal Mephisto::Plugins::PluginWhammyJammy.find(1), Mephisto::Plugin[:plugin_whammy_jammy]
0
   end
0
   
0
   def test_should_persist_options
0
- plugin = MephistoPlugin[:plugin_whammy_jammy]
0
+ plugin = Mephisto::Plugin[:plugin_whammy_jammy]
0
     assert_equal 'one', plugin.foo
0
     plugin.foo = 'two'
0
     plugin.save!
0
@@ -71,8 +71,8 @@ class PluginTest < Test::Unit::TestCase
0
   end
0
   
0
   def test_should_persist_options_on_new_plugin_record
0
- MephistoPlugins::PluginWhammyJammy.delete_all
0
- plugin = MephistoPlugin[:plugin_whammy_jammy]
0
+ Mephisto::Plugins::PluginWhammyJammy.delete_all
0
+ plugin = Mephisto::Plugin[:plugin_whammy_jammy]
0
     klass1 = plugin.class.name
0
     
0
     assert plugin.new_record?
0
@@ -80,7 +80,7 @@ class PluginTest < Test::Unit::TestCase
0
     plugin.save!
0
     assert plugin.reload.options.empty?
0
 
0
- plugin2 = MephistoPlugin[:plugin_whammy_jammy]
0
+ plugin2 = Mephisto::Plugin[:plugin_whammy_jammy]
0
     assert_equal 'one', plugin2.foo
0
     reloaded_klass = plugin2.class.name
0
     
0
@@ -94,7 +94,7 @@ class PluginTest < Test::Unit::TestCase
0
   end
0
   
0
   # def test_should_load_or_initialize_plugin_list
0
- # plugins = MephistoPlugin.load(%w(plugin_whammy_jammy foo_bar baz))
0
+ # plugins = Mephisto::Plugin.load(%w(plugin_whammy_jammy foo_bar baz))
0
  # assert_equal 2, plugins.size
0
  # assert plugins['foo_bar'].new_record?
0
  # end
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
 
 
 
 
 
 
 
 
 
 
 
 
 
15
16
17
...
1
2
3
 
 
 
 
 
 
 
 
 
 
 
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
0
@@ -1,16 +1,18 @@
0
 require File.expand_path(File.dirname(__FILE__) + '/../../../../test/test_helper.rb')
0
 Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + '/fixtures'
0
 
0
-module MephistoPlugins
0
- class PluginWhammyJammy < MephistoPlugin
0
- option :foo, 'one'
0
- option :bar, 2
0
- option :baz, [3]
0
- end
0
-
0
- class FooBar < MephistoPlugin
0
- end
0
-
0
- class NonPlugin
0
+module Mephisto
0
+ module Plugins
0
+ class PluginWhammyJammy < Mephisto::Plugin
0
+ option :foo, 'one'
0
+ option :bar, 2
0
+ option :baz, [3]
0
+ end
0
+
0
+ class FooBar < Mephisto::Plugin
0
+ end
0
+
0
+ class NonPlugin
0
+ end
0
   end
0
 end
0
\ No newline at end of file

Comments

    No one has commented yet.