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.
- data/LICENSE +280 -0
- data/README +28 -0
- data/README.en +175 -0
- data/README.pt-br +175 -0
- data/Rakefile +10 -0
- data/app/controllers/account_controller.rb +62 -0
- data/app/controllers/application.rb +72 -0
- data/app/controllers/edition_controller.rb +13 -0
- data/app/controllers/javascript_controller.rb +21 -0
- data/app/controllers/report_controller.rb +79 -0
- data/app/controllers/root_controller.rb +7 -0
- data/app/controllers/wiki_controller.rb +102 -0
- data/app/core/cache_reporter.rb +53 -0
- data/app/core/cache_reporter_fetcher.rb +33 -0
- data/app/core/chief_editor.rb +69 -0
- data/app/core/reporter.rb +105 -0
- data/app/core/reporter_driver.rb +36 -0
- data/app/core/reporter_fetcher.rb +39 -0
- data/app/core/settings.rb +43 -0
- data/app/core/version.rb +1 -0
- data/app/core/wiki_page_not_found.rb +33 -0
- data/app/core/wiki_reporter.rb +83 -0
- data/app/helpers/account_helper.rb +2 -0
- data/app/helpers/application_helper.rb +68 -0
- data/app/helpers/default_page_provider.rb +28 -0
- data/app/helpers/report_helper.rb +2 -0
- data/app/helpers/root_helper.rb +2 -0
- data/app/helpers/wiki_helper.rb +3 -0
- data/app/models/change.rb +96 -0
- data/app/models/diff_table_builder.rb +285 -0
- data/app/models/event.rb +18 -0
- data/app/models/headline.rb +109 -0
- data/app/models/page.rb +114 -0
- data/app/models/page_sweeper.rb +26 -0
- data/app/models/user.rb +85 -0
- data/app/ports/chdir_runner.rb +36 -0
- data/app/ports/reporter_loader.rb +9 -0
- data/app/ports/runner.rb +64 -0
- data/app/reporters/darcs_connection.rb +54 -0
- data/app/reporters/darcs_reporter.rb +104 -0
- data/app/reporters/darcs_settings.rb +9 -0
- data/app/reporters/darcs_temp_repo.rb +40 -0
- data/app/reporters/events_reporter.rb +28 -0
- data/app/reporters/features_reporter.rb +24 -0
- data/app/reporters/subversion_reporter.rb +203 -0
- data/app/reporters/svn_connection.rb +62 -0
- data/app/reporters/svn_settings.rb +40 -0
- data/app/views/account/_authorization.rhtml +54 -0
- data/app/views/account/_availability.rhtml +5 -0
- data/app/views/account/availability.rhtml +1 -0
- data/app/views/account/login.rhtml +22 -0
- data/app/views/account/logout.rhtml +10 -0
- data/app/views/javascript/motiro.rjs +132 -0
- data/app/views/javascript/niftycube.rjs +300 -0
- data/app/views/layouts/_bottom.rhtml +5 -0
- data/app/views/layouts/_header.rhtml +7 -0
- data/app/views/layouts/_top.rhtml +25 -0
- data/app/views/layouts/application.rhtml +3 -0
- data/app/views/layouts/scaffold.rhtml +13 -0
- data/app/views/layouts/wiki_edit.rhtml +26 -0
- data/app/views/report/list.rhtml +32 -0
- data/app/views/report/older.rhtml +26 -0
- data/app/views/report/rss.rxml +29 -0
- data/app/views/report/show.rhtml +20 -0
- data/app/views/root/index.rhtml +33 -0
- data/app/views/wiki/_editbar.rhtml +26 -0
- data/app/views/wiki/_properties_edit.rhtml +5 -0
- data/app/views/wiki/_properties_show.rhtml +5 -0
- data/app/views/wiki/edit.rhtml +56 -0
- data/app/views/wiki/properties_edit.rhtml +1 -0
- data/app/views/wiki/show.rhtml +9 -0
- data/bin/motiro +44 -0
- data/config/boot.rb +19 -0
- data/config/database.yml +14 -0
- data/config/environment.rb +64 -0
- data/config/environments/development.rb +20 -0
- data/config/environments/production.rb +19 -0
- data/config/environments/test.rb +19 -0
- data/config/motiro.yml +43 -0
- data/config/routes.rb +79 -0
- data/db/migrate/005_globalize_migration.rb +11363 -0
- data/db/migrate/006_remove_headline_title.rb +14 -0
- data/db/migrate/007_stretch_rid.rb +11 -0
- data/db/migrate/008_add_page_editors.rb +12 -0
- data/db/migrate/009_add_page_original_author.rb +12 -0
- data/db/migrate/010_remove_empty_string_defaults_from_pages.rb +17 -0
- data/db/migrate/011_add_title_and_kind_to_pages.rb +13 -0
- data/db/migrate/012_page_modification_info.rb +13 -0
- data/db/migrate/013_nullify_initial_page_attributes.rb +21 -0
- data/db/migrate/014_events_are_wiki_pages.rb +13 -0
- data/db/migrate/015_migrate_previous_event_data.rb +23 -0
- data/db/migrate/1_initial_structure.rb +36 -0
- data/db/migrate/2_add_authentication.rb +12 -0
- data/db/migrate/3_drop_articles.rb +26 -0
- data/db/migrate/4_add_page_editing.rb +14 -0
- data/db/motirodb.sqlite.initial +0 -0
- data/db/schema_version +1 -0
- data/db/translation/pt-BR.rb +76 -0
- data/doc/README_FOR_APP +2 -0
- data/installer/rails_installer_defaults.yml +5 -0
- data/lib/import_translations.rb +154 -0
- data/lib/login_system.rb +89 -0
- data/lib/relative_time.rb +48 -0
- data/lib/string_extensions.rb +10 -0
- data/lib/stub_hash.rb +22 -0
- data/lib/tasks/packaging.rake +93 -0
- data/lib/tasks/testing.rake +32 -0
- data/lib/tick_daemon.rb +41 -0
- data/lib/translator.rb +67 -0
- data/lib/wiki_renderer.rb +42 -0
- data/lib/wiki_url_generator.rb +29 -0
- data/log/.keepdir +0 -0
- data/public/404.html +8 -0
- data/public/500.html +8 -0
- data/public/dispatch.cgi +10 -0
- data/public/dispatch.fcgi +24 -0
- data/public/dispatch.rb +10 -0
- data/public/favicon.ico +0 -0
- data/public/images/calendar.png +0 -0
- data/public/images/rss.png +0 -0
- data/public/javascripts/controls.js +750 -0
- data/public/javascripts/dragdrop.js +584 -0
- data/public/javascripts/effects.js +854 -0
- data/public/javascripts/prototype.js +1785 -0
- data/public/robots.txt +1 -0
- data/public/stylesheets/motiro.css +269 -0
- data/public/stylesheets/niftyCorners.css +35 -0
- data/public/stylesheets/scaffold.css +74 -0
- data/script/about +3 -0
- data/script/breakpointer +3 -0
- data/script/console +3 -0
- data/script/destroy +3 -0
- data/script/generate +3 -0
- data/script/performance/benchmarker +3 -0
- data/script/performance/profiler +3 -0
- data/script/plugin +3 -0
- data/script/process/reaper +3 -0
- data/script/process/spawner +3 -0
- data/script/process/spinner +3 -0
- data/script/runner +3 -0
- data/script/server +3 -0
- data/script/ticker +29 -0
- data/test/acceptance/account_test.rb +186 -0
- data/test/acceptance/darcs_test.rb +62 -0
- data/test/acceptance/events_test.rb +47 -0
- data/test/acceptance/main_page_test.rb +92 -0
- data/test/acceptance/subversion_test.rb +319 -0
- data/test/acceptance/ts_all_suites.rb +27 -0
- data/test/acceptance/wiki_test.rb +202 -0
- data/test/contract/darcs_test.rb +51 -0
- data/test/contract/remote_darcs_test.rb +61 -0
- data/test/contract/svn_test.rb +53 -0
- data/test/fixtures/changes.yml +25 -0
- data/test/fixtures/headlines.yml +45 -0
- data/test/fixtures/pages.yml +98 -0
- data/test/fixtures/users.yml +31 -0
- data/test/functional/account_controller_test.rb +96 -0
- data/test/functional/report_controller_test.rb +113 -0
- data/test/functional/report_features_test.rb +38 -0
- data/test/functional/report_subversion_test.rb +79 -0
- data/test/functional/root_controller_test.rb +127 -0
- data/test/functional/wiki_controller_test.rb +280 -0
- data/test/lib/acceptance_test_case.rb +43 -0
- data/test/lib/configuration.rb +53 -0
- data/test/lib/darcs_excerpts.rb +181 -0
- data/test/lib/darcs_repo.rb +77 -0
- data/test/lib/live_mode_test.rb +51 -0
- data/test/lib/local_svn.rb +157 -0
- data/test/lib/netutils.rb +42 -0
- data/test/lib/platform_thread.rb +62 -0
- data/test/lib/repoutils.rb +23 -0
- data/test/lib/selenium_extensions.rb +32 -0
- data/test/lib/stubio.rb +37 -0
- data/test/lib/svn_excerpts.rb +288 -0
- data/test/lib/test_configuration.rb +14 -0
- data/test/lib/webserver.rb +71 -0
- data/test/meta/configuration_test.rb +72 -0
- data/test/meta/darcs_repo_test.rb +118 -0
- data/test/meta/local_svn_test.rb +125 -0
- data/test/meta/platform_thread_test.rb +46 -0
- data/test/meta/stubio_test.rb +44 -0
- data/test/mocks/headline.rb +34 -0
- data/test/mocks/svn_reporter.rb +29 -0
- data/test/stubs/svn_settings.rb +19 -0
- data/test/stubs/url_generator.rb +24 -0
- data/test/test_helper.rb +36 -0
- data/test/unit/cache_reporter_fetcher_test.rb +46 -0
- data/test/unit/cache_reporter_test.rb +97 -0
- data/test/unit/caching_test.rb +78 -0
- data/test/unit/change_test.rb +152 -0
- data/test/unit/chdir_runner_test.rb +77 -0
- data/test/unit/chief_editor_test.rb +234 -0
- data/test/unit/darcs_connection_test.rb +109 -0
- data/test/unit/darcs_reporter_test.rb +146 -0
- data/test/unit/darcs_settings_test.rb +37 -0
- data/test/unit/darcs_temp_repo_test.rb +51 -0
- data/test/unit/default_page_provider_test.rb +46 -0
- data/test/unit/diff_table_builder_test.rb +602 -0
- data/test/unit/headline_test.rb +259 -0
- data/test/unit/page_test.rb +145 -0
- data/test/unit/relative_time_test.rb +56 -0
- data/test/unit/reporter_driver_test.rb +85 -0
- data/test/unit/reporter_fetcher_test.rb +31 -0
- data/test/unit/reporter_test.rb +81 -0
- data/test/unit/runner_test.rb +93 -0
- data/test/unit/settings_test.rb +55 -0
- data/test/unit/string_extensions_test.rb +10 -0
- data/test/unit/svn_connection_test.rb +183 -0
- data/test/unit/svn_reporter_interaction_test.rb +38 -0
- data/test/unit/svn_reporter_test.rb +286 -0
- data/test/unit/svn_settings_test.rb +86 -0
- data/test/unit/translator_test.rb +96 -0
- data/test/unit/user_test.rb +125 -0
- data/test/unit/wiki_renderer_test.rb +87 -0
- data/test/unit/wiki_reporter_test.rb +94 -0
- data/test/unit/wiki_url_generator_test.rb +31 -0
- data/vendor/motiro-installer.rb +159 -0
- data/vendor/plugins/globalize/LICENSE +9 -0
- data/vendor/plugins/globalize/README +49 -0
- data/vendor/plugins/globalize/data/country_data.csv +240 -0
- data/vendor/plugins/globalize/data/language_data.csv +188 -0
- data/vendor/plugins/globalize/data/translation_data.csv +3421 -0
- data/vendor/plugins/globalize/generators/globalize/USAGE +10 -0
- data/vendor/plugins/globalize/generators/globalize/globalize_generator.rb +42 -0
- data/vendor/plugins/globalize/generators/globalize/templates/migration.rb.gz +0 -0
- data/vendor/plugins/globalize/generators/globalize/templates/tiny_migration.rb.gz +0 -0
- data/vendor/plugins/globalize/init.rb +30 -0
- data/vendor/plugins/globalize/lib/globalize/localization/core_ext.rb +170 -0
- data/vendor/plugins/globalize/lib/globalize/localization/core_ext_hooks.rb +33 -0
- data/vendor/plugins/globalize/lib/globalize/localization/db_translate.rb +494 -0
- data/vendor/plugins/globalize/lib/globalize/localization/db_view_translator.rb +152 -0
- data/vendor/plugins/globalize/lib/globalize/localization/locale.rb +173 -0
- data/vendor/plugins/globalize/lib/globalize/localization/rfc_3066.rb +40 -0
- data/vendor/plugins/globalize/lib/globalize/models/country.rb +24 -0
- data/vendor/plugins/globalize/lib/globalize/models/currency.rb +188 -0
- data/vendor/plugins/globalize/lib/globalize/models/language.rb +84 -0
- data/vendor/plugins/globalize/lib/globalize/models/model_translation.rb +4 -0
- data/vendor/plugins/globalize/lib/globalize/models/translation.rb +9 -0
- data/vendor/plugins/globalize/lib/globalize/models/view_translation.rb +14 -0
- data/vendor/plugins/globalize/lib/globalize/rails/action_mailer.rb +125 -0
- data/vendor/plugins/globalize/lib/globalize/rails/action_view.rb +79 -0
- data/vendor/plugins/globalize/lib/globalize/rails/active_record.rb +129 -0
- data/vendor/plugins/globalize/lib/globalize/rails/active_record_helper.rb +33 -0
- data/vendor/plugins/globalize/populators/pop_dates.rb +81 -0
- data/vendor/plugins/globalize/populators/pop_migration.rb +18 -0
- data/vendor/plugins/globalize/populators/pop_pluralization.rb +26 -0
- data/vendor/plugins/globalize/populators/pop_seps.rb +32 -0
- data/vendor/plugins/globalize/tasks/data.rake +130 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en-US.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.en.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.he.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test/globalize_mailer/test.plain.text.rhtml +1 -0
- data/vendor/plugins/globalize/test/action_mailer_test.rb +54 -0
- data/vendor/plugins/globalize/test/config/database.yml.default +16 -0
- data/vendor/plugins/globalize/test/config/database.yml.example +22 -0
- data/vendor/plugins/globalize/test/core_ext_test.rb +61 -0
- data/vendor/plugins/globalize/test/currency_test.rb +141 -0
- data/vendor/plugins/globalize/test/date_helper_test.rb +634 -0
- data/vendor/plugins/globalize/test/db/schema.rb +90 -0
- data/vendor/plugins/globalize/test/db_translation_test.rb +374 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_categories.yml +7 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_categories_products.yml +7 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_countries.yml +41 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_languages.yml +64 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_manufacturers.yml +5 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_products.yml +29 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_simples.yml +5 -0
- data/vendor/plugins/globalize/test/fixtures/globalize_translations.yml +354 -0
- data/vendor/plugins/globalize/test/locale_test.rb +27 -0
- data/vendor/plugins/globalize/test/mime_responds_test.rb +358 -0
- data/vendor/plugins/globalize/test/model_test.rb +17 -0
- data/vendor/plugins/globalize/test/standard_data_test_helper.rb +33 -0
- data/vendor/plugins/globalize/test/test_helper.rb +19 -0
- data/vendor/plugins/globalize/test/test_standard_data.rb +54 -0
- data/vendor/plugins/globalize/test/validation_test.rb +29 -0
- data/vendor/plugins/globalize/test/view_picking_test.rb +49 -0
- data/vendor/plugins/globalize/test/view_translation_test.rb +237 -0
- data/vendor/plugins/globalize/test/views/layouts/standard.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/all_types_with_layout.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.en.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.fr.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.en.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.fr.rxml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rjs +1 -0
- data/vendor/plugins/globalize/test/views/respond_to/using_defaults_with_type_list.rxml +1 -0
- data/vendor/plugins/globalize/test/views/test.he-IL.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test2.he.rhtml +1 -0
- data/vendor/plugins/globalize/test/views/test2.rhtml +1 -0
- data/vendor/plugins/test_xml/MIT-LICENSE +20 -0
- data/vendor/plugins/test_xml/README +20 -0
- data/vendor/plugins/test_xml/Rakefile +22 -0
- data/vendor/plugins/test_xml/init.rb +7 -0
- data/vendor/plugins/test_xml/lib/xml_assertions.rb +22 -0
- data/vendor/plugins/test_xml/test/test_xml_test.rb +40 -0
- metadata +505 -0
|
@@ -0,0 +1,39 @@
|
|
|
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_dependency 'core/settings'
|
|
19
|
+
require_dependency 'ports/reporter_loader'
|
|
20
|
+
|
|
21
|
+
require 'reporters/events_reporter'
|
|
22
|
+
require 'reporters/features_reporter'
|
|
23
|
+
|
|
24
|
+
class ReporterFetcher
|
|
25
|
+
|
|
26
|
+
def initialize(settings=SettingsProvider.new, loader=ReporterLoader.new)
|
|
27
|
+
@settings, @loader = settings, loader
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def active_reporters
|
|
31
|
+
reporters = @settings.active_reporter_ids.map do |rid|
|
|
32
|
+
@loader.create_reporter(rid)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
reporters << FeaturesReporter.new
|
|
36
|
+
reporters << EventsReporter.new
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
end
|
|
@@ -0,0 +1,43 @@
|
|
|
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 'yaml'
|
|
19
|
+
|
|
20
|
+
# The settings provider is responsible for reading the settings from the
|
|
21
|
+
# config file and providing them to clients
|
|
22
|
+
class SettingsProvider
|
|
23
|
+
|
|
24
|
+
def initialize(fs=File)
|
|
25
|
+
@filesystem = fs
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def method_missing(method_id)
|
|
29
|
+
load_confs[method_id.to_s].to_i
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def active_reporter_ids
|
|
33
|
+
load_confs.keys - ['package_size', 'update_interval']
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
private
|
|
37
|
+
|
|
38
|
+
def load_confs
|
|
39
|
+
file = @filesystem.open(File.expand_path(RAILS_ROOT + '/config/motiro.yml'))
|
|
40
|
+
confs = YAML.load file
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
data/app/core/version.rb
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
MOTIRO_VERSION = '0.6.3'
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
CONGRATS_TEXT = <<END
|
|
2
|
+
= Parabéns! Você instalou o Motiro corretamente =
|
|
3
|
+
|
|
4
|
+
Agora que tal colocar uma pequena descrição do seu projeto aqui?
|
|
5
|
+
|
|
6
|
+
Você só precisa clicar em 'Editar' logo abaixo desta mensagem. É preciso se
|
|
7
|
+
identificar primeiro.
|
|
8
|
+
|
|
9
|
+
--- en -------------------------------------------------------------------------
|
|
10
|
+
|
|
11
|
+
= Congratulations! Motiro was installed correctly =
|
|
12
|
+
|
|
13
|
+
Now that everything is in place, how about writing a little description for
|
|
14
|
+
your project here?
|
|
15
|
+
|
|
16
|
+
You just need to click 'Edit' below this message. You must be logged in.
|
|
17
|
+
|
|
18
|
+
END
|
|
19
|
+
|
|
20
|
+
WIKI_NOT_FOUND_TEXT = <<END
|
|
21
|
+
Parece que esta página ainda não foi escrita.
|
|
22
|
+
|
|
23
|
+
Mas você pode começar a escrevê-la agora mesmo, basta clicar em 'Editar' logo
|
|
24
|
+
abaixo desta mensagem. Você vai precisar se identificar primeiro.
|
|
25
|
+
|
|
26
|
+
--- en -------------------------------------------------------------------------
|
|
27
|
+
|
|
28
|
+
Looks like there is nothing to be read here.
|
|
29
|
+
|
|
30
|
+
But you can write something right now, just click 'Edit' below this message. You
|
|
31
|
+
must be logged in.
|
|
32
|
+
|
|
33
|
+
END
|
|
@@ -0,0 +1,83 @@
|
|
|
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 'core/reporter'
|
|
19
|
+
require 'core/settings'
|
|
20
|
+
|
|
21
|
+
DEFAULT_AUTHOR = 'someone'
|
|
22
|
+
DEFAULT_TIME = Time.local(2007, 1, 3, 15, 10)
|
|
23
|
+
|
|
24
|
+
class WikiReporter < MotiroReporter
|
|
25
|
+
|
|
26
|
+
caching :off
|
|
27
|
+
|
|
28
|
+
def default_opts
|
|
29
|
+
{ :settings => SettingsProvider.new, :page_provider => Page }
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def initialize(opts={})
|
|
33
|
+
opts = default_opts.merge(opts)
|
|
34
|
+
@settings, @page_provider = opts[:settings], opts[:page_provider]
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.inherited(klass)
|
|
38
|
+
klass.add(button[:older])
|
|
39
|
+
klass.add(button_for_creating(klass.reporter_name.chop))
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
def latest_headlines
|
|
43
|
+
to_headlines @page_provider.find(:all, find_opts.merge(
|
|
44
|
+
:limit => @settings.package_size))
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def headlines
|
|
48
|
+
to_headlines @page_provider.find(:all, find_opts)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def params_for(page_name)
|
|
52
|
+
{ :controller => 'wiki', :action => 'show', :page_name => page_name }
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
def column; 'modified_at'; end
|
|
56
|
+
|
|
57
|
+
def extract_happened_at(page); page.modified_at; end
|
|
58
|
+
|
|
59
|
+
private
|
|
60
|
+
|
|
61
|
+
def self.button_for_creating(kind)
|
|
62
|
+
"if current_user.nil?; " +
|
|
63
|
+
" content_tag('span', 'Add'.t, :class => 'disabled'); " +
|
|
64
|
+
"else; " +
|
|
65
|
+
" link_to( 'Add'.t, :controller => 'wiki', " +
|
|
66
|
+
":action => 'new', :kind => '#{kind}'); " +
|
|
67
|
+
"end;"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def find_opts
|
|
71
|
+
{ :conditions => "kind = '#{name.chop}'", :order => "#{column} DESC" }
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def to_headlines(pages)
|
|
75
|
+
pages.map do |page|
|
|
76
|
+
Headline.new(:rid => page.name,
|
|
77
|
+
:author => page.last_editor ? page.last_editor.login : DEFAULT_AUTHOR,
|
|
78
|
+
:happened_at => extract_happened_at(page) || DEFAULT_TIME,
|
|
79
|
+
:description => page.title)
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
end
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
# Methods added to this helper will be available to all templates in the application.
|
|
19
|
+
module ApplicationHelper
|
|
20
|
+
|
|
21
|
+
def current_user
|
|
22
|
+
session[:user] || NullUser.new
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def current_locale
|
|
26
|
+
@locale
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def server_url_for(options = {})
|
|
30
|
+
url_for options.update(:only_path => false)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def dynjs_include_tag(script_name)
|
|
34
|
+
content_tag("script", "", { "type" => "text/javascript",
|
|
35
|
+
"src" => url_for(:controller => 'javascript',
|
|
36
|
+
:action => script_name) })
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def pagetext(title, &block)
|
|
40
|
+
content = capture(&block)
|
|
41
|
+
b = Builder::XmlMarkup.new
|
|
42
|
+
xml = b.div(:class => 'pagetext') do
|
|
43
|
+
b.div(:id => 'crumbs') do
|
|
44
|
+
b.text!('You are here: '.t)
|
|
45
|
+
last = @crumbs.delete_at(@crumbs.length - 1)
|
|
46
|
+
@crumbs.each do |h|
|
|
47
|
+
b.a(h.keys.first,
|
|
48
|
+
:href => url_for(h.values.first.update(:only_path => true)))
|
|
49
|
+
b << ' > '
|
|
50
|
+
end
|
|
51
|
+
b.a(last.keys.first,
|
|
52
|
+
:href => url_for(last.values.first.update(:only_path => true)))
|
|
53
|
+
end unless params[:context] == 'partial'
|
|
54
|
+
b.h1(title)
|
|
55
|
+
b << content
|
|
56
|
+
end
|
|
57
|
+
concat(xml, block.binding)
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
class NullUser
|
|
63
|
+
|
|
64
|
+
def nil?; true; end
|
|
65
|
+
def can_edit?(p); false; end
|
|
66
|
+
def can_change_editors?(p); false; end
|
|
67
|
+
|
|
68
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
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
|
+
class DefaultPageProvider
|
|
19
|
+
|
|
20
|
+
def find_by_name_and_type(name, type)
|
|
21
|
+
class_name = type || 'Page'
|
|
22
|
+
page = class_name.constantize.new(:name => name)
|
|
23
|
+
page.text = WIKI_NOT_FOUND_TEXT
|
|
24
|
+
page.text = CONGRATS_TEXT if 'MainPage' == name
|
|
25
|
+
return page
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
@@ -0,0 +1,96 @@
|
|
|
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 'erb'
|
|
19
|
+
|
|
20
|
+
class Change < ActiveRecord::Base
|
|
21
|
+
|
|
22
|
+
include ERB::Util
|
|
23
|
+
|
|
24
|
+
def to_s
|
|
25
|
+
return summary
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def render_summary
|
|
29
|
+
if (has_diff?)
|
|
30
|
+
return "<a href='\#' onClick=\"showOnly('#{ref}')\">#{html_escape(summary)}</a>"
|
|
31
|
+
else
|
|
32
|
+
return summary
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def render_diff
|
|
37
|
+
if (has_diff?)
|
|
38
|
+
return "<div id='#{ref}' class='diff-window'>" +
|
|
39
|
+
"<center>" +
|
|
40
|
+
"<h2>#{'Changes to %s' / resource_name}</h2>\n" +
|
|
41
|
+
render_diff_table +
|
|
42
|
+
"</center>" +
|
|
43
|
+
"</div>"
|
|
44
|
+
else
|
|
45
|
+
return ''
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def render_diff_table
|
|
50
|
+
@differ ||= DiffTableBuilder.new
|
|
51
|
+
diff.split("\n").each do |line|
|
|
52
|
+
c = line[0,1]
|
|
53
|
+
line_text = line[1, line.length - 1]
|
|
54
|
+
|
|
55
|
+
if '+' == c then
|
|
56
|
+
@differ.push_addition line_text
|
|
57
|
+
elsif '-' == c then
|
|
58
|
+
@differ.push_deletion line_text
|
|
59
|
+
elsif ' ' == c then
|
|
60
|
+
@differ.push_unchanged line_text
|
|
61
|
+
elsif '@' == c then
|
|
62
|
+
md = line_text.match(/-(\d+)[^\+]*\+(\d+)/)
|
|
63
|
+
@differ.start_line(md[1].to_i, md[2].to_i)
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
return @differ.render_diff_table
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def qualified_resource_name
|
|
71
|
+
return summary.match(/(\w )?([^\s]+)/)[2]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def resource_name
|
|
75
|
+
return qualified_resource_name.split('/').last
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def filled?
|
|
79
|
+
!self.resource_kind.nil? && ('dir' == self.resource_kind || !self.diff.nil?)
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def use_differ(differ)
|
|
83
|
+
@differ = differ
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
private
|
|
87
|
+
|
|
88
|
+
def has_diff?
|
|
89
|
+
return ! (diff.nil? or diff.empty?)
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def ref
|
|
93
|
+
return "change" + summary.hash.to_s
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
end
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
require 'erb'
|
|
2
|
+
|
|
3
|
+
class DiffTableBuilder
|
|
4
|
+
|
|
5
|
+
include ERB::Util
|
|
6
|
+
|
|
7
|
+
def initialize
|
|
8
|
+
@mod_groups = []
|
|
9
|
+
@curr_group = 0
|
|
10
|
+
@left_line_to_start = @right_line_to_start = 1
|
|
11
|
+
@last_mod_type = nil
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def render_diff_table
|
|
15
|
+
result = "<table class='diff 'cellspacing='0'>\n"
|
|
16
|
+
@mod_groups.each do |mg|
|
|
17
|
+
result += mg.render_diff_lines
|
|
18
|
+
end
|
|
19
|
+
result += "</table>"
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def start_line(left_line_num, right_line_num=left_line_num)
|
|
23
|
+
@mod_groups << SpacingGroup.instance if @left_line_to_start != 1 || @right_line_to_start != 1
|
|
24
|
+
@left_line_to_start = left_line_num
|
|
25
|
+
@right_line_to_start = right_line_num
|
|
26
|
+
@start_new_group = true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
{ 'addition' => 'add',
|
|
30
|
+
'deletion' => 'del',
|
|
31
|
+
'unchanged' => 'unch'}.each do |k,v|
|
|
32
|
+
eval "def push_#{k}(text); " +
|
|
33
|
+
"get_current_group(:#{v}).push_#{k}(html_escape(text)); " +
|
|
34
|
+
"end"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
def get_current_group(mod_type)
|
|
40
|
+
if need_a_new_group(mod_type) then
|
|
41
|
+
@mod_groups << create_group(mod_type)
|
|
42
|
+
end
|
|
43
|
+
@last_mod_type = mod_type
|
|
44
|
+
|
|
45
|
+
return @mod_groups.last
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def create_group(mod_type)
|
|
49
|
+
left_line, right_line = curr_lines
|
|
50
|
+
mg = :unch == mod_type ? UnchangedGroup.new(left_line, right_line) :
|
|
51
|
+
ModGroup.new(left_line, right_line)
|
|
52
|
+
@left_line_to_start, @right_line_to_start = left_line, right_line
|
|
53
|
+
@start_new_group = false
|
|
54
|
+
return mg
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def curr_lines
|
|
58
|
+
if @start_new_group or @mod_groups.empty? then
|
|
59
|
+
return [@left_line_to_start, @right_line_to_start]
|
|
60
|
+
else
|
|
61
|
+
return [ @left_line_to_start + @mod_groups.last.num_lines_left,
|
|
62
|
+
@right_line_to_start + @mod_groups.last.num_lines_right ]
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
CREATE_GROUP_DECISION_TABLE = # current / last
|
|
67
|
+
{ :add => { :add => false, :del => false, :unch => true },
|
|
68
|
+
:del => { :add => true, :del => false, :unch => true },
|
|
69
|
+
:unch => { :add => true, :del => true, :unch => false} }
|
|
70
|
+
|
|
71
|
+
def need_a_new_group(mod_type)
|
|
72
|
+
if @start_new_group then
|
|
73
|
+
return true
|
|
74
|
+
end
|
|
75
|
+
(@mod_groups.empty?) or
|
|
76
|
+
CREATE_GROUP_DECISION_TABLE[mod_type][@last_mod_type]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class Group
|
|
82
|
+
|
|
83
|
+
def render_diff_lines
|
|
84
|
+
result = ''
|
|
85
|
+
0.upto(num_lines - 1) do |i|
|
|
86
|
+
|
|
87
|
+
result += " <tr style='background: #FFF'>\n"
|
|
88
|
+
result += render_counter(:left, i)
|
|
89
|
+
result += render_left_cell(i)
|
|
90
|
+
result += render_right_cell(i)
|
|
91
|
+
result += render_counter(:right, i)
|
|
92
|
+
result += " </tr>\n"
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
return result
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
protected
|
|
99
|
+
|
|
100
|
+
attr_reader :initial_left_line, :initial_right_line
|
|
101
|
+
|
|
102
|
+
def initialize(initial_left_line = 1, initial_right_line = 1)
|
|
103
|
+
@initial_left_line = initial_left_line
|
|
104
|
+
@initial_right_line = initial_right_line
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
def render_cell_contents(text)
|
|
108
|
+
return "<pre>#{text}</pre>" unless text.nil? || 0 == text.length
|
|
109
|
+
return ' '
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def render_counter(side, pos)
|
|
113
|
+
num_lines, initial_line = num_lines_left, initial_left_line
|
|
114
|
+
if :right == side then
|
|
115
|
+
num_lines, initial_line = num_lines_right, initial_right_line
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
result = " <td class='line_number'>"
|
|
119
|
+
|
|
120
|
+
if pos < num_lines then
|
|
121
|
+
result += (initial_line + pos).to_s
|
|
122
|
+
else
|
|
123
|
+
result += ' '
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
return result + "</td>\n"
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
def render_left_cell(pos)
|
|
130
|
+
style = cell_border_width(pos, :left)
|
|
131
|
+
return render_cell(left_lines[pos], style, :left)
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
def render_right_cell(pos)
|
|
135
|
+
style = cell_border_width(pos, :right)
|
|
136
|
+
return render_cell(right_lines[pos], style, :right)
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def render_cell(text, style, side)
|
|
140
|
+
clazz = class_for(text)
|
|
141
|
+
cell_contents = render_cell_contents(text)
|
|
142
|
+
return " <td class='#{side.to_s}#{clazz}' style='#{style}'>" +
|
|
143
|
+
cell_contents +
|
|
144
|
+
"</td>\n"
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
class ModGroup < Group
|
|
150
|
+
|
|
151
|
+
def initialize(initial_left_line = 1, initial_right_line = 1)
|
|
152
|
+
super(initial_left_line, initial_right_line)
|
|
153
|
+
@deletions = []
|
|
154
|
+
@additions = []
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
def push_addition(text)
|
|
158
|
+
additions << text
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
def push_deletion(text)
|
|
162
|
+
deletions << text
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
def num_lines_left
|
|
166
|
+
deletions.length
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
def num_lines_right
|
|
170
|
+
additions.length
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
private
|
|
174
|
+
|
|
175
|
+
def num_lines
|
|
176
|
+
deletions.length > additions.length ? deletions.length :
|
|
177
|
+
additions.length
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
def cell_border_width(pos, side)
|
|
181
|
+
borders = 'border-width: '
|
|
182
|
+
|
|
183
|
+
borders += top_border(pos)
|
|
184
|
+
borders += right_border(pos, side)
|
|
185
|
+
borders += bottom_border(pos, :left == side ? deletions : additions)
|
|
186
|
+
borders += left_border(pos, side)
|
|
187
|
+
|
|
188
|
+
return borders
|
|
189
|
+
end
|
|
190
|
+
|
|
191
|
+
def top_border(pos)
|
|
192
|
+
if 0 == pos then
|
|
193
|
+
return '1px '
|
|
194
|
+
else
|
|
195
|
+
return '0 '
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def right_border(pos, side)
|
|
200
|
+
if :right == side and 0!=pos and pos >= additions.length then
|
|
201
|
+
return '0 '
|
|
202
|
+
else
|
|
203
|
+
return '1px '
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
def bottom_border(pos, lines)
|
|
208
|
+
if lines.length == pos+1 or (lines.length == 0 and 0==pos) then
|
|
209
|
+
return '1px '
|
|
210
|
+
else
|
|
211
|
+
return '0 '
|
|
212
|
+
end
|
|
213
|
+
end
|
|
214
|
+
|
|
215
|
+
def left_border(pos, side)
|
|
216
|
+
if 0!=pos and pos >= additions.length then
|
|
217
|
+
return '1px;'
|
|
218
|
+
elsif !( (:right == side) ^ (0!=pos and pos >= deletions.length) ) then
|
|
219
|
+
return '1px;'
|
|
220
|
+
else
|
|
221
|
+
return '0;'
|
|
222
|
+
end
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
def class_for(text)
|
|
227
|
+
return ' changed' unless text.nil?
|
|
228
|
+
return ''
|
|
229
|
+
end
|
|
230
|
+
|
|
231
|
+
attr_accessor :additions, :deletions
|
|
232
|
+
alias left_lines deletions
|
|
233
|
+
alias right_lines additions
|
|
234
|
+
|
|
235
|
+
end
|
|
236
|
+
|
|
237
|
+
class UnchangedGroup < Group
|
|
238
|
+
|
|
239
|
+
include ERB::Util
|
|
240
|
+
|
|
241
|
+
def initialize(initial_left_line = 1, initial_right_line = 1)
|
|
242
|
+
super(initial_left_line, initial_right_line)
|
|
243
|
+
@lines = []
|
|
244
|
+
end
|
|
245
|
+
|
|
246
|
+
def push_unchanged(text)
|
|
247
|
+
@lines << text
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
def num_lines
|
|
251
|
+
@lines.size
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
alias num_lines_left num_lines
|
|
255
|
+
alias num_lines_right num_lines
|
|
256
|
+
|
|
257
|
+
private
|
|
258
|
+
|
|
259
|
+
def cell_border_width(pos, side)
|
|
260
|
+
return 'border-width: 0 1px 0 0;' if :left == side
|
|
261
|
+
return 'border-width: 0 0 0 0;'
|
|
262
|
+
end
|
|
263
|
+
|
|
264
|
+
def class_for(text)
|
|
265
|
+
return ''
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
attr_accessor :lines
|
|
269
|
+
alias left_lines lines
|
|
270
|
+
alias right_lines lines
|
|
271
|
+
|
|
272
|
+
end
|
|
273
|
+
|
|
274
|
+
class SpacingGroup
|
|
275
|
+
|
|
276
|
+
include Singleton
|
|
277
|
+
|
|
278
|
+
def render_diff_lines
|
|
279
|
+
cell = " <td style='border:solid gray; " +
|
|
280
|
+
"border-width: 1px 0 1px 0;'> </td>\n"
|
|
281
|
+
|
|
282
|
+
return " <tr>\n" + cell + cell + cell + cell + " </tr>\n"
|
|
283
|
+
end
|
|
284
|
+
|
|
285
|
+
end
|