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
@@ -1,176 +1,147 @@
1
- module Engines
2
- module RakeTasks
3
- def self.all_engines
4
- # An engine is informally defined as any subdirectory in vendor/plugins
5
- # which ends in '_engine', '_bundle', or contains an 'init_engine.rb' file.
6
- engine_base_dirs = ['vendor/plugins']
7
- # The engine root may be different; if possible try to include
8
- # those directories too
9
- if Engines.const_defined?(:CONFIG)
10
- engine_base_dirs << Engines::CONFIG[:root]
1
+ # This code lets us redefine existing Rake tasks, which is extermely
2
+ # handy for modifying existing Rails rake tasks.
3
+ # Credit for this snippet of code goes to Jeremy Kemper
4
+ # http://pastie.caboo.se/9620
5
+ unless Rake::TaskManager.methods.include?(:redefine_task)
6
+ module Rake
7
+ module TaskManager
8
+ def redefine_task(task_class, args, &block)
9
+ task_name, deps = resolve_args(args)
10
+ task_name = task_class.scope_name(@scope, task_name)
11
+ deps = [deps] unless deps.respond_to?(:to_ary)
12
+ deps = deps.collect {|d| d.to_s }
13
+ task = @tasks[task_name.to_s] = task_class.new(task_name, self)
14
+ task.application = self
15
+ task.add_comment(@last_comment)
16
+ @last_comment = nil
17
+ task.enhance(deps, &block)
18
+ task
11
19
  end
12
- engine_base_dirs.map! {|d| [d + '/*_engine/*',
13
- d + '/*_bundle/*',
14
- d + '/*/init_engine.rb']}.flatten!
15
- engine_dirs = FileList.new(*engine_base_dirs)
16
- engine_dirs.map do |engine|
17
- File.basename(File.dirname(engine))
18
- end.uniq
19
20
  end
20
- end
21
- end
22
-
23
-
24
- namespace :engines do
25
- desc "Display version information about active engines"
26
- task :info => :environment do
27
- if ENV["ENGINE"]
28
- e = Engines.get(ENV["ENGINE"])
29
- header = "Details for engine '#{e.name}':"
30
- puts header
31
- puts "-" * header.length
32
- puts "Version: #{e.version}"
33
- puts "Details: #{e.info}"
34
- else
35
- puts "Engines plugin: #{Engines.version}"
36
- Engines.each do |e|
37
- puts "#{e.name}: #{e.version}"
21
+ class Task
22
+ class << self
23
+ def redefine_task(args, &block)
24
+ Rake.application.redefine_task(self, args, &block)
25
+ end
38
26
  end
39
27
  end
40
28
  end
41
29
  end
42
30
 
31
+
43
32
  namespace :db do
44
33
  namespace :fixtures do
45
- namespace :engines do
34
+ namespace :plugins do
46
35
 
47
- desc "Load plugin/engine fixtures into the current environment's database."
36
+ desc "Load plugin fixtures into the current environment's database."
48
37
  task :load => :environment do
49
38
  require 'active_record/fixtures'
50
39
  ActiveRecord::Base.establish_connection(RAILS_ENV.to_sym)
51
- plugin = ENV['ENGINE'] || '*'
52
- Dir.glob(File.join(RAILS_ROOT, 'vendor', 'plugins', plugin, 'test', 'fixtures', '*.yml')).each do |fixture_file|
40
+ Dir.glob(File.join(RAILS_ROOT, 'vendor', 'plugins', ENV['PLUGIN'] || '**',
41
+ 'test', 'fixtures', '*.yml')).each do |fixture_file|
53
42
  Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
54
43
  end
55
44
  end
56
45
 
57
46
  end
58
47
  end
59
-
60
-
61
- namespace :migrate do
62
-
63
- desc "Migrate all engines. Target specific version with VERSION=x, specific engine with ENGINE=x"
64
- task :engines => :environment do
65
- engines_to_migrate = ENV["ENGINE"] ? [Engines.get(ENV["ENGINE"])].compact : Engines.active
66
- if engines_to_migrate.empty?
67
- puts "Couldn't find an engine called '#{ENV["ENGINE"]}'"
68
- else
69
- if ENV["VERSION"] && !ENV["ENGINE"]
70
- # ignore the VERSION, since it makes no sense in this context; we wouldn't
71
- # want to revert ALL engines to the same version because of a misttype
72
- puts "Ignoring the given version (#{ENV["VERSION"]})."
73
- puts "To control individual engine versions, use the ENGINE=<engine> argument"
74
- else
75
- engines_to_migrate.each do |engine|
76
- Engines::EngineMigrator.current_engine = engine
77
- migration_directory = File.join(engine.root, 'db', 'migrate')
78
- if File.exist?(migration_directory)
79
- puts "Migrating engine '#{engine.name}'"
80
- Engines::EngineMigrator.migrate(migration_directory, ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
81
- else
82
- puts "The db/migrate directory for engine '#{engine.name}' appears to be missing."
83
- puts "Should be: #{migration_directory}"
84
- end
85
- end
86
- if ActiveRecord::Base.schema_format == :ruby && !engines_to_migrate.empty?
87
- Rake::Task[:db_schema_dump].invoke
88
- end
89
- end
90
- end
91
- end
92
-
93
- namespace :engines do
94
- Engines::RakeTasks.all_engines.each do |engine_name|
95
- desc "Migrate the '#{engine_name}' engine. Target specific version with VERSION=x"
96
- task engine_name => :environment do
97
- ENV['ENGINE'] = engine_name; Rake::Task['db:migrate:engines'].invoke
98
- end
99
- end
100
- end
101
-
102
- end
103
48
  end
104
49
 
105
-
106
- # this is just a rip-off from the plugin stuff in railties/lib/tasks/documentation.rake,
107
- # because the default plugindoc stuff doesn't support subdirectories like <engine>/app or
108
- # <engine>/component.
50
+ # this is just a modification of the original task in railties/lib/tasks/documentation.rake,
51
+ # because the default task doesn't support subdirectories like <plugin>/app or
52
+ # <plugin>/component. These tasks now include every file under a plugin's code paths (see
53
+ # Plugin#code_paths).
109
54
  namespace :doc do
110
55
 
111
- desc "Generate documation for all installed engines"
112
- task :engines => Engines::RakeTasks.all_engines.map {|engine| "doc:engines:#{engine}"}
56
+ plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }
57
+
58
+ namespace :plugins do
113
59
 
114
- namespace :engines do
115
- # Define doc tasks for each engine
116
- Engines::RakeTasks.all_engines.each do |engine_name|
117
- desc "Generation documentation for the '#{engine_name}' engine"
118
- task engine_name => :environment do
119
- engine_base = "vendor/plugins/#{engine_name}"
60
+ # Define doc tasks for each plugin
61
+ plugins.each do |plugin|
62
+ desc "Create plugin documentation for '#{plugin}'"
63
+ Rake::Task.redefine_task(plugin => :environment) do
64
+ plugin_base = RAILS_ROOT + "/vendor/plugins/#{plugin}"
120
65
  options = []
121
66
  files = Rake::FileList.new
122
- options << "-o doc/plugins/#{engine_name}"
123
- options << "--title '#{engine_name.titlecase} Documentation'"
124
- options << '--line-numbers --inline-source'
125
- options << '--all' # include protected methods
67
+ options << "-o doc/plugins/#{plugin}"
68
+ options << "--title '#{plugin.titlecase} Plugin Documentation'"
69
+ options << '--line-numbers' << '--inline-source'
126
70
  options << '-T html'
127
71
 
128
- files.include("#{engine_base}/lib/**/*.rb")
129
- files.include("#{engine_base}/app/**/*.rb") # include the app directory
130
- files.include("#{engine_base}/components/**/*.rb") # include the components directory
131
- if File.exists?("#{engine_base}/README")
132
- files.include("#{engine_base}/README")
133
- options << "--main '#{engine_base}/README'"
72
+ # Include every file in the plugin's code_paths (see Plugin#code_paths)
73
+ files.include("#{plugin_base}/{#{Rails.plugins[plugin].code_paths.join(",")}}/**/*.rb")
74
+ if File.exists?("#{plugin_base}/README")
75
+ files.include("#{plugin_base}/README")
76
+ options << "--main '#{plugin_base}/README'"
134
77
  end
135
- files.include("#{engine_base}/CHANGELOG") if File.exists?("#{engine_base}/CHANGELOG")
78
+ files.include("#{plugin_base}/CHANGELOG") if File.exists?("#{plugin_base}/CHANGELOG")
136
79
 
137
- options << files.to_s
138
-
139
- sh %(rdoc #{options * ' '})
80
+ if files.empty?
81
+ puts "No source files found in #{plugin_base}. No documentation will be generated."
82
+ else
83
+ options << files.to_s
84
+ sh %(rdoc #{options * ' '})
85
+ end
140
86
  end
141
87
  end
142
88
  end
143
89
  end
144
90
 
91
+
92
+
145
93
  namespace :test do
146
- desc "Run the engine tests in vendor/plugins/**/test (or specify with ENGINE=name)"
147
- # NOTE: we're using the Rails 1.0 non-namespaced task here, just to maintain
148
- # compatibility with Rails 1.0
149
- # TODO: make this work with Engines.config(:root)
150
-
151
- namespace :engines do
152
- Engines::RakeTasks.all_engines.each do |engine_name|
153
- desc "Run the engine tests for '#{engine_name}'"
154
- Rake::TestTask.new(engine_name => :prepare_test_database) do |t|
155
- t.libs << 'test'
156
- t.pattern = "vendor/plugins/#{engine_name}/test/**/*_test.rb"
157
- t.verbose = true
158
- end
159
- end
160
- end
161
-
162
- Rake::TestTask.new(:engines => [:warn_about_multiple_engines_testing, :prepare_test_database]) do |t|
163
- t.libs << "test"
164
- engines = ENV['ENGINE'] || '**'
165
- t.pattern = "vendor/plugins/#{engines}/test/**/*_test.rb"
166
- t.verbose = true
94
+ task :warn_about_multiple_plugin_testing_with_engines do
95
+ puts %{-~============== A Moste Polite Warninge ===========================~-
96
+
97
+ You may experience issues testing multiple plugins at once when using
98
+ the code-mixing features that the engines plugin provides. If you do
99
+ experience any problems, please test plugins individually, i.e.
100
+
101
+ $ rake test:plugins PLUGIN=my_plugin
102
+
103
+ or use the per-type plugin test tasks:
104
+
105
+ $ rake test:plugins:units
106
+ $ rake test:plugins:functionals
107
+ $ rake test:plugins:integration
108
+ $ rake test:plugins:all
109
+
110
+ Report any issues on http://dev.rails-engines.org. Thanks!
111
+
112
+ -~===============( ... as you were ... )============================~-}
167
113
  end
168
114
 
169
- task :warn_about_multiple_engines_testing do
170
- puts %{-~============== A Moste Polite Warninge ==================~-
171
- You may experience issues testing multiple engines at once.
172
- Please test engines individual for the moment.
173
- -~===============( ... as you were ... )===================~-
174
- }
175
- end
115
+ namespace :plugins do
116
+
117
+ desc "Run the plugin tests in vendor/plugins/**/test (or specify with PLUGIN=name)"
118
+ task :all => [:warn_about_multiple_plugin_testing_with_engines,
119
+ :units, :functionals, :integration]
120
+
121
+ desc "Run all plugin unit tests"
122
+ Rake::TestTask.new(:units => :setup_plugin_fixtures) do |t|
123
+ t.pattern = "vendor/plugins/#{ENV['PLUGIN'] || "**"}/test/unit/**/*_test.rb"
124
+ t.verbose = true
125
+ end
126
+
127
+ desc "Run all plugin functional tests"
128
+ Rake::TestTask.new(:functionals => :setup_plugin_fixtures) do |t|
129
+ t.pattern = "vendor/plugins/#{ENV['PLUGIN'] || "**"}/test/functional/**/*_test.rb"
130
+ t.verbose = true
131
+ end
132
+
133
+ desc "Integration test engines"
134
+ Rake::TestTask.new(:integration => :setup_plugin_fixtures) do |t|
135
+ t.pattern = "vendor/plugins/#{ENV['PLUGIN'] || "**"}/test/integration/**/*_test.rb"
136
+ t.verbose = true
137
+ end
138
+
139
+ desc "Mirrors plugin fixtures into a single location to help plugin tests"
140
+ task :setup_plugin_fixtures => :environment do
141
+ Engines::Testing.setup_plugin_fixtures
142
+ end
143
+
144
+ # Patch the default plugin testing task to have setup_plugin_fixtures as a prerequisite
145
+ Rake::Task["test:plugins"].prerequisites << "test:plugins:setup_plugin_fixtures"
146
+ end
176
147
  end