parlement 0.10 → 0.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CHANGES +11 -0
  2. data/MEMORY +9 -1
  3. data/README +5 -4
  4. data/app/controllers/account_controller.rb +10 -13
  5. data/app/controllers/application.rb +4 -5
  6. data/app/controllers/elt_controller.rb +9 -7
  7. data/app/controllers/person_controller.rb +1 -3
  8. data/app/controllers/subscriber_controller.rb +10 -10
  9. data/app/helpers/elt_helper.rb +2 -0
  10. data/app/models/elt.rb +28 -19
  11. data/app/models/mail.rb +26 -14
  12. data/app/models/mail_notify.rb +5 -4
  13. data/app/models/person.rb +11 -2
  14. data/app/views/account/_login.rhtml +3 -3
  15. data/app/views/account/_show.rhtml +12 -14
  16. data/app/views/elt/_choice.rhtml +3 -3
  17. data/app/views/elt/_elt.rhtml +4 -4
  18. data/app/views/elt/_list.rhtml +2 -2
  19. data/app/views/elt/_listByDate.rhtml +1 -1
  20. data/app/views/elt/_listByVote.rhtml +1 -1
  21. data/app/views/elt/new.rhtml +3 -3
  22. data/app/views/elt/show.rhtml +2 -2
  23. data/app/views/layouts/top.rhtml +6 -0
  24. data/app/views/mail_notify/publish.text.html.rhtml +1 -1
  25. data/app/views/person/_listElts.rhtml +5 -3
  26. data/app/views/person/show.rhtml +1 -2
  27. data/config/boot.rb +5 -4
  28. data/config/environment.rb +6 -4
  29. data/config/routes.rb +3 -2
  30. data/db/development_structure.sql +15 -4
  31. data/db/migrate/006_last_activity.rb +10 -0
  32. data/db/schema.rb +67 -49
  33. data/public/dispatch.fcgi +1 -0
  34. data/public/javascripts/controls.js +41 -23
  35. data/public/javascripts/dragdrop.js +317 -99
  36. data/public/javascripts/effects.js +301 -166
  37. data/public/javascripts/prototype.js +932 -402
  38. data/public/stylesheets/default.css +3 -2
  39. data/test/unit/elt_test.rb +13 -0
  40. data/test/unit/mail_test.rb +3 -1
  41. data/vendor/plugins/engines/CHANGELOG +203 -99
  42. data/vendor/plugins/engines/MIT-LICENSE +1 -1
  43. data/vendor/plugins/engines/README +32 -384
  44. data/vendor/plugins/engines/Rakefile +14 -0
  45. data/vendor/plugins/engines/UPGRADING +93 -0
  46. data/vendor/plugins/engines/about.yml +7 -0
  47. data/vendor/plugins/engines/generators/plugin_migration/USAGE +45 -0
  48. data/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +79 -0
  49. data/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +13 -0
  50. data/vendor/plugins/engines/init.rb +34 -47
  51. data/vendor/plugins/engines/install.rb +32 -0
  52. data/vendor/plugins/engines/lib/engines/{ruby_extensions.rb → deprecated_config_support.rb} +135 -113
  53. data/vendor/plugins/engines/lib/engines/plugin.rb +214 -0
  54. data/vendor/plugins/engines/lib/engines/plugin_list.rb +31 -0
  55. data/vendor/plugins/engines/lib/engines/plugin_migrator.rb +60 -0
  56. data/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +19 -0
  57. data/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +143 -0
  58. data/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +155 -0
  59. data/vendor/plugins/engines/lib/engines/rails_extensions/public_asset_helpers.rb +116 -0
  60. data/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +20 -0
  61. data/vendor/plugins/engines/lib/engines/rails_extensions/rails_initializer.rb +86 -0
  62. data/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +77 -0
  63. data/vendor/plugins/engines/lib/engines/rails_extensions/templates.rb +140 -0
  64. data/vendor/plugins/engines/lib/engines/rails_extensions.rb +6 -0
  65. data/vendor/plugins/engines/lib/engines/testing.rb +88 -0
  66. data/vendor/plugins/engines/lib/engines.rb +281 -425
  67. data/vendor/plugins/engines/tasks/engines.rake +108 -137
  68. metadata +218 -250
  69. data/db/ROOT/perso.txt +0 -214
  70. data/public/images/indicator.gif +0 -0
  71. data/public/images/orange_by_darren_Hester_350o.jpg +0 -0
  72. data/public/images/smile.png +0 -0
  73. data/vendor/plugins/engines/generators/engine/USAGE +0 -26
  74. data/vendor/plugins/engines/generators/engine/engine_generator.rb +0 -199
  75. data/vendor/plugins/engines/generators/engine/templates/README +0 -85
  76. data/vendor/plugins/engines/generators/engine/templates/init_engine.erb +0 -15
  77. data/vendor/plugins/engines/generators/engine/templates/install.erb +0 -4
  78. data/vendor/plugins/engines/generators/engine/templates/lib/engine.erb +0 -6
  79. data/vendor/plugins/engines/generators/engine/templates/licenses/GPL +0 -18
  80. data/vendor/plugins/engines/generators/engine/templates/licenses/LGPL +0 -19
  81. data/vendor/plugins/engines/generators/engine/templates/licenses/MIT +0 -22
  82. data/vendor/plugins/engines/generators/engine/templates/licenses/None +0 -1
  83. data/vendor/plugins/engines/generators/engine/templates/public/javascripts/engine.js +0 -0
  84. data/vendor/plugins/engines/generators/engine/templates/public/stylesheets/engine.css +0 -0
  85. data/vendor/plugins/engines/generators/engine/templates/tasks/engine.rake +0 -0
  86. data/vendor/plugins/engines/generators/engine/templates/test/test_helper.erb +0 -17
  87. data/vendor/plugins/engines/lib/bundles/require_resource.rb +0 -124
  88. data/vendor/plugins/engines/lib/bundles.rb +0 -77
  89. data/vendor/plugins/engines/lib/engines/action_mailer_extensions.rb +0 -140
  90. data/vendor/plugins/engines/lib/engines/action_view_extensions.rb +0 -141
  91. data/vendor/plugins/engines/lib/engines/active_record_extensions.rb +0 -21
  92. data/vendor/plugins/engines/lib/engines/dependencies_extensions.rb +0 -129
  93. data/vendor/plugins/engines/lib/engines/migration_extensions.rb +0 -53
  94. data/vendor/plugins/engines/lib/engines/routing_extensions.rb +0 -28
  95. data/vendor/plugins/engines/lib/engines/testing_extensions.rb +0 -327
  96. data/vendor/plugins/engines/tasks/deprecated_engines.rake +0 -7
  97. data/vendor/plugins/engines/test/action_view_extensions_test.rb +0 -9
  98. data/vendor/plugins/engines/test/ruby_extensions_test.rb +0 -115
  99. data/vendor/plugins/guid/README.TXT +0 -29
  100. data/vendor/plugins/guid/init.rb +0 -30
  101. data/vendor/plugins/guid/lib/usesguid.rb +0 -37
  102. data/vendor/plugins/guid/lib/uuid22.rb +0 -43
  103. data/vendor/plugins/guid/lib/uuidtools.rb +0 -572
  104. data/vendor/plugins/responds_to_parent/MIT-LICENSE +0 -20
  105. data/vendor/plugins/responds_to_parent/README +0 -42
  106. data/vendor/plugins/responds_to_parent/Rakefile +0 -22
  107. data/vendor/plugins/responds_to_parent/init.rb +0 -1
  108. data/vendor/plugins/responds_to_parent/lib/responds_to_parent.rb +0 -46
  109. data/vendor/plugins/responds_to_parent/test/responds_to_parent_test.rb +0 -115
@@ -0,0 +1,79 @@
1
+ # Generates a migration which migrates all plugins to their latest versions
2
+ # within the database.
3
+ class PluginMigrationGenerator < Rails::Generator::Base
4
+
5
+ def initialize(runtime_args, runtime_options={})
6
+ super
7
+ @options = {:assigns => {}}
8
+
9
+ ensure_plugin_schema_table_exists
10
+ get_plugins_to_migrate(runtime_args)
11
+
12
+ if @plugins_to_migrate.empty?
13
+ puts "All plugins are migrated to their latest versions"
14
+ exit(0)
15
+ end
16
+
17
+ @options[:migration_file_name] = build_migration_name
18
+ @options[:assigns][:class_name] = build_migration_name.classify
19
+ end
20
+
21
+ def manifest
22
+ record do |m|
23
+ m.migration_template 'plugin_migration.erb', 'db/migrate', @options
24
+ end
25
+ end
26
+
27
+ protected
28
+
29
+ # Create the plugin schema table if it doesn't already exist. See
30
+ # Engines::RailsExtensions::Migrations#initialize_schema_information_with_engine_additions
31
+ def ensure_plugin_schema_table_exists
32
+ ActiveRecord::Base.connection.initialize_schema_information
33
+ end
34
+
35
+ # Determine all the plugins which have migrations that aren't present
36
+ # according to the plugin schema information from the database.
37
+ def get_plugins_to_migrate(plugin_names)
38
+
39
+ # First, grab all the plugins which exist and have migrations
40
+ @plugins_to_migrate = if plugin_names.empty?
41
+ Rails.plugins
42
+ else
43
+ plugin_names.map do |name|
44
+ Rails.plugins[name] ? Rails.plugins[name] : raise("Cannot find the plugin '#{name}'")
45
+ end
46
+ end
47
+
48
+ @plugins_to_migrate.reject! { |p| p.latest_migration.nil? }
49
+
50
+ # Then find the current versions from the database
51
+ @current_versions = {}
52
+ @plugins_to_migrate.each do |plugin|
53
+ @current_versions[plugin.name] = Engines::PluginMigrator.current_version(plugin)
54
+ end
55
+
56
+ # Then find the latest versions from their migration directories
57
+ @new_versions = {}
58
+ @plugins_to_migrate.each do |plugin|
59
+ @new_versions[plugin.name] = plugin.latest_migration
60
+ end
61
+
62
+ # Remove any plugins that don't need migration
63
+ @plugins_to_migrate.map { |p| p.name }.each do |name|
64
+ @plugins_to_migrate.delete(Rails.plugins[name]) if @current_versions[name] == @new_versions[name]
65
+ end
66
+
67
+ @options[:assigns][:plugins] = @plugins_to_migrate
68
+ @options[:assigns][:new_versions] = @new_versions
69
+ @options[:assigns][:current_versions] = @current_versions
70
+ end
71
+
72
+ # Construct a unique migration name based on the plugins involved and the
73
+ # versions they should reach after this migration is run.
74
+ def build_migration_name
75
+ @plugins_to_migrate.map do |plugin|
76
+ "#{plugin.name}_to_version_#{@new_versions[plugin.name]}"
77
+ end.join("_and_")
78
+ end
79
+ end
@@ -0,0 +1,13 @@
1
+ class <%= class_name %> < ActiveRecord::Migration
2
+ def self.up
3
+ <%- plugins.each do |plugin| -%>
4
+ Rails.plugins["<%= plugin.name %>"].migrate(<%= new_versions[plugin.name] %>)
5
+ <%- end -%>
6
+ end
7
+
8
+ def self.down
9
+ <%- plugins.each do |plugin| -%>
10
+ Rails.plugins["<%= plugin.name %>"].migrate(<%= current_versions[plugin.name] %>)
11
+ <%- end -%>
12
+ end
13
+ end
@@ -1,53 +1,40 @@
1
- #--
2
- # Copyright (c) 2006 James Adam
3
- #
4
- # Permission is hereby granted, free of charge, to any person obtaining
5
- # a copy of this software and associated documentation files (the
6
- # "Software"), to deal in the Software without restriction, including
7
- # without limitation the rights to use, copy, modify, merge, publish,
8
- # distribute, sublicense, and/or sell copies of the Software, and to
9
- # permit persons to whom the Software is furnished to do so, subject to
10
- # the following conditions:
11
- #
12
- # The above copyright notice and this permission notice shall be
13
- # included in all copies or substantial portions of the Software.
14
- #
15
- # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16
- # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
- # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18
- # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
19
- # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
20
- # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21
- # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
- #
23
- #
24
- #
25
- # = IN OTHER WORDS:
26
- #
27
- # You are free to use this software as you please, but if it breaks you'd
28
- # best not come a'cryin...
29
- #++
1
+ begin
2
+ silence_warnings { require 'rails/version' } # it may already be loaded
3
+ unless Rails::VERSION::MAJOR >= 1 && Rails::VERSION::MINOR >= 2
4
+ raise "This version of the engines plugin requires Rails 1.2 or later!"
5
+ end
6
+ end
30
7
 
31
- # Load the engines & bundles extensions
32
- require 'engines'
33
- require 'bundles'
8
+ # First, require the engines module & core methods
9
+ require "engines"
34
10
 
35
- module ::Engines::Version
36
- Major = 1 # change implies compatibility breaking with previous versions
37
- Minor = 1 # change implies backwards-compatible change to API
38
- Release = 4 # incremented with bug-fixes, updates, etc.
39
- end
11
+ # Load this before we get actually start engines
12
+ require "engines/rails_extensions/rails_initializer"
13
+
14
+ # Start the engines mechanism.
15
+ Engines.init(config, self)
40
16
 
41
- #--
42
- # Create the Engines directory if it isn't present
43
- #++
44
- if !File.exist?(Engines.config(:root))
45
- Engines.log.debug "Creating engines directory in /vendor"
46
- FileUtils.mkdir_p(Engines.config(:root))
17
+ # Now that we've defined the engines module, load up any extensions
18
+ [:rails,
19
+ :rails_initializer,
20
+ :dependencies,
21
+ :active_record,
22
+ :migrations,
23
+ :templates,
24
+ :public_asset_helpers,
25
+ :routing
26
+ ].each do |f|
27
+ require "engines/rails_extensions/#{f}"
47
28
  end
48
29
 
49
- # Keep a hold of the Rails Configuration object
50
- Engines.rails_config = config
30
+ # Load the testing extensions, if we are in the test environment.
31
+ require "engines/testing" if RAILS_ENV == "test"
51
32
 
52
- # Initialize the routing (controller_paths)
53
- Engines.initialize_routing
33
+ # Load the Rails::Info module so that plugins can insert information into it.
34
+ begin
35
+ require 'rails/info'
36
+ rescue Exception
37
+ # If this file can't be loaded, it's probably because we're running in an
38
+ # environment where Rails' builtins aren't yet in the load path.
39
+ # For the moment, just ignore this. See Ticket #261
40
+ end
@@ -0,0 +1,32 @@
1
+ $LOAD_PATH.unshift File.join(File.dirname(__FILE__), "..", "..", "rails", "railties", "lib")
2
+ silence_warnings { require 'rails/version' } # it may already be loaded.
3
+
4
+ unless Rails::VERSION::MAJOR >= 1 && Rails::VERSION::MINOR >= 2
5
+ puts <<-end_of_warning
6
+
7
+ !!!=== IMPORTANT NOTE ===!!!
8
+
9
+ Support for Rails < 1.2 has been dropped; if you are using
10
+ Rails =< 1.1.6, please use Engines 1.1.6, available from:
11
+
12
+ >> http://svn.rails-engines.org/engines/tags/rel_1.1.6
13
+
14
+ For more details about changes in Engines 1.2, please see
15
+ the changelog or the website:
16
+
17
+ >> http://www.rails-engines.org
18
+
19
+ end_of_warning
20
+ else
21
+ puts <<-end_of_message
22
+
23
+ The engines plugin is now installed. Feels good, right? Yeah.
24
+ You knew it would.
25
+
26
+ Once the warm, fuzzy glow has subsided, be sure to read the contents
27
+ of the README and UPGRADING files if you're migrating this application
28
+ from Rails 1.1.x to 1.2.x.
29
+
30
+ Have a great day!
31
+ end_of_message
32
+ end
@@ -1,113 +1,135 @@
1
- #--
2
- # Add these methods to the top-level module so that they are available in all
3
- # modules, etc
4
- #++
5
- class ::Module
6
- # Defines a constant within a module/class ONLY if that constant does
7
- # not already exist.
8
- #
9
- # This can be used to implement defaults in plugins/engines/libraries, e.g.
10
- # if a plugin module exists:
11
- # module MyPlugin
12
- # default_constant :MyDefault, "the_default_value"
13
- # end
14
- #
15
- # then developers can override this default by defining that constant at
16
- # some point *before* the module/plugin gets loaded (such as environment.rb)
17
- def default_constant(name, value)
18
- if !(name.is_a?(String) or name.is_a?(Symbol))
19
- raise "Cannot use a #{name.class.name} ['#{name}'] object as a constant name"
20
- end
21
- if !self.const_defined?(name)
22
- self.class_eval("#{name} = #{value.inspect}")
23
- end
24
- end
25
-
26
- # A mechanism for defining configuration of Modules. With this
27
- # mechanism, default values for configuration can be provided within shareable
28
- # code, and the end user can customise the configuration without having to
29
- # provide all values.
30
- #
31
- # Example:
32
- #
33
- # module MyModule
34
- # config :param_one, "some value"
35
- # config :param_two, 12345
36
- # end
37
- #
38
- # Those values can now be accessed by the following method
39
- #
40
- # MyModule.config :param_one
41
- # => "some value"
42
- # MyModule.config :param_two
43
- # => 12345
44
- #
45
- # ... or, if you have overrriden the method 'config'
46
- #
47
- # MyModule::CONFIG[:param_one]
48
- # => "some value"
49
- # MyModule::CONFIG[:param_two]
50
- # => 12345
51
- #
52
- # Once a value is stored in the configuration, it will not be altered
53
- # by subsequent assignments, unless a special flag is given:
54
- #
55
- # (later on in your code, most likely in another file)
56
- # module MyModule
57
- # config :param_one, "another value"
58
- # config :param_two, 98765, :force
59
- # end
60
- #
61
- # The configuration is now:
62
- #
63
- # MyModule.config :param_one
64
- # => "some value" # not changed
65
- # MyModule.config :param_two
66
- # => 98765
67
- #
68
- # Configuration values can also be given as a Hash:
69
- #
70
- # MyModule.config :param1 => 'value1', :param2 => 'value2'
71
- #
72
- # Setting of these values can also be forced:
73
- #
74
- # MyModule.config :param1 => 'value3', :param2 => 'value4', :force => true
75
- #
76
- # A value of anything other than false or nil given for the :force key will
77
- # result in the new values *always* being set.
78
- def config(*args)
79
-
80
- raise "config expects at least one argument" if args.empty?
81
-
82
- # extract the arguments
83
- if args[0].is_a?(Hash)
84
- override = args[0][:force]
85
- args[0].delete(:force)
86
- args[0].each { |key, value| _handle_config(key, value, override)}
87
- else
88
- _handle_config(*args)
89
- end
90
- end
91
-
92
- private
93
- # Actually set the config values
94
- def _handle_config(name, value=nil, override=false)
95
- if !self.const_defined?("CONFIG")
96
- self.class_eval("CONFIG = {}")
97
- end
98
-
99
- if value != nil
100
- if override or self::CONFIG[name] == nil
101
- self::CONFIG[name] = value
102
- end
103
- else
104
- # if we pass an array of config keys to config(),
105
- # get the array of values back
106
- if name.is_a? Array
107
- name.map { |c| self::CONFIG[c] }
108
- else
109
- self::CONFIG[name]
110
- end
111
- end
112
- end
113
- end
1
+ # This file contains support for the now-deprecated +config+ method that the engines
2
+ # plugin provided before version 1.2. Instead of using this, plugin authors are
3
+ # now encouraged to create their own Module configuration mechanisms; the
4
+ # +mattr_accessor+ mechanism provided by ActiveSupport is ideal for this:
5
+ #
6
+ # module MyPlugin
7
+ # mattr_accessor :config_value
8
+ # self.config_value = "default"
9
+ # end
10
+ #
11
+ # == Using the deprecated config method
12
+ #
13
+ # If you require the config method to be present, change your <tt>environment.rb</tt>
14
+ # file such that the very top of the file looks like this:
15
+ #
16
+ # require File.join(File.dirname(__FILE__), 'boot')
17
+ # require File.join(RAILS_ROOT, "vendor", "plugins", "engines",
18
+ # "lib", "engines", "deprecated_config_support")
19
+ #
20
+
21
+
22
+ # Adds the +config+ and +default_constant+ methods to Module.
23
+ #
24
+ # *IMPORTANT NOTE* - these methods are deprecated. Only use them when you have no
25
+ # other choice. See link:files/lib/engines/deprecated_config_support_rb.html for more
26
+ # information.
27
+ class Module
28
+ # Defines a constant within a module/class ONLY if that constant does
29
+ # not already exist.
30
+ #
31
+ # This can be used to implement defaults in plugins/engines/libraries, e.g.
32
+ # if a plugin module exists:
33
+ # module MyPlugin
34
+ # default_constant :MyDefault, "the_default_value"
35
+ # end
36
+ #
37
+ # then developers can override this default by defining that constant at
38
+ # some point *before* the module/plugin gets loaded (such as environment.rb)
39
+ def default_constant(name, value)
40
+ if !(name.is_a?(String) or name.is_a?(Symbol))
41
+ raise "Cannot use a #{name.class.name} ['#{name}'] object as a constant name"
42
+ end
43
+ if !self.const_defined?(name)
44
+ self.class_eval("#{name} = #{value.inspect}")
45
+ end
46
+ end
47
+
48
+ # A mechanism for defining configuration of Modules. With this
49
+ # mechanism, default values for configuration can be provided within shareable
50
+ # code, and the end user can customise the configuration without having to
51
+ # provide all values.
52
+ #
53
+ # Example:
54
+ #
55
+ # module MyModule
56
+ # config :param_one, "some value"
57
+ # config :param_two, 12345
58
+ # end
59
+ #
60
+ # Those values can now be accessed by the following method
61
+ #
62
+ # MyModule.config :param_one
63
+ # => "some value"
64
+ # MyModule.config :param_two
65
+ # => 12345
66
+ #
67
+ # ... or, if you have overrriden the method 'config'
68
+ #
69
+ # MyModule::CONFIG[:param_one]
70
+ # => "some value"
71
+ # MyModule::CONFIG[:param_two]
72
+ # => 12345
73
+ #
74
+ # Once a value is stored in the configuration, it will not be altered
75
+ # by subsequent assignments, unless a special flag is given:
76
+ #
77
+ # (later on in your code, most likely in another file)
78
+ # module MyModule
79
+ # config :param_one, "another value"
80
+ # config :param_two, 98765, :force
81
+ # end
82
+ #
83
+ # The configuration is now:
84
+ #
85
+ # MyModule.config :param_one
86
+ # => "some value" # not changed
87
+ # MyModule.config :param_two
88
+ # => 98765
89
+ #
90
+ # Configuration values can also be given as a Hash:
91
+ #
92
+ # MyModule.config :param1 => 'value1', :param2 => 'value2'
93
+ #
94
+ # Setting of these values can also be forced:
95
+ #
96
+ # MyModule.config :param1 => 'value3', :param2 => 'value4', :force => true
97
+ #
98
+ # A value of anything other than false or nil given for the :force key will
99
+ # result in the new values *always* being set.
100
+ def config(*args)
101
+
102
+ raise "config expects at least one argument" if args.empty?
103
+
104
+ # extract the arguments
105
+ if args[0].is_a?(Hash)
106
+ override = args[0][:force]
107
+ args[0].delete(:force)
108
+ args[0].each { |key, value| _handle_config(key, value, override)}
109
+ else
110
+ _handle_config(*args)
111
+ end
112
+ end
113
+
114
+ private
115
+ # Actually set the config values
116
+ def _handle_config(name, value=nil, override=false)
117
+ if !self.const_defined?("CONFIG")
118
+ self.class_eval("CONFIG = {}")
119
+ end
120
+
121
+ if value != nil
122
+ if override or self::CONFIG[name] == nil
123
+ self::CONFIG[name] = value
124
+ end
125
+ else
126
+ # if we pass an array of config keys to config(),
127
+ # get the array of values back
128
+ if name.is_a? Array
129
+ name.map { |c| self::CONFIG[c] }
130
+ else
131
+ self::CONFIG[name]
132
+ end
133
+ end
134
+ end
135
+ end