motiro 0.6.8 → 0.6.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. data/AUTHORS +15 -0
  2. data/README +2 -2
  3. data/README.en +1 -2
  4. data/README.pt-br +1 -2
  5. data/app/controllers/account_controller.rb +1 -1
  6. data/app/controllers/application.rb +13 -12
  7. data/app/controllers/javascript_controller.rb +1 -1
  8. data/app/controllers/report_controller.rb +1 -1
  9. data/app/controllers/wiki_controller.rb +3 -5
  10. data/app/core/cache_reporter.rb +1 -1
  11. data/app/core/cache_reporter_fetcher.rb +1 -1
  12. data/app/core/chief_editor.rb +1 -1
  13. data/app/core/reporter.rb +1 -1
  14. data/app/core/reporter_driver.rb +1 -1
  15. data/app/core/reporter_fetcher.rb +1 -1
  16. data/app/core/settings.rb +1 -1
  17. data/app/core/version.rb +1 -1
  18. data/app/core/wiki_reporter.rb +1 -1
  19. data/app/helpers/application_helper.rb +5 -1
  20. data/app/helpers/default_page_provider.rb +6 -2
  21. data/app/helpers/report_helper.rb +14 -1
  22. data/app/models/change.rb +1 -1
  23. data/app/models/chunk.rb +1 -1
  24. data/app/models/feed_observer.rb +1 -1
  25. data/app/models/headline.rb +1 -1
  26. data/app/models/page.rb +38 -4
  27. data/app/models/revision.rb +1 -1
  28. data/app/models/user.rb +1 -1
  29. data/app/models/wiki_reference.rb +21 -0
  30. data/app/models/wiki_sweeper.rb +17 -2
  31. data/app/ports/chdir_runner.rb +1 -1
  32. data/app/ports/runner.rb +1 -1
  33. data/app/reporters/darcs_connection.rb +1 -1
  34. data/app/reporters/darcs_reporter.rb +1 -1
  35. data/app/reporters/darcs_temp_repo.rb +1 -1
  36. data/app/reporters/events_reporter.rb +1 -1
  37. data/app/reporters/features_reporter.rb +1 -1
  38. data/app/reporters/subversion_reporter.rb +1 -1
  39. data/app/reporters/svn_connection.rb +1 -1
  40. data/app/reporters/svn_settings.rb +1 -1
  41. data/app/views/report/list.rhtml +6 -7
  42. data/app/views/report/older.rhtml +1 -2
  43. data/app/views/report/rss.rxml +1 -1
  44. data/app/views/report/show.rhtml +2 -2
  45. data/app/views/wiki/_edit_event.rhtml +2 -0
  46. data/app/views/wiki/_edit_feature.rhtml +2 -0
  47. data/app/views/wiki/_properties_edit.rhtml +3 -5
  48. data/app/views/wiki/_properties_show.rhtml +4 -5
  49. data/app/views/wiki/_show_event.rhtml +3 -0
  50. data/app/views/wiki/_show_feature.rhtml +2 -0
  51. data/app/views/wiki/show.rhtml +1 -1
  52. data/bin/motiro +3 -3
  53. data/config/routes.rb +1 -1
  54. data/db/migrate/024_add_feature_status.rb +11 -0
  55. data/db/migrate/025_add_page_references.rb +12 -0
  56. data/db/migrate/026_convert_link_syntax.rb +12 -0
  57. data/db/migrate/027_register_page_references.rb +12 -0
  58. data/db/motirodb.sqlite.initial +0 -0
  59. data/db/schema_version +1 -1
  60. data/db/translation/pt-BR.rb +7 -1
  61. data/lib/array_extensions.rb +1 -1
  62. data/lib/diff_chunk_builder.rb +1 -1
  63. data/lib/differ.rb +1 -1
  64. data/lib/string_extensions.rb +13 -6
  65. data/lib/stub_hash.rb +1 -1
  66. data/lib/tasks/packaging.rake +10 -12
  67. data/lib/tasks/testing.rake +1 -1
  68. data/lib/tick_daemon.rb +1 -1
  69. data/lib/{wiki_url_generator.rb → wiki_link_handler.rb} +13 -3
  70. data/lib/wiki_renderer.rb +63 -34
  71. data/public/images/done.png +0 -0
  72. data/public/images/not-done.png +0 -0
  73. data/public/stylesheets/motiro.css +8 -0
  74. data/script/ticker +1 -1
  75. data/test/acceptance/account_test.rb +1 -1
  76. data/test/acceptance/darcs_test.rb +1 -1
  77. data/test/acceptance/events_test.rb +1 -1
  78. data/test/acceptance/main_page_test.rb +1 -1
  79. data/test/acceptance/subversion_test.rb +1 -1
  80. data/test/acceptance/ts_all_suites.rb +1 -1
  81. data/test/acceptance/wiki_test.rb +3 -3
  82. data/test/contract/darcs_test.rb +1 -1
  83. data/test/contract/remote_darcs_test.rb +1 -1
  84. data/test/contract/svn_test.rb +1 -1
  85. data/test/fixtures/pages.yml +20 -1
  86. data/test/fixtures/revisions.yml +40 -1
  87. data/test/fixtures/wiki_references.yml +5 -0
  88. data/test/functional/report_controller_test.rb +1 -1
  89. data/test/functional/report_features_test.rb +8 -1
  90. data/test/functional/report_subversion_test.rb +1 -1
  91. data/test/functional/root_controller_test.rb +1 -1
  92. data/test/functional/wiki_controller_test.rb +67 -2
  93. data/test/lib/acceptance_test_case.rb +1 -1
  94. data/test/lib/darcs_excerpts.rb +1 -1
  95. data/test/lib/darcs_repo.rb +1 -1
  96. data/test/lib/hash_extensions.rb +22 -0
  97. data/test/lib/live_mode_test.rb +1 -1
  98. data/test/lib/netutils.rb +1 -1
  99. data/test/lib/platform_thread.rb +1 -1
  100. data/test/lib/selenium_extensions.rb +1 -1
  101. data/test/lib/stubio.rb +1 -1
  102. data/test/lib/webserver.rb +1 -1
  103. data/test/meta/darcs_repo_test.rb +1 -1
  104. data/test/meta/local_svn_test.rb +1 -1
  105. data/test/meta/platform_thread_test.rb +1 -1
  106. data/test/meta/stubio_test.rb +1 -1
  107. data/test/stubs/{url_generator.rb → wiki_link_handler.rb} +8 -4
  108. data/test/test_helper.rb +3 -1
  109. data/test/unit/array_extensions_test.rb +1 -1
  110. data/test/unit/cache_reporter_fetcher_test.rb +1 -1
  111. data/test/unit/cache_reporter_test.rb +1 -1
  112. data/test/unit/change_test.rb +1 -1
  113. data/test/unit/chdir_runner_test.rb +1 -1
  114. data/test/unit/chief_editor_test.rb +1 -1
  115. data/test/unit/darcs_connection_test.rb +1 -1
  116. data/test/unit/darcs_reporter_test.rb +4 -4
  117. data/test/unit/darcs_temp_repo_test.rb +1 -1
  118. data/test/unit/default_page_provider_test.rb +23 -13
  119. data/test/unit/diff_chunk_builder_test.rb +1 -1
  120. data/test/unit/page_test.rb +67 -4
  121. data/test/unit/reporter_driver_test.rb +1 -1
  122. data/test/unit/reporter_test.rb +1 -1
  123. data/test/unit/revision_test.rb +1 -1
  124. data/test/unit/runner_test.rb +1 -1
  125. data/test/unit/string_extensions_test.rb +15 -3
  126. data/test/unit/svn_connection_test.rb +1 -1
  127. data/test/unit/svn_reporter_interaction_test.rb +1 -1
  128. data/test/unit/svn_reporter_test.rb +1 -1
  129. data/test/unit/svn_settings_test.rb +1 -1
  130. data/test/unit/user_test.rb +1 -1
  131. data/test/unit/{wiki_url_generator_test.rb → wiki_link_handler_test.rb} +3 -3
  132. data/test/unit/wiki_renderer_test.rb +75 -20
  133. data/test/unit/wiki_reporter_test.rb +1 -1
  134. data/vendor/mediacloth-trunk/MIT-LICENSE +20 -0
  135. data/vendor/mediacloth-trunk/README +32 -0
  136. data/vendor/mediacloth-trunk/Rakefile +33 -0
  137. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiast.rb +122 -0
  138. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikihtmlgenerator.rb +252 -0
  139. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikilexer.rb +821 -0
  140. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikilinkhandler.rb +68 -0
  141. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparams.rb +33 -0
  142. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparser.rb +1218 -0
  143. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiparser.y +493 -0
  144. data/vendor/mediacloth-trunk/lib/mediacloth/mediawikiwalker.rb +146 -0
  145. data/vendor/mediacloth-trunk/lib/mediacloth.rb +29 -0
  146. data/vendor/mediacloth-trunk/mediacloth.gemspec +24 -0
  147. data/vendor/mediacloth-trunk/mediacloth.kdevelop +117 -0
  148. data/vendor/mediacloth-trunk/setup.rb +1585 -0
  149. data/vendor/mediacloth-trunk/test/data/html1 +26 -0
  150. data/vendor/mediacloth-trunk/test/data/html10 +130 -0
  151. data/vendor/mediacloth-trunk/test/data/html11 +17 -0
  152. data/vendor/mediacloth-trunk/test/data/html12 +12 -0
  153. data/vendor/mediacloth-trunk/test/data/html13 +11 -0
  154. data/vendor/mediacloth-trunk/test/data/html2 +2 -0
  155. data/vendor/mediacloth-trunk/test/data/html3 +1 -0
  156. data/vendor/mediacloth-trunk/test/data/html4 +47 -0
  157. data/vendor/mediacloth-trunk/test/data/html5 +57 -0
  158. data/vendor/mediacloth-trunk/test/data/html6 +8 -0
  159. data/vendor/mediacloth-trunk/test/data/html7 +45 -0
  160. data/vendor/mediacloth-trunk/test/data/html8 +1 -0
  161. data/vendor/mediacloth-trunk/test/data/html9 +14 -0
  162. data/vendor/mediacloth-trunk/test/data/input1 +34 -0
  163. data/vendor/mediacloth-trunk/test/data/input10 +124 -0
  164. data/vendor/mediacloth-trunk/test/data/input11 +17 -0
  165. data/vendor/mediacloth-trunk/test/data/input12 +15 -0
  166. data/vendor/mediacloth-trunk/test/data/input13 +10 -0
  167. data/vendor/mediacloth-trunk/test/data/input2 +2 -0
  168. data/vendor/mediacloth-trunk/test/data/input3 +2 -0
  169. data/vendor/mediacloth-trunk/test/data/input4 +50 -0
  170. data/vendor/mediacloth-trunk/test/data/input5 +63 -0
  171. data/vendor/mediacloth-trunk/test/data/input6 +8 -0
  172. data/vendor/mediacloth-trunk/test/data/input7 +45 -0
  173. data/vendor/mediacloth-trunk/test/data/input8 +1 -0
  174. data/vendor/mediacloth-trunk/test/data/input9 +14 -0
  175. data/vendor/mediacloth-trunk/test/data/lex1 +26 -0
  176. data/vendor/mediacloth-trunk/test/data/lex10 +85 -0
  177. data/vendor/mediacloth-trunk/test/data/lex11 +17 -0
  178. data/vendor/mediacloth-trunk/test/data/lex12 +15 -0
  179. data/vendor/mediacloth-trunk/test/data/lex13 +3 -0
  180. data/vendor/mediacloth-trunk/test/data/lex2 +2 -0
  181. data/vendor/mediacloth-trunk/test/data/lex3 +1 -0
  182. data/vendor/mediacloth-trunk/test/data/lex4 +47 -0
  183. data/vendor/mediacloth-trunk/test/data/lex5 +57 -0
  184. data/vendor/mediacloth-trunk/test/data/lex6 +8 -0
  185. data/vendor/mediacloth-trunk/test/data/lex7 +45 -0
  186. data/vendor/mediacloth-trunk/test/data/lex8 +1 -0
  187. data/vendor/mediacloth-trunk/test/data/lex9 +14 -0
  188. data/vendor/mediacloth-trunk/test/data/result1 +48 -0
  189. data/vendor/mediacloth-trunk/test/dataproducers/html.rb +18 -0
  190. data/vendor/mediacloth-trunk/test/dataproducers/lex.rb +15 -0
  191. data/vendor/mediacloth-trunk/test/debugwalker.rb +68 -0
  192. data/vendor/mediacloth-trunk/test/htmlgenerator.rb +97 -0
  193. data/vendor/mediacloth-trunk/test/lexer.rb +542 -0
  194. data/vendor/mediacloth-trunk/test/linkhandler.rb +39 -0
  195. data/vendor/mediacloth-trunk/test/parser.rb +22 -0
  196. data/vendor/mediacloth-trunk/test/testhelper.rb +27 -0
  197. data/vendor/mediacloth.rb +3 -0
  198. data/vendor/motiro-installer.rb +1 -1
  199. data/vendor/plugins/cache_test-0.2/CHANGELOG +14 -0
  200. data/vendor/plugins/cache_test-0.2/MIT-LICENSE +20 -0
  201. data/vendor/plugins/cache_test-0.2/README +124 -0
  202. data/vendor/plugins/cache_test-0.2/init.rb +8 -0
  203. data/vendor/plugins/cache_test-0.2/lib/fragment_cache_test.rb +205 -0
  204. data/vendor/plugins/cache_test-0.2/lib/page_cache_test.rb +140 -0
  205. data/vendor/plugins/global_routing/init.rb +1 -1
  206. metadata +517 -455
data/AUTHORS ADDED
@@ -0,0 +1,15 @@
1
+ Motiro was created and is currently maintained by Thiago Arrais.
2
+
3
+ The code has also received contributions from Eduardo Fiorezi and Walter Cruz.
4
+
5
+ The icons used on the feature suggestion pages are based on the Dropline Nuovo!
6
+ icon set by Silvestre Herrera. See http://www.silvestre.com.ar/ for details.
7
+
8
+ The icon used on the event pages is from the Silk icon set by Mark James. See
9
+ http://www.famfamfam.com/lab/icons/silk/ for details.
10
+
11
+ All the code, images and other assets (except for the event page icon) inside
12
+ Motiro are licensed under the GPLv2. See LICENSE for details.
13
+
14
+ The event page icon is licensed under a Creative Commons Attribution 2.5
15
+ License. See http://www.famfamfam.com/lab/icons/silk/ for details.
data/README CHANGED
@@ -1,5 +1,5 @@
1
1
  Motiro - A project tracking tool
2
- Copyright (C) 2006, 2007 Thiago Arrais
2
+ Copyright (C) 2006-2008 Thiago Arrais
3
3
 
4
4
  This program is free software; you can redistribute it and/or modify
5
5
  it under the terms of the GNU General Public License as published by
@@ -15,7 +15,7 @@ You should have received a copy of the GNU General Public License
15
15
  along with this program; if not, write to the Free Software
16
16
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
17
  --------------------------------------------------------------------------------
18
- Motiro version 0.6.8 - July 2007
18
+ Motiro version 0.6.9 - February 2008
19
19
 
20
20
  Please refer to your preferred language README. Every text file below this
21
21
  directory is UTF-8 encoded. Please make sure to set up your reader accordingly.
data/README.en CHANGED
@@ -1,5 +1,5 @@
1
1
  Motiro - A project tracking tool
2
- Copyright (C) 2006, 2007 Thiago Arrais
2
+ Copyright (C) 2006-2008 Thiago Arrais
3
3
 
4
4
  This program is free software; you can redistribute it and/or modify
5
5
  it under the terms of the GNU General Public License as published by
@@ -73,7 +73,6 @@ but those with no label need to be installed by everyone.
73
73
  repository)
74
74
  * Darcs command line client (darcs) (only if you will be using a Darcs
75
75
  repository)
76
- * (tar) POpen4 0.1.1 (available as Ruby Gem: POpen4)
77
76
  * (tar) SQLite3-Ruby 1.2.1 or later (available as Ruby Gem: sqlite3-ruby)
78
77
 
79
78
  After making sure your system has all those requirements, you may proceed with
data/README.pt-br CHANGED
@@ -1,5 +1,5 @@
1
1
  Motiro - Uma ferramenta para acompanhamento de projetos
2
- Copyright (C) 2006, 2007 Thiago Arrais
2
+ Copyright (C) 2006-2008 Thiago Arrais
3
3
 
4
4
  Este programa é um software de livre distribuição, que pode ser
5
5
  copiado e distribuído sob os termos da Licença Pública Geral GNU,
@@ -76,7 +76,6 @@ manualmente por todos.
76
76
  repositório Subversion)
77
77
  * Cliente de linha de comando Darcs (darcs) (somente se estiver utilizando
78
78
  repositório Darcs)
79
- * (tar) POpen4 0.1.1 (disponível como Ruby Gem: POpen4)
80
79
  * (tar) SQLite3-Ruby 1.2.1 ou superior (disponível como Ruby Gem:
81
80
  sqlite3-ruby)
82
81
 
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -24,14 +24,14 @@ require 'string_extensions'
24
24
  class ApplicationController < ActionController::Base
25
25
  include LoginSystem
26
26
  include ApplicationHelper
27
-
27
+
28
28
  before_filter :set_locale, :setup_renderer, :check_desired_login_available, :drop_top_crumbs
29
-
29
+
30
30
  def set_locale
31
31
  default_locale = 'en-US'
32
32
  request_language = request.env['HTTP_ACCEPT_LANGUAGE']
33
33
  request_language = request_language.nil? ? nil : request_language[/[^,;]+/]
34
-
34
+
35
35
  @locale = params[:locale] || session[:locale] ||
36
36
  request_language || default_locale
37
37
  session[:locale] = @locale
@@ -42,11 +42,11 @@ class ApplicationController < ActionController::Base
42
42
  Locale.set @locale
43
43
  end
44
44
  end
45
-
45
+
46
46
  def setup_renderer
47
47
  @renderer = create_renderer
48
48
  end
49
-
49
+
50
50
  def check_desired_login_available
51
51
  if current_user.nil?
52
52
  desired_login = params[:desired_login] || flash[:desired_login]
@@ -54,19 +54,20 @@ class ApplicationController < ActionController::Base
54
54
  end
55
55
  true
56
56
  end
57
-
57
+
58
58
  def drop_top_crumbs
59
59
  @crumbs = [{ 'Home'.t => {:controller => 'root', :action => 'index'} }]
60
60
  end
61
-
61
+
62
62
  private
63
-
63
+
64
64
  def create_renderer
65
65
  WikiRenderer.new(my_url_generator, current_locale)
66
66
  end
67
67
 
68
68
  def my_url_generator
69
- @url_generator ||= WikiUrlGenerator.new(self)
69
+ @url_generator ||= WikiLinkHandler.new(self)
70
70
  end
71
-
72
- end
71
+
72
+ end
73
+
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -40,8 +40,7 @@ class WikiController < ApplicationController
40
40
 
41
41
  def initialize(page_provider=Page, renderer=nil)
42
42
  @renderer = renderer || create_renderer
43
- @real_page_provider = page_provider
44
- @default_page_provider = DefaultPageProvider.new
43
+ @page_provider = DefaultPageProvider.new(page_provider)
45
44
  end
46
45
 
47
46
  def fetch_page
@@ -132,8 +131,7 @@ private
132
131
  end
133
132
 
134
133
  def find_page(name)
135
- @real_page_provider.find_by_name(name) ||
136
- @default_page_provider.find_by_name(name)
134
+ @page_provider.find_by_name(name)
137
135
  end
138
136
 
139
137
  end
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/app/core/reporter.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/app/core/settings.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/app/core/version.rb CHANGED
@@ -1 +1 @@
1
- MOTIRO_VERSION = '0.6.8'
1
+ MOTIRO_VERSION = '0.6.9'
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -68,6 +68,10 @@ module ApplicationHelper
68
68
  concat(xml, block.binding)
69
69
  end
70
70
 
71
+ def render_wiki(text)
72
+ @renderer.render_wiki_text(text)
73
+ end
74
+
71
75
  def render_diff_table(chunks)
72
76
  Builder::XmlMarkup.new.table :class => 'diff', :cellspacing => '0' do |b|
73
77
  b.colgroup do
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -17,8 +17,12 @@
17
17
 
18
18
  class DefaultPageProvider
19
19
 
20
+ def initialize(real_page_provider)
21
+ @provider = real_page_provider
22
+ end
23
+
20
24
  def find_by_name(name)
21
- Page.new(:name => name)
25
+ @provider.find_by_name(name) || Page.new(:name => name)
22
26
  end
23
27
 
24
28
  end
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -38,4 +38,17 @@ module ReportHelper
38
38
  def ref(change)
39
39
  "change" + change.summary.hash.to_s
40
40
  end
41
+
42
+ def headline_link(headline)
43
+ link_to( h(headline.title(Translator.for(@locale))),
44
+ @reporter.params_for(headline.rid),
45
+ page_link_handler.extra_link_attributes_for(headline.rid) )
46
+ end
47
+
48
+ private
49
+
50
+ def page_link_handler
51
+ WikiLinkHandler.new(@controller)
52
+ end
53
+
41
54
  end
data/app/models/change.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/app/models/chunk.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/app/models/page.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -15,6 +15,9 @@
15
15
  # along with this program; if not, write to the Free Software
16
16
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
+ require 'rubygems'
19
+ require 'mediacloth'
20
+
18
21
  PLACE_HOLDER_TITLE = 'Insert page title here'
19
22
  DEFAULT_AUTHOR = 'someone'
20
23
  DEFAULT_TIME = Time.local(2007, 1, 3, 15, 10)
@@ -22,12 +25,18 @@ DEFAULT_TIME = Time.local(2007, 1, 3, 15, 10)
22
25
  class Page < ActiveRecord::Base
23
26
 
24
27
  has_many :revisions, :order => 'modified_at, id'
28
+ has_many :references, :foreign_key => 'referer_id', :dependent => :delete_all,
29
+ :class_name => 'WikiReference'
30
+ has_many :referrals, :foreign_key => 'referee_id',
31
+ :class_name => 'WikiReference'
32
+ has_many :refered_pages, :through => :references, :source => :referee
33
+ has_many :refering_pages, :through => :referrals, :source => :referer
25
34
 
26
35
  def original_author
27
36
  oldest(:last_editor)
28
37
  end
29
38
 
30
- %w{modified_at last_editor}.each do |attr|
39
+ %w{modified_at last_editor done done?}.each do |attr|
31
40
  define_method attr do
32
41
  most_recent(attr)
33
42
  end
@@ -105,7 +114,8 @@ class Page < ActiveRecord::Base
105
114
  self.kind = attrs[:kind] if attrs[:kind]
106
115
  self.happens_at = attrs[:happens_at] if attrs[:happens_at]
107
116
  rev.kind, rev.happens_at = self.kind, self.happens_at
108
- rev.title, rev.text = attrs[:title], attrs[:text]
117
+ rev.title, rev.text, rev.done = attrs[:title], attrs[:text], attrs[:done]
118
+ update_references(rev.text) if rev.text
109
119
  self.revisions << rev
110
120
 
111
121
  save
@@ -120,9 +130,19 @@ class Page < ActiveRecord::Base
120
130
  :happened_at => (kind == 'event' ? happens_at.to_t : modified_at) || DEFAULT_TIME,
121
131
  :description => inject_title_into_text)
122
132
  end
123
-
133
+
124
134
  private
125
135
 
136
+ def update_references(input)
137
+ self.references.clear
138
+ MediaCloth::wiki_to_html(input, :link_handler => reference_collector)
139
+ self.refered_pages.reset
140
+ end
141
+
142
+ def reference_collector
143
+ PageReferenceCollector.new(self)
144
+ end
145
+
126
146
  def inject_title_into_text
127
147
  title + "\n\n" +
128
148
  text.gsub(/^--- (\S+) ----*[ \t\f]*\r?\n/,
@@ -171,3 +191,17 @@ private
171
191
  end
172
192
 
173
193
  end
194
+
195
+ class PageReferenceCollector < MediaWikiLinkHandler
196
+ def initialize(page)
197
+ @referer = page
198
+ @page_provider = DefaultPageProvider.new(Page)
199
+ end
200
+
201
+ def url_for(page_name)
202
+ page = @page_provider.find_by_name(page_name)
203
+ @referer.references << WikiReference.new(:referer => @referer,
204
+ :referee => page)
205
+ page_name
206
+ end
207
+ end
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/app/models/user.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -0,0 +1,21 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
+ #
4
+ # This program is free software; you can redistribute it and/or modify
5
+ # it under the terms of the GNU General Public License as published by
6
+ # the Free Software Foundation; either version 2 of the License, or
7
+ # any later version.
8
+ #
9
+ # This program is distributed in the hope that it will be useful,
10
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ # GNU General Public License for more details.
13
+ #
14
+ # You should have received a copy of the GNU General Public License
15
+ # along with this program; if not, write to the Free Software
16
+ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17
+
18
+ class WikiReference < ActiveRecord::Base
19
+ belongs_to :referer, :class_name => 'Page', :foreign_key => 'referer_id'
20
+ belongs_to :referee, :class_name => 'Page', :foreign_key => 'referee_id'
21
+ end
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -20,9 +20,24 @@ class WikiSweeper < ActionController::Caching::Sweeper
20
20
  observe Page
21
21
 
22
22
  def after_save(page)
23
- expire_fragment(/wiki\/show.*?#{page.name}/)
23
+ expire_referers(page) if page.revisions.size > 1 &&
24
+ page.revisions[-1].done != page.revisions[-2].done
25
+
26
+ expire_fragment(fragments_for(page))
24
27
  cache_dir = ActionController::Base.page_cache_directory
25
28
  FileUtils.rm_r(Dir.glob(cache_dir+"/wiki/history/#{page.name}*")) rescue Errno::ENOENT
26
29
  end
27
30
 
31
+ private
32
+
33
+ def expire_referers(page)
34
+ page.refering_pages.each do |referer|
35
+ expire_fragment(fragments_for(referer))
36
+ end
37
+ end
38
+
39
+ def fragments_for(page)
40
+ /wiki\/show.*?#{page.name}/
41
+ end
28
42
  end
43
+
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
data/app/ports/runner.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -1,5 +1,5 @@
1
1
  # Motiro - A project tracking tool
2
- # Copyright (C) 2006-2007 Thiago Arrais
2
+ # Copyright (C) 2006-2008 Thiago Arrais
3
3
  #
4
4
  # This program is free software; you can redistribute it and/or modify
5
5
  # it under the terms of the GNU General Public License as published by
@@ -11,20 +11,19 @@
11
11
  <% buttons = @reporter.buttons
12
12
  if ! buttons.empty? then %>
13
13
  <div class='toolbar channel_toolbar'>
14
- <%= buttons.map { |b| instance_eval(b) }. join(' | ') -%>
14
+ <%= buttons.map { |b| instance_eval(b) }. join(' | ') %>
15
15
  </div>
16
16
  <% end %>
17
- <% @headlines.each do |headline|%>
17
+ <% @headlines.each do |headline|%>
18
18
  <p>
19
- <%= link_to( h(headline.title(Translator.for(@locale))),
20
- @reporter.params_for(headline.rid) )%>
19
+ <%= headline_link(headline) %>
21
20
  <br/>
22
- <font size="-1">
21
+ <span class="meta">
23
22
  <i><%= h(headline.author) %></i>
24
23
  (<%= headline.happened_at.relative_to_now %>)
25
- </font>
24
+ </span>
26
25
  </p>
27
26
  <hr/>
28
- <% end %>
27
+ <% end %>
29
28
  </div>
30
29
  </div>
@@ -17,8 +17,7 @@
17
17
  <td class="date"><%= headline.happened_at-%></td>
18
18
  <td class="relative"><%= headline.happened_at.relative_to_now %></td>
19
19
  <td><%= headline.author %></td>
20
- <td><%= link_to( h(headline.title(Translator.for(@locale))),
21
- @reporter.params_for(headline.rid) )%></td>
20
+ <td><%= headline_link(headline) %></td>
22
21
  </tr>
23
22
  <% end %>
24
23
  </tbody>
@@ -16,7 +16,7 @@ xml.rss 'version' => '2.0',
16
16
 
17
17
  xml.title h(headline.title(Translator.for(@locale)))
18
18
  xml.link permalink
19
- xml.description headline.description(Translator.for(@locale)).medialize
19
+ xml.description render_wiki(headline.description(Translator.for(@locale)))
20
20
  xml.pubDate h(headline.happened_at.to_s(:rfc822))
21
21
  xml.dc :creator, h(headline.author)
22
22
  xml.guid(permalink + '.' +