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
@@ -1,7 +1,7 @@
1
1
  <% @title = "#{'Revision details'.t} - #{@headline.title(Translator.for(@locale))} (Motiro)" %>
2
2
  <% cache(:action => 'show', :suffix => 'summary', :locale => @locale) do %>
3
3
  <% pagetext('Revision %s' / truncate(@revision_id)) do %>
4
- <%= @renderer.render_wiki_text(@headline.description(Translator.for(@locale))) %>
4
+ <%= render_wiki(@headline.description(Translator.for(@locale))) %>
5
5
  <div id="summary">
6
6
  <% @headline.changes.each do |change| %>
7
7
  <%= render_summary(change) -%>
@@ -17,4 +17,4 @@
17
17
  <% end %>
18
18
  </div>
19
19
  <% end %>
20
-
20
+
@@ -0,0 +1,2 @@
1
+ <%= 'This event is planned for'.t -%>
2
+ <%= date_select 'page', 'happens_at' %>
@@ -0,0 +1,2 @@
1
+ <%= check_box('page', 'done') -%>
2
+ <%= 'This feature is done'.t %>
@@ -1,5 +1,3 @@
1
- <% if 'event' == (params[:kind] || @page.kind) %>
2
- <%= 'This event is planned for'.t -%>
3
- <%= date_select 'page', 'happens_at' %>
4
- <%= hidden_field 'page', 'type', :value => 'Event' %>
5
- <% end %>
1
+ <% begin %>
2
+ <%= render(:partial => 'edit_' + (params[:kind] || @page.kind)) -%>
3
+ <% rescue; end %>
@@ -1,5 +1,4 @@
1
- <% if 'event' == @page.kind %>
2
- <%= image_tag 'calendar.png' -%>
3
- <%= 'This event was planned for'.t -%>
4
- <%= @page.happens_at.localize('%d %B %Y (%A)') -%>
5
- <% end %>
1
+ <% begin %>
2
+ <%= render(:partial => 'show_' + @page.kind) -%>
3
+ <% rescue; end %>
4
+
@@ -0,0 +1,3 @@
1
+ <%= image_tag 'calendar.png' -%>
2
+ <%= 'This event was planned for'.t -%>
3
+ <%= @page.happens_at.localize('%d %B %Y (%A)') -%>
@@ -0,0 +1,2 @@
1
+ <%= image_tag(@page.done? ? 'done.png' : 'not-done.png') %>
2
+ <%= 'This feature is'.t + ' ' + (@page.done? ? 'done'.t : 'not done'.t) %>
@@ -3,7 +3,7 @@
3
3
  :page => @page.name, :locale_suffix => @locale,
4
4
  :revision => @page_revision_id) do %>
5
5
  <%= render :partial => 'properties_show' %>
6
- <%= @renderer.render_wiki_text(@page.text) %>
6
+ <%= render_wiki(@page.text) %>
7
7
  <% end %>
8
8
  <%= render :partial => 'editbar' %>
9
9
  <% end %>
data/bin/motiro CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # Motiro - A project tracking tool
4
- # Copyright (C) 2006-2007 Thiago Arrais
4
+ # Copyright (C) 2006-2008 Thiago Arrais
5
5
  #
6
6
  # This program is free software; you can redistribute it and/or modify
7
7
  # it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@ require File.expand_path(File.dirname(__FILE__) + '/../vendor/motiro-installer')
22
22
  class AppInstaller < RailsInstaller
23
23
  application_name 'motiro'
24
24
  support_location 'http://www.motiro.org'
25
- rails_version '1.2.2'
25
+ rails_version '1.2.3'
26
26
 
27
27
  def create_initial_database
28
28
  cp(install_directory + '/db/motirodb.sqlite.initial',
@@ -41,4 +41,4 @@ app = AppInstaller.new(directory)
41
41
  app.message_proc = Proc.new do |msg|
42
42
  STDERR.puts " #{msg}"
43
43
  end
44
- app.execute_command(*ARGV)
44
+ app.execute_command(*ARGV)
data/config/routes.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,11 @@
1
+ class AddFeatureStatus < ActiveRecord::Migration
2
+
3
+ def self.up
4
+ add_column :revisions, :done, :boolean, :default => 0
5
+ end
6
+
7
+ def self.down
8
+ remove_column :revisions, :done
9
+ end
10
+
11
+ end
@@ -0,0 +1,12 @@
1
+ class AddPageReferences < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :wiki_references do |t|
4
+ t.column 'referer_id', :integer
5
+ t.column 'referee_id', :integer
6
+ end
7
+ end
8
+
9
+ def self.down
10
+ drop_table :wiki_references
11
+ end
12
+ end
@@ -0,0 +1,12 @@
1
+ class ConvertLinkSyntax < ActiveRecord::Migration
2
+ def self.up
3
+ Revision.find(:all).each do |change|
4
+ change.text.gsub!(/\[\[?(\w+)([ \t]+([^\]]+))?\]?\]/) do
5
+ "[[#{$1}#{$2 ? '|' + $2.strip : ''}]]"
6
+ end
7
+ change.save
8
+ end
9
+ end
10
+
11
+ def self.down; end
12
+ end
@@ -0,0 +1,12 @@
1
+ class RegisterPageReferences < ActiveRecord::Migration
2
+ def self.up
3
+ Page.find(:all).each do |page|
4
+ begin
5
+ page.send :update_references, page.text
6
+ page.save
7
+ rescue; end
8
+ end
9
+ end
10
+
11
+ def self.down; end
12
+ end
Binary file
data/db/schema_version CHANGED
@@ -1 +1 @@
1
- 23
1
+ 24
@@ -56,6 +56,11 @@
56
56
  'This event was planned for' => 'Este evento foi planejado para',
57
57
  'The first line on the event text will turn into a summary displayed on the main page' => 'A primeira linha do texto do evento será exibida como resumo na página principal',
58
58
 
59
+ # Feature suggestion pages
60
+ 'This feature is' => 'Este recurso sugerido',
61
+ 'done' => 'está pronto',
62
+ 'not done' => 'ainda não está pronto',
63
+
59
64
  # Wiki edition page
60
65
  'Insert page title here' => 'Digite o título aqui',
61
66
  'Save modifications' => 'Salvar modificações',
@@ -68,7 +73,8 @@
68
73
  'This page is a' => 'Esta página é uma',
69
74
  'common wiki page' => 'página wiki comum',
70
75
  'feature suggestion' => 'sugestão de recurso',
71
- 'event description' => 'descrição de evento',
76
+ 'event description' => 'descrição de evento',
77
+ 'This feature is done' => 'Este recurso está pronto',
72
78
  'Who should be able to edit this page?' => 'Quem pode editar esta página?',
73
79
  '(Usernames separated by spaces. Blank for everyone)' => '(Nomes de usuário separados por espaços. Em branco para todos.)',
74
80
 
@@ -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/lib/differ.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
@@ -25,13 +25,20 @@ class String
25
25
  end
26
26
 
27
27
  def xml_split
28
- str = self
28
+ remainder = self
29
29
  words = []
30
- while(md = str.match(/<([^>]+)(\s+[^>]+)?>.*?<\/\1>|[^\s<]+/m))
31
- words << md[0]
32
- str = md.post_match
30
+ while(md = remainder.match(/<([^>]+)(\s+[^>]+)?(>.*?<\/\1>|\/>)|[^\s<]+/m))
31
+ word = md[0]
32
+ remainder = md.post_match
33
+ while word.match(/<\/#{md[1]}/) &&
34
+ word.scan(/<#{md[1]}/).size > word.scan(/<\/#{md[1]}/).size
35
+ m = remainder.match(/<\/#{md[1]}>/)
36
+ word << m.pre_match << m[0]
37
+ remainder = m.post_match
38
+ end
39
+ words << word
33
40
  end
34
41
  words
35
42
  end
36
43
 
37
- end
44
+ end
data/lib/stub_hash.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,7 +1,7 @@
1
1
  # packaging.rake largely inspired by Tobias Luetke's release.rake for typo
2
2
  #
3
3
  # Motiro - A project tracking tool
4
- # Copyright (C) 2006-2007 Thiago Arrais
4
+ # Copyright (C) 2006-2008 Thiago Arrais
5
5
  #
6
6
  # This program is free software; you can redistribute it and/or modify
7
7
  # it under the terms of the GNU General Public License as published by
@@ -39,7 +39,9 @@ unless MOTIRO_VERSION.include? 'dev'
39
39
  %r{public/javascript($|/)},
40
40
  /\/\._/, /\/#/ ].any? {|regex| f =~ regex }
41
41
  end
42
- s.files += Dir.glob('vendor/plugins/**/*') <<
42
+ s.files += Dir.glob('vendor/plugins/**/*') +
43
+ Dir.glob('vendor/mediacloth-trunk/**/*') <<
44
+ 'vendor/mediacloth.rb' <<
43
45
  'log/.keepdir' << 'vendor/motiro-installer.rb'
44
46
  s.require_path = '.'
45
47
  s.author = "Thiago Arrais"
@@ -50,11 +52,7 @@ unless MOTIRO_VERSION.include? 'dev'
50
52
  s.executables = ['motiro']
51
53
 
52
54
  s.add_dependency("rails", "= 1.2.3")
53
- s.add_dependency("mediacloth", ">= 0.0.2")
54
55
  s.add_dependency("daemons", ">= 1.0.4")
55
- s.add_dependency("Platform", ">= 0.4.0")
56
- s.add_dependency("open4", ">= 0.9.1")
57
- s.add_dependency("POpen4", ">= 0.1.1")
58
56
  s.add_dependency("sqlite3-ruby", ">= 1.2.1")
59
57
  s.add_dependency("flexmock", ">= 0.5")
60
58
  s.add_dependency("rails-app-installer", "= 0.2.0")
@@ -64,12 +62,12 @@ unless MOTIRO_VERSION.include? 'dev'
64
62
  packaging = Rake::GemPackageTask.new(spec) do |p|
65
63
  p.gem_spec = spec
66
64
  end
67
-
65
+
68
66
  task :tarball => packaging.package_dir_path do
69
67
  files = Dir.glob('vendor/**/*').reject do |f|
70
68
  f =~ %r{^vendor/plugins}
71
69
  end
72
-
70
+
73
71
  files.each do |fn|
74
72
  f = File.join(packaging.package_dir_path, fn)
75
73
  fdir = File.dirname(f)
@@ -81,14 +79,14 @@ unless MOTIRO_VERSION.include? 'dev'
81
79
  safe_ln(fn, f)
82
80
  end
83
81
  end
84
-
82
+
85
83
  safe_ln(File.join(packaging.package_dir_path, 'db/motirodb.sqlite.initial'),
86
84
  File.join(packaging.package_dir_path, 'db/motirodb.sqlite'))
87
85
  rm_f(File.join(packaging.package_dir_path, 'db/motirodb.sqlite.initial'))
88
-
86
+
89
87
  chdir(packaging.package_dir) do
90
- sh %{tar cvzf #{packaging.package_name}.tar.gz #{packaging.package_name}}
91
- end
88
+ sh %{tar cvzf #{packaging.package_name}.tar.gz #{packaging.package_name}}
89
+ end
92
90
  end
93
91
 
94
92
  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/lib/tick_daemon.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # tick_daemon.rb based on the Rails' Daemon Generator by Kyle Maxwell
2
2
  #
3
3
  # Motiro - A project tracking tool
4
- # Copyright (C) 2006-2007 Thiago Arrais
4
+ # Copyright (C) 2006-2008 Thiago Arrais
5
5
  #
6
6
  # This program is free software; you can redistribute it and/or modify
7
7
  # 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
@@ -15,15 +15,25 @@
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
- class WikiUrlGenerator
18
+ class WikiLinkHandler < MediaWikiLinkHandler
19
19
 
20
20
  def initialize(parent_controller)
21
21
  @parent_controller = parent_controller
22
22
  end
23
23
 
24
- def generate_url_for(page_name)
24
+ def url_for(page_name)
25
25
  @parent_controller.server_url_for :controller => 'wiki', :action => 'show',
26
26
  :page_name => page_name
27
27
  end
28
28
 
29
+ def link_attributes_for(page_name)
30
+ super(page_name).merge(extra_link_attributes_for(page_name))
31
+ end
32
+
33
+ def extra_link_attributes_for(page_name)
34
+ atts = {}
35
+ atts[:class] = 'done' if (page = Page.find_by_name(page_name)) && page.done?
36
+ atts
37
+ end
38
+
29
39
  end
data/lib/wiki_renderer.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
@@ -23,17 +23,15 @@ require 'array_extensions'
23
23
 
24
24
  class WikiRenderer
25
25
 
26
- include MediaCloth
27
-
28
26
  def initialize(url_generator, locale_code=nil)
29
- @url_generator = url_generator
27
+ @html_generator = MediaWikiHTMLGenerator.new
30
28
  @translator = Translator.for(locale_code)
29
+ @html_generator.link_handler = url_generator
31
30
  end
32
31
 
33
32
  def render_wiki_text(text)
34
33
  localized_text = @translator.localize(text).delete("\r")
35
- expanded_text = expand_internal_links(localized_text)
36
- wiki_to_html(expanded_text)
34
+ wiki_to_html(localized_text)
37
35
  end
38
36
 
39
37
  def render_wiki_diff(old_text, new_text)
@@ -45,10 +43,10 @@ class WikiRenderer
45
43
 
46
44
  private
47
45
 
48
- def expand_internal_links(text)
49
- text.gsub(/\[(\w+)([ \t]+([^\]]+))?\]/) do |substr|
50
- "[#{@url_generator.generate_url_for($1)} #{$2 ? $2: $1}]"
51
- end
46
+ def wiki_to_html(input)
47
+ MediaCloth::wiki_to_html(input, :generator => @html_generator).
48
+ gsub(/\r?\n?\r?\n<\//, '</').
49
+ gsub('<p></p>', '')
52
50
  end
53
51
 
54
52
  end
@@ -61,7 +59,7 @@ class HtmlDiffRenderer
61
59
  end
62
60
 
63
61
  def start_new_chunk(action)
64
- inject(@diff_words, @removed_text.xml_join, @inserted_text.xml_join)
62
+ inject(@diff_words, @removed_text, @inserted_text)
65
63
  @removed_text = []
66
64
  @inserted_text = []
67
65
  end
@@ -76,38 +74,69 @@ class HtmlDiffRenderer
76
74
  end
77
75
 
78
76
  def get_result
79
- inject(@diff_words, @removed_text.xml_join, @inserted_text.xml_join)
77
+ inject(@diff_words, @removed_text, @inserted_text)
80
78
 
81
79
  @diff_words.xml_join
82
80
  end
83
81
 
84
82
  private
85
83
 
86
- HTML_ELEMENT = /<([^>]+)(\s+[^>]+)?>(.*?)<\/\1>/m
87
-
88
- def inject(words, old_text, new_text)
89
- match_old = old_text.match(HTML_ELEMENT)
90
- match_new = new_text.match(HTML_ELEMENT)
91
- if match_old && match_new && match_old[1..2] == match_new[1..2]
92
- words << [HtmlDiffRenderer.new.render_html_diff(match_old.pre_match, match_new.pre_match),
93
- "<#{match_old[1..2].join}>",
94
- HtmlDiffRenderer.new.render_html_diff(match_old[3], match_new[3]),
95
- "</#{match_old[1]}>",
96
- HtmlDiffRenderer.new.render_html_diff(match_old.post_match, match_new.post_match)].xml_join
97
- else
98
- injection = ''
99
- injection += enclose('#ffb8b8', old_text) unless old_text.empty?
100
- injection += enclose('#b8ffb8', new_text) unless new_text.empty?
101
- words << injection
84
+ HTML_ELEMENT = /<([^\s>]+)(\s+[^>]+)?>/
85
+
86
+ def inject(words, old_words, new_words)
87
+ old_words, new_words = group_words(old_words), group_words(new_words)
88
+ old_words.fill(nil, old_words.size, new_words.size - old_words.size)
89
+ pairs = old_words.zip(new_words)
90
+
91
+ pairs.each do |pair|
92
+ match_old = pair.first.match(HTML_ELEMENT) if pair.first
93
+ match_new = pair.last.match(HTML_ELEMENT) if pair.last
94
+ if match_old && match_new && match_old[1..2] == match_new[1..2]
95
+ old_content, new_content = match_old.post_match, match_new.post_match
96
+ old_content = old_content[0..(old_content.size - match_old[1].size - 4)]
97
+ new_content = new_content[0..(new_content.size - match_new[1].size - 4)]
98
+ words << ["<#{match_old[1..2].join}>",
99
+ HtmlDiffRenderer.new.render_html_diff(old_content, new_content),
100
+ "</#{match_old[1]}>"].xml_join
101
+ else
102
+ injection = ''
103
+ injection += enclose('#ffb8b8', pair.first) if pair.first
104
+ injection += enclose('#b8ffb8', pair.last) if pair.last
105
+ words << injection
106
+ end
102
107
  end
103
108
  words
104
109
  end
105
-
110
+
106
111
  def enclose(color, text)
107
- return "<span style=\"background: #{color}\">#{text}</span>" unless ?< == text[0]
108
- match = text.match(HTML_ELEMENT)
109
- [match.pre_match,
110
- "<#{match[1..2].join}><span style=\"background: #{color}\">#{match[3]}</span></#{match[1]}>",
111
- match.post_match].xml_join
112
+ if (md = text.match(HTML_ELEMENT)) && md[0][-2..-1] != '/>'
113
+ match = text.match(HTML_ELEMENT)
114
+ text = match.post_match
115
+ text = text.slice(0, text.size - match[1].size - 3) # '</>'.size => 3
116
+
117
+ "<#{match[1..2].join}><span style=\"background: #{color}\">#{text}</span></#{match[1]}>"
118
+ else
119
+ "<span style=\"background: #{color}\">#{text}</span>"
120
+ end
121
+ end
122
+
123
+ def group_words(words)
124
+ group = []
125
+ words.each do |w|
126
+ if group.empty? || inserting_tag?(w) || last_is_tag?(group)
127
+ group << w
128
+ else
129
+ group.last << ' ' << w
130
+ end
131
+ end
132
+ group
133
+ end
134
+
135
+ def inserting_tag?(word)
136
+ ?< == word[0]
137
+ end
138
+
139
+ def last_is_tag?(words)
140
+ ?> == words.last[-1]
112
141
  end
113
142
  end
Binary file
Binary file
@@ -118,6 +118,10 @@ div.inner {
118
118
  padding: 4px 4px 12px 4px;
119
119
  }
120
120
 
121
+ div.inner span.meta {
122
+ font-size: 0.8em;
123
+ }
124
+
121
125
  div.toolbar {
122
126
  font-size: 0.8em;
123
127
  }
@@ -288,6 +292,10 @@ div#page_properties div.inner {
288
292
  background-color: #e8f2f2;
289
293
  }
290
294
 
295
+ a.done {
296
+ text-decoration: line-through;
297
+ }
298
+
291
299
  #footer {
292
300
  padding: 4px 6px 2px 8px;
293
301
  font-size: x-small;
data/script/ticker CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
  #
3
3
  # Motiro - A project tracking tool
4
- # Copyright (C) 2006 Thiago Arrais
4
+ # Copyright (C) 2006-2008 Thiago Arrais
5
5
  #
6
6
  # This program is free software; you can redistribute it and/or modify
7
7
  # 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
@@ -30,7 +30,7 @@ class WikiAcceptanceTest < AcceptanceTestCase
30
30
 
31
31
  wait_for_page_to_load(1000)
32
32
 
33
- assert_element_present "//h1[text() = 'Motiro']"
33
+ assert_element_present "//h1/a[@name = 'Motiro']"
34
34
  assert_text_present 'This is project motiro'
35
35
  end
36
36
 
@@ -199,4 +199,4 @@ class WikiAcceptanceTest < AcceptanceTestCase
199
199
  assert_element_not_present "//select/option[text() = '2007']"
200
200
  end
201
201
 
202
- end
202
+ 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