motiro 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. data/LICENSE +280 -0
  2. data/README +28 -0
  3. data/README.en +175 -0
  4. data/README.pt-br +175 -0
  5. data/Rakefile +10 -0
  6. data/app/controllers/account_controller.rb +62 -0
  7. data/app/controllers/application.rb +72 -0
  8. data/app/controllers/edition_controller.rb +13 -0
  9. data/app/controllers/javascript_controller.rb +21 -0
  10. data/app/controllers/report_controller.rb +79 -0
  11. data/app/controllers/root_controller.rb +7 -0
  12. data/app/controllers/wiki_controller.rb +102 -0
  13. data/app/core/cache_reporter.rb +53 -0
  14. data/app/core/cache_reporter_fetcher.rb +33 -0
  15. data/app/core/chief_editor.rb +69 -0
  16. data/app/core/reporter.rb +105 -0
  17. data/app/core/reporter_driver.rb +36 -0
  18. data/app/core/reporter_fetcher.rb +39 -0
  19. data/app/core/settings.rb +43 -0
  20. data/app/core/version.rb +1 -0
  21. data/app/core/wiki_page_not_found.rb +33 -0
  22. data/app/core/wiki_reporter.rb +83 -0
  23. data/app/helpers/account_helper.rb +2 -0
  24. data/app/helpers/application_helper.rb +68 -0
  25. data/app/helpers/default_page_provider.rb +28 -0
  26. data/app/helpers/report_helper.rb +2 -0
  27. data/app/helpers/root_helper.rb +2 -0
  28. data/app/helpers/wiki_helper.rb +3 -0
  29. data/app/models/change.rb +96 -0
  30. data/app/models/diff_table_builder.rb +285 -0
  31. data/app/models/event.rb +18 -0
  32. data/app/models/headline.rb +109 -0
  33. data/app/models/page.rb +114 -0
  34. data/app/models/page_sweeper.rb +26 -0
  35. data/app/models/user.rb +85 -0
  36. data/app/ports/chdir_runner.rb +36 -0
  37. data/app/ports/reporter_loader.rb +9 -0
  38. data/app/ports/runner.rb +64 -0
  39. data/app/reporters/darcs_connection.rb +54 -0
  40. data/app/reporters/darcs_reporter.rb +104 -0
  41. data/app/reporters/darcs_settings.rb +9 -0
  42. data/app/reporters/darcs_temp_repo.rb +40 -0
  43. data/app/reporters/events_reporter.rb +28 -0
  44. data/app/reporters/features_reporter.rb +24 -0
  45. data/app/reporters/subversion_reporter.rb +203 -0
  46. data/app/reporters/svn_connection.rb +62 -0
  47. data/app/reporters/svn_settings.rb +40 -0
  48. data/app/views/account/_authorization.rhtml +54 -0
  49. data/app/views/account/_availability.rhtml +5 -0
  50. data/app/views/account/availability.rhtml +1 -0
  51. data/app/views/account/login.rhtml +22 -0
  52. data/app/views/account/logout.rhtml +10 -0
  53. data/app/views/javascript/motiro.rjs +132 -0
  54. data/app/views/javascript/niftycube.rjs +300 -0
  55. data/app/views/layouts/_bottom.rhtml +5 -0
  56. data/app/views/layouts/_header.rhtml +7 -0
  57. data/app/views/layouts/_top.rhtml +25 -0
  58. data/app/views/layouts/application.rhtml +3 -0
  59. data/app/views/layouts/scaffold.rhtml +13 -0
  60. data/app/views/layouts/wiki_edit.rhtml +26 -0
  61. data/app/views/report/list.rhtml +32 -0
  62. data/app/views/report/older.rhtml +26 -0
  63. data/app/views/report/rss.rxml +29 -0
  64. data/app/views/report/show.rhtml +20 -0
  65. data/app/views/root/index.rhtml +33 -0
  66. data/app/views/wiki/_editbar.rhtml +26 -0
  67. data/app/views/wiki/_properties_edit.rhtml +5 -0
  68. data/app/views/wiki/_properties_show.rhtml +5 -0
  69. data/app/views/wiki/edit.rhtml +56 -0
  70. data/app/views/wiki/properties_edit.rhtml +1 -0
  71. data/app/views/wiki/show.rhtml +9 -0
  72. data/bin/motiro +44 -0
  73. data/config/boot.rb +19 -0
  74. data/config/database.yml +14 -0
  75. data/config/environment.rb +64 -0
  76. data/config/environments/development.rb +20 -0
  77. data/config/environments/production.rb +19 -0
  78. data/config/environments/test.rb +19 -0
  79. data/config/motiro.yml +43 -0
  80. data/config/routes.rb +79 -0
  81. data/db/migrate/005_globalize_migration.rb +11363 -0
  82. data/db/migrate/006_remove_headline_title.rb +14 -0
  83. data/db/migrate/007_stretch_rid.rb +11 -0
  84. data/db/migrate/008_add_page_editors.rb +12 -0
  85. data/db/migrate/009_add_page_original_author.rb +12 -0
  86. data/db/migrate/010_remove_empty_string_defaults_from_pages.rb +17 -0
  87. data/db/migrate/011_add_title_and_kind_to_pages.rb +13 -0
  88. data/db/migrate/012_page_modification_info.rb +13 -0
  89. data/db/migrate/013_nullify_initial_page_attributes.rb +21 -0
  90. data/db/migrate/014_events_are_wiki_pages.rb +13 -0
  91. data/db/migrate/015_migrate_previous_event_data.rb +23 -0
  92. data/db/migrate/1_initial_structure.rb +36 -0
  93. data/db/migrate/2_add_authentication.rb +12 -0
  94. data/db/migrate/3_drop_articles.rb +26 -0
  95. data/db/migrate/4_add_page_editing.rb +14 -0
  96. data/db/motirodb.sqlite.initial +0 -0
  97. data/db/schema_version +1 -0
  98. data/db/translation/pt-BR.rb +76 -0
  99. data/doc/README_FOR_APP +2 -0
  100. data/installer/rails_installer_defaults.yml +5 -0
  101. data/lib/import_translations.rb +154 -0
  102. data/lib/login_system.rb +89 -0
  103. data/lib/relative_time.rb +48 -0
  104. data/lib/string_extensions.rb +10 -0
  105. data/lib/stub_hash.rb +22 -0
  106. data/lib/tasks/packaging.rake +93 -0
  107. data/lib/tasks/testing.rake +32 -0
  108. data/lib/tick_daemon.rb +41 -0
  109. data/lib/translator.rb +67 -0
  110. data/lib/wiki_renderer.rb +42 -0
  111. data/lib/wiki_url_generator.rb +29 -0
  112. data/log/.keepdir +0 -0
  113. data/public/404.html +8 -0
  114. data/public/500.html +8 -0
  115. data/public/dispatch.cgi +10 -0
  116. data/public/dispatch.fcgi +24 -0
  117. data/public/dispatch.rb +10 -0
  118. data/public/favicon.ico +0 -0
  119. data/public/images/calendar.png +0 -0
  120. data/public/images/rss.png +0 -0
  121. data/public/javascripts/controls.js +750 -0
  122. data/public/javascripts/dragdrop.js +584 -0
  123. data/public/javascripts/effects.js +854 -0
  124. data/public/javascripts/prototype.js +1785 -0
  125. data/public/robots.txt +1 -0
  126. data/public/stylesheets/motiro.css +269 -0
  127. data/public/stylesheets/niftyCorners.css +35 -0
  128. data/public/stylesheets/scaffold.css +74 -0
  129. data/script/about +3 -0
  130. data/script/breakpointer +3 -0
  131. data/script/console +3 -0
  132. data/script/destroy +3 -0
  133. data/script/generate +3 -0
  134. data/script/performance/benchmarker +3 -0
  135. data/script/performance/profiler +3 -0
  136. data/script/plugin +3 -0
  137. data/script/process/reaper +3 -0
  138. data/script/process/spawner +3 -0
  139. data/script/process/spinner +3 -0
  140. data/script/runner +3 -0
  141. data/script/server +3 -0
  142. data/script/ticker +29 -0
  143. data/test/acceptance/account_test.rb +186 -0
  144. data/test/acceptance/darcs_test.rb +62 -0
  145. data/test/acceptance/events_test.rb +47 -0
  146. data/test/acceptance/main_page_test.rb +92 -0
  147. data/test/acceptance/subversion_test.rb +319 -0
  148. data/test/acceptance/ts_all_suites.rb +27 -0
  149. data/test/acceptance/wiki_test.rb +202 -0
  150. data/test/contract/darcs_test.rb +51 -0
  151. data/test/contract/remote_darcs_test.rb +61 -0
  152. data/test/contract/svn_test.rb +53 -0
  153. data/test/fixtures/changes.yml +25 -0
  154. data/test/fixtures/headlines.yml +45 -0
  155. data/test/fixtures/pages.yml +98 -0
  156. data/test/fixtures/users.yml +31 -0
  157. data/test/functional/account_controller_test.rb +96 -0
  158. data/test/functional/report_controller_test.rb +113 -0
  159. data/test/functional/report_features_test.rb +38 -0
  160. data/test/functional/report_subversion_test.rb +79 -0
  161. data/test/functional/root_controller_test.rb +127 -0
  162. data/test/functional/wiki_controller_test.rb +280 -0
  163. data/test/lib/acceptance_test_case.rb +43 -0
  164. data/test/lib/configuration.rb +53 -0
  165. data/test/lib/darcs_excerpts.rb +181 -0
  166. data/test/lib/darcs_repo.rb +77 -0
  167. data/test/lib/live_mode_test.rb +51 -0
  168. data/test/lib/local_svn.rb +157 -0
  169. data/test/lib/netutils.rb +42 -0
  170. data/test/lib/platform_thread.rb +62 -0
  171. data/test/lib/repoutils.rb +23 -0
  172. data/test/lib/selenium_extensions.rb +32 -0
  173. data/test/lib/stubio.rb +37 -0
  174. data/test/lib/svn_excerpts.rb +288 -0
  175. data/test/lib/test_configuration.rb +14 -0
  176. data/test/lib/webserver.rb +71 -0
  177. data/test/meta/configuration_test.rb +72 -0
  178. data/test/meta/darcs_repo_test.rb +118 -0
  179. data/test/meta/local_svn_test.rb +125 -0
  180. data/test/meta/platform_thread_test.rb +46 -0
  181. data/test/meta/stubio_test.rb +44 -0
  182. data/test/mocks/headline.rb +34 -0
  183. data/test/mocks/svn_reporter.rb +29 -0
  184. data/test/stubs/svn_settings.rb +19 -0
  185. data/test/stubs/url_generator.rb +24 -0
  186. data/test/test_helper.rb +36 -0
  187. data/test/unit/cache_reporter_fetcher_test.rb +46 -0
  188. data/test/unit/cache_reporter_test.rb +97 -0
  189. data/test/unit/caching_test.rb +78 -0
  190. data/test/unit/change_test.rb +152 -0
  191. data/test/unit/chdir_runner_test.rb +77 -0
  192. data/test/unit/chief_editor_test.rb +234 -0
  193. data/test/unit/darcs_connection_test.rb +109 -0
  194. data/test/unit/darcs_reporter_test.rb +146 -0
  195. data/test/unit/darcs_settings_test.rb +37 -0
  196. data/test/unit/darcs_temp_repo_test.rb +51 -0
  197. data/test/unit/default_page_provider_test.rb +46 -0
  198. data/test/unit/diff_table_builder_test.rb +602 -0
  199. data/test/unit/headline_test.rb +259 -0
  200. data/test/unit/page_test.rb +145 -0
  201. data/test/unit/relative_time_test.rb +56 -0
  202. data/test/unit/reporter_driver_test.rb +85 -0
  203. data/test/unit/reporter_fetcher_test.rb +31 -0
  204. data/test/unit/reporter_test.rb +81 -0
  205. data/test/unit/runner_test.rb +93 -0
  206. data/test/unit/settings_test.rb +55 -0
  207. data/test/unit/string_extensions_test.rb +10 -0
  208. data/test/unit/svn_connection_test.rb +183 -0
  209. data/test/unit/svn_reporter_interaction_test.rb +38 -0
  210. data/test/unit/svn_reporter_test.rb +286 -0
  211. data/test/unit/svn_settings_test.rb +86 -0
  212. data/test/unit/translator_test.rb +96 -0
  213. data/test/unit/user_test.rb +125 -0
  214. data/test/unit/wiki_renderer_test.rb +87 -0
  215. data/test/unit/wiki_reporter_test.rb +94 -0
  216. data/test/unit/wiki_url_generator_test.rb +31 -0
  217. data/vendor/motiro-installer.rb +159 -0
  218. data/vendor/plugins/globalize/LICENSE +9 -0
  219. data/vendor/plugins/globalize/README +49 -0
  220. data/vendor/plugins/globalize/data/country_data.csv +240 -0
  221. data/vendor/plugins/globalize/data/language_data.csv +188 -0
  222. data/vendor/plugins/globalize/data/translation_data.csv +3421 -0
  223. data/vendor/plugins/globalize/generators/globalize/USAGE +10 -0
  224. data/vendor/plugins/globalize/generators/globalize/globalize_generator.rb +42 -0
  225. data/vendor/plugins/globalize/generators/globalize/templates/migration.rb.gz +0 -0
  226. data/vendor/plugins/globalize/generators/globalize/templates/tiny_migration.rb.gz +0 -0
  227. data/vendor/plugins/globalize/init.rb +30 -0
  228. data/vendor/plugins/globalize/lib/globalize/localization/core_ext.rb +170 -0
  229. data/vendor/plugins/globalize/lib/globalize/localization/core_ext_hooks.rb +33 -0
  230. data/vendor/plugins/globalize/lib/globalize/localization/db_translate.rb +494 -0
  231. data/vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb +152 -0
  232. data/vendor/plugins/globalize/lib/globalize/localization/locale.rb +173 -0
  233. data/vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb +40 -0
  234. data/vendor/plugins/globalize/lib/globalize/models/country.rb +24 -0
  235. data/vendor/plugins/globalize/lib/globalize/models/currency.rb +188 -0
  236. data/vendor/plugins/globalize/lib/globalize/models/language.rb +84 -0
  237. data/vendor/plugins/globalize/lib/globalize/models/model_translation.rb +4 -0
  238. data/vendor/plugins/globalize/lib/globalize/models/translation.rb +9 -0
  239. data/vendor/plugins/globalize/lib/globalize/models/view_translation.rb +14 -0
  240. data/vendor/plugins/globalize/lib/globalize/rails/action_mailer.rb +125 -0
  241. data/vendor/plugins/globalize/lib/globalize/rails/action_view.rb +79 -0
  242. data/vendor/plugins/globalize/lib/globalize/rails/active_record.rb +129 -0
  243. data/vendor/plugins/globalize/lib/globalize/rails/active_record_helper.rb +33 -0
  244. data/vendor/plugins/globalize/populators/pop_dates.rb +81 -0
  245. data/vendor/plugins/globalize/populators/pop_migration.rb +18 -0
  246. data/vendor/plugins/globalize/populators/pop_pluralization.rb +26 -0
  247. data/vendor/plugins/globalize/populators/pop_seps.rb +32 -0
  248. data/vendor/plugins/globalize/tasks/data.rake +130 -0
  249. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en-US.plain.text.rhtml +1 -0
  250. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en.plain.text.rhtml +1 -0
  251. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.he.plain.text.rhtml +1 -0
  252. data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.plain.text.rhtml +1 -0
  253. data/vendor/plugins/globalize/test/action_mailer_test.rb +54 -0
  254. data/vendor/plugins/globalize/test/config/database.yml.default +16 -0
  255. data/vendor/plugins/globalize/test/config/database.yml.example +22 -0
  256. data/vendor/plugins/globalize/test/core_ext_test.rb +61 -0
  257. data/vendor/plugins/globalize/test/currency_test.rb +141 -0
  258. data/vendor/plugins/globalize/test/date_helper_test.rb +634 -0
  259. data/vendor/plugins/globalize/test/db/schema.rb +90 -0
  260. data/vendor/plugins/globalize/test/db_translation_test.rb +374 -0
  261. data/vendor/plugins/globalize/test/fixtures/globalize_categories.yml +7 -0
  262. data/vendor/plugins/globalize/test/fixtures/globalize_categories_products.yml +7 -0
  263. data/vendor/plugins/globalize/test/fixtures/globalize_countries.yml +41 -0
  264. data/vendor/plugins/globalize/test/fixtures/globalize_languages.yml +64 -0
  265. data/vendor/plugins/globalize/test/fixtures/globalize_manufacturers.yml +5 -0
  266. data/vendor/plugins/globalize/test/fixtures/globalize_products.yml +29 -0
  267. data/vendor/plugins/globalize/test/fixtures/globalize_simples.yml +5 -0
  268. data/vendor/plugins/globalize/test/fixtures/globalize_translations.yml +354 -0
  269. data/vendor/plugins/globalize/test/locale_test.rb +27 -0
  270. data/vendor/plugins/globalize/test/mime_responds_test.rb +358 -0
  271. data/vendor/plugins/globalize/test/model_test.rb +17 -0
  272. data/vendor/plugins/globalize/test/standard_data_test_helper.rb +33 -0
  273. data/vendor/plugins/globalize/test/test_helper.rb +19 -0
  274. data/vendor/plugins/globalize/test/test_standard_data.rb +54 -0
  275. data/vendor/plugins/globalize/test/validation_test.rb +29 -0
  276. data/vendor/plugins/globalize/test/view_picking_test.rb +49 -0
  277. data/vendor/plugins/globalize/test/view_translation_test.rb +237 -0
  278. data/vendor/plugins/globalize/test/views/layouts/standard.rhtml +1 -0
  279. data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rhtml +1 -0
  280. data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rjs +1 -0
  281. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rhtml +1 -0
  282. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rjs +1 -0
  283. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rxml +1 -0
  284. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rhtml +1 -0
  285. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rjs +1 -0
  286. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rxml +1 -0
  287. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rhtml +1 -0
  288. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rjs +1 -0
  289. data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rxml +1 -0
  290. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rhtml +1 -0
  291. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rjs +1 -0
  292. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rxml +1 -0
  293. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rhtml +1 -0
  294. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rjs +1 -0
  295. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rxml +1 -0
  296. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rhtml +1 -0
  297. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rjs +1 -0
  298. data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rxml +1 -0
  299. data/vendor/plugins/globalize/test/views/test.he-IL.rhtml +1 -0
  300. data/vendor/plugins/globalize/test/views/test.rhtml +1 -0
  301. data/vendor/plugins/globalize/test/views/test2.he.rhtml +1 -0
  302. data/vendor/plugins/globalize/test/views/test2.rhtml +1 -0
  303. data/vendor/plugins/test_xml/MIT-LICENSE +20 -0
  304. data/vendor/plugins/test_xml/README +20 -0
  305. data/vendor/plugins/test_xml/Rakefile +22 -0
  306. data/vendor/plugins/test_xml/init.rb +7 -0
  307. data/vendor/plugins/test_xml/lib/xml_assertions.rb +22 -0
  308. data/vendor/plugins/test_xml/test/test_xml_test.rb +40 -0
  309. metadata +505 -0
@@ -0,0 +1,37 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 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
+ require 'stringio'
19
+
20
+ class StubIO
21
+
22
+ def initialize(initial_value='')
23
+ @in = StringIO.new
24
+ @out = StringIO.new initial_value
25
+ end
26
+
27
+ def <<(input)
28
+ @in << input
29
+ return self
30
+ end
31
+
32
+ def read; @out.read; end
33
+ def close; @out.close; end
34
+ def flush; @in.flush; end
35
+ def string; @in.string; end
36
+
37
+ end
@@ -0,0 +1,288 @@
1
+ revText = "------------------------------------------------------------------------\n"
2
+ revText += "r2 | gilbertogil | 2006-02-17 18:07:55 -0400 (Sex, 17 Fev 2006) | 4 lines\n"
3
+ revText += "Caminhos mudados:\n"
4
+ revText += " M /trunk/src/test/unit/svn_reporter_test.rb\n"
5
+ revText += "\n"
6
+ revText += "Estou tentando enganar o SubversionReporter\n"
7
+ revText += "------------------------------------------------------------------------\n"
8
+ revText += "Isto aqui ainda é comentário da revisao 2\n\n"
9
+ R2 = revText
10
+
11
+ revText = "------------------------------------------------------------------------\n"
12
+ revText += "r6 | thiagoarrais | 2006-02-17 12:22:25 -0300 (Sex, 17 Fev 2006) | 1 line\n"
13
+ revText += "Caminhos mudados:\n"
14
+ revText += " A /trunk/src/test/stubs/svn_connection.rb\n"
15
+ revText += " A /trunk/src/test/unit/headline_test.rb\n"
16
+ revText += "\n"
17
+ revText += "Teste do reporter SVN agora falhando decentemente (ao inves de explodir)\n"
18
+ R6 = revText
19
+
20
+ R6C2DIFF = <<DIFF_END
21
+ @@ -0,0 +1,10 @@
22
+ +require File.dirname(__FILE__) + '/../test_helper'
23
+ +
24
+ +class HeadlineTest < Test::Unit::TestCase
25
+ + fixtures :headlines
26
+ +
27
+ + # Replace this with your real tests.
28
+ + def test_truth
29
+ + assert_kind_of Headline, headlines(:first)
30
+ + end
31
+ +end
32
+ DIFF_END
33
+
34
+ R6C1DIFF = <<DIFF_END
35
+ @@ -0,0 +1,11 @@
36
+ +class StubSVNConnection
37
+ +
38
+ + def initialize
39
+ + @log = ''
40
+ + end
41
+ +
42
+ + def log_append_line(text)
43
+ + @log += text + '\n'
44
+ + end
45
+ +
46
+ +end
47
+ DIFF_END
48
+
49
+ R6C1INFO = <<END
50
+ <?xml version="1.0" encoding="utf-8"?>
51
+ <info>
52
+ <entry
53
+ kind="file"
54
+ path="svn_connection.rb"
55
+ revision="6">
56
+ <url>http://svn.berlios.de/svnroot/repos/motiro/trunk/src/test/stubs/svn_connection.rb</url>
57
+ <repository>
58
+ <root>http://svn.berlios.de/svnroot/repos/motiro</root>
59
+ <uuid>31482026-630c-0410-91bb-adf60aae4351</uuid>
60
+ </repository>
61
+ <commit
62
+ revision="6">
63
+ <author>thiagoarrais</author>
64
+ <date>2006-02-17T15:22:25.029049Z</date>
65
+ </commit>
66
+ </entry>
67
+ </info>
68
+ END
69
+
70
+ R6C2INFO = <<END
71
+ <?xml version="1.0" encoding="utf-8"?>
72
+ <info>
73
+ <entry
74
+ kind="file"
75
+ path="headline_test.rb"
76
+ revision="6">
77
+ <url>http://svn.berlios.de/svnroot/repos/motiro/trunk/src/test/unit/headline_test.rb</url>
78
+ <repository>
79
+ <root>http://svn.berlios.de/svnroot/repos/motiro</root>
80
+ <uuid>31482026-630c-0410-91bb-adf60aae4351</uuid>
81
+ </repository>
82
+ <commit
83
+ revision="6">
84
+ <author>thiagoarrais</author>
85
+ <date>2006-02-17T15:22:25.029049Z</date>
86
+ </commit>
87
+ </entry>
88
+ </info>
89
+ END
90
+
91
+ diff_text = <<DIFF_END
92
+ Index: src/test/unit/headline_test.rb
93
+ ===================================================================
94
+ --- src/test/unit/headline_test.rb (revisão 0)
95
+ +++ src/test/unit/headline_test.rb (revisão 6)
96
+ DIFF_END
97
+
98
+ diff_text += R6C2DIFF
99
+
100
+ diff_text += <<DIFF_END
101
+ Index: src/test/stubs/svn_connection.rb
102
+ ===================================================================
103
+ --- src/test/stubs/svn_connection.rb (revisão 0)
104
+ +++ src/test/stubs/svn_connection.rb (revisão 6)
105
+ DIFF_END
106
+
107
+ diff_text += R6C1DIFF
108
+
109
+ R6DIFF = diff_text
110
+
111
+ revText = "------------------------------------------------------------------------\n"
112
+ revText += "r7 | gilbertogil | 2006-02-17 18:07:55 -0400 (Sex, 17 Fev 2006) | 4 lines\n"
113
+ revText += "Caminhos mudados:\n"
114
+ revText += " A /trunk/src/app\n"
115
+ revText += " A /trunk/src/app/reporters\n"
116
+ revText += " A /trunk/src/app/reporters/svn_reporter.rb\n"
117
+ revText += "\n"
118
+ revText += "Correcao para a revisao anterior (r6)\n"
119
+ revText += "\n"
120
+ revText += "Esqueci de colocar o svn_reporter. Foi mal!\n\n"
121
+ R7 = revText
122
+
123
+ R10DIFF = <<INFO_END
124
+ Index: rakefile
125
+ ===================================================================
126
+ --- rakefile (revision 9)
127
+ +++ rakefile (revision 10)
128
+ @@ -1,14 +1,12 @@
129
+ +require 'fileutils'
130
+ +
131
+ SITE_DIR = File.dirname(__FILE__)
132
+
133
+ end
134
+ INFO_END
135
+
136
+ R10INFO = <<END
137
+ <?xml version="1.0" encoding="utf-8"?>
138
+ <info>
139
+ <entry
140
+ kind="file"
141
+ path="rakefile"
142
+ revision="10">
143
+ <url>http://svn.berlios.de/svnroot/repos/motiro/trunk/rakefile</url>
144
+ <repository>
145
+ <root>http://svn.berlios.de/svnroot/repos/motiro</root>
146
+ <uuid>31482026-630c-0410-91bb-adf60aae4351</uuid>
147
+ </repository>
148
+ <commit
149
+ revision="10">
150
+ <author>thiagoarrais</author>
151
+ <date>2006-02-18T00:34:19.987417Z</date>
152
+ </commit>
153
+ </entry>
154
+ </info>
155
+ END
156
+
157
+ R10 = <<INFO_END
158
+ ------------------------------------------------------------------------
159
+ r10 | thiagoarrais | 2006-02-17 20:34:19 -0400 (Sex, 17 Fev 2006) | 1 line
160
+ Changed paths:
161
+ M /trunk/rakefile
162
+
163
+ Rakefile agora usando a biblioteca padrao onde possivel
164
+ ------------------------------------------------------------------------
165
+ INFO_END
166
+
167
+ revText = "------------------------------------------------------------------------\n"
168
+ revText += "r13 | thiagoarrais | 2006-02-19 08:50:07 -0400 (Dom, 19 Fev 2006) | 1 line\n"
169
+ revText += "Caminhos mudados:\n"
170
+ revText += " M /trunk/src/app/reporters/svn_reporter.rb\n"
171
+ revText += " M /trunk/src/test/unit/svn_reporter_test.rb\n"
172
+ revText += "\n"
173
+ revText += "Leitura de uma revisao SVN pronta\n"
174
+ R13 = revText
175
+
176
+ revText = "------------------------------------------------------------------------\n"
177
+ revText += "r15 | thiagoarrais | 2006-02-19 09:13:07 -0400 (Dom, 19 Fev 2006) | 1 line\n"
178
+ revText += "Caminhos mudados:\n"
179
+ revText += " M /trunk/src/test/unit/svn_reporter_test.rb\n"
180
+ revText += "\n"
181
+ revText += "\n"
182
+ R15 = revText
183
+
184
+ revText = "------------------------------------------------------------------------\n"
185
+ revText += "r105 | gilbertogil | 2006-03-24 15:03:06 -0400 (Sex, 24 Mar 2006) | 7 lines\n"
186
+ revText += "Caminhos mudados:\n"
187
+ revText += " A /trunk/app/models/change.rb\n"
188
+ revText += "\n"
189
+ revText += "Agora mostrando resumo das modificacoes de cada revisao\n"
190
+ revText += "\n"
191
+ revText += "Alem de mostrar o comentario completo, o detalhamento agora mostra os\n"
192
+ revText += "nomes dos recursos que foram alterados com a revisao. A partir desta\n"
193
+ revText += "revisao, o Motiro ja deve mostrar uma lista de recursos alterados abaixo\n"
194
+ revText += "desta mensagem.\n"
195
+ revText += "\n"
196
+ revText += "------------------------------------------------------------------------\n"
197
+ R105 = revText
198
+
199
+ diff_text = "Index: app/models/change.rb\n"
200
+ diff_text += "===================================================================\n"
201
+ diff_text += "--- app/models/change.rb (revision 0)\n"
202
+ diff_text += "+++ app/models/change.rb (revision 105)\n"
203
+ diff_text += "@@ -0,0 +1,7 @@\n"
204
+ diff_text += "+class Change < ActiveRecord::Base\n"
205
+ diff_text += "+\n"
206
+ diff_text += "+ def to_s\n"
207
+ diff_text += "+ return summary\n"
208
+ diff_text += "+ end\n"
209
+ diff_text += "+\n"
210
+ diff_text += "+end"
211
+ R105DIFF = diff_text
212
+
213
+ revText = "------------------------------------------------------------------------\n"
214
+ revText += "r124 | thiagoarrais | 2006-04-02 12:47:35 -0300 (Dom, 02 Abr 2006) | 5 lines\n"
215
+ revText += "Caminhos mudados:\n"
216
+ revText += " A /trunk/app/views/report/html_fragment.rhtml (de /trunk/app/views/report/subversion_html_fragment.rhtml:123)\n"
217
+ revText += " D /trunk/app/views/report/subversion_html_fragment.rhtml\n"
218
+ revText += "\n"
219
+ revText += "Reporter de eventos e reestruturacao do codigo\n"
220
+ revText += "\n"
221
+ revText += "- Reporter de eventos ainda nao funciona ao vivo\n"
222
+ revText += "- Ainda nao ha detalhamento dos eventos\n"
223
+ revText += "\n"
224
+ revText += "------------------------------------------------------------------------\n"
225
+ R124 = revText
226
+
227
+ R124DIFF = <<END
228
+ Index: app/views/report/subversion_html_fragment.rhtml
229
+ ===================================================================
230
+ --- app/views/report/subversion_html_fragment.rhtml (revisão 123)
231
+ +++ app/views/report/subversion_html_fragment.rhtml (revisão 124)
232
+ @@ -1,24 +0,0 @@
233
+ -<p>
234
+ - <h1>Ã<9A>ltimas notícias do Subversion</h1>
235
+ - <%= link_to( image_tag('rss.gif', :border => 0),
236
+ - { :controller => 'report',
237
+ - :action => 'show',
238
+ - :reporter => 'subversion',
239
+ - :format => 'rss' } )
240
+ - %>
241
+ -</p>
242
+ -<% @headlines.each do |headline|%>
243
+ - <p>
244
+ - <%= link_to( h(headline.title),
245
+ - { :controller => 'report',
246
+ - :action => 'show',
247
+ - :reporter => 'subversion',
248
+ - :id => headline.rid } )%>
249
+ - <br/>
250
+ - <font size="-1">
251
+ - <i><%= h(headline.author) %></i>
252
+ - <%= h(headline.happened_at) %>
253
+ - </font>
254
+ - <hr/>
255
+ - </p>
256
+ -<% end %>
257
+ \ Sem nova-linha ao fim do arquivo
258
+ Index: app/views/report/html_fragment.rhtml
259
+ ===================================================================
260
+ --- app/views/report/html_fragment.rhtml (revisão 0)
261
+ +++ app/views/report/html_fragment.rhtml (revisão 124)
262
+ @@ -0,0 +1,24 @@
263
+ +<p>
264
+ + <h1><%= h(@title) %></h1>
265
+ + <%= link_to( image_tag('rss.gif', :border => 0),
266
+ + { :controller => 'report',
267
+ + :action => 'show',
268
+ + :reporter => @name,
269
+ + :format => 'rss' } )
270
+ + %>
271
+ +</p>
272
+ +<% @headlines.each do |headline|%>
273
+ + <p>
274
+ + <%= link_to( h(headline.title),
275
+ + { :controller => 'report',
276
+ + :action => 'show',
277
+ + :reporter => @name,
278
+ + :id => headline.rid } )%>
279
+ + <br/>
280
+ + <font size="-1">
281
+ + <i><%= h(headline.author) %></i>
282
+ + <%= h(headline.happened_at) %>
283
+ + </font>
284
+ + <hr/>
285
+ + </p>
286
+ +<% end %>
287
+ \ Sem nova-linha ao fim do arquivo
288
+ END
@@ -0,0 +1,14 @@
1
+ module TestConfiguration
2
+
3
+ private
4
+
5
+ def ensure_logged_in
6
+ user = FlexMock.new
7
+ user.should_receive(:login).and_return('motiro')
8
+ user.should_receive(:can_edit?).with_any_args.and_return(true)
9
+ user.should_receive(:can_change_editors?).with_any_args.and_return(true)
10
+
11
+ @request.session[:user] = user
12
+ end
13
+
14
+ end
@@ -0,0 +1,71 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 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
+ require 'webrick'
19
+ require 'webrick/https'
20
+
21
+ require 'netutils'
22
+ require 'platform_thread'
23
+
24
+ class WebServer
25
+
26
+ def self.create_https_server
27
+ create_server(
28
+ :SSLEnable => true,
29
+ :SSLVerifyClient => ::OpenSSL::SSL::VERIFY_NONE,
30
+ :SSLCertName => [ ["C","JP"], ["O","WEBrick.Org"], ["CN", "WWW"] ] )
31
+ end
32
+
33
+ def self.create_http_server_on(document_root)
34
+ create_server :DocumentRoot => document_root
35
+ end
36
+
37
+ def self.create_server(options)
38
+ defaults = { :Port => NetUtils.find_available_port,
39
+ :DocumentRoot => Dir::pwd,
40
+ :Logger => NullLogger.new,
41
+ :AccessLog => [ [NullLogger.new, WEBrick::AccessLog::COMBINED_LOG_FORMAT] ] }
42
+
43
+ return new(defaults.update(options))
44
+ end
45
+
46
+ def shutdown
47
+ @server_thread.kill
48
+ end
49
+
50
+ def [](key)
51
+ @options[key]
52
+ end
53
+
54
+ private
55
+
56
+ def initialize(options)
57
+ @options = options
58
+
59
+ @server_thread = PlatformThread.new do
60
+ server = WEBrick::HTTPServer.new options
61
+ server.start
62
+ end
63
+
64
+ sleep 1.2
65
+ end
66
+
67
+ end
68
+
69
+ class NullLogger
70
+ def method_missing(name, *args); end
71
+ end
@@ -0,0 +1,72 @@
1
+ require File.dirname(__FILE__) + '/../test_helper'
2
+
3
+ require 'configuration'
4
+ require 'yaml'
5
+
6
+ class ConfigurationTest < Test::Unit::TestCase
7
+
8
+ FILE_NAME = File.dirname(__FILE__) + '/../../config/motiro.yml'
9
+
10
+ def setup
11
+ @config = Configuration.new
12
+ end
13
+
14
+ def test_reconfigure_update_interval
15
+ expected_interval = 6
16
+ @config.update_interval = expected_interval
17
+ assert_equal expected_interval, read('update_interval')
18
+ end
19
+
20
+ def test_revert
21
+ original_contents = File.open(FILE_NAME).read
22
+
23
+ @config.update_interval = 13
24
+ @config.revert
25
+
26
+ assert_equal original_contents, File.open(FILE_NAME).read
27
+ end
28
+
29
+ def test_switch_to_live_mode
30
+ @config.go_live
31
+ assert_equal 0, read('update_interval')
32
+ end
33
+
34
+ def test_switch_to_cached_mode
35
+ @config.go_cached
36
+ assert_equal 10, read('update_interval')
37
+ end
38
+
39
+ def test_reconfigure_repo_url
40
+ expected_url = 'http://www.nowhere.com'
41
+ @config.repo = expected_url
42
+ assert_equal expected_url, read('subversion/repo')
43
+ end
44
+
45
+ def test_use_custom_repo_type_prefix
46
+ expected_url = '/tmp/darcsrepo'
47
+ @config = Configuration.new('darcs')
48
+ @config.repo = expected_url
49
+
50
+ assert_equal expected_url, read('darcs/repo')
51
+ assert_nil read('subversion/repo')
52
+ end
53
+
54
+ def teardown
55
+ @config.revert
56
+ end
57
+
58
+ private
59
+
60
+ def read(key)
61
+ file = File.open(FILE_NAME)
62
+ configs = YAML.load(file)
63
+ file.close
64
+
65
+ result = configs
66
+ key.split('/').each do |node|
67
+ result = result[node] unless result.nil?
68
+ end
69
+ return result
70
+ end
71
+
72
+ end
@@ -0,0 +1,118 @@
1
+ # Motiro - A project tracking tool
2
+ # Copyright (C) 2006-2007 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
+ require File.dirname(__FILE__) + '/../test_helper'
19
+
20
+ require 'fileutils'
21
+ require 'darcs_repo'
22
+
23
+ class DarcsRepositoryTest < Test::Unit::TestCase
24
+
25
+ def test_default_repo_url_is_http_location
26
+ repo = DarcsRepository.new
27
+
28
+ assert repo.url.match(/^http:/)
29
+
30
+ repo.destroy
31
+ end
32
+
33
+ def test_filesystem_repo_does_not_use_http
34
+ repo = DarcsRepository.new(:file)
35
+
36
+ assert !repo.url.match(/^http/)
37
+
38
+ repo.destroy
39
+ end
40
+
41
+ def test_different_repos_have_different_urls
42
+ fst_repo = DarcsRepository.new
43
+ snd_repo = DarcsRepository.new
44
+
45
+ assert_not_equal fst_repo.url, snd_repo.url
46
+
47
+ fst_repo.destroy
48
+ snd_repo.destroy
49
+ end
50
+
51
+ def test_repo_url_really_points_to_a_darcs_repo
52
+ repo = DarcsRepository.new
53
+
54
+ assert is_repo?(repo.url)
55
+
56
+ repo.destroy
57
+ end
58
+
59
+ def test_destroy_removes_dir
60
+ repo = DarcsRepository.new
61
+
62
+ assert is_repo?(repo.dir)
63
+
64
+ repo.destroy
65
+
66
+ assert !is_repo?(repo.dir)
67
+ end
68
+
69
+ def test_adding_file
70
+ repo = DarcsRepository.new
71
+ file_name = 'fileOne.txt'
72
+
73
+ repo.add_file(file_name, 'unimportant')
74
+
75
+ assert File.exists?(repo.dir + '/' + file_name)
76
+ output = `darcs whatsnew --no-summary --look-for-adds --repo=#{repo.dir} 2>&1`
77
+ assert output.match(/addfile/)
78
+ assert output.match(/#{file_name}/)
79
+
80
+ repo.destroy
81
+ end
82
+
83
+ def test_recording_and_author_name
84
+ repo = DarcsRepository.new
85
+ patch_title = 'This is the first patch ever'
86
+
87
+ repo.add_file('fileOne.txt', 'unimportant')
88
+ repo.record(patch_title)
89
+
90
+ assert `darcs whatsnew --repo=#{repo.dir} 2>&1`.match(/No changes!/)
91
+ output = `darcs changes --repo=#{repo.dir} 2>&1`
92
+ assert output.match(/#{patch_title}/)
93
+ assert output.match(/#{repo.author}/)
94
+
95
+ repo.destroy
96
+ end
97
+
98
+ def test_recording_with_long_comment
99
+ repo = DarcsRepository.new
100
+
101
+ repo.add_file('fileTwo.txt', 'file contents')
102
+ repo.record("This is the comment title\n\n" +
103
+ "And these are some details about the patch")
104
+
105
+ output = `darcs changes --repo=#{repo.dir}`
106
+ assert output.match(/This is the comment title/)
107
+ assert output.match(/And these are some details about the patch/)
108
+ end
109
+
110
+ private
111
+
112
+ def is_repo?(repo_url)
113
+ result = !(`darcs get #{repo_url} tmprepo 2>&1`.match(/Invalid repository/))
114
+ FileUtils.rm_rf('tmprepo')
115
+ return result
116
+ end
117
+
118
+ end