parlement 0.14 → 0.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. data/CHANGES +41 -1
  2. data/MEMORY +66 -5
  3. data/README +10 -5
  4. data/Rakefile +15 -23
  5. data/app/controllers/account_controller.rb +48 -43
  6. data/app/controllers/{application.rb → application_controller.rb} +15 -12
  7. data/app/controllers/elt_controller.rb +77 -32
  8. data/app/controllers/subscriber_controller.rb +11 -10
  9. data/app/helpers/application_helper.rb +14 -1
  10. data/app/helpers/elt_helper.rb +9 -7
  11. data/app/models/elt.rb +25 -24
  12. data/app/models/mail.rb +44 -47
  13. data/app/models/person_notify.rb +2 -2
  14. data/app/models/user.rb +128 -2
  15. data/app/models/user_notify.rb +15 -15
  16. data/app/views/account/_login.rhtml +39 -39
  17. data/app/views/account/_show.rhtml +22 -30
  18. data/app/views/account/signup.rhtml +2 -2
  19. data/app/views/elt/_choice.rhtml +6 -6
  20. data/app/views/elt/_elt.rhtml +27 -32
  21. data/app/views/elt/choices.rhtml +16 -18
  22. data/app/views/elt/list/_byDate.rhtml +14 -14
  23. data/app/views/elt/list/_byVote.rhtml +15 -15
  24. data/app/views/elt/list/_children.rhtml +48 -40
  25. data/app/views/elt/list/_subscribers.rhtml +1 -1
  26. data/app/views/elt/new.rhtml +22 -21
  27. data/app/views/elt/rss.rxml +4 -11
  28. data/app/views/elt/show.rhtml +65 -61
  29. data/app/views/elt/vote_rss.rxml +4 -11
  30. data/app/views/layouts/top.rhtml +39 -50
  31. data/app/views/person/_listElts.rhtml +1 -1
  32. data/app/views/person/show.rhtml +1 -1
  33. data/{vendor/plugins/login_engine/app → app}/views/user_notify/change_password.rhtml +0 -0
  34. data/{vendor/plugins/login_engine/app → app}/views/user_notify/delete.rhtml +0 -0
  35. data/{vendor/plugins/login_engine/app → app}/views/user_notify/forgot_password.rhtml +0 -0
  36. data/{vendor/plugins/login_engine/app → app}/views/user_notify/pending_delete.rhtml +0 -0
  37. data/{vendor/plugins/login_engine/app → app}/views/user_notify/signup.rhtml +0 -0
  38. data/config/boot.rb +97 -32
  39. data/config/environment.rb +37 -35
  40. data/config/environments/development.rb +2 -3
  41. data/config/environments/production.rb +3 -0
  42. data/config/initializers/string_ruby_1.8.rb +10 -0
  43. data/config/routes.rb +17 -22
  44. data/db/schema.rb +102 -74
  45. data/lib/tasks/rspec.rake +167 -0
  46. data/public/404.html +25 -7
  47. data/public/500.html +26 -7
  48. data/public/dispatch.cgi +0 -0
  49. data/public/dispatch.fcgi +0 -0
  50. data/public/dispatch.rb +0 -0
  51. data/public/images/live_tree_branch_collapsed_icon.gif +0 -0
  52. data/public/images/live_tree_branch_expanded_icon.gif +0 -0
  53. data/public/images/live_tree_leaf_icon.gif +0 -0
  54. data/public/javascripts/application.js +258 -0
  55. data/public/javascripts/controls.js +544 -414
  56. data/public/javascripts/dragdrop.js +229 -198
  57. data/public/javascripts/effects.js +499 -459
  58. data/public/javascripts/prototype.js +2926 -1121
  59. data/public/javascripts/shadedborder.js +68 -50
  60. data/public/stylesheets/default.css +34 -34
  61. data/public/stylesheets/live_tree.css +0 -0
  62. data/public/stylesheets/scaffold.css +6 -6
  63. data/script/about +0 -0
  64. data/script/autospec +6 -0
  65. data/script/benchmarker +0 -0
  66. data/script/breakpointer +0 -0
  67. data/script/console +0 -0
  68. data/script/dbconsole +3 -0
  69. data/script/destroy +0 -0
  70. data/script/generate +0 -0
  71. data/script/plugin +0 -0
  72. data/script/profiler +0 -0
  73. data/script/runner +0 -0
  74. data/script/server +0 -0
  75. data/script/spec +10 -0
  76. data/script/spec_server +9 -0
  77. data/test/unit/attachment_test.rb +4 -4
  78. data/test/unit/choice_test.rb +1 -1
  79. data/test/unit/elt_test.rb +9 -9
  80. data/test/unit/mail_notify_test.rb +2 -2
  81. data/test/unit/mail_test.rb +18 -11
  82. data/test/unit/person_notify_test.rb +1 -1
  83. data/test/unit/person_test.rb +1 -1
  84. data/test/unit/subscriber_test.rb +1 -1
  85. data/test/unit/user_test.rb +81 -0
  86. data/test/unit/visit_test.rb +6 -6
  87. data/vendor/plugins/activerecord_foreign_key_extensions/init.rb +2 -0
  88. data/vendor/plugins/activerecord_foreign_key_extensions/lib/active_record_extensions.rb +182 -0
  89. data/vendor/plugins/activerecord_text_id_extensions/init.rb +2 -0
  90. data/vendor/plugins/activerecord_text_id_extensions/lib/active_record_extensions.rb +24 -0
  91. data/vendor/plugins/acts_as_nested_set/README +15 -0
  92. data/vendor/plugins/acts_as_nested_set/init.rb +1 -0
  93. data/vendor/plugins/acts_as_nested_set/lib/active_record/acts/nested_set.rb +210 -0
  94. data/vendor/plugins/acts_as_nested_set/test/nested_set_test.rb +269 -0
  95. data/vendor/plugins/acts_as_tree/README +26 -0
  96. data/vendor/plugins/acts_as_tree/Rakefile +22 -0
  97. data/vendor/plugins/acts_as_tree/init.rb +1 -0
  98. data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
  99. data/vendor/plugins/{output_compression/CHANGELOG → acts_as_tree/test/abstract_unit.rb} +0 -0
  100. data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
  101. data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
  102. data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
  103. data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
  104. data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
  105. data/vendor/plugins/classic_pagination/CHANGELOG +152 -0
  106. data/vendor/plugins/classic_pagination/README +18 -0
  107. data/vendor/plugins/{output_compression/rakefile → classic_pagination/Rakefile} +22 -22
  108. data/vendor/plugins/classic_pagination/init.rb +33 -0
  109. data/vendor/plugins/classic_pagination/install.rb +1 -0
  110. data/vendor/plugins/classic_pagination/lib/pagination.rb +405 -0
  111. data/vendor/plugins/classic_pagination/lib/pagination_helper.rb +135 -0
  112. data/vendor/plugins/classic_pagination/test/fixtures/companies.yml +24 -0
  113. data/vendor/plugins/classic_pagination/test/fixtures/company.rb +9 -0
  114. data/vendor/plugins/classic_pagination/test/fixtures/developer.rb +7 -0
  115. data/vendor/plugins/classic_pagination/test/fixtures/developers.yml +21 -0
  116. data/vendor/plugins/classic_pagination/test/fixtures/developers_projects.yml +13 -0
  117. data/vendor/plugins/classic_pagination/test/fixtures/project.rb +3 -0
  118. data/vendor/plugins/classic_pagination/test/fixtures/projects.yml +7 -0
  119. data/vendor/plugins/classic_pagination/test/fixtures/replies.yml +13 -0
  120. data/vendor/plugins/classic_pagination/test/fixtures/reply.rb +5 -0
  121. data/vendor/plugins/classic_pagination/test/fixtures/schema.sql +42 -0
  122. data/vendor/plugins/classic_pagination/test/fixtures/topic.rb +3 -0
  123. data/vendor/plugins/classic_pagination/test/fixtures/topics.yml +22 -0
  124. data/vendor/plugins/classic_pagination/test/helper.rb +117 -0
  125. data/vendor/plugins/classic_pagination/test/pagination_helper_test.rb +38 -0
  126. data/vendor/plugins/classic_pagination/test/pagination_test.rb +177 -0
  127. data/vendor/plugins/file_column/lib/file_column.rb +1 -1
  128. data/vendor/plugins/file_column/test/file_column_test.rb +0 -0
  129. metadata +151 -197
  130. data/app/helpers/live_tree.rb +0 -238
  131. data/app/views/elt/_form.rhtml +0 -31
  132. data/app/views/elt/show_tree.rhtml +0 -8
  133. data/config/environments/user_environment.rb +0 -1
  134. data/db/ROOT/Titemagli.txt +0 -3
  135. data/db/ROOT/titemagli.txt +0 -9
  136. data/public/javascripts/behaviour.js +0 -254
  137. data/public/javascripts/ie7-load.htc +0 -1
  138. data/public/javascripts/ie7.js +0 -6
  139. data/public/javascripts/live_tree.js +0 -749
  140. data/public/javascripts/mybehaviour.js +0 -225
  141. data/public/javascripts/scriptaculous.js +0 -47
  142. data/public/javascripts/slider.js +0 -283
  143. data/public/stylesheets/blue.css +0 -471
  144. data/vendor/plugins/engines/CHANGELOG +0 -241
  145. data/vendor/plugins/engines/MIT-LICENSE +0 -21
  146. data/vendor/plugins/engines/README +0 -64
  147. data/vendor/plugins/engines/Rakefile +0 -32
  148. data/vendor/plugins/engines/UPGRADING +0 -93
  149. data/vendor/plugins/engines/about.yml +0 -7
  150. data/vendor/plugins/engines/generators/plugin_migration/USAGE +0 -45
  151. data/vendor/plugins/engines/generators/plugin_migration/plugin_migration_generator.rb +0 -79
  152. data/vendor/plugins/engines/generators/plugin_migration/templates/plugin_migration.erb +0 -13
  153. data/vendor/plugins/engines/init.rb +0 -40
  154. data/vendor/plugins/engines/install.rb +0 -32
  155. data/vendor/plugins/engines/lib/engines.rb +0 -323
  156. data/vendor/plugins/engines/lib/engines/deprecated_config_support.rb +0 -135
  157. data/vendor/plugins/engines/lib/engines/plugin.rb +0 -214
  158. data/vendor/plugins/engines/lib/engines/plugin_list.rb +0 -31
  159. data/vendor/plugins/engines/lib/engines/plugin_migrator.rb +0 -60
  160. data/vendor/plugins/engines/lib/engines/rails_extensions.rb +0 -6
  161. data/vendor/plugins/engines/lib/engines/rails_extensions/active_record.rb +0 -19
  162. data/vendor/plugins/engines/lib/engines/rails_extensions/dependencies.rb +0 -143
  163. data/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb +0 -155
  164. data/vendor/plugins/engines/lib/engines/rails_extensions/public_asset_helpers.rb +0 -116
  165. data/vendor/plugins/engines/lib/engines/rails_extensions/rails.rb +0 -20
  166. data/vendor/plugins/engines/lib/engines/rails_extensions/rails_initializer.rb +0 -86
  167. data/vendor/plugins/engines/lib/engines/rails_extensions/routing.rb +0 -77
  168. data/vendor/plugins/engines/lib/engines/rails_extensions/templates.rb +0 -140
  169. data/vendor/plugins/engines/lib/engines/testing.rb +0 -87
  170. data/vendor/plugins/engines/tasks/engines.rake +0 -149
  171. data/vendor/plugins/login_engine/CHANGELOG +0 -22
  172. data/vendor/plugins/login_engine/README +0 -344
  173. data/vendor/plugins/login_engine/app/controllers/user_controller.rb +0 -262
  174. data/vendor/plugins/login_engine/app/helpers/user_helper.rb +0 -88
  175. data/vendor/plugins/login_engine/app/models/user.rb +0 -7
  176. data/vendor/plugins/login_engine/app/models/user_notify.rb +0 -75
  177. data/vendor/plugins/login_engine/app/views/user/_edit.rhtml +0 -11
  178. data/vendor/plugins/login_engine/app/views/user/_password.rhtml +0 -9
  179. data/vendor/plugins/login_engine/app/views/user/change_password.rhtml +0 -17
  180. data/vendor/plugins/login_engine/app/views/user/edit.rhtml +0 -23
  181. data/vendor/plugins/login_engine/app/views/user/forgot_password.rhtml +0 -18
  182. data/vendor/plugins/login_engine/app/views/user/home.rhtml +0 -7
  183. data/vendor/plugins/login_engine/app/views/user/login.rhtml +0 -17
  184. data/vendor/plugins/login_engine/app/views/user/logout.rhtml +0 -8
  185. data/vendor/plugins/login_engine/app/views/user/signup.rhtml +0 -17
  186. data/vendor/plugins/login_engine/db/migrate/001_initial_schema.rb +0 -25
  187. data/vendor/plugins/login_engine/init_engine.rb +0 -11
  188. data/vendor/plugins/login_engine/install.rb +0 -4
  189. data/vendor/plugins/login_engine/lib/login_engine.rb +0 -62
  190. data/vendor/plugins/login_engine/lib/login_engine/authenticated_system.rb +0 -113
  191. data/vendor/plugins/login_engine/lib/login_engine/authenticated_user.rb +0 -155
  192. data/vendor/plugins/login_engine/public/stylesheets/login_engine.css +0 -81
  193. data/vendor/plugins/login_engine/test/fixtures/users.yml +0 -41
  194. data/vendor/plugins/login_engine/test/functional/user_controller_test.rb +0 -536
  195. data/vendor/plugins/login_engine/test/mocks/mail.rb +0 -14
  196. data/vendor/plugins/login_engine/test/mocks/time.rb +0 -19
  197. data/vendor/plugins/login_engine/test/test_helper.rb +0 -11
  198. data/vendor/plugins/login_engine/test/unit/user_test.rb +0 -114
  199. data/vendor/plugins/output_compression/MIT-LICENSE +0 -20
  200. data/vendor/plugins/output_compression/README +0 -4
  201. data/vendor/plugins/output_compression/init.rb +0 -1
  202. data/vendor/plugins/output_compression/lib/output_compression.rb +0 -84
  203. data/vendor/plugins/output_compression/test/output_test.rb +0 -11
  204. data/vendor/plugins/output_compression/test/test_controller.rb +0 -3
  205. data/vendor/plugins/output_compression/test/test_helper.rb +0 -14
@@ -39,10 +39,24 @@ Rails::Initializer.run do |config|
39
39
  # Use Active Record's schema dumper instead of SQL when creating the test database
40
40
  # (enables use of different database adapters for development and test environments)
41
41
  # config.active_record.schema_format = :ruby
42
- # echarp
43
- config.active_record.schema_format = :sql
44
42
 
45
43
  # See Rails::Configuration for more options
44
+
45
+ config.action_controller.session = {
46
+ :session_key => "_parlement_session",
47
+ :secret => "phrase of at least 30 characters"
48
+ }
49
+
50
+ config.gem "term-ansicolor", :lib => "term/ansicolor"
51
+ config.gem "ruby-debug"
52
+ config.gem "RedCloth", :lib => "redcloth"
53
+
54
+ config.gem 'locale'
55
+ config.gem "locale_rails"
56
+ config.gem "gettext_activerecord"
57
+ config.gem "gettext_rails"
58
+
59
+ config.gem "meta_project"
46
60
  end
47
61
 
48
62
  # Add new inflection rules using the following format
@@ -56,16 +70,6 @@ end
56
70
 
57
71
  # Include your application configuration below
58
72
 
59
-
60
-
61
- # http://www.kanthak.net/opensource/file_column/
62
- require 'rails_file_column'
63
-
64
- require 'jcode'
65
- $KCODE = 'u'
66
-
67
- require 'gettext/rails'
68
-
69
73
  # What is the name of a quick anonymous poster
70
74
  ANONYMOUS_POSTER = 'anon'
71
75
 
@@ -79,38 +83,36 @@ LIST_LENGTH = 10
79
83
  # Number of elt's paragraphs to show initially
80
84
  NB_PARAGRAPH_TO_DISPLAY = 4
81
85
 
82
- require 'environments/user_environment'
86
+ # Number of seconds between sidebar list automatic updates
87
+ UPDATE_VIEW_PERIOD = 300
83
88
 
84
89
  CONFIG = { :default_language => 'en' }
85
90
 
86
91
  # This variable is of course used for mails, but also in the html mail
87
92
  # template, to set the base url for the generated html
88
93
  ActionMailer::Base.smtp_settings = {
89
- :domain => 'leparlement.org'
94
+ :domain => 'leparlement.org'
90
95
  }
91
96
 
92
- #
93
- # :address => 'smtp.postoffice.net',
94
- # :port => 25,
95
- # :domain => 'www.mywebsite.com',
96
- # :user_name => 'me@postoffice.net',
97
- # :password => 'mypass',
98
- # :authentication => :login
99
- #
100
-
101
- require File.join(RAILS_ROOT, "vendor", "plugins", "engines", "lib", "engines",
102
- "deprecated_config_support")
103
-
104
- module LoginEngine
105
- config :salt, 'parle'
106
- config :email_from, 'facteur@leparlement.org'
107
- config :admin_email, 'root@leparlement.org'
108
- config :app_url, 'http://leparlement.org'
109
- config :app_name, 'parlement'
110
- config :use_email_notification, true
111
- end
97
+ LOGIN_ENGINE = {
98
+ :salt => 'parle',
99
+ :email_from => 'facteur@leparlement.org',
100
+ :admin_email => 'root@leparlement.org',
101
+ :app_url => 'http://leparlement.org',
102
+ :app_name => 'parlement',
103
+ :use_email_notification => true,
104
+ :mail_charset => 'utf-8',
105
+ :security_token_life_hours => 24
106
+ }
112
107
 
113
108
  Rubaidh::GoogleAnalytics.tracker_id = 'UA-317241-1'
114
109
 
115
- PARLEMENT_VERSION='0.14'
110
+ PARLEMENT_VERSION = '0.17'
111
+
112
+ def log_to(stream)
113
+ ActiveRecord::Base.logger = Logger.new(stream)
114
+ ActiveRecord::Base.clear_active_connections!
115
+ end
116
+
117
+ #log_to STDOUT
116
118
 
@@ -8,9 +8,6 @@ config.cache_classes = false
8
8
  # Log error messages when you accidentally call methods on nil.
9
9
  config.whiny_nils = true
10
10
 
11
- # Enable the breakpoint server that script/breakpointer connects to
12
- config.breakpoint_server = true
13
-
14
11
  # Show full error reports and disable caching
15
12
  config.action_controller.consider_all_requests_local = true
16
13
  config.action_controller.perform_caching = true
@@ -19,3 +16,5 @@ config.action_controller.perform_caching = true
19
16
  config.action_mailer.raise_delivery_errors = false
20
17
 
21
18
  config.action_mailer.delivery_method = :test
19
+
20
+ require 'ruby-debug'
@@ -17,3 +17,6 @@ config.action_controller.perform_caching = true
17
17
 
18
18
  # Disable delivery errors if you bad email addresses should just be ignored
19
19
  # config.action_mailer.raise_delivery_errors = false
20
+
21
+ ActionController::Base.cache_store = :file_store, "tmp/cache"
22
+
@@ -0,0 +1,10 @@
1
+ unless '1.9'.respond_to?(:force_encoding)
2
+ String.class_eval do
3
+ begin
4
+ remove_method :chars
5
+ rescue NameError
6
+ # OK
7
+ end
8
+ end
9
+ end
10
+
@@ -1,36 +1,31 @@
1
1
  ActionController::Routing::Routes.draw do |map|
2
- # Add your own custom routes here.
3
- # The priority is based upon order of creation: first created -> highest priority.
4
-
5
- # Here's a sample route:
6
- # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7
- # Keep in mind you can assign values other than :controller and :action
2
+ # Add your own custom routes here.
3
+ # The priority is based upon order of creation: first created -> highest priority.
8
4
 
9
- # You can have the root of your site routed by hooking up ''
10
- # -- just remember to delete public/index.html.
11
- # map.connect '', :controller => "welcome"
5
+ # Here's a sample route:
6
+ # map.connect 'products/:id', :controller => 'catalog', :action => 'view'
7
+ # Keep in mind you can assign values other than :controller and :action
12
8
 
13
- map.connect '', :controller => 'elt', :action => 'show', :id => 'parlement'
14
- map.connect 'index.rss', :controller => 'elt', :action => 'rss', :id => 'parlement'
15
- map.connect 'vote.rss', :controller => 'elt', :action => 'vote_rss', :id => 'parlement'
9
+ # You can have the root of your site routed by hooking up ''
10
+ # -- just remember to delete public/index.html.
11
+ # map.connect '', :controller => "welcome"
12
+
13
+ # This is to get clean nice rss urls, the empty id is necessary... it seems
14
+ map.connect 'index.rss', :controller => 'elt', :action => 'rss', :id => ''
15
+ map.connect 'vote.rss', :controller => 'elt', :action => 'vote_rss', :id => ''
16
16
 
17
17
  map.connect ':id/index.rss', :controller => 'elt', :action => 'rss'
18
18
  map.connect ':id/vote.rss', :controller => 'elt', :action => 'vote_rss'
19
- map.connect ':id//index.rss', :controller => 'elt', :action => 'rss'
20
- map.connect ':id//vote.rss', :controller => 'elt', :action => 'vote_rss'
21
-
22
- # Allow downloading Web Service WSDL as a file with an extension
23
- # instead of a file named 'wsdl'
24
- #map.connect ':controller/service.wsdl', :action => 'wsdl'
25
19
 
26
20
  map.connect ':id', :controller => 'elt', :action => 'rss', :requirements => { :id => /.*\.rss/ }
27
- map.connect ':id', :controller => 'elt', :action => 'show'
21
+ map.connect ':id', :controller => 'elt'
28
22
 
29
- # Install the default route as the lowest priority.
30
- map.connect ':controller/:action/:id'
23
+ # Install the default route as the lowest priority.
24
+ map.connect ':controller/:action/:id'
31
25
 
32
- map.connect 'perso/:id', :controller => 'elt', :action => 'show'
26
+ map.connect 'perso/:id', :controller => 'elt'
33
27
  map.connect 'perso/:id/index.rss', :controller => 'elt', :action => 'rss'
28
+ map.connect 'perso/:id/vote.rss', :controller => 'elt', :action => 'rss'
34
29
  map.connect 'perso/blog/:id', :controller => 'elt'
35
30
  map.connect 'perso/blog/:id/index.rss', :controller => 'elt', :action => 'rss'
36
31
  map.connect 'perso/blog/:id/vote.rss', :controller => 'elt', :action => 'vote_rss'
@@ -1,130 +1,158 @@
1
- # This file is autogenerated. Instead of editing this file, please use the
2
- # migrations feature of ActiveRecord to incrementally modify your database, and
1
+ # This file is auto-generated from the current state of the database. Instead of editing this file,
2
+ # please use the migrations feature of Active Record to incrementally modify your database, and
3
3
  # then regenerate this schema definition.
4
+ #
5
+ # Note that this schema.rb definition is the authoritative source for your database schema. If you need
6
+ # to create the application database on another system, you should be using db:schema:load, not running
7
+ # all the migrations from scratch. The latter is a flawed and unsustainable approach (the more migrations
8
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
9
+ #
10
+ # It's strongly recommended to check this file into your version control system.
4
11
 
5
12
  ActiveRecord::Schema.define(:version => 9) do
6
13
 
7
14
  create_table "attachments", :force => true do |t|
8
- t.column "elt_id", :text, :null => false
9
- t.column "created_on", :datetime, :null => false
10
- t.column "content_type", :text
11
- t.column "file", :text
15
+ t.text "elt_id", :null => false
16
+ t.datetime "created_on", :null => false
17
+ t.text "content_type"
18
+ t.text "file"
12
19
  end
13
20
 
21
+ remove_column :attachments, :id
22
+ add_column :attachments, :id, :text, :null => false, :primary_key => true
23
+ execute 'ALTER TABLE attachments ADD CONSTRAINT attachments_pkey PRIMARY KEY (id)'
24
+
14
25
  create_table "choices", :force => true do |t|
15
- t.column "elt_id", :string, :null => false
16
- t.column "person_id", :string
17
- t.column "created_on", :datetime, :null => false
18
- t.column "value", :integer, :default => 1, :null => false
26
+ t.string "elt_id", :null => false
27
+ t.string "person_id"
28
+ t.datetime "created_on", :null => false
29
+ t.integer "value", :default => 1, :null => false
19
30
  end
20
31
 
21
32
  add_index "choices", ["elt_id", "person_id"], :name => "elt_person_key", :unique => true
22
33
 
23
34
  create_table "delegations", :force => true do |t|
24
- t.column "elt_id", :text, :null => false
25
- t.column "person_id", :text, :null => false
26
- t.column "created_on", :datetime, :null => false
27
- t.column "temporary", :boolean, :default => false, :null => false
28
- t.column "delegate_to", :text, :null => false
35
+ t.text "elt_id", :null => false
36
+ t.text "person_id", :null => false
37
+ t.datetime "created_on", :null => false
38
+ t.boolean "temporary", :default => false, :null => false
39
+ t.text "delegate_to", :null => false
29
40
  end
30
41
 
31
42
  create_table "elts", :force => true do |t|
32
- t.column "parent_id", :text
33
- t.column "position", :float
34
- t.column "created_on", :datetime, :null => false
35
- t.column "person_id", :text
36
- t.column "subject", :text
37
- t.column "body", :text
38
- t.column "lft", :integer
39
- t.column "rgt", :integer
40
- t.column "elts_count", :integer, :default => 0
41
- t.column "last_activity", :datetime
43
+ t.text "parent_id"
44
+ t.float "position"
45
+ t.datetime "created_on", :null => false
46
+ t.text "person_id"
47
+ t.text "subject"
48
+ t.text "body"
49
+ t.integer "lft"
50
+ t.integer "rgt"
51
+ t.integer "elts_count", :default => 0
52
+ t.datetime "last_activity"
42
53
  end
43
54
 
55
+ add_index "elts", ["lft"], :name => "lft"
44
56
  add_index "elts", ["parent_id"], :name => "elts_parent"
45
57
  add_index "elts", ["parent_id"], :name => "elts_parent_key"
46
- add_index "elts", ["lft"], :name => "lft"
47
58
  add_index "elts", ["rgt"], :name => "rgt"
48
59
 
60
+ remove_column :elts, :id
61
+ add_column :elts, :id, :text, :null => false, :primary_key => true
62
+ execute 'ALTER TABLE elts ADD CONSTRAINT elts_pkey PRIMARY KEY (id)'
63
+
49
64
  create_table "engine_schema_info", :id => false, :force => true do |t|
50
- t.column "engine_name", :string
51
- t.column "version", :integer
65
+ t.string "engine_name"
66
+ t.integer "version"
52
67
  end
53
68
 
54
69
  create_table "mails", :force => true do |t|
55
- t.column "elt_id", :text, :null => false
56
- t.column "message", :text
57
- t.column "mail_parents", :text
58
- t.column "file", :text
70
+ t.text "elt_id", :null => false
71
+ t.text "message"
72
+ t.text "mail_parents"
73
+ t.text "file"
59
74
  end
60
75
 
76
+ remove_column :mails, :id
77
+ add_column :mails, :id, :text, :null => false, :primary_key => true
78
+ execute 'ALTER TABLE mails ADD CONSTRAINT mails_pkey PRIMARY KEY (id)'
79
+
61
80
  create_table "old_visits", :force => true do |t|
62
- t.column "person_id", :string
63
- t.column "elt_id", :string, :null => false
64
- t.column "created_on", :datetime, :null => false
65
- t.column "updated_on", :datetime
66
- t.column "filter", :integer, :default => 0
81
+ t.string "person_id"
82
+ t.string "elt_id", :null => false
83
+ t.datetime "created_on", :null => false
84
+ t.datetime "updated_on"
85
+ t.integer "filter", :default => 0
67
86
  end
68
87
 
69
- add_index "old_visits", ["person_id", "elt_id"], :name => "old_visits_elt_person_key", :unique => true
88
+ add_index "old_visits", ["elt_id", "person_id"], :name => "old_visits_elt_person_key", :unique => true
70
89
 
71
90
  create_table "people", :force => true do |t|
72
- t.column "created_on", :datetime, :null => false
73
- t.column "name", :text
74
- t.column "email", :text
75
- t.column "image", :text
76
- t.column "last_login", :datetime
91
+ t.datetime "created_on", :null => false
92
+ t.text "name"
93
+ t.text "email"
94
+ t.text "image"
95
+ t.datetime "last_login"
77
96
  end
78
97
 
79
98
  add_index "people", ["name"], :name => "people_name_key", :unique => true
80
99
 
100
+ remove_column :people, :id
101
+ add_column :people, :id, :text, :null => false, :primary_key => true
102
+ execute 'ALTER TABLE people ADD CONSTRAINT people_pkey PRIMARY KEY (id)'
103
+
81
104
  create_table "person_mails", :force => true do |t|
82
- t.column "mail_id", :string, :null => false
83
- t.column "person_id", :string
84
- t.column "created_on", :datetime, :null => false
105
+ t.string "mail_id", :null => false
106
+ t.string "person_id"
107
+ t.datetime "created_on", :null => false
108
+ end
109
+
110
+ create_table "plugin_schema_info", :id => false, :force => true do |t|
111
+ t.string "plugin_name"
112
+ t.integer "version"
85
113
  end
86
114
 
87
115
  create_table "subscriptions", :force => true do |t|
88
- t.column "elt_id", :text, :null => false
89
- t.column "person_id", :text, :null => false
90
- t.column "filter", :integer, :default => 0
91
- t.column "created_on", :datetime, :null => false
116
+ t.text "elt_id", :null => false
117
+ t.text "person_id", :null => false
118
+ t.integer "filter", :default => 0
119
+ t.datetime "created_on", :null => false
92
120
  end
93
121
 
94
122
  create_table "users", :force => true do |t|
95
- t.column "login", :text, :null => false
96
- t.column "salted_password", :string, :limit => 40, :null => false
97
- t.column "email", :string, :limit => 60
98
- t.column "firstname", :string, :limit => 40
99
- t.column "lastname", :string, :limit => 40
100
- t.column "salt", :string, :limit => 40, :null => false
101
- t.column "verified", :integer, :default => 0
102
- t.column "role", :string, :limit => 40
103
- t.column "security_token", :string, :limit => 40
104
- t.column "token_expiry", :datetime
105
- t.column "deleted", :integer, :default => 0
106
- t.column "delete_after", :datetime
123
+ t.text "login", :null => false
124
+ t.string "salted_password", :limit => 40, :null => false
125
+ t.string "email", :limit => 60
126
+ t.string "firstname", :limit => 40
127
+ t.string "lastname", :limit => 40
128
+ t.string "salt", :limit => 40, :null => false
129
+ t.integer "verified", :default => 0
130
+ t.string "role", :limit => 40
131
+ t.string "security_token", :limit => 40
132
+ t.datetime "token_expiry"
133
+ t.integer "deleted", :default => 0
134
+ t.datetime "delete_after"
107
135
  end
108
136
 
109
137
  create_table "usersold", :force => true do |t|
110
- t.column "person_id", :text, :null => false
111
- t.column "salted_password", :text
112
- t.column "salt", :text
113
- t.column "verified", :integer, :default => 0
114
- t.column "new_email", :text
115
- t.column "security_token", :text
138
+ t.text "person_id", :null => false
139
+ t.text "salted_password"
140
+ t.text "salt"
141
+ t.integer "verified", :default => 0
142
+ t.text "new_email"
143
+ t.text "security_token"
116
144
  end
117
145
 
118
146
  add_index "usersold", ["person_id"], :name => "usersold_person_id_key", :unique => true
119
147
 
120
148
  create_table "visits", :force => true do |t|
121
- t.column "person_id", :string
122
- t.column "elt_id", :string, :null => false
123
- t.column "created_on", :datetime, :null => false
124
- t.column "updated_on", :datetime
125
- t.column "filter", :integer, :default => 0
149
+ t.string "person_id"
150
+ t.string "elt_id", :null => false
151
+ t.datetime "created_on", :null => false
152
+ t.datetime "updated_on"
153
+ t.integer "filter", :default => 0
126
154
  end
127
155
 
128
- add_index "visits", ["person_id", "elt_id"], :name => "visits_elt_person_key", :unique => true
156
+ add_index "visits", ["elt_id", "person_id"], :name => "visits_elt_person_key", :unique => true
129
157
 
130
158
  end
@@ -0,0 +1,167 @@
1
+ gem 'test-unit', '1.2.3' if RUBY_VERSION.to_f >= 1.9
2
+ rspec_plugin_dir = File.expand_path(File.dirname(__FILE__) + '/../../vendor/plugins/rspec')
3
+ $LOAD_PATH.unshift("#{rspec_plugin_dir}/lib") if File.exist?(rspec_plugin_dir)
4
+
5
+ # Don't load rspec if running "rake gems:*"
6
+ unless ARGV.any? {|a| a =~ /^gems/}
7
+
8
+ begin
9
+ require 'spec/rake/spectask'
10
+ rescue MissingSourceFile
11
+ module Spec
12
+ module Rake
13
+ class SpecTask
14
+ def initialize(name)
15
+ task name do
16
+ # if rspec-rails is a configured gem, this will output helpful material and exit ...
17
+ require File.expand_path(File.dirname(__FILE__) + "/../../config/environment")
18
+
19
+ # ... otherwise, do this:
20
+ raise <<-MSG
21
+
22
+ #{"*" * 80}
23
+ * You are trying to run an rspec rake task defined in
24
+ * #{__FILE__},
25
+ * but rspec can not be found in vendor/gems, vendor/plugins or system gems.
26
+ #{"*" * 80}
27
+ MSG
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+
35
+ Rake.application.instance_variable_get('@tasks').delete('default')
36
+
37
+ spec_prereq = File.exist?(File.join(RAILS_ROOT, 'config', 'database.yml')) ? "db:test:prepare" : :noop
38
+ task :noop do
39
+ end
40
+
41
+ task :default => :spec
42
+ task :stats => "spec:statsetup"
43
+
44
+ desc "Run all specs in spec directory (excluding plugin specs)"
45
+ Spec::Rake::SpecTask.new(:spec => spec_prereq) do |t|
46
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
47
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
48
+ end
49
+
50
+ namespace :spec do
51
+ desc "Run all specs in spec directory with RCov (excluding plugin specs)"
52
+ Spec::Rake::SpecTask.new(:rcov) do |t|
53
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
54
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
55
+ t.rcov = true
56
+ t.rcov_opts = lambda do
57
+ IO.readlines("#{RAILS_ROOT}/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
58
+ end
59
+ end
60
+
61
+ desc "Print Specdoc for all specs (excluding plugin specs)"
62
+ Spec::Rake::SpecTask.new(:doc) do |t|
63
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
64
+ t.spec_files = FileList['spec/**/*/*_spec.rb']
65
+ end
66
+
67
+ desc "Print Specdoc for all plugin examples"
68
+ Spec::Rake::SpecTask.new(:plugin_doc) do |t|
69
+ t.spec_opts = ["--format", "specdoc", "--dry-run"]
70
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*')
71
+ end
72
+
73
+ [:models, :controllers, :views, :helpers, :lib].each do |sub|
74
+ desc "Run the code examples in spec/#{sub}"
75
+ Spec::Rake::SpecTask.new(sub => spec_prereq) do |t|
76
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
77
+ t.spec_files = FileList["spec/#{sub}/**/*_spec.rb"]
78
+ end
79
+ end
80
+
81
+ desc "Run the code examples in vendor/plugins (except RSpec's own)"
82
+ Spec::Rake::SpecTask.new(:plugins => spec_prereq) do |t|
83
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
84
+ t.spec_files = FileList['vendor/plugins/**/spec/**/*/*_spec.rb'].exclude('vendor/plugins/rspec/*').exclude("vendor/plugins/rspec-rails/*")
85
+ end
86
+
87
+ namespace :plugins do
88
+ desc "Runs the examples for rspec_on_rails"
89
+ Spec::Rake::SpecTask.new(:rspec_on_rails) do |t|
90
+ t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]
91
+ t.spec_files = FileList['vendor/plugins/rspec-rails/spec/**/*/*_spec.rb']
92
+ end
93
+ end
94
+
95
+ # Setup specs for stats
96
+ task :statsetup do
97
+ require 'code_statistics'
98
+ ::STATS_DIRECTORIES << %w(Model\ specs spec/models) if File.exist?('spec/models')
99
+ ::STATS_DIRECTORIES << %w(View\ specs spec/views) if File.exist?('spec/views')
100
+ ::STATS_DIRECTORIES << %w(Controller\ specs spec/controllers) if File.exist?('spec/controllers')
101
+ ::STATS_DIRECTORIES << %w(Helper\ specs spec/helpers) if File.exist?('spec/helpers')
102
+ ::STATS_DIRECTORIES << %w(Library\ specs spec/lib) if File.exist?('spec/lib')
103
+ ::STATS_DIRECTORIES << %w(Routing\ specs spec/routing) if File.exist?('spec/routing')
104
+ ::CodeStatistics::TEST_TYPES << "Model specs" if File.exist?('spec/models')
105
+ ::CodeStatistics::TEST_TYPES << "View specs" if File.exist?('spec/views')
106
+ ::CodeStatistics::TEST_TYPES << "Controller specs" if File.exist?('spec/controllers')
107
+ ::CodeStatistics::TEST_TYPES << "Helper specs" if File.exist?('spec/helpers')
108
+ ::CodeStatistics::TEST_TYPES << "Library specs" if File.exist?('spec/lib')
109
+ ::CodeStatistics::TEST_TYPES << "Routing specs" if File.exist?('spec/routing')
110
+ end
111
+
112
+ namespace :db do
113
+ namespace :fixtures do
114
+ desc "Load fixtures (from spec/fixtures) into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z."
115
+ task :load => :environment do
116
+ ActiveRecord::Base.establish_connection(Rails.env)
117
+ base_dir = File.join(Rails.root, 'spec', 'fixtures')
118
+ fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
119
+
120
+ require 'active_record/fixtures'
121
+ (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
122
+ Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
123
+ end
124
+ end
125
+ end
126
+ end
127
+
128
+ namespace :server do
129
+ daemonized_server_pid = File.expand_path("#{RAILS_ROOT}/tmp/pids/spec_server.pid")
130
+
131
+ desc "start spec_server."
132
+ task :start do
133
+ if File.exist?(daemonized_server_pid)
134
+ $stderr.puts "spec_server is already running."
135
+ else
136
+ $stderr.puts %Q{Starting up spec_server ...}
137
+ FileUtils.mkdir_p('tmp/pids') unless test ?d, 'tmp/pids'
138
+ system("ruby", "script/spec_server", "--daemon", "--pid", daemonized_server_pid)
139
+ end
140
+ end
141
+
142
+ desc "stop spec_server."
143
+ task :stop do
144
+ unless File.exist?(daemonized_server_pid)
145
+ $stderr.puts "No server running."
146
+ else
147
+ $stderr.puts "Shutting down spec_server ..."
148
+ system("kill", "-s", "TERM", File.read(daemonized_server_pid).strip) &&
149
+ File.delete(daemonized_server_pid)
150
+ end
151
+ end
152
+
153
+ desc "restart spec_server."
154
+ task :restart => [:stop, :start]
155
+
156
+ desc "check if spec server is running"
157
+ task :status do
158
+ if File.exist?(daemonized_server_pid)
159
+ $stderr.puts %Q{spec_server is running (PID: #{File.read(daemonized_server_pid).gsub("\n","")})}
160
+ else
161
+ $stderr.puts "No server running."
162
+ end
163
+ end
164
+ end
165
+ end
166
+
167
+ end