aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephane Gamard <stephane.gamard@searchbox.com>2014-07-24 10:31:07 +0200
committerStephane Gamard <stephane.gamard@searchbox.com>2014-07-24 10:31:07 +0200
commitf04357ba06cc0c2b6e694017567186b9e76d4bea (patch)
treedc69cfa38ea8283cc6f566df96eefa79fa2890dc
parentc099bc484b891ecd80e4bf10d8a863320015eeba (diff)
parent4b31edf8e292a4d43c15a9faee9ee6ee5e855d84 (diff)
downloadsonarqube-f04357ba06cc0c2b6e694017567186b9e76d4bea.tar.gz
sonarqube-f04357ba06cc0c2b6e694017567186b9e76d4bea.zip
Merge branch 'master' into SONAR-4898
-rw-r--r--plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb1
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/batch/BatchWs.java5
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/batch/GlobalReferentialsAction.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/batch/ProjectReferentialsAction.java137
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/component/persistence/ComponentDao.java18
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java2
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java15
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java12
-rw-r--r--server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java6
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/batch/GlobalReferentialsActionTest.java2
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/batch/ProjectReferentialsActionTest.java154
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/component/persistence/ComponentDaoTest.java12
-rw-r--r--server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java28
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profile_from_default_profile.json13
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profiles.json13
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules.json14
-rw-r--r--server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules_without_empty_module_settings.json11
-rw-r--r--server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-debt-popup-view.coffee16
-rw-r--r--server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee23
-rw-r--r--server/sonar-web/src/main/hbs/coding-rules/coding-rules-custom-rule-creation.hbs2
-rw-r--r--server/sonar-web/src/main/hbs/coding-rules/coding-rules-debt-popup.hbs23
-rw-r--r--server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs4
-rw-r--r--server/sonar-web/src/main/hbs/coding-rules/coding-rules-manual-rule-creation.hbs2
-rw-r--r--server/sonar-web/src/main/hbs/component-viewer/header/cw-tests-header.hbs13
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js64
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/app_admin.json109
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/edit_note_x1.json58
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec.js143
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/coverage.json196
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/duplications.json25
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/issues.json646
-rw-r--r--server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/scm.json184
-rw-r--r--server/sonar-web/src/main/less/coding-rules.less12
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-2.3.15/install.rb30
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/.gemtest0
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/History.txt452
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Manifest.txt187
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Rakefile10
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Changelog50
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Install18
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/metaconfig13
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/pre-setup.rb55
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/setup.rb1366
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/Rakefile95
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/TODO6
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/setup.rb1360
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/i18n-0.4.2/CHANGELOG.textile143
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/Rakefile365
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info.rb131
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_controller.rb9
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_helper.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails_info_controller.rb2
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/fresh_rakefile10
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/404.html30
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/422.html30
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/500.html30
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/favicon.ico0
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/images/rails.pngbin6646 -> 0 bytes
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/index.html275
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/application.js2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/controls.js963
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/dragdrop.js973
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/effects.js1128
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/prototype.js4320
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/robots.txt5
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/code_statistics.rb107
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands.rb17
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/about.rb3
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/console.rb45
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/dbconsole.rb87
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/destroy.rb6
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/generate.rb6
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/listener86
-rwxr-xr-xserver/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/tracker69
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/benchmarker.rb24
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/profiler.rb50
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/plugin.rb968
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/runner.rb54
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/server.rb114
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/update.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_app.rb30
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_sandbox.rb6
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_with_helpers.rb5
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/performance_test_help.rb5
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator.rb46
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/base.rb266
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/commands.rb621
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generated_attribute.rb47
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/USAGE9
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb266
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/git.rb18
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/scm.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/svn.rb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/template_runner.rb401
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/USAGE30
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/controller_generator.rb43
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/controller.rb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/functional_test.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper_test.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/view.html.erb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/USAGE24
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/helper_generator.rb25
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper_test.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/USAGE8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb16
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb10
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/USAGE16
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/mailer_generator.rb30
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.erb3
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml0
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/mailer.rb15
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/unit_test.rb20
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.erb3
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.rhtml0
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/USAGE8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/metal_generator.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/templates/metal.rb12
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/USAGE29
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/migration_generator.rb20
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/templates/migration.rb11
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/USAGE27
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/model_generator.rb52
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/fixtures.yml23
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/migration.rb16
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/model.rb5
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/unit_test.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/USAGE13
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/observer_generator.rb16
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/observer.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/unit_test.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/USAGE8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb16
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb9
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/USAGE25
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/plugin_generator.rb39
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE20
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/README13
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/Rakefile23
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/USAGE8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/generator.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/init.rb1
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/install.rb1
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/plugin.rb1
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/tasks.rake4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/test_helper.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/uninstall.rb1
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/unit_test.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/USAGE23
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/resource_generator.rb76
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/controller.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/functional_test.rb8
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper_test.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/USAGE29
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb103
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/controller.rb83
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb45
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper.rb2
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper_test.rb4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb17
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/style.css54
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb18
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb24
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb17
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb10
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/USAGE10
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb18
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/templates/migration.rb16
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/lookup.rb249
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/manifest.rb53
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/options.rb150
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts.rb89
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/destroy.rb29
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/generate.rb7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/update.rb12
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/secret_key_generator.rb24
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/simple_logger.rb46
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/spec.rb44
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/annotations.rake20
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/databases.rake436
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/documentation.rake93
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/framework.rake146
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/gems.rake78
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/log.rake9
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/middleware.rake7
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/misc.rake63
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/rails.rb14
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/routes.rake18
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/statistics.rake17
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/testing.rake139
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/tmp.rake37
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/webrick_server.rb156
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/acts_as_tree/Rakefile22
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/Rakefile22
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/tasks/http_accept_language_tasks.rake4
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/README.textile224
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/Rakefile32
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/TODO15
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/tasks/auth.rake33
-rw-r--r--sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java9
-rw-r--r--sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java4
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java2
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java1
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultSensorContext.java19
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java1
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java8
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/scan2/SensorsExecutor.java (renamed from sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzersExecutor.java)6
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesMediumTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesOnDirMediumTest.java2
-rw-r--r--sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java4
-rw-r--r--sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java5
-rw-r--r--sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java7
-rw-r--r--sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java7
-rw-r--r--sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java4
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml30
-rw-r--r--sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml14
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties10
-rw-r--r--sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java21
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRule.java9
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java6
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java15
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java3
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueBuilder.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java1
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueBuilder.java18
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/MeasureBuilder.java5
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java7
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureBuilder.java31
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java2
-rw-r--r--sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureTest.java7
237 files changed, 2079 insertions, 19176 deletions
diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb
index b12ca554f18..76c152ec75a 100644
--- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb
+++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/plugins/core/widgets/treemap.html.erb
@@ -22,6 +22,7 @@
<%
filter = MeasureFilter.new
filter.set_criteria_value(:base, @resource.key)
+ filter.set_criteria_value(:onBaseComponents, 'true')
filter.set_criteria_value(:pageSize, 100)
filter.set_criteria_value(:page, 1)
filter.metrics=([sizeMetric, colorMetric].compact)
diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/BatchWs.java b/server/sonar-server/src/main/java/org/sonar/server/batch/BatchWs.java
index 948ae241714..39f5fc8c695 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/batch/BatchWs.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/batch/BatchWs.java
@@ -32,10 +32,12 @@ public class BatchWs implements WebService {
private final BatchIndex batchIndex;
private final GlobalReferentialsAction globalReferentialsAction;
+ private final ProjectReferentialsAction projectReferentialsAction;
- public BatchWs(BatchIndex batchIndex, GlobalReferentialsAction globalReferentialsAction) {
+ public BatchWs(BatchIndex batchIndex, GlobalReferentialsAction globalReferentialsAction, ProjectReferentialsAction projectReferentialsAction) {
this.batchIndex = batchIndex;
this.globalReferentialsAction = globalReferentialsAction;
+ this.projectReferentialsAction = projectReferentialsAction;
}
@Override
@@ -47,6 +49,7 @@ public class BatchWs implements WebService {
defineIndexAction(controller);
defineFileAction(controller);
globalReferentialsAction.define(controller);
+ projectReferentialsAction.define(controller);
controller.done();
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/GlobalReferentialsAction.java b/server/sonar-server/src/main/java/org/sonar/server/batch/GlobalReferentialsAction.java
index 286f37021be..03251c89695 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/batch/GlobalReferentialsAction.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/batch/GlobalReferentialsAction.java
@@ -101,7 +101,7 @@ public class GlobalReferentialsAction implements RequestHandler {
}
}
- private boolean isPropertyAllowed(String key, boolean hasScanPerm, boolean hasDryRunPerm){
+ private static boolean isPropertyAllowed(String key, boolean hasScanPerm, boolean hasDryRunPerm) {
return !key.contains(".secured") || hasScanPerm || (key.contains(".license") && hasDryRunPerm);
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectReferentialsAction.java b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectReferentialsAction.java
new file mode 100644
index 00000000000..8b4a9f23054
--- /dev/null
+++ b/server/sonar-server/src/main/java/org/sonar/server/batch/ProjectReferentialsAction.java
@@ -0,0 +1,137 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.server.batch;
+
+import org.apache.commons.io.IOUtils;
+import org.sonar.api.resources.Language;
+import org.sonar.api.resources.Languages;
+import org.sonar.api.server.ws.Request;
+import org.sonar.api.server.ws.RequestHandler;
+import org.sonar.api.server.ws.Response;
+import org.sonar.api.server.ws.WebService;
+import org.sonar.batch.protocol.input.ProjectReferentials;
+import org.sonar.batch.protocol.input.QProfile;
+import org.sonar.core.UtcDateUtils;
+import org.sonar.core.component.ComponentDto;
+import org.sonar.core.permission.GlobalPermissions;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.core.persistence.MyBatis;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.core.properties.PropertyDto;
+import org.sonar.core.qualityprofile.db.QualityProfileDto;
+import org.sonar.server.db.DbClient;
+import org.sonar.server.plugins.MimeTypes;
+import org.sonar.server.qualityprofile.QProfileFactory;
+import org.sonar.server.user.UserSession;
+
+import java.util.List;
+import java.util.Map;
+
+import static com.google.common.collect.Maps.newHashMap;
+
+public class ProjectReferentialsAction implements RequestHandler {
+
+ private static final String PARAM_KEY = "key";
+
+ private final DbClient dbClient;
+ private final PropertiesDao propertiesDao;
+ private final QProfileFactory qProfileFactory;
+ private final Languages languages;
+
+ public ProjectReferentialsAction(DbClient dbClient, PropertiesDao propertiesDao, QProfileFactory qProfileFactory, Languages languages) {
+ this.dbClient = dbClient;
+ this.propertiesDao = propertiesDao;
+ this.qProfileFactory = qProfileFactory;
+ this.languages = languages;
+ }
+
+ void define(WebService.NewController controller) {
+ WebService.NewAction action = controller.createAction("project")
+ .setDescription("Return project referentials")
+ .setSince("4.5")
+ .setInternal(true)
+ .setHandler(this);
+
+ action
+ .createParam(PARAM_KEY)
+ .setRequired(true)
+ .setDescription("Project key")
+ .setExampleValue("org.codehaus.sonar:sonar");
+ }
+
+ @Override
+ public void handle(Request request, Response response) throws Exception {
+ UserSession userSession = UserSession.get();
+ boolean hasScanPerm = userSession.hasGlobalPermission(GlobalPermissions.SCAN_EXECUTION);
+
+ DbSession session = dbClient.openSession(false);
+ try {
+ ProjectReferentials ref = new ProjectReferentials();
+ String projectKey = request.mandatoryParam(PARAM_KEY);
+ addSettings(ref, projectKey, hasScanPerm, session);
+ addProfiles(ref, projectKey, session);
+
+ response.stream().setMediaType(MimeTypes.JSON);
+ IOUtils.write(ref.toJson(), response.stream().output());
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ private void addSettings(ProjectReferentials ref, String projectKey, boolean hasScanPerm, DbSession session) {
+ addSettings(ref, projectKey, propertiesDao.selectProjectProperties(projectKey, session), hasScanPerm);
+ for (ComponentDto module : dbClient.componentDao().findModulesByProject(projectKey, session)) {
+ addSettings(ref, module.getKey(), propertiesDao.selectProjectProperties(module.getKey(), session), hasScanPerm);
+ }
+ }
+
+ private void addSettings(ProjectReferentials ref, String projectOrModuleKey, List<PropertyDto> propertyDtos, boolean hasScanPerm) {
+ Map<String, String> properties = newHashMap();
+ for (PropertyDto propertyDto : propertyDtos) {
+ String key = propertyDto.getKey();
+ String value = propertyDto.getValue();
+ if (isPropertyAllowed(key, hasScanPerm)) {
+ properties.put(key, value);
+ }
+ }
+ if (!properties.isEmpty()) {
+ ref.addSettings(projectOrModuleKey, properties);
+ }
+ }
+
+ private static boolean isPropertyAllowed(String key, boolean hasScanPerm) {
+ return !key.contains(".secured") || hasScanPerm;
+ }
+
+ private void addProfiles(ProjectReferentials ref, String projectKey, DbSession session) {
+ for (Language language : languages.all()) {
+ String languageKey = language.getKey();
+ QualityProfileDto qualityProfileDto = qProfileFactory.getByProjectAndLanguage(session, projectKey, languageKey);
+ qualityProfileDto = qualityProfileDto != null ? qualityProfileDto : qProfileFactory.getDefault(session, languageKey);
+ if (qualityProfileDto != null) {
+ QProfile profile = new QProfile(qualityProfileDto.getKey(), qualityProfileDto.getName(), qualityProfileDto.getLanguage(),
+ UtcDateUtils.parseDateTime(qualityProfileDto.getRulesUpdatedAt()));
+ ref.addQProfile(profile);
+ }
+ }
+ }
+
+}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/component/persistence/ComponentDao.java b/server/sonar-server/src/main/java/org/sonar/server/component/persistence/ComponentDao.java
index 940bd4d344e..39a23370fdf 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/component/persistence/ComponentDao.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/component/persistence/ComponentDao.java
@@ -19,7 +19,6 @@
*/
package org.sonar.server.component.persistence;
-import org.apache.ibatis.session.SqlSession;
import org.sonar.api.ServerComponent;
import org.sonar.api.utils.System2;
import org.sonar.core.component.ComponentDto;
@@ -29,6 +28,7 @@ import org.sonar.core.persistence.DbSession;
import org.sonar.server.db.BaseDao;
import java.util.Date;
+import java.util.List;
/**
* @since 4.3
@@ -39,26 +39,26 @@ public class ComponentDao extends BaseDao<ComponentMapper, ComponentDto, String>
super(ComponentMapper.class, system);
}
- public ComponentDto getById(Long id, SqlSession session) {
- return getMapper(session).selectById(id);
+ public ComponentDto getById(Long id, DbSession session) {
+ return mapper(session).selectById(id);
}
- public boolean existsById(Long id, SqlSession session) {
- return getMapper(session).countById(id) > 0;
+ public boolean existsById(Long id, DbSession session) {
+ return mapper(session).countById(id) > 0;
}
- private ComponentMapper getMapper(SqlSession session) {
- return session.getMapper(ComponentMapper.class);
+ public List<ComponentDto> findModulesByProject(String projectKey, DbSession session) {
+ return mapper(session).findModulesByProject(projectKey);
}
@Override
protected ComponentDto doGetNullableByKey(DbSession session, String key) {
- return getMapper(session).selectByKey(key);
+ return mapper(session).selectByKey(key);
}
@Override
protected ComponentDto doInsert(DbSession session, ComponentDto item) {
- getMapper(session).insert(item);
+ mapper(session).insert(item);
return item;
}
diff --git a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
index db2109db7f9..91023ef5a0e 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/platform/ServerComponents.java
@@ -81,6 +81,7 @@ import org.sonar.server.authentication.ws.AuthenticationWs;
import org.sonar.server.batch.BatchIndex;
import org.sonar.server.batch.BatchWs;
import org.sonar.server.batch.GlobalReferentialsAction;
+import org.sonar.server.batch.ProjectReferentialsAction;
import org.sonar.server.charts.ChartFactory;
import org.sonar.server.component.DefaultComponentFinder;
import org.sonar.server.component.DefaultRubyComponentService;
@@ -296,6 +297,7 @@ class ServerComponents {
// batch
pico.addSingleton(BatchIndex.class);
pico.addSingleton(GlobalReferentialsAction.class);
+ pico.addSingleton(ProjectReferentialsAction.class);
pico.addSingleton(BatchWs.class);
// update center
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java
index a6fa81675e6..0e7b1042e12 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileFactory.java
@@ -141,7 +141,7 @@ public class QProfileFactory implements ServerComponent {
}
@CheckForNull
- QualityProfileDto getDefault(DbSession session, String language) {
+ public QualityProfileDto getDefault(DbSession session, String language) {
return db.qualityProfileDao().getDefaultProfile(language, session);
}
@@ -168,6 +168,19 @@ public class QProfileFactory implements ServerComponent {
db.propertiesDao().setProperty(property, session);
}
+ QualityProfileDto getByProjectAndLanguage(String projectKey, String language) {
+ DbSession dbSession = db.openSession(false);
+ try {
+ return getByProjectAndLanguage(dbSession, projectKey, language);
+ } finally {
+ dbSession.close();
+ }
+ }
+
+ public QualityProfileDto getByProjectAndLanguage(DbSession session, String projectKey, String language) {
+ return db.qualityProfileDao().getByProjectAndLanguage(projectKey, language, PROFILE_PROPERTY_PREFIX + language, session);
+ }
+
private void checkNotDefault(@Nullable QualityProfileDto defaultProfile, QualityProfileDto p) {
if (defaultProfile != null && defaultProfile.getKey().equals(p.getKey())) {
throw new BadRequestException("The profile marked as default can not be deleted: " + p.getKey());
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java
index f1e694297ca..da24181f9fb 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfileProjectOperations.java
@@ -44,15 +44,21 @@ public class QProfileProjectOperations implements ServerComponent {
checkPermission(userSession);
DbSession session = db.openSession(false);
try {
+ addProject(profileId, projectId, userSession, session);
+ session.commit();
+ } finally {
+ MyBatis.closeQuietly(session);
+ }
+ }
+
+ void addProject(int profileId, long projectId, UserSession userSession, DbSession session) {
+ checkPermission(userSession);
ComponentDto project = (ComponentDto) findProjectNotNull(projectId, session);
QualityProfileDto qualityProfile = findNotNull(profileId, session);
db.propertiesDao().setProperty(new PropertyDto().setKey(
QProfileProjectLookup.PROFILE_PROPERTY_PREFIX + qualityProfile.getLanguage()).setValue(qualityProfile.getName()).setResourceId(project.getId()), session);
session.commit();
- } finally {
- MyBatis.closeQuietly(session);
- }
}
public void removeProject(int profileId, long projectId, UserSession userSession) {
diff --git a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java
index e36b55dae05..b3559277ad1 100644
--- a/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java
+++ b/server/sonar-server/src/main/java/org/sonar/server/qualityprofile/QProfiles.java
@@ -31,6 +31,10 @@ import javax.annotation.CheckForNull;
import java.util.List;
+/**
+ * Use {@link org.sonar.server.qualityprofile.QProfileService} instead
+ */
+@Deprecated
public class QProfiles implements ServerComponent {
private static final String LANGUAGE_PARAM = "language";
@@ -90,7 +94,7 @@ public class QProfiles implements ServerComponent {
}
/**
- * Used in /project/profile
+ * Used in /project/profile and in /api/profiles
*/
@CheckForNull
public QProfile findProfileByProjectAndLanguage(long projectId, String language) {
diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java
index bef1af04f54..50a7c340705 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/batch/BatchWsTest.java
@@ -28,8 +28,10 @@ import org.junit.rules.TemporaryFolder;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.api.resources.Languages;
import org.sonar.core.properties.PropertiesDao;
import org.sonar.server.db.DbClient;
+import org.sonar.server.qualityprofile.QProfileFactory;
import org.sonar.server.ws.WsTester;
import java.io.File;
@@ -55,7 +57,9 @@ public class BatchWsTest {
@Before
public void before() throws IOException {
- tester = new WsTester(new BatchWs(batchIndex, new GlobalReferentialsAction(mock(DbClient.class), mock(PropertiesDao.class))));
+ tester = new WsTester(new BatchWs(batchIndex,
+ new GlobalReferentialsAction(mock(DbClient.class), mock(PropertiesDao.class)),
+ new ProjectReferentialsAction(mock(DbClient.class), mock(PropertiesDao.class), mock(QProfileFactory.class), mock(Languages.class))));
}
@Test
diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalReferentialsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalReferentialsActionTest.java
index d3f9fb9906a..4468e1b7f66 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalReferentialsActionTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/batch/GlobalReferentialsActionTest.java
@@ -59,7 +59,7 @@ public class GlobalReferentialsActionTest {
when(dbClient.openSession(false)).thenReturn(session);
when(dbClient.metricDao()).thenReturn(metricDao);
- tester = new WsTester(new BatchWs(mock(BatchIndex.class), new GlobalReferentialsAction(dbClient, propertiesDao)));
+ tester = new WsTester(new BatchWs(mock(BatchIndex.class), new GlobalReferentialsAction(dbClient, propertiesDao), mock(ProjectReferentialsAction.class)));
}
@Test
diff --git a/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectReferentialsActionTest.java b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectReferentialsActionTest.java
new file mode 100644
index 00000000000..a04fcc58cf6
--- /dev/null
+++ b/server/sonar-server/src/test/java/org/sonar/server/batch/ProjectReferentialsActionTest.java
@@ -0,0 +1,154 @@
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+package org.sonar.server.batch;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.runners.MockitoJUnitRunner;
+import org.sonar.api.resources.Language;
+import org.sonar.api.resources.Languages;
+import org.sonar.core.component.ComponentDto;
+import org.sonar.core.permission.GlobalPermissions;
+import org.sonar.core.persistence.DbSession;
+import org.sonar.core.properties.PropertiesDao;
+import org.sonar.core.properties.PropertyDto;
+import org.sonar.core.qualityprofile.db.QualityProfileDto;
+import org.sonar.server.component.persistence.ComponentDao;
+import org.sonar.server.db.DbClient;
+import org.sonar.server.qualityprofile.QProfileFactory;
+import org.sonar.server.user.MockUserSession;
+import org.sonar.server.ws.WsTester;
+
+import static com.google.common.collect.Lists.newArrayList;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ProjectReferentialsActionTest {
+
+ @Mock
+ DbSession session;
+
+ @Mock
+ ComponentDao componentDao;
+
+ @Mock
+ PropertiesDao propertiesDao;
+
+ @Mock
+ QProfileFactory qProfileFactory;
+
+ @Mock
+ Languages languages;
+
+ @Mock
+ Language language;
+
+ WsTester tester;
+
+ @Before
+ public void setUp() throws Exception {
+ DbClient dbClient = mock(DbClient.class);
+ when(dbClient.openSession(false)).thenReturn(session);
+ when(dbClient.componentDao()).thenReturn(componentDao);
+
+ when(language.getKey()).thenReturn("java");
+ when(languages.all()).thenReturn(new Language[]{language});
+
+ tester = new WsTester(new BatchWs(mock(BatchIndex.class), mock(GlobalReferentialsAction.class), new ProjectReferentialsAction(dbClient, propertiesDao, qProfileFactory, languages)));
+ }
+
+ @Test
+ public void return_settings_by_modules() throws Exception {
+ MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION, GlobalPermissions.DRY_RUN_EXECUTION);
+ String projectKey = "org.codehaus.sonar:sonar";
+ String moduleKey = "org.codehaus.sonar:sonar-server";
+
+ when(componentDao.findModulesByProject(projectKey, session)).thenReturn(newArrayList(
+ new ComponentDto().setKey(projectKey),
+ new ComponentDto().setKey(moduleKey)
+ ));
+
+ when(propertiesDao.selectProjectProperties(projectKey, session)).thenReturn(newArrayList(
+ new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
+ new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
+ ));
+
+ when(propertiesDao.selectProjectProperties(moduleKey, session)).thenReturn(newArrayList(
+ new PropertyDto().setKey("sonar.coverage.exclusions").setValue("**/*.java")
+ ));
+
+ WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", projectKey);
+ request.execute().assertJson(getClass(), "return_settings_by_modules.json");
+ }
+
+ @Test
+ public void return_settings_by_modules_without_empty_module_settings() throws Exception {
+ MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION, GlobalPermissions.DRY_RUN_EXECUTION);
+ String projectKey = "org.codehaus.sonar:sonar";
+ String moduleKey = "org.codehaus.sonar:sonar-server";
+
+ when(componentDao.findModulesByProject(projectKey, session)).thenReturn(newArrayList(
+ new ComponentDto().setKey(projectKey),
+ new ComponentDto().setKey(moduleKey)
+ ));
+
+ when(propertiesDao.selectProjectProperties(projectKey, session)).thenReturn(newArrayList(
+ new PropertyDto().setKey("sonar.jira.project.key").setValue("SONAR"),
+ new PropertyDto().setKey("sonar.jira.login.secured").setValue("john")
+ ));
+ // No property on module
+
+ WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", projectKey);
+ request.execute().assertJson(getClass(), "return_settings_by_modules_without_empty_module_settings.json");
+ }
+
+ @Test
+ public void return_quality_profiles() throws Exception {
+ MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION, GlobalPermissions.DRY_RUN_EXECUTION);
+
+ String projectKey = "org.codehaus.sonar:sonar";
+
+ when(qProfileFactory.getByProjectAndLanguage(session, projectKey, "java")).thenReturn(
+ QualityProfileDto.createFor("abcd").setName("Default").setLanguage("java").setRulesUpdatedAt("2014-01-14T14:00:00+0200")
+ );
+
+ WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", projectKey);
+ request.execute().assertJson(getClass(), "return_quality_profiles.json");
+ }
+
+ @Test
+ public void return_quality_profile_from_default_profile() throws Exception {
+ MockUserSession.set().setLogin("john").setGlobalPermissions(GlobalPermissions.SCAN_EXECUTION, GlobalPermissions.DRY_RUN_EXECUTION);
+
+ String projectKey = "org.codehaus.sonar:sonar";
+
+ when(qProfileFactory.getDefault(session, "java")).thenReturn(
+ QualityProfileDto.createFor("abcd").setName("Default").setLanguage("java").setRulesUpdatedAt("2014-01-14T14:00:00+0200")
+ );
+
+ WsTester.TestRequest request = tester.newGetRequest("batch", "project").setParam("key", projectKey);
+ request.execute().assertJson(getClass(), "return_quality_profile_from_default_profile.json");
+ }
+
+}
diff --git a/server/sonar-server/src/test/java/org/sonar/server/component/persistence/ComponentDaoTest.java b/server/sonar-server/src/test/java/org/sonar/server/component/persistence/ComponentDaoTest.java
index 4d794a8c9ad..c5cb63a11b5 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/component/persistence/ComponentDaoTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/component/persistence/ComponentDaoTest.java
@@ -29,6 +29,7 @@ import org.sonar.core.persistence.AbstractDaoTestCase;
import org.sonar.core.persistence.DbSession;
import java.util.Date;
+import java.util.List;
import static org.fest.assertions.Assertions.assertThat;
import static org.mockito.Mockito.mock;
@@ -107,6 +108,17 @@ public class ComponentDaoTest extends AbstractDaoTestCase {
}
@Test
+ public void find_modules_by_project() throws Exception {
+ setupData("shared");
+
+ List<ComponentDto> results = dao.findModulesByProject("org.struts:struts", session);
+ assertThat(results).hasSize(1);
+ assertThat(results.get(0).getKey()).isEqualTo("org.struts:struts-core");
+
+ assertThat(dao.findModulesByProject("unknown", session)).isEmpty();
+ }
+
+ @Test
public void insert() {
when(system2.now()).thenReturn(DateUtils.parseDate("2014-06-18").getTime());
setupData("empty");
diff --git a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java
index caaab96473b..cfcb07c5eae 100644
--- a/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java
+++ b/server/sonar-server/src/test/java/org/sonar/server/qualityprofile/QProfileFactoryMediumTest.java
@@ -24,6 +24,8 @@ import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Test;
import org.sonar.api.server.rule.RuleParamType;
+import org.sonar.core.component.ComponentDto;
+import org.sonar.core.permission.GlobalPermissions;
import org.sonar.core.persistence.DbSession;
import org.sonar.core.properties.PropertyDto;
import org.sonar.core.qualityprofile.db.QualityProfileDto;
@@ -35,6 +37,7 @@ import org.sonar.server.qualityprofile.index.ActiveRuleIndex;
import org.sonar.server.rule.RuleTesting;
import org.sonar.server.search.IndexClient;
import org.sonar.server.tester.ServerTester;
+import org.sonar.server.user.MockUserSession;
import static org.fest.assertions.Assertions.assertThat;
import static org.fest.assertions.Fail.fail;
@@ -300,6 +303,31 @@ public class QProfileFactoryMediumTest {
}
}
+ @Test
+ public void get_profile_by_project_and_language() {
+ ComponentDto project = new ComponentDto()
+ .setId(1L)
+ .setKey("org.codehaus.sonar:sonar")
+ .setName("SonarQube")
+ .setLongName("SonarQube")
+ .setQualifier("TRK")
+ .setScope("TRK")
+ .setEnabled(true);
+ db.componentDao().insert(dbSession, project);
+
+ QualityProfileDto profileDto = QProfileTesting.newXooP1();
+ db.qualityProfileDao().insert(dbSession, profileDto);
+ dbSession.commit();
+ dbSession.clearCache();
+ assertThat(factory.getByProjectAndLanguage("org.codehaus.sonar:sonar", "xoo")).isNull();
+
+ tester.get(QProfileProjectOperations.class).addProject(profileDto.getId(), project.getId(),
+ MockUserSession.set().setGlobalPermissions(GlobalPermissions.QUALITY_PROFILE_ADMIN), dbSession);
+ dbSession.commit();
+ dbSession.clearCache();
+ assertThat(factory.getByProjectAndLanguage("org.codehaus.sonar:sonar", "xoo").getKey()).isEqualTo(XOO_P1_KEY);
+ }
+
private void initRules() {
// create pre-defined rules
RuleDto xooRule1 = RuleTesting.newXooX1();
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profile_from_default_profile.json b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profile_from_default_profile.json
new file mode 100644
index 00000000000..a1bb33bb01f
--- /dev/null
+++ b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profile_from_default_profile.json
@@ -0,0 +1,13 @@
+{
+ "timestamp": 0,
+ "qprofilesByLanguage": {
+ "java": {
+ "key": "abcd",
+ "name": "Default",
+ "language": "java",
+ "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+ }
+ },
+ "activeRules": [],
+ "settingsByModule": {}
+}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profiles.json b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profiles.json
new file mode 100644
index 00000000000..a1bb33bb01f
--- /dev/null
+++ b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_quality_profiles.json
@@ -0,0 +1,13 @@
+{
+ "timestamp": 0,
+ "qprofilesByLanguage": {
+ "java": {
+ "key": "abcd",
+ "name": "Default",
+ "language": "java",
+ "rulesUpdatedAt": "Jan 14, 2014 1:00:00 PM"
+ }
+ },
+ "activeRules": [],
+ "settingsByModule": {}
+}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules.json b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules.json
new file mode 100644
index 00000000000..8891c4589eb
--- /dev/null
+++ b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules.json
@@ -0,0 +1,14 @@
+{
+ "timestamp": 0,
+ "qprofilesByLanguage": {},
+ "activeRules": [],
+ "settingsByModule": {
+ "org.codehaus.sonar:sonar": {
+ "sonar.jira.project.key": "SONAR",
+ "sonar.jira.login.secured": "john"
+ },
+ "org.codehaus.sonar:sonar-server": {
+ "sonar.coverage.exclusions": "**/*.java"
+ }
+ }
+}
diff --git a/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules_without_empty_module_settings.json b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules_without_empty_module_settings.json
new file mode 100644
index 00000000000..5ca420c2a6d
--- /dev/null
+++ b/server/sonar-server/src/test/resources/org/sonar/server/batch/ProjectReferentialsActionTest/return_settings_by_modules_without_empty_module_settings.json
@@ -0,0 +1,11 @@
+{
+ "timestamp": 0,
+ "qprofilesByLanguage": {},
+ "activeRules": [],
+ "settingsByModule": {
+ "org.codehaus.sonar:sonar": {
+ "sonar.jira.project.key": "SONAR",
+ "sonar.jira.login.secured": "john"
+ }
+ }
+}
diff --git a/server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-debt-popup-view.coffee b/server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-debt-popup-view.coffee
new file mode 100644
index 00000000000..c8882d87fb4
--- /dev/null
+++ b/server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-debt-popup-view.coffee
@@ -0,0 +1,16 @@
+define [
+ 'backbone.marionette'
+ 'templates/coding-rules'
+ 'common/popup'
+], (
+ Marionette
+ Templates
+ Popup
+) ->
+
+ class CodingRulesDebtPopupView extends Popup
+ template: Templates['coding-rules-debt-popup']
+
+ serializeData: ->
+ _.extend super,
+ subcharacteristic: @options.app.getSubcharacteristicName(@model.get 'debtSubChar')
diff --git a/server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee b/server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee
index 6bb84a5be26..67776649b39 100644
--- a/server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee
+++ b/server/sonar-web/src/main/coffee/coding-rules/views/coding-rules-detail-view.coffee
@@ -6,6 +6,7 @@ define [
'coding-rules/views/coding-rules-detail-custom-rules-view'
'coding-rules/views/coding-rules-detail-custom-rule-view'
'coding-rules/views/coding-rules-parameter-popup-view'
+ 'coding-rules/views/coding-rules-debt-popup-view'
'templates/coding-rules'
], (
Backbone
@@ -15,6 +16,7 @@ define [
CodingRulesDetailCustomRulesView
CodingRulesDetailCustomRuleView
CodingRulesParameterPopupView
+ CodingRulesDebtPopupView
Templates
) ->
@@ -37,7 +39,6 @@ define [
tagsList: '.coding-rules-detail-tag-list'
subcharacteristic: '.coding-rules-subcharacteristic'
- subcharacteristicMore: '.coding-rules-subcharacteristic-more'
descriptionExtra: '#coding-rules-detail-description-extra'
extendDescriptionLink: '#coding-rules-detail-extend-description'
@@ -74,7 +75,8 @@ define [
'click @ui.changeManualRule': 'changeManualRule'
'click @ui.deleteCustomRule': 'deleteRule'
- 'click .coding-rules-subcharacteristic': 'toggleDebtInfo'
+ 'click .coding-rules-detail-parameter-name': 'toggleParameterDescription'
+ 'click .coding-rules-subcharacteristic': 'showDebtPopup'
initialize: (options) ->
super options
@@ -172,8 +174,18 @@ define [
@ui.extendDescriptionSpinner.hide()
- toggleDebtInfo: (e) ->
- @ui.subcharacteristicMore.toggle()
+ toggleParameterDescription: (e) ->
+ jQuery(e.currentTarget).next('.coding-rules-detail-parameter-description').toggle();
+
+
+ showDebtPopup: (e) ->
+ e.stopPropagation()
+ jQuery('body').click()
+ popup = new CodingRulesDebtPopupView
+ model: @model
+ app: @options.app
+ triggerEl: jQuery(e.currentTarget)
+ popup.render()
false
@@ -282,9 +294,10 @@ define [
deleteRule: ->
+ ruleType = if @model.has('templateKey') then 'custom' else 'manual'
confirmDialog
title: t 'delete'
- html: t 'are_you_sure'
+ html: tp "coding_rules.delete.#{ruleType}.confirm", @model.get('name')
yesHandler: =>
jQuery.ajax
type: 'POST'
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-custom-rule-creation.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-custom-rule-creation.hbs
index c0bdfdc46e5..e9db47f05eb 100644
--- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-custom-rule-creation.hbs
+++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-custom-rule-creation.hbs
@@ -34,7 +34,7 @@
<th><h3>{{t 'description'}} <em class="mandatory">*</em></h3></th>
<td>
<textarea type="textarea" name="markdown_description" id="coding-rules-custom-rule-creation-html-description"
- class="coding-rules-markdown-description" rows="4">{{{mdDesc}}}</textarea>
+ class="coding-rules-markdown-description" rows="15">{{{mdDesc}}}</textarea>
<span class="right">{{> '_markdown-tips' }}</span>
</td>
</tr>
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-debt-popup.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-debt-popup.hbs
new file mode 100644
index 00000000000..42decbd26d0
--- /dev/null
+++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-debt-popup.hbs
@@ -0,0 +1,23 @@
+<div class="coding-rules-debt-popup bubble-popup-container">
+ <ul class="bubble-popup-list">
+ {{#if debtRemFnType}}
+ <li>
+ <h3>{{t 'coding_rules.remediation_function'}}</h3>
+ {{t 'coding_rules.remediation_function' debtRemFnType}}
+ </li>
+ {{/if}}
+ {{#if debtRemFnCoeff}}
+ <li>
+ <h3>{{t 'coding_rules.remediation_function.coeff'}}</h3>
+ {{debtRemFnCoeff}}
+ </li>
+ {{/if}}
+ {{#if debtRemFnOffset}}
+ <li>
+ <h3>{{t 'coding_rules.remediation_function.offset'}}</h3>
+ {{debtRemFnOffset}}
+ </li>
+ {{/if}}
+</div>
+
+<div class="bubble-popup-arrow"></div>
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
index 7f65d83a2af..f839bb8963c 100644
--- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
+++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-detail.hbs
@@ -34,9 +34,7 @@
</li>{{/if}}
{{#if subcharacteristic}}
- <li class="coding-rules-detail-property">
- <a class="link-action coding-rules-subcharacteristic">{{subcharacteristic}}</a>
- </li>
+ <li class="coding-rules-detail-property coding-rules-subcharacteristic">{{subcharacteristic}}</li>
{{/if}}
<li class="coding-rules-detail-property">{{t 'coding_rules.available_since'}} {{d createdAt}}</li>
<li class="coding-rules-detail-property">{{repository}}{{#unless isManual}} ({{language}}){{/unless}}</li>
diff --git a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-manual-rule-creation.hbs b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-manual-rule-creation.hbs
index 4cf821ccdd3..389dd69c661 100644
--- a/server/sonar-web/src/main/hbs/coding-rules/coding-rules-manual-rule-creation.hbs
+++ b/server/sonar-web/src/main/hbs/coding-rules/coding-rules-manual-rule-creation.hbs
@@ -34,7 +34,7 @@
<th><h3>{{t 'description'}} <em class="mandatory">*</em></h3></th>
<td>
<textarea type="textarea" name="markdown_description" id="coding-rules-manual-rule-creation-html-description"
- class="coding-rules-markdown-description" rows="4">{{{mdDesc}}}</textarea>
+ class="coding-rules-markdown-description" rows="15">{{{mdDesc}}}</textarea>
<span class="right">{{> '_markdown-tips' }}</span>
</td>
</tr>
diff --git a/server/sonar-web/src/main/hbs/component-viewer/header/cw-tests-header.hbs b/server/sonar-web/src/main/hbs/component-viewer/header/cw-tests-header.hbs
index 0b8659bb2a6..19f904c1b3b 100644
--- a/server/sonar-web/src/main/hbs/component-viewer/header/cw-tests-header.hbs
+++ b/server/sonar-web/src/main/hbs/component-viewer/header/cw-tests-header.hbs
@@ -44,7 +44,13 @@
<div class="component-viewer-header-expanded-bar-section large">
<div class="component-viewer-header-expanded-bar-section-title justify">
- <span class="ib">{{t 'component_viewer.measure_section.test_names'}}</span>
+ <span class="ib">
+ {{t 'component_viewer.measure_section.test_cases'}}
+ {{t 'component_viewer.tests.ordered_by'}}
+ <a class="js-sort-tests-name underlined-link">{{t 'component_viewer.tests.test_name'}}</a>
+ /
+ <a class="js-sort-tests-duration underlined-link">{{t 'component_viewer.tests.duration'}}</a>
+ </span>
{{#if hasCoveragePerTestData}}
<span class="ib">{{t 'component_viewer.covered_lines'}}</span>
{{/if}}
@@ -77,9 +83,4 @@
{{/eq}}
{{/each}}
</ul>
- <div class="component-viewer-header-expanded-bar-section-title">
- <span>{{t 'component_viewer.tests.sort_by'}}</span>
- <a class="js-sort-tests-name underlined-link">{{t 'component_viewer.tests.test_name'}}</a>
- <a class="js-sort-tests-duration underlined-link">{{t 'component_viewer.tests.duration'}}</a>
- </div>
</div>
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
index 48049d18f24..e2cf097fab7 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec.js
@@ -7,6 +7,7 @@ lib.changeWorkingDirectory('coding-rules-spec');
casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
+ var appId = null;
var showId = null;
casper.start(lib.buildUrl('coding-rules'), function() {
@@ -17,17 +18,6 @@ casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
showId = lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
});
-/*
- jQuery.mockjax({ url: '../api/rules/search', data: {
- 'p': 1, 'ps': 25, 'facets': true, 's': 'createdAt', 'asc': false, 'f': 'name,lang,status'
- }, responseText: searchInitialResponse});
- jQuery.mockjax({ url: '../api/rules/show', data: {
- 'key': 'squid-xoo:x1', 'actives': true
- }, responseText: showX1Response});
- jQuery.mockjax({ url: '../api/rules/show', data: {
- 'key': 'squid:S0001', 'actives': true
- }, responseText: showDeprecatedResponse});
-*/
casper.waitWhileSelector("div#coding-rules-page-loader", function checkInitialPageLoad() {
@@ -62,6 +52,8 @@ casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
test.assertSelectorHasText('.coding-rules-detail-property:nth-child(3)', 'convention, pitfall');
test.assertSelectorHasText('.coding-rules-detail-property:nth-child(4)', 'Testability > Integration level testability');
test.assertSelectorHasText('.coding-rules-detail-property:nth-child(6)', 'SonarQube (Xoo)');
+
+ test.assertDoesntExist('button#coding-rules-detail-extend-description');
});
});
@@ -82,3 +74,53 @@ casper.test.begin('Coding Rules - Readonly Tests', function suite(test) {
test.done();
});
});
+
+casper.test.begin('Coding Rules - Admin Tests', function suite(test) {
+
+ var showId = null;
+ var updateId = null;
+
+ casper.start(lib.buildUrl('coding-rules'), function() {
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/rules/app', 'app_admin.json');
+ lib.mockRequestFromFile('/api/rules/tags', 'tags.json');
+ lib.mockRequestFromFile('/api/rules/search', 'search_initial.json');
+ showId = lib.mockRequestFromFile('/api/rules/show', 'show_x1.json');
+ });
+
+
+ casper.waitWhileSelector("div#coding-rules-page-loader", function checkInitialPageLoad() {
+
+ casper.waitForSelector('.navigator-header', function checkAdminHeader() {
+ test.assertExist('button#coding-rules-create-rule');
+ });
+
+
+ casper.waitForSelector('h3.coding-rules-detail-header', function showFirstRule() {
+ test.assertSelectorHasText('.coding-rules-detail-description-extra', 'Xoo shall not pass');
+
+ test.assertExists('button#coding-rules-detail-extend-description');
+ });
+
+
+ casper.then(function editNote() {
+ casper.click('button#coding-rules-detail-extend-description');
+ test.assertSelectorHasText('textarea#coding-rules-detail-extend-description-text', 'As per the [Book of Xoo](http://xoo.sonarsource.com/book):\n> Xoo shall not pass!');
+
+ casper.sendKeys('textarea#coding-rules-detail-extend-description-text', 'Xoo must pass');
+
+ updateId = lib.mockRequestFromFile('/api/rules/update', 'edit_note_x1.json');
+ casper.click('button#coding-rules-detail-extend-description-submit');
+
+ casper.wait(500, function showUpdatedRule() {
+ test.assertSelectorHasText('.coding-rules-detail-description-extra', 'Xoo must pass');
+ });
+
+ });
+ });
+
+
+ casper.run(function() {
+ test.done();
+ });
+});
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/app_admin.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/app_admin.json
new file mode 100644
index 00000000000..1549d75f02f
--- /dev/null
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/app_admin.json
@@ -0,0 +1,109 @@
+{
+ "canWrite": true,
+ "qualityprofiles": [
+ {
+ "key": "xoo-sonar-way",
+ "name": "Sonar way",
+ "lang": "xoo"
+ },
+ {
+ "key": "xoo-empty",
+ "name": "Empty",
+ "lang": "xoo"
+ },
+ {
+ "key": "java-sonar-way",
+ "name": "Sonar way",
+ "lang": "java"
+ },
+ {
+ "key": "coffee-sonar-way",
+ "name": "Sonar way",
+ "lang": "coffee"
+ },
+ {
+ "key": "java-sonar-way-with-findbugs",
+ "name": "Sonar way with Findbugs",
+ "lang": "java",
+ "parentKey": "java-sonar-way"
+ }
+ ],
+ "languages": {
+ "xoo": "Xoo",
+ "java": "Java",
+ "coffee": "CoffeeScript"
+ },
+ "repositories": [
+ {
+ "key": "squid",
+ "name": "SonarQube",
+ "language": "java"
+ },
+ {
+ "key": "squid-xoo",
+ "name": "SonarQube",
+ "language": "xoo"
+ },
+ {
+ "key": "squid-coffee",
+ "name": "SonarQube",
+ "language": "coffee"
+ },
+ {
+ "key": "common-coffee",
+ "name": "Common SonarQube",
+ "language": "coffee"
+ },
+ {
+ "key": "common-java",
+ "name": "Common SonarQube",
+ "language": "java"
+ }
+ ],
+ "statuses": {
+ "BETA": "Beta",
+ "DEPRECATED": "Deprecated",
+ "READY": "Ready"
+ },
+ "characteristics": {
+ "UNDERSTANDABILITY": "Maintainability: Understandability",
+ "MAINTAINABILITY": "Maintainability",
+ "TIME_ZONE_RELATED_PORTABILITY": "Portability: Time zone related portability",
+ "READABILITY": "Maintainability: Readability",
+ "SECURITY_FEATURES": "Security: Security features",
+ "ARCHITECTURE_RELIABILITY": "Reliability: Architecture related reliability",
+ "OS_RELATED_PORTABILITY": "Portability: OS related portability",
+ "EXCEPTION_HANDLING": "Reliability: Exception handling",
+ "LOGIC_CHANGEABILITY": "Changeability: Logic related changeability",
+ "SOFTWARE_RELATED_PORTABILITY": "Portability: Software related portability",
+ "INPUT_VALIDATION_AND_REPRESENTATION": "Security: Input validation and representation",
+ "LANGUAGE_RELATED_PORTABILITY": "Portability: Language related portability",
+ "ERRORS": "Security: Errors",
+ "SECURITY": "Security",
+ "RELIABILITY": "Reliability",
+ "PORTABILITY": "Portability",
+ "HARDWARE_RELATED_PORTABILITY": "Portability: Hardware related portability",
+ "SYNCHRONIZATION_RELIABILITY": "Reliability: Synchronization related reliability",
+ "TRANSPORTABILITY": "Reusability: Transportability",
+ "COMPILER_RELATED_PORTABILITY": "Portability: Compiler related portability",
+ "RESOURCE_RELIABILITY": "Reliability: Resource",
+ "CPU_EFFICIENCY": "Efficiency: Processor use",
+ "EFFICIENCY": "Efficiency",
+ "CHANGEABILITY": "Changeability",
+ "DATA_CHANGEABILITY": "Changeability: Data related changeability",
+ "API_ABUSE": "Security: API abuse",
+ "ARCHITECTURE_CHANGEABILITY": "Changeability: Architecture related changeability",
+ "UNIT_TESTS": "Reliability: Unit tests",
+ "INSTRUCTION_RELIABILITY": "Reliability: Instruction related reliability",
+ "REUSABILITY": "Reusability",
+ "MODULARITY": "Reusability: Modularity",
+ "UNIT_TESTABILITY": "Testability: Unit level testability",
+ "TESTABILITY": "Testability",
+ "INTEGRATION_TESTABILITY": "Testability: Integration level testability",
+ "NETWORK_USE": "Efficiency: Network use",
+ "MEMORY_EFFICIENCY": "Efficiency: Memory use",
+ "DATA_RELIABILITY": "Reliability: Data related reliability",
+ "FAULT_TOLERANCE": "Reliability: Fault tolerance",
+ "LOGIC_RELIABILITY": "Reliability: Logic related reliability"
+ }
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/edit_note_x1.json b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/edit_note_x1.json
new file mode 100644
index 00000000000..a142eb112c7
--- /dev/null
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/coding-rules-spec/edit_note_x1.json
@@ -0,0 +1,58 @@
+{
+ "rule": {
+ "key": "squid-xoo:x1",
+ "repo": "squid-xoo",
+ "name": "No empty line",
+ "createdAt": "2014-07-23T11:17:26+0200",
+ "severity": "MINOR",
+ "status": "BETA",
+ "isTemplate": false,
+ "tags": [ ],
+ "sysTags": [
+ "convention",
+ "pitfall"
+ ],
+ "lang": "xoo",
+ "langName": "Xoo",
+ "htmlDesc": "Generate an issue on <em>empty</em> lines of Xoo source files",
+ "mdDesc": "Generate an issue on *empty* lines of Xoo source files",
+ "noteLogin": "admin",
+ "mdNote": "As per the [Book of Xoo](http://xoo.sonarsource.com/book):\n> Xoo shall not pass!Xoo must pass",
+ "htmlNote": "As per the <a href=\"http://xoo.sonarsource.com/book\" target=\"_blank\">Book of Xoo</a>:<br/><blockquote>Xoo shall not pass!Xoo must pass</blockquote>",
+ "defaultDebtChar": "TESTABILITY",
+ "defaultDebtSubChar": "INTEGRATION_TESTABILITY",
+ "debtChar": "TESTABILITY",
+ "debtSubChar": "INTEGRATION_TESTABILITY",
+ "debtCharName": "Testability",
+ "debtSubCharName": "Integration level",
+ "debtRemFnType": "LINEAR_OFFSET",
+ "debtRemFnCoeff": "1h",
+ "debtRemFnOffset": "30min",
+ "defaultDebtRemFnType": "LINEAR_OFFSET",
+ "defaultDebtRemFnCoeff": "1h",
+ "defaultDebtRemFnOffset": "30min",
+ "effortToFixDescription": "Effort to fix issue on one line",
+ "debtOverloaded": false,
+ "params": [
+ {
+ "key": "acceptWhitespace",
+ "htmlDesc": "<h1>Accept whitespace (<code>\\s|\\t</code>) on the line\n</h1>This property is available so that a line containing only whitespace is not considered empty.<br/><h2>Example with property set to ``false``\n</h2><pre lang=\"xoo\"><code> &lt;- One issue here\n&lt;- And one here</code></pre><br/><br/><h2>Example with property set to ``true``\n</h2><pre lang=\"xoo\"><code> &lt;- No issue here\n&lt;- But one here</code></pre><br/>",
+ "defaultValue": "false"
+ }
+ ]
+ },
+ "actives": [
+ {
+ "qProfile": "xoo-sonar-way",
+ "inherit": "NONE",
+ "severity": "MAJOR",
+ "params": [
+ {
+ "key": "acceptWhitespace",
+ "value": "true"
+ }
+ ]
+ }
+ ]
+
+}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec.js b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec.js
index c807e35569f..1058b8a1838 100644
--- a/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec.js
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec.js
@@ -5,39 +5,112 @@ lib.changeWorkingDirectory('component-viewer-spec');
casper.test.begin('Component Viewer Base Tests', function (test) {
- casper.start(lib.buildUrl('component-viewer#component=component'), function () {
- lib.setDefaultViewport();
-
- lib.mockRequest('/api/l10n/index', '{}');
- lib.mockRequestFromFile('/api/components/app', 'app.json');
- lib.mockRequestFromFile('/api/sources/show', 'source.json');
- });
-
- casper.wait(1000, function () {
-
- // Check header elements
- test.assertElementCount('.component-viewer-header', 1);
- test.assertSelectorContains('.component-viewer-header-component-project', 'SonarQube');
- test.assertSelectorContains('.component-viewer-header-component-project', 'SonarQube :: Batch');
- test.assertSelectorContains('.component-viewer-header-component-name',
- 'src/main/java/org/sonar/batch/index/Cache.java');
- test.assertElementCount('.component-viewer-header-favorite', 1);
- test.assertElementCount('.component-viewer-header-actions', 1);
-
- // Check main measures
- test.assertSelectorContains('.js-header-tab-basic', '379');
- test.assertSelectorContains('.js-header-tab-issues', 'A');
- test.assertSelectorContains('.js-header-tab-issues', '3h 30min');
- test.assertSelectorContains('.js-header-tab-issues', '6');
- test.assertSelectorContains('.js-header-tab-coverage', '74.3%');
- test.assertElementCount('.js-header-tab-scm', 1);
-
- // Check source
- test.assertElementCount('.component-viewer-source .row', 520);
- test.assertSelectorContains('.component-viewer-source', 'public class Cache');
- });
-
- casper.run(function () {
- test.done();
- });
+ casper
+ .start(lib.buildUrl('component-viewer#component=component'), function () {
+ lib.setDefaultViewport();
+
+ lib.mockRequest('/api/l10n/index', '{}');
+ lib.mockRequestFromFile('/api/components/app', 'app.json');
+ lib.mockRequestFromFile('/api/sources/show', 'source.json');
+ lib.mockRequestFromFile('/api/issues/search', 'issues.json');
+ lib.mockRequestFromFile('/api/coverage/show', 'coverage.json');
+ lib.mockRequestFromFile('/api/duplications/show', 'duplications.json');
+ lib.mockRequestFromFile('/api/sources/scm', 'scm.json');
+ lib.mockRequest('*', '{}'); // Trick to see all ajax requests
+ })
+
+ .then(function () {
+ casper.waitForSelector('.component-viewer-source .row', function () {
+
+ // Check header elements
+ test.assertElementCount('.component-viewer-header', 1);
+ test.assertSelectorContains('.component-viewer-header-component-project', 'SonarQube');
+ test.assertSelectorContains('.component-viewer-header-component-project', 'SonarQube :: Batch');
+ test.assertSelectorContains('.component-viewer-header-component-name',
+ 'src/main/java/org/sonar/batch/index/Cache.java');
+ test.assertElementCount('.component-viewer-header-favorite', 1);
+ test.assertElementCount('.component-viewer-header-actions', 1);
+
+ // Check main measures
+ test.assertSelectorContains('.js-header-tab-basic', '379');
+ test.assertSelectorContains('.js-header-tab-issues', 'A');
+ test.assertSelectorContains('.js-header-tab-issues', '3h 30min');
+ test.assertSelectorContains('.js-header-tab-issues', '6');
+ test.assertSelectorContains('.js-header-tab-coverage', '74.3%');
+ test.assertElementCount('.js-header-tab-scm', 1);
+
+ // Check source
+ test.assertElementCount('.component-viewer-source .row', 520);
+ test.assertSelectorContains('.component-viewer-source', 'public class Cache');
+
+ // Check workspace
+ test.assertElementCount('.component-viewer-workspace', 1);
+ });
+ })
+
+ .then(function() {
+ // Check issues decoration
+ casper.click('.js-toggle-issues');
+ casper.waitForSelector('.code-issue', function () {
+ test.assertElementCount('.code-issue', 6);
+ test.assertSelectorContains('.code-issue', '2 duplicated blocks of code.');
+
+ casper.click('.js-toggle-issues');
+ casper.waitWhileSelector('.code-issue', function () {
+ test.assertElementCount('.code-issue', 0);
+ });
+ });
+ })
+
+ .then(function () {
+ // Check coverage decoration
+ casper.click('.js-toggle-coverage');
+ casper.waitForSelector('.coverage-green', function () {
+ test.assertElementCount('.coverage-green', 149);
+ test.assertSelectorContains('.coverage-green', '27');
+ test.assertElementCount('.coverage-red', 51);
+ test.assertElementCount('.coverage-orange', 2);
+ test.assertSelectorContains('.coverage-orange', '1/2');
+
+ casper.click('.js-toggle-coverage');
+ casper.waitWhileSelector('.coverage-green', function () {
+ test.assertElementCount('.coverage-green', 0);
+ });
+ });
+ })
+
+ .then(function () {
+ // Check duplications decoration
+ casper.click('.js-toggle-duplications');
+ casper.waitForSelector('.duplication-exists', function () {
+ test.assertElementCount('.duplication-exists', 32);
+
+ casper.click('.js-toggle-duplications');
+ casper.waitWhileSelector('.duplication-exists', function () {
+ test.assertElementCount('.duplication-exists', 0);
+ });
+ });
+ })
+
+ .then(function () {
+ // Check scm decoration
+ casper.click('.js-toggle-scm');
+ casper.waitForSelector('.scm-author', function () {
+ test.assertElementCount('.scm-author', 182);
+ test.assertElementCount('.scm-date', 182);
+ test.assertSelectorContains('.scm-author', 'simon.brandhof@gmail.com');
+ test.assertSelectorContains('.scm-author', 'julien.henry@sonarsource.com');
+ test.assertSelectorContains('.scm-date', '2014-02-20');
+
+ casper.click('.js-toggle-scm');
+ casper.waitWhileSelector('.scm-author', function () {
+ test.assertElementCount('.scm-author', 0);
+ test.assertElementCount('.scm-date', 0);
+ });
+ });
+ })
+
+ .run(function () {
+ test.done();
+ });
});
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/coverage.json b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/coverage.json
new file mode 100644
index 00000000000..ace41da645e
--- /dev/null
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/coverage.json
@@ -0,0 +1,196 @@
+{"coverage": [
+ [46, true, 32, null, null],
+ [47, true, 32, null, null],
+ [48, true, 32, null, null],
+ [49, true, 32, null, null],
+ [52, true, 2, null, null],
+ [53, true, 2, null, null],
+ [57, true, 18, null, null],
+ [58, true, 18, null, null],
+ [62, true, 13, null, null],
+ [63, true, 13, null, null],
+ [67, false, null, null, null],
+ [68, false, null, null, null],
+ [73, true, 27, null, null],
+ [74, true, 27, null, null],
+ [75, true, 27, null, null],
+ [76, true, 1, null, null],
+ [77, true, 1, null, null],
+ [85, true, 5, null, null],
+ [86, true, 5, null, null],
+ [94, true, 10, null, null],
+ [95, true, 10, null, null],
+ [103, true, 11, null, null],
+ [104, true, 11, null, null],
+ [112, false, null, null, null],
+ [113, false, null, null, null],
+ [120, true, 17, null, null],
+ [121, true, 17, 2, 2],
+ [122, true, 8, null, null],
+ [124, true, 13, null, null],
+ [125, false, null, null, null],
+ [127, false, null, null, null],
+ [132, true, 4, null, null],
+ [133, true, 4, null, null],
+ [137, true, 3, null, null],
+ [138, true, 3, null, null],
+ [142, true, 5, null, null],
+ [143, true, 5, null, null],
+ [147, false, null, null, null],
+ [148, false, null, null, null],
+ [153, true, 7, null, null],
+ [154, true, 7, null, null],
+ [155, false, null, null, null],
+ [157, false, null, null, null],
+ [162, true, 3, null, null],
+ [163, true, 3, null, null],
+ [167, true, 3, null, null],
+ [168, true, 3, null, null],
+ [172, true, 2, null, null],
+ [173, true, 2, null, null],
+ [177, false, null, null, null],
+ [178, false, null, null, null],
+ [183, true, 6, null, null],
+ [184, false, null, null, null],
+ [186, false, null, null, null],
+ [196, true, 5, null, null],
+ [197, true, 5, null, null],
+ [201, true, 2, null, null],
+ [202, true, 2, null, null],
+ [206, true, 1, null, null],
+ [207, true, 1, null, null],
+ [211, false, null, null, null],
+ [212, false, null, null, null],
+ [217, true, 5, null, null],
+ [218, true, 5, null, null],
+ [219, true, 5, null, null],
+ [220, true, 5, null, null],
+ [221, false, null, null, null],
+ [222, false, null, null, null],
+ [231, true, 4, null, null],
+ [232, true, 4, null, null],
+ [233, false, null, null, null],
+ [234, false, null, null, null],
+ [235, true, 4, null, null],
+ [236, true, 4, null, null],
+ [248, true, 4, null, null],
+ [249, true, 4, null, null],
+ [250, true, 4, null, null],
+ [251, true, 4, null, null],
+ [252, true, 4, null, null],
+ [253, true, 4, 2, 2],
+ [254, true, 2, null, null],
+ [256, true, 4, null, null],
+ [257, false, null, null, null],
+ [258, false, null, null, null],
+ [265, true, 1, null, null],
+ [266, true, 1, null, null],
+ [267, true, 1, null, null],
+ [268, true, 1, null, null],
+ [269, true, 1, null, null],
+ [270, true, 1, null, null],
+ [271, true, 1, 2, 2],
+ [272, true, 1, null, null],
+ [274, true, 1, null, null],
+ [275, false, null, null, null],
+ [276, false, null, null, null],
+ [287, true, 4, null, null],
+ [288, true, 4, null, null],
+ [289, true, 4, null, null],
+ [290, true, 4, null, null],
+ [291, true, 4, 2, 2],
+ [292, true, 3, null, null],
+ [294, true, 4, null, null],
+ [295, false, null, null, null],
+ [296, false, null, null, null],
+ [305, true, 1, null, null],
+ [306, true, 1, null, null],
+ [307, true, 1, null, null],
+ [308, true, 1, null, null],
+ [309, true, 1, null, null],
+ [310, false, null, null, null],
+ [311, false, null, null, null],
+ [316, false, null, null, null],
+ [324, true, 23, null, null],
+ [325, true, 23, null, null],
+ [326, true, 23, null, null],
+ [327, true, 23, null, null],
+ [328, true, 23, null, null],
+ [329, false, null, null, null],
+ [330, false, null, null, null],
+ [339, true, 16, null, null],
+ [340, true, 16, null, null],
+ [341, true, 16, null, null],
+ [342, true, 16, null, null],
+ [343, false, null, null, null],
+ [344, false, null, null, null],
+ [349, true, 9, null, null],
+ [350, true, 9, null, null],
+ [351, true, 9, null, null],
+ [355, true, 3, null, null],
+ [356, true, 3, null, null],
+ [357, true, 3, null, null],
+ [361, true, 7, null, null],
+ [362, true, 7, null, null],
+ [363, true, 7, null, null],
+ [366, true, 20, null, null],
+ [367, true, 20, null, null],
+ [368, true, 20, null, null],
+ [371, true, 18, null, null],
+ [372, true, 18, null, null],
+ [373, true, 18, null, null],
+ [376, false, null, null, null],
+ [377, false, null, 2, 0],
+ [378, false, null, null, null],
+ [380, false, null, null, null],
+ [389, true, 26, null, null],
+ [390, true, 26, null, null],
+ [391, true, 26, null, null],
+ [395, true, 26, null, null],
+ [403, true, 26, null, null],
+ [404, true, 26, null, null],
+ [405, true, 26, null, null],
+ [406, true, 26, null, null],
+ [411, true, 25, null, null],
+ [412, false, null, null, null],
+ [413, false, null, null, null],
+ [421, true, 23, null, null],
+ [422, false, null, null, null],
+ [423, false, null, null, null],
+ [424, true, 23, null, null],
+ [425, true, 23, 2, 1],
+ [426, true, 23, null, null],
+ [428, false, null, null, null],
+ [433, false, null, null, null],
+ [440, true, 10, null, null],
+ [441, true, 10, null, null],
+ [442, true, 10, null, null],
+ [446, true, 10, null, null],
+ [454, true, 10, null, null],
+ [455, true, 10, null, null],
+ [456, true, 10, null, null],
+ [457, true, 10, null, null],
+ [462, true, 10, null, null],
+ [463, false, null, null, null],
+ [464, false, null, null, null],
+ [472, true, 9, null, null],
+ [473, false, null, null, null],
+ [474, false, null, null, null],
+ [475, true, 9, null, null],
+ [476, true, 9, 2, 1],
+ [477, true, 9, null, null],
+ [478, true, 9, null, null],
+ [479, true, 9, null, null],
+ [480, true, 9, 2, 2],
+ [481, true, 9, null, null],
+ [483, true, 9, null, null],
+ [485, false, null, null, null],
+ [490, false, null, null, null],
+ [498, true, 16, null, null],
+ [499, true, 16, null, null],
+ [500, true, 16, null, null],
+ [501, true, 16, null, null],
+ [504, true, 14, null, null],
+ [509, true, 14, null, null],
+ [514, false, null, null, null]
+]}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/duplications.json b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/duplications.json
new file mode 100644
index 00000000000..f77e92bef26
--- /dev/null
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/duplications.json
@@ -0,0 +1,25 @@
+{"duplications": [
+ {
+ "blocks": [
+ {
+ "from": 404,
+ "size": 15,
+ "_ref": "1"
+ },
+ {
+ "from": 455,
+ "size": 15,
+ "_ref": "1"
+ }
+ ]
+ }
+], "files": {
+ "1": {
+ "key": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "name": "src/main/java/org/sonar/batch/index/Cache.java",
+ "project": "org.codehaus.sonar:sonar",
+ "projectName": "SonarQube",
+ "subProject": "org.codehaus.sonar:sonar-batch",
+ "subProjectName": "SonarQube :: Batch"
+ }
+}}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/issues.json b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/issues.json
new file mode 100644
index 00000000000..0d9c4fbae43
--- /dev/null
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/issues.json
@@ -0,0 +1,646 @@
+{"maxResultsReached": false, "paging": {
+ "pageIndex": 1,
+ "pageSize": 999999,
+ "total": 27,
+ "fTotal": "27",
+ "pages": 1
+}, "issues": [
+ {
+ "key": "1c88fb97-4e89-4719-895d-fdf027cd9e6d",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "checkstyle:com.puppycrawl.tools.checkstyle.checks.TodoCommentCheck_1296413157",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "INFO",
+ "message": "Comment matches to-do format 'TODO'.",
+ "line": 153,
+ "author": "Simon Brandhof",
+ "creationDate": "2013-04-17T04:05:53+0200",
+ "updateDate": "2013-07-26T12:39:46+0200",
+ "fUpdateAge": "12 months",
+ "closeDate": "2013-07-26T12:39:46+0200"
+ },
+ {
+ "key": "242b8049-33f5-4bb3-b9a8-ff86de5698d1",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1135",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "INFO",
+ "message": "Complete the task associated to this TODO comment.",
+ "line": 151,
+ "author": "Simon Brandhof",
+ "creationDate": "2013-07-26T14:28:10+0200",
+ "updateDate": "2013-08-03T00:02:13+0200",
+ "fUpdateAge": "11 months",
+ "closeDate": "2013-08-03T00:02:13+0200"
+ },
+ {
+ "key": "9942b361-7127-4ee1-950c-bc67cdb21d19",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1135",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "INFO",
+ "message": "Complete the task associated to this TODO comment.",
+ "line": 151,
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-08T00:00:30+0200",
+ "updateDate": "2013-08-09T00:24:41+0200",
+ "fUpdateAge": "11 months",
+ "closeDate": "2013-08-09T00:24:41+0200"
+ },
+ {
+ "key": "987a803e-2dc8-4552-a0ec-e59c7d6bba8e",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1166",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "CRITICAL",
+ "message": "",
+ "line": 322,
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-09T16:04:33+0200",
+ "updateDate": "2013-08-09T17:35:26+0200",
+ "fUpdateAge": "11 months",
+ "closeDate": "2013-08-09T17:35:26+0200"
+ },
+ {
+ "key": "9afae6b5-3328-4867-8263-16ac58589699",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1173",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "MAJOR",
+ "message": "Rename 'it' to a meaningful name of at least 3 characters.",
+ "line": 297,
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-09T16:04:33+0200",
+ "updateDate": "2013-08-09T17:35:26+0200",
+ "fUpdateAge": "11 months",
+ "closeDate": "2013-08-09T17:35:26+0200"
+ },
+ {
+ "key": "cb76411f-7965-4949-bfb8-a7e48b19de1c",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1166",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "CRITICAL",
+ "message": "",
+ "line": 277,
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-09T16:04:33+0200",
+ "updateDate": "2013-08-09T17:35:26+0200",
+ "fUpdateAge": "11 months",
+ "closeDate": "2013-08-09T17:35:26+0200"
+ },
+ {
+ "key": "e4de6481-7bfb-460a-8b3c-24459f9561d3",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1135",
+ "status": "CONFIRMED",
+ "severity": "INFO",
+ "message": "Complete the task associated to this TODO comment.",
+ "line": 240,
+ "debt": "20min",
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-09T16:04:33+0200",
+ "updateDate": "2013-08-20T11:32:56+0200",
+ "fUpdateAge": "11 months"
+ },
+ {
+ "key": "3a64321a-c031-43ff-bdd6-121cefaf332c",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1186",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MAJOR",
+ "message": "Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.",
+ "line": 406,
+ "debt": "5min",
+ "author": "Simon Brandhof",
+ "actionPlan": "eaf2a3b4-e06f-4e8a-92ec-444f1cf68231",
+ "creationDate": "2013-08-22T10:19:41+0200",
+ "updateDate": "2014-02-24T14:51:05+0100",
+ "fUpdateAge": "4 months",
+ "closeDate": "2014-02-24T14:51:05+0100"
+ },
+ {
+ "key": "3c330410-3fb7-474b-a6f3-522fb5468c69",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1166",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MAJOR",
+ "message": "Either log or rethrow this exception along with some contextual information.",
+ "line": 277,
+ "assignee": "simon.brandhof",
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-22T10:19:41+0200",
+ "updateDate": "2013-08-28T12:19:16+0200",
+ "fUpdateAge": "10 months",
+ "closeDate": "2013-08-28T12:19:16+0200"
+ },
+ {
+ "key": "517b0861-bdfd-4b01-a4fc-2fccbf4e1748",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1192",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MINOR",
+ "message": "Define a constant instead of duplicating this literal \"Fail to get element from cache \" 2 times.",
+ "line": 124,
+ "debt": "10min",
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-22T10:19:41+0200",
+ "updateDate": "2014-04-29T11:24:53+0200",
+ "fUpdateAge": "2 months",
+ "closeDate": "2014-04-29T11:24:53+0200",
+ "comments": [
+ {
+ "key": "7b24f4be-bcaa-4896-a5f7-9e1c84648025",
+ "login": "simon.brandhof",
+ "userName": "Simon Brandhof",
+ "htmlText": "Using constants in log messages does not make sense",
+ "markdown": "Using constants in log messages does not make sense",
+ "updatable": false,
+ "createdAt": "2013-09-02T17:04:47+0200"
+ }
+ ]
+ },
+ {
+ "key": "963c67be-0a42-4fe6-837b-755232e4c41b",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1192",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MINOR",
+ "message": "Define a constant instead of duplicating this literal \"Fail to get values from cache \" 3 times.",
+ "line": 306,
+ "debt": "10min",
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-22T10:19:41+0200",
+ "updateDate": "2014-04-29T11:24:53+0200",
+ "fUpdateAge": "2 months",
+ "closeDate": "2014-04-29T11:24:53+0200",
+ "comments": [
+ {
+ "key": "948f7629-4f81-4b5b-8a44-ba9ca05553c4",
+ "login": "simon.brandhof",
+ "userName": "Simon Brandhof",
+ "htmlText": "Using constants in log messages does not make sense",
+ "markdown": "Using constants in log messages does not make sense",
+ "updatable": false,
+ "createdAt": "2013-09-02T17:04:56+0200"
+ }
+ ]
+ },
+ {
+ "key": "bb6cee43-0e33-41a8-b550-6214418b50c1",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1186",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MAJOR",
+ "message": "Add a nested comment explaining why this method is empty, throw an UnsupportedOperationException or complete the implementation.",
+ "line": 351,
+ "debt": "20min",
+ "author": "Simon Brandhof",
+ "actionPlan": "c3484f53-4bcf-4ae8-ad34-383480070950",
+ "creationDate": "2013-08-22T10:19:41+0200",
+ "updateDate": "2013-12-10T15:55:46+0100",
+ "fUpdateAge": "7 months",
+ "closeDate": "2013-12-10T15:55:46+0100"
+ },
+ {
+ "key": "c86f19ef-cacb-43ab-bc7f-a3bfb00e954b",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1166",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MAJOR",
+ "message": "Either log or rethrow this exception along with some contextual information.",
+ "line": 322,
+ "assignee": "simon.brandhof",
+ "author": "Simon Brandhof",
+ "creationDate": "2013-08-22T10:19:41+0200",
+ "updateDate": "2013-08-28T12:19:16+0200",
+ "fUpdateAge": "10 months",
+ "closeDate": "2013-08-28T12:19:16+0200"
+ },
+ {
+ "key": "26ebfb62-ce60-47e5-86b9-872d8322ddb8",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "findbugs:NP_NULL_PARAM_DEREF",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "CRITICAL",
+ "message": "Null passed for nonnull parameter of new Cache$Entry(String, String, Serializable) in org.sonar.batch.index.Cache$EntryIterator.next()",
+ "line": 334,
+ "author": "Simon Brandhof",
+ "creationDate": "2013-09-16T17:20:55+0200",
+ "updateDate": "2013-09-17T01:55:28+0200",
+ "fUpdateAge": "10 months",
+ "closeDate": "2013-09-17T01:55:28+0200"
+ },
+ {
+ "key": "01461208-6c1e-4cdf-9f27-b7afa78e76ec",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1135",
+ "status": "CONFIRMED",
+ "severity": "INFO",
+ "message": "Complete the task associated to this TODO comment.",
+ "line": 185,
+ "debt": "20min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2013-10-10T23:51:33+0200",
+ "updateDate": "2013-12-10T16:22:53+0100",
+ "fUpdateAge": "7 months"
+ },
+ {
+ "key": "71a26f48-a90d-4a76-a745-4f6e6e8b1773",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1135",
+ "status": "CONFIRMED",
+ "severity": "INFO",
+ "message": "Complete the task associated to this TODO comment.",
+ "line": 126,
+ "debt": "20min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2013-10-10T23:51:33+0200",
+ "updateDate": "2013-12-10T16:24:57+0100",
+ "fUpdateAge": "7 months"
+ },
+ {
+ "key": "75419c88-0e3c-4311-aa47-fe5731e67558",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1135",
+ "status": "CONFIRMED",
+ "severity": "INFO",
+ "message": "Complete the task associated to this TODO comment.",
+ "line": 156,
+ "debt": "20min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2013-10-10T23:51:33+0200",
+ "updateDate": "2013-12-10T16:25:06+0100",
+ "fUpdateAge": "7 months"
+ },
+ {
+ "key": "59fc17f7-c977-4cb6-8f04-fbe88e4b9186",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1192",
+ "status": "CONFIRMED",
+ "severity": "MINOR",
+ "message": "Define a constant instead of duplicating this literal \"Fail to get keys from cache \" 3 times.",
+ "line": 258,
+ "debt": "10min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2014-02-20T07:48:16+0100",
+ "updateDate": "2014-02-24T16:57:34+0100",
+ "fUpdateAge": "4 months"
+ },
+ {
+ "key": "e30c874a-0cd1-44db-8dd3-c7cfd5d72929",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1192",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MINOR",
+ "message": "Define a constant instead of duplicating this literal \"Removing an item is not supported\" 2 times.",
+ "line": 420,
+ "debt": "10min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2014-02-24T14:51:05+0100",
+ "updateDate": "2014-04-29T11:24:53+0200",
+ "fUpdateAge": "2 months",
+ "closeDate": "2014-04-29T11:24:53+0200"
+ },
+ {
+ "key": "7cc2e50d-3afc-4e7e-a562-eae2fbb9b596",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1192",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MINOR",
+ "message": "Define a constant instead of duplicating this literal \"Fail to get values from cache \" 3 times.",
+ "line": 311,
+ "debt": "10min",
+ "assignee": "julien.henry",
+ "author": "julien.henry@sonarsource.com",
+ "actionPlan": "39d06f0c-98c0-4a4f-956b-38ccbc9eb5c9",
+ "creationDate": "2014-04-30T23:37:32+0200",
+ "updateDate": "2014-06-20T14:47:17+0200",
+ "fUpdateAge": "about a month",
+ "closeDate": "2014-06-20T14:47:17+0200"
+ },
+ {
+ "key": "20002ec7-b647-44da-bdf5-4d9fbf4b7c58",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "common-java:DuplicatedBlocks",
+ "status": "CONFIRMED",
+ "severity": "MAJOR",
+ "message": "2 duplicated blocks of code.",
+ "debt": "2h",
+ "creationDate": "2014-05-01T23:38:31+0200",
+ "updateDate": "2014-07-01T17:48:47+0200",
+ "fUpdateAge": "21 days"
+ },
+ {
+ "key": "5cbf3374-cd56-4e16-8434-d47ee541b347",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:HiddenFieldCheck",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MAJOR",
+ "message": "Rename \"exchange\" which hides the field declared at line 46.",
+ "line": 517,
+ "debt": "30min",
+ "creationDate": "2014-05-06T16:36:28+0200",
+ "updateDate": "2014-05-07T23:40:25+0200",
+ "fUpdateAge": "2 months",
+ "closeDate": "2014-05-07T23:40:25+0200"
+ },
+ {
+ "key": "aac25f93-f7e5-4e75-a750-b64d4d621c67",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1166",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "CRITICAL",
+ "message": "Either log or rethrow this exception.",
+ "line": 523,
+ "debt": "10min",
+ "creationDate": "2014-05-06T16:36:28+0200",
+ "updateDate": "2014-05-07T23:40:25+0200",
+ "fUpdateAge": "2 months",
+ "closeDate": "2014-05-07T23:40:25+0200"
+ },
+ {
+ "key": "cdea44e2-a1eb-43dd-a990-662c7cf0b8b9",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "findbugs:REC_CATCH_EXCEPTION",
+ "status": "CLOSED",
+ "resolution": "FIXED",
+ "severity": "MAJOR",
+ "message": "Exception is caught when Exception is not thrown in org.sonar.batch.index.Cache.newExchange(Exchange)",
+ "line": 523,
+ "debt": "1h",
+ "creationDate": "2014-05-06T16:36:28+0200",
+ "updateDate": "2014-05-07T23:40:25+0200",
+ "fUpdateAge": "2 months",
+ "closeDate": "2014-05-07T23:40:25+0200"
+ },
+ {
+ "key": "331984f1-e2ce-49a7-838f-a5e2e00bdb65",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1701",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "MAJOR",
+ "message": "Rename the \"value\" member.",
+ "line": 496,
+ "debt": "10min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2014-06-26T23:17:10+0200",
+ "updateDate": "2014-06-27T23:12:06+0200",
+ "fUpdateAge": "25 days",
+ "closeDate": "2014-06-27T23:12:06+0200"
+ },
+ {
+ "key": "539895b5-bca6-491a-94da-24b0105af28f",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1701",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "MAJOR",
+ "message": "Rename the \"key\" member.",
+ "line": 495,
+ "debt": "10min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2014-06-26T23:17:10+0200",
+ "updateDate": "2014-06-27T23:12:06+0200",
+ "fUpdateAge": "25 days",
+ "closeDate": "2014-06-27T23:12:06+0200"
+ },
+ {
+ "key": "889efbf0-b218-4be7-9ff4-84867b5bc808",
+ "component": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "componentId": 19983,
+ "project": "org.codehaus.sonar:sonar",
+ "rule": "squid:S1701",
+ "status": "CLOSED",
+ "resolution": "REMOVED",
+ "severity": "MAJOR",
+ "message": "Rename the \"iterator\" member.",
+ "line": 387,
+ "debt": "10min",
+ "author": "simon.brandhof@gmail.com",
+ "creationDate": "2014-06-26T23:17:10+0200",
+ "updateDate": "2014-06-27T23:12:06+0200",
+ "fUpdateAge": "25 days",
+ "closeDate": "2014-06-27T23:12:06+0200"
+ }
+], "components": [
+ {
+ "key": "org.codehaus.sonar:sonar",
+ "id": 2865,
+ "qualifier": "TRK",
+ "name": "SonarQube",
+ "longName": "SonarQube"
+ },
+ {
+ "key": "org.codehaus.sonar:sonar-batch",
+ "id": 1624,
+ "qualifier": "BRC",
+ "name": "SonarQube :: Batch",
+ "longName": "SonarQube :: Batch",
+ "path": "sonar-batch",
+ "projectId": 2865,
+ "subProjectId": 2865
+ },
+ {
+ "key": "org.codehaus.sonar:sonar-batch:src/main/java/org/sonar/batch/index/Cache.java",
+ "id": 19983,
+ "qualifier": "FIL",
+ "name": "Cache.java",
+ "longName": "src/main/java/org/sonar/batch/index/Cache.java",
+ "path": "src/main/java/org/sonar/batch/index/Cache.java",
+ "projectId": 2865,
+ "subProjectId": 1624
+ }
+], "projects": [
+ {
+ "key": "org.codehaus.sonar:sonar",
+ "id": 2865,
+ "qualifier": "TRK",
+ "name": "SonarQube",
+ "longName": "SonarQube"
+ }
+], "rules": [
+ {
+ "key": "squid:S1166",
+ "name": "Exception handlers should preserve the original exception",
+ "desc": "<p>\nWhen handling a caught exception, two mandatory informations should be logged:\n</p>\n\n<ul>\n <li>Some context to ease the reproduction of the issue.</li>\n <li>The original's exception, for its message and stack trace.</lu>\n</ul>\n\n<h2>Noncompliant Code Example</h2>\n\n<pre>\n // Noncompliant - exception is lost\ntry { /* ... */ } catch (Exception e) { LOGGER.info(\"context\"); }\n\n// Noncompliant - context is required\ntry { /* ... */ } catch (Exception e) { LOGGER.info(e); }\n\n// Noncompliant - exception is lost (only message is preserved)\ntry { /* ... */ } catch (Exception e) { LOGGER.info(e.getMessage()); }\n\n// Noncompliant - exception is lost\ntry { /* ... */ } catch (Exception e) { throw new RuntimeException(\"context\"); }\n</pre>\n\n<h2>Compliant Solution</h2>\n\n<pre>\ntry { /* ... */ } catch (Exception e) { LOGGER.info(\"context\", e); }\n\ntry { /* ... */ } catch (Exception e) { throw new RuntimeException(\"context\", e); }\n</pre>\n\n<h2>Exceptions</h2>\n\n<p>It is allowed to let the exception propagate.</p>\n\n<pre>\ntry {\n /* ... */\n} catch (RuntimeException e) {\n doSomething();\n throw e;\n} catch (Exception e) {\n // Conversion into unchecked exception is also allowed\n throw new RuntimeException(e);\n}\n</pre>\n\n<p>\n<code>InterruptedException</code>, <code>NumberFormatException</code>, <code>ParseException</code> and <code>MalformedURLException</code> exceptions are arguably used to indicate nonexceptional outcomes.\nAs they are part of Java, developers have no choice but to deal with them. This rule does not verify that those particular exceptions are correctly handled.\n</p>\n\n<pre>\nint myInteger;\ntry {\n myInteger = Integer.parseInt(myString);\n} catch (NumberFormatException e) {\n // It is perfectly acceptable to not handle \"e\" here\n myInteger = 0;\n}\n</pre>",
+ "status": "READY"
+ },
+ {
+ "key": "common-java:DuplicatedBlocks",
+ "name": "Duplicated blocks",
+ "desc": "<p>An issue is created on a file as soon as there is a block of duplicated code on this file. It gives the number of blocks in the file.</p>",
+ "status": "READY"
+ },
+ {
+ "key": "findbugs:REC_CATCH_EXCEPTION",
+ "name": "Dodgy - Exception is caught when Exception is not thrown",
+ "desc": "<p>\n This method uses a try-catch block that catches Exception objects, but Exception is not\n thrown within the try block, and RuntimeException is not explicitly caught. It is a common bug pattern to\n say try { ... } catch (Exception e) { something } as a shorthand for catching a number of types of exception\n each of whose catch blocks is identical, but this construct also accidentally catches RuntimeException as well,\n masking potential bugs.\n </p>",
+ "status": "READY"
+ },
+ {
+ "key": "squid:S1701",
+ "name": "Fields should not duplicate method names",
+ "desc": "<p>It's confusing to have a class member with the same name as a method in the class.</p>\n\n<p>Typically this situation indicates that the method is poorly named; method names should be action-oriented, and thus contain a verb, which is unlikely in the case where both a method and a member have the same name. However, renaming a public method could be disruptive to callers. Therefore renaming the member is the recommended action.</p>\n\n<h2>Noncompliant Code Sample</h2>\n<pre>\npublic class Foo {\n\n private string fiz;\n public String fiz() {\n // do something...\n }\n\n private void doSomething() {\n\n String tmp = fiz; // is this what was intended? Should this have been a call to fiz()?\n\n }\n}\n</pre>\n\n<h2>Compliant Solution</h2>\n<pre>\npublic class Foo {\n\n private string fizbah; // member has been renamed\n public String fiz() {\n // do something...\n }\n\n private void doSomething() {\n\n String tmp = fiz; // results in a compile error\n String tmp2 = fiz(); // no question now what was intended\n }\n}\n</pre>",
+ "status": "REMOVED"
+ },
+ {
+ "key": "squid:S1192",
+ "name": "String literals should not be duplicated",
+ "desc": "<p>\n Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.\n On the other hand, constants can be referenced from many places, but only need to be updated in a single place.\n</p>\n\n<h2>Non Compliant Code Example</h2>\n\n<pre>\npublic void run() {\n prepare(\"action1\"); // Non-Compliant - \"action1\" is duplicated 3 times\n execute(\"action1\");\n release(\"action1\");\n}\n\n@SuppressWarning(\"all\") // Compliant - annotations are excluded\nprivate void method1() { /* ... */ }\n@SuppressWarning(\"all\")\nprivate void method2() { /* ... */ }\n\npublic String method3(String a) {\n System.out.println(\"'\" + a + \"'\"); // Compliant - literal \"'\" has less than 5 characters and is excluded\n return \"\"; // Compliant - literal \"\" has less than 5 characters and is excluded\n}\n</pre>\n\n<h2>Compliant Code Example</h2>\n\n<pre>\nprivate static final String ACTION_1 = \"action1\"; // Compliant\n\npublic void run() {\n prepare(ACTION_1); // Compliant\n execute(ACTION_1);\n release(ACTION_1);\n}\n</pre>\n\n<h2>Exceptions</h2>\n<p>To prevent generating some false-positives, literals having less than 5 characters are excluded.</p>",
+ "status": "READY"
+ },
+ {
+ "key": "squid:HiddenFieldCheck",
+ "name": "Local variables should not shadow class fields",
+ "desc": "<p>\nShadowing fields with a local variable is a bad practice reducing code readability: It makes it confusing to know whether the field or the variable is and should be accessed.\n</p>\n\n<p>\nThe following code illustrates this rule:\n</p>\n\n<pre>\nclass Foo {\n public int myField;\n\n public Foo(int myField) { // Compliant - method parameters are not checked\n this.myField = myField;\n }\n\n @Override\n public String toString() {\n int myField = 0; // Non-Compliant - should be renamed\n return \"Foo{MyField: \" + myField + \"}\";\n }\n}\n</pre>",
+ "status": "READY"
+ },
+ {
+ "key": "squid:S1135",
+ "name": "TODO tags should be handled",
+ "desc": "<p>\n<code>TODO</code> tags are commonly used to mark places where some more code is required, but which the developer wants to implement later.\nSometimes the developer will not have the time or will simply forget to get back to that tag.\nThis rule is meant to track those tags, and ensure that they do not go unnoticed.\n</p>\n\n<p>The following code illustrates this rule:</p>\n\n<pre>\nvoid doSomething() {\n // TODO\n}\n</pre>",
+ "status": "READY"
+ },
+ {
+ "key": "findbugs:NP_NULL_PARAM_DEREF",
+ "name": "Correctness - Method call passes null for nonnull parameter",
+ "desc": "<p>\n This method call passes a null value for a nonnull method parameter.\n\tEither the parameter is annotated as a parameter that should\n\talways be nonnull, or analysis has shown that it will always be \n\tdereferenced.\n </p>",
+ "status": "READY"
+ },
+ {
+ "key": "squid:S1173",
+ "name": "S1173",
+ "desc": "S1173",
+ "status": "REMOVED"
+ },
+ {
+ "key": "squid:S1186",
+ "name": "Methods should not be empty",
+ "desc": "<p>There are three reasons for a method not to have a method body:</p>\n\n<ul>\n <li>It is an unintentional omission, and should be fixed.</li>\n <li>It is not yet, or never will be, supported. In this case an <code>UnsupportedOperationException</code> should be thrown.</li>\n <li>The method is an intentionally-blank override. In this case a nested comment should explain the reason for the blank override.</li>\n</ul>\n\n<p>The following code snippet:</p>\n\n<pre>\n// Non-Compliant\npublic void doSomething() {\n}\n</pre>\n\nshould be refactored into:\n\n<pre>\n// Compliant\n@Override\npublic void doSomethingElse() {\n // Do nothing because of X and Y.\n}\n</pre>\n\nor:\n\n<pre>\n// Compliant\n@Override\npublic void doSomethingElse() {\n throw new UnsupportedOperationException();\n}\n</pre>\n\n<p>Empty methods not having any nested comments are tolerated in Abstract classes as those empty methods are usual when implementing the visitor pattern.</p>",
+ "status": "READY"
+ }
+], "users": [
+ {
+ "login": "julien.henry",
+ "name": "Julien Henry",
+ "active": true,
+ "email": "julien.henry@sonarsource.com"
+ },
+ {
+ "login": "simon.brandhof",
+ "name": "Simon Brandhof",
+ "active": true,
+ "email": "simon.brandhof@sonarsource.com"
+ }
+], "actionPlans": [
+ {
+ "key": "eaf2a3b4-e06f-4e8a-92ec-444f1cf68231",
+ "name": "4.2",
+ "status": "CLOSED",
+ "project": "org.codehaus.sonar:sonar",
+ "userLogin": "fabrice.bellingard",
+ "deadLine": "2014-01-31T00:00:00+0100",
+ "fDeadLine": "Jan 31, 2014 12:00 AM",
+ "createdAt": "2013-12-11T08:35:23+0100",
+ "fCreatedAt": "Dec 11, 2013 8:35 AM",
+ "updatedAt": "2014-04-14T11:55:03+0200",
+ "fUpdatedAt": "Apr 14, 2014 11:55 AM"
+ },
+ {
+ "key": "39d06f0c-98c0-4a4f-956b-38ccbc9eb5c9",
+ "name": "4.4",
+ "status": "CLOSED",
+ "project": "org.codehaus.sonar:sonar",
+ "userLogin": "fabrice.bellingard",
+ "deadLine": "2014-06-27T00:00:00+0200",
+ "fDeadLine": "Jun 27, 2014 12:00 AM",
+ "createdAt": "2014-04-14T10:23:34+0200",
+ "fCreatedAt": "Apr 14, 2014 10:23 AM",
+ "updatedAt": "2014-07-11T16:56:06+0200",
+ "fUpdatedAt": "Jul 11, 2014 4:56 PM"
+ },
+ {
+ "key": "c3484f53-4bcf-4ae8-ad34-383480070950",
+ "name": "SonarQube 4.1",
+ "status": "CLOSED",
+ "project": "org.codehaus.sonar:sonar",
+ "userLogin": "freddy.mallet",
+ "deadLine": "2013-11-05T00:00:00+0100",
+ "fDeadLine": "Nov 5, 2013 12:00 AM",
+ "createdAt": "2013-10-22T12:39:01+0200",
+ "fCreatedAt": "Oct 22, 2013 12:39 PM",
+ "updatedAt": "2013-12-12T14:22:07+0100",
+ "fUpdatedAt": "Dec 12, 2013 2:22 PM"
+ }
+]}
diff --git a/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/scm.json b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/scm.json
new file mode 100644
index 00000000000..ff89c9856ca
--- /dev/null
+++ b/server/sonar-web/src/main/js/tests/e2e/tests/component-viewer-spec/scm.json
@@ -0,0 +1,184 @@
+{"scm": [
+ [1, "simon.brandhof@gmail.com", "2013-04-16"],
+ [2, "simon.brandhof@gmail.com", "2013-04-21"],
+ [3, "simon.brandhof@gmail.com", "2014-03-11"],
+ [4, "simon.brandhof@gmail.com", "2013-04-16"],
+ [6, "simon.brandhof@gmail.com", "2013-04-21"],
+ [7, "simon.brandhof@gmail.com", "2013-04-16"],
+ [11, "simon.brandhof@gmail.com", "2013-04-21"],
+ [12, "simon.brandhof@gmail.com", "2013-04-16"],
+ [16, "simon.brandhof@gmail.com", "2013-04-22"],
+ [19, "simon.brandhof@gmail.com", "2013-04-16"],
+ [25, "julien.henry@sonarsource.com", "2014-05-01"],
+ [26, "simon.brandhof@gmail.com", "2013-04-17"],
+ [30, "julien.henry@sonarsource.com", "2014-04-30"],
+ [31, "simon.brandhof@gmail.com", "2013-04-16"],
+ [32, "simon.brandhof@gmail.com", "2013-04-17"],
+ [33, "julien.henry@sonarsource.com", "2014-05-01"],
+ [34, "simon.brandhof@gmail.com", "2013-04-16"],
+ [37, "simon.brandhof@gmail.com", "2013-04-17"],
+ [38, "simon.brandhof@gmail.com", "2013-04-16"],
+ [39, "simon.brandhof@gmail.com", "2013-04-17"],
+ [40, "simon.brandhof@gmail.com", "2013-04-16"],
+ [41, "simon.brandhof@gmail.com", "2014-02-20"],
+ [42, "simon.brandhof@gmail.com", "2013-04-16"],
+ [51, "julien.henry@sonarsource.com", "2014-05-01"],
+ [52, "simon.brandhof@gmail.com", "2014-02-20"],
+ [54, "simon.brandhof@gmail.com", "2013-04-16"],
+ [56, "julien.henry@sonarsource.com", "2014-05-01"],
+ [57, "simon.brandhof@gmail.com", "2014-02-20"],
+ [61, "julien.henry@sonarsource.com", "2014-05-01"],
+ [62, "simon.brandhof@gmail.com", "2014-02-20"],
+ [66, "julien.henry@sonarsource.com", "2014-05-01"],
+ [67, "simon.brandhof@gmail.com", "2014-02-20"],
+ [71, "julien.henry@sonarsource.com", "2014-05-01"],
+ [72, "simon.brandhof@gmail.com", "2013-04-16"],
+ [77, "simon.brandhof@gmail.com", "2013-05-29"],
+ [78, "simon.brandhof@gmail.com", "2013-04-16"],
+ [82, "simon.brandhof@gmail.com", "2014-02-20"],
+ [83, "simon.brandhof@gmail.com", "2013-04-16"],
+ [84, "simon.brandhof@gmail.com", "2014-02-20"],
+ [116, "julien.henry@sonarsource.com", "2014-05-01"],
+ [117, "simon.brandhof@gmail.com", "2014-02-20"],
+ [119, "simon.brandhof@gmail.com", "2013-04-16"],
+ [126, "simon.brandhof@gmail.com", "2013-10-10"],
+ [127, "simon.brandhof@gmail.com", "2013-05-29"],
+ [128, "simon.brandhof@gmail.com", "2013-04-16"],
+ [131, "simon.brandhof@gmail.com", "2014-02-20"],
+ [144, "simon.brandhof@gmail.com", "2013-04-16"],
+ [146, "simon.brandhof@gmail.com", "2014-02-20"],
+ [152, "simon.brandhof@gmail.com", "2013-10-10"],
+ [161, "simon.brandhof@gmail.com", "2014-02-20"],
+ [182, "simon.brandhof@gmail.com", "2013-04-16"],
+ [183, "simon.brandhof@gmail.com", "2013-04-26"],
+ [184, "simon.brandhof@gmail.com", "2013-04-16"],
+ [185, "simon.brandhof@gmail.com", "2013-10-10"],
+ [186, "simon.brandhof@gmail.com", "2013-05-29"],
+ [187, "simon.brandhof@gmail.com", "2013-04-16"],
+ [195, "julien.henry@sonarsource.com", "2014-05-01"],
+ [196, "simon.brandhof@gmail.com", "2014-02-20"],
+ [200, "julien.henry@sonarsource.com", "2014-05-01"],
+ [201, "simon.brandhof@gmail.com", "2014-02-20"],
+ [205, "julien.henry@sonarsource.com", "2014-05-01"],
+ [206, "simon.brandhof@gmail.com", "2014-02-20"],
+ [210, "julien.henry@sonarsource.com", "2014-05-01"],
+ [211, "simon.brandhof@gmail.com", "2014-02-20"],
+ [215, "julien.henry@sonarsource.com", "2014-05-01"],
+ [216, "simon.brandhof@gmail.com", "2013-04-16"],
+ [217, "simon.brandhof@gmail.com", "2014-02-20"],
+ [220, "simon.brandhof@gmail.com", "2013-04-16"],
+ [222, "simon.brandhof@gmail.com", "2014-02-20"],
+ [223, "simon.brandhof@gmail.com", "2013-04-16"],
+ [229, "simon.brandhof@gmail.com", "2014-02-20"],
+ [230, "simon.brandhof@gmail.com", "2013-04-16"],
+ [245, "julien.henry@sonarsource.com", "2014-05-01"],
+ [246, "simon.brandhof@gmail.com", "2014-02-20"],
+ [247, "simon.brandhof@gmail.com", "2013-04-16"],
+ [248, "simon.brandhof@gmail.com", "2014-02-20"],
+ [249, "simon.brandhof@gmail.com", "2013-04-16"],
+ [251, "simon.brandhof@gmail.com", "2014-02-20"],
+ [252, "simon.brandhof@gmail.com", "2013-04-16"],
+ [254, "simon.brandhof@gmail.com", "2014-02-20"],
+ [255, "simon.brandhof@gmail.com", "2013-04-16"],
+ [258, "simon.brandhof@gmail.com", "2013-05-29"],
+ [259, "simon.brandhof@gmail.com", "2013-04-16"],
+ [262, "julien.henry@sonarsource.com", "2014-05-01"],
+ [263, "simon.brandhof@gmail.com", "2014-02-20"],
+ [279, "simon.brandhof@gmail.com", "2013-04-16"],
+ [285, "simon.brandhof@gmail.com", "2014-02-20"],
+ [298, "simon.brandhof@gmail.com", "2013-04-16"],
+ [300, "simon.brandhof@gmail.com", "2013-05-29"],
+ [301, "julien.henry@sonarsource.com", "2014-04-30"],
+ [308, "julien.henry@sonarsource.com", "2014-05-01"],
+ [310, "julien.henry@sonarsource.com", "2014-04-30"],
+ [311, "julien.henry@sonarsource.com", "2014-06-20"],
+ [312, "julien.henry@sonarsource.com", "2014-04-30"],
+ [315, "julien.henry@sonarsource.com", "2014-06-20"],
+ [319, "julien.henry@sonarsource.com", "2014-04-30"],
+ [320, "simon.brandhof@gmail.com", "2014-02-20"],
+ [321, "simon.brandhof@gmail.com", "2013-05-29"],
+ [322, "julien.henry@sonarsource.com", "2014-05-01"],
+ [323, "simon.brandhof@gmail.com", "2013-04-16"],
+ [325, "julien.henry@sonarsource.com", "2014-05-01"],
+ [326, "simon.brandhof@gmail.com", "2013-04-16"],
+ [327, "julien.henry@sonarsource.com", "2014-05-01"],
+ [329, "simon.brandhof@gmail.com", "2013-04-16"],
+ [330, "julien.henry@sonarsource.com", "2014-06-20"],
+ [331, "simon.brandhof@gmail.com", "2013-04-16"],
+ [334, "simon.brandhof@gmail.com", "2013-05-29"],
+ [337, "simon.brandhof@gmail.com", "2013-04-16"],
+ [339, "simon.brandhof@gmail.com", "2014-02-20"],
+ [340, "simon.brandhof@gmail.com", "2013-04-16"],
+ [341, "julien.henry@sonarsource.com", "2014-05-01"],
+ [343, "simon.brandhof@gmail.com", "2013-04-16"],
+ [344, "julien.henry@sonarsource.com", "2014-06-20"],
+ [345, "simon.brandhof@gmail.com", "2013-04-16"],
+ [347, "simon.brandhof@gmail.com", "2013-04-17"],
+ [348, "simon.brandhof@gmail.com", "2014-02-20"],
+ [350, "julien.henry@sonarsource.com", "2014-05-01"],
+ [352, "simon.brandhof@gmail.com", "2013-04-17"],
+ [353, "simon.brandhof@gmail.com", "2014-02-20"],
+ [354, "julien.henry@sonarsource.com", "2014-05-01"],
+ [358, "simon.brandhof@gmail.com", "2013-04-17"],
+ [359, "simon.brandhof@gmail.com", "2014-02-20"],
+ [363, "simon.brandhof@gmail.com", "2013-04-17"],
+ [365, "simon.brandhof@gmail.com", "2014-02-20"],
+ [368, "simon.brandhof@gmail.com", "2013-04-17"],
+ [370, "simon.brandhof@gmail.com", "2014-02-20"],
+ [380, "simon.brandhof@gmail.com", "2013-04-17"],
+ [382, "simon.brandhof@gmail.com", "2013-05-29"],
+ [389, "julien.henry@sonarsource.com", "2014-05-01"],
+ [391, "simon.brandhof@gmail.com", "2013-05-29"],
+ [401, "julien.henry@sonarsource.com", "2014-05-01"],
+ [402, "simon.brandhof@gmail.com", "2013-05-29"],
+ [403, "julien.henry@sonarsource.com", "2014-05-01"],
+ [404, "simon.brandhof@gmail.com", "2013-05-29"],
+ [405, "julien.henry@sonarsource.com", "2014-05-01"],
+ [406, "simon.brandhof@gmail.com", "2013-05-29"],
+ [411, "julien.henry@sonarsource.com", "2014-05-01"],
+ [412, "simon.brandhof@gmail.com", "2013-05-29"],
+ [417, "julien.henry@sonarsource.com", "2014-05-01"],
+ [418, "simon.brandhof@gmail.com", "2013-05-29"],
+ [420, "simon.brandhof@gmail.com", "2014-02-20"],
+ [421, "julien.henry@sonarsource.com", "2014-05-01"],
+ [422, "simon.brandhof@gmail.com", "2014-02-20"],
+ [425, "simon.brandhof@gmail.com", "2013-05-29"],
+ [426, "julien.henry@sonarsource.com", "2014-05-01"],
+ [427, "simon.brandhof@gmail.com", "2013-05-29"],
+ [428, "julien.henry@sonarsource.com", "2014-05-01"],
+ [429, "simon.brandhof@gmail.com", "2013-05-29"],
+ [433, "simon.brandhof@gmail.com", "2014-02-24"],
+ [434, "simon.brandhof@gmail.com", "2013-05-29"],
+ [437, "simon.brandhof@gmail.com", "2013-04-17"],
+ [440, "julien.henry@sonarsource.com", "2014-05-01"],
+ [442, "simon.brandhof@gmail.com", "2013-04-17"],
+ [452, "julien.henry@sonarsource.com", "2014-05-01"],
+ [453, "simon.brandhof@gmail.com", "2013-04-17"],
+ [454, "julien.henry@sonarsource.com", "2014-05-01"],
+ [455, "simon.brandhof@gmail.com", "2013-04-17"],
+ [456, "julien.henry@sonarsource.com", "2014-05-01"],
+ [457, "simon.brandhof@gmail.com", "2013-04-17"],
+ [462, "julien.henry@sonarsource.com", "2014-05-01"],
+ [463, "simon.brandhof@gmail.com", "2013-04-17"],
+ [468, "julien.henry@sonarsource.com", "2014-05-01"],
+ [469, "simon.brandhof@gmail.com", "2013-04-17"],
+ [470, "julien.henry@sonarsource.com", "2014-05-01"],
+ [475, "simon.brandhof@gmail.com", "2013-04-17"],
+ [476, "julien.henry@sonarsource.com", "2014-05-01"],
+ [478, "simon.brandhof@gmail.com", "2013-04-17"],
+ [479, "simon.brandhof@gmail.com", "2014-02-20"],
+ [483, "julien.henry@sonarsource.com", "2014-05-01"],
+ [486, "simon.brandhof@gmail.com", "2013-04-17"],
+ [490, "simon.brandhof@gmail.com", "2014-02-24"],
+ [491, "simon.brandhof@gmail.com", "2013-04-17"],
+ [494, "simon.brandhof@gmail.com", "2014-02-20"],
+ [497, "simon.brandhof@gmail.com", "2013-04-17"],
+ [498, "simon.brandhof@gmail.com", "2014-02-20"],
+ [499, "simon.brandhof@gmail.com", "2013-04-17"],
+ [503, "simon.brandhof@gmail.com", "2014-02-20"],
+ [504, "simon.brandhof@gmail.com", "2013-04-17"],
+ [508, "simon.brandhof@gmail.com", "2014-02-20"],
+ [509, "simon.brandhof@gmail.com", "2013-04-17"],
+ [517, "julien.henry@sonarsource.com", "2014-05-06"],
+ [518, "simon.brandhof@gmail.com", "2013-04-16"]
+]}
diff --git a/server/sonar-web/src/main/less/coding-rules.less b/server/sonar-web/src/main/less/coding-rules.less
index 34f299fad55..bacf9217e72 100644
--- a/server/sonar-web/src/main/less/coding-rules.less
+++ b/server/sonar-web/src/main/less/coding-rules.less
@@ -161,6 +161,16 @@
.select2-search-field { line-height: 1; }
}
+.coding-rules-subcharacteristic {
+ cursor: pointer;
+}
+
+.coding-rules-debt-popup {
+ h3 {
+ display: inline
+ }
+}
+
.coding-rules-detail-tag + .coding-rules-detail-tag {
margin-left: @navigatorPadding;
}
@@ -201,6 +211,7 @@
display: block;
margin-left: 2 * @navigatorPadding;
font-weight: bold;
+ cursor: pointer;
}
.coding-rules-detail-parameter-description {
@@ -213,6 +224,7 @@
.box-sizing(border-box);
.subtitle {
+ margin-top: @navigatorPadding;
font-size: @baseFontSize;
}
}
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
index 67db448759c..5cf89173487 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
@@ -121,8 +121,6 @@
<a href="<%= ApplicationController.root_context -%>/settings/index"><%= message('settings.page') -%></a></li>
<li class="<%= 'active' if controller.controller_path=='metrics' -%>">
<a href="<%= ApplicationController.root_context -%>/metrics/index"><%= message('manual_metrics.page') -%></a></li>
- <li class="<%= 'active' if controller.controller_path=='manual_rules' -%>">
- <a href="<%= ApplicationController.root_context -%>/manual_rules/index"><%= message('manual_rules.page') -%></a></li>
<li class="<%= 'active' if controller.controller_path=='admin_dashboards' -%>">
<a href="<%= ApplicationController.root_context -%>/admin_dashboards/index"><%= message('default_dashboards.page') -%></a></li>
<% controller.java_facade.getPages(Navigation::SECTION_CONFIGURATION.key, nil, nil, nil, nil).each do |page|
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-2.3.15/install.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-2.3.15/install.rb
deleted file mode 100644
index c87398b1f42..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-2.3.15/install.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'rbconfig'
-require 'find'
-require 'ftools'
-
-include Config
-
-# this was adapted from rdoc's install.rb by ways of Log4r
-
-$sitedir = CONFIG["sitelibdir"]
-unless $sitedir
- version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
- $libdir = File.join(CONFIG["libdir"], "ruby", version)
- $sitedir = $:.find {|x| x =~ /site_ruby/ }
- if !$sitedir
- $sitedir = File.join($libdir, "site_ruby")
- elsif $sitedir !~ Regexp.quote(version)
- $sitedir = File.join($sitedir, version)
- end
-end
-
-# the actual gruntwork
-Dir.chdir("lib")
-
-Find.find("active_record", "active_record.rb") { |f|
- if f[-3..-1] == ".rb"
- File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
- else
- File::makedirs(File.join($sitedir, *f.split(/\//)))
- end
-}
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/.gemtest b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/.gemtest
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/.gemtest
+++ /dev/null
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/History.txt b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/History.txt
deleted file mode 100644
index f1a92304969..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/History.txt
+++ /dev/null
@@ -1,452 +0,0 @@
-== 1.1.3
-
-- Remove AR version < 3 guard around some caching methods (sugg. invadersmustdie)
-- Small bug in arjdbc/discover logic, thanks autotelik.
-- Added bigint serial support + some testcases for native type mapping (postgres only)
-- mssql: use subscript instead of #first. (Kim Toms)
-- #71: fix yield called out of block error
-- Silence Rake::DSL warnings for Rake > 0.9
-
-== 1.1.2
-
-- Update version of H2 driver from 1.1.107 to 1.3.153 (Ketan
- Padegaonkar, Jeremy Stephens)
-- Fix errors in db:test:clone_structure with PostgreSQL (Andrea Campi)
-- Fixing limit for sqlServer2000 if primary key is not named 'id'
- (Luca Simone)
-- DB2: define jdbc_columns (fixes table_exists? bug) (Nick Kreucher)
-- ACTIVERECORD_JDBC-152 - omitting limit when dumping bytea fields
- (Gregor Schmidt)
-- Postgres doesn't support a limit for bytea columns (Alex Tambellini)
-- JRUBY-5642: Default to schema public if no schema given for postgres
- (Anthony Juckel)
-- Sqlite3 supports float data type so use float (Alex Tambellini)
-- GH #21: Now using sqlite3 driver from
- http://www.xerial.org/trac/Xerial/wiki/SQLiteJDBC (thanks Ukabu)
-- GH #65: PG: Respect integer sizes (Alex Tambellini)
-- GH #59: PG: Properly escape bytea-escaped string
-- GH #53: oracle: allow configuration of schema through schema: key
-- GH #50: PG: support multiple schema in search_path (Daniel
- Schreiber)
-- GH #25: Reload ArJdbc.column_types if number of constants changed
-- GH #47: Allow table statistics for indexes to be approximate; speeds
- up Oracle
-- GH #67: Change primary_keys to use the same catalog/schema/table
- separation logic as columns_internal (Marcus Brito). This change
- allows set_table_name to specify a custom schema.
-- GH #49: mssql: quote table names like column names
-- GH #56: mssql: Fix 'select 1' behavior introduced by AR 3.0.7
-- GH #55: Make decimal columns with no precision or scale stay
- decimals
-- GH #45: Add Arel limit support for Firebird (Systho))
-- GH #39: PG: allow negative integer default values
-- GH #19: Make a stub Mysql::Error class
-- ACTIVERECORD_JDBC-148: mssql: Ensure regex doesn't match 'from' in a
- field name
-- GH#31: mssql: Remove extra code breaking mssql w/o limit
-- ACTIVERECORD_JDBC-156: mssql: Logic fix for detecting select_count?
-
-== 1.1.1
-
-- Arel 2.0.7 compatibility: fix bugs arising from use of Arel 2.0.7 +
- ArJdbc 1.1.0.
- - Gracefully handle changes to limit in Arel's AST
- - Avoid conflict with Arel 2.0.7's mssql visitor
-- Upgrade to PostgreSQL 9.0.801 JDBC drivers (David Kellum)
-
-== 1.1.0 (12/09/10)
-
-- Don't narrow platform to '-java' only: revert back to 0.9.2 where
- ar-jdbc can be installed under any Ruby (for easier Bundler/Warbler
- usage and less confusion on rubygems.org).
-- Upgrade MySQL execute code to use RETURN_GENERATED_KEYS.
-- Upgrade to MySQL driver version 5.1.13
-- Add multi-statement support, idea from oruen. For databases that
- support it, you can now do:
- results = Model.connection.execute("select 1; select 2")
- and receive back an array of multiple result set arrays. For use with
- MySQL, you need to add
- options:
- allowMultiQueries: true
- in database.yml.
-- ACTIVERECORD_JDBC-144: Fix limits appearing in schema dump for some
- datatypes (Uwe Kubosch)
-- Fixes for DB2 limit/offset
-- Fix rake db:create for 'jdbc' adapter (Joeri Samson)
-- add create/drop database methods to h2 adapter (sahglie)
-- Use connection getDatabaseProductName instead of getClass.getName
- when detecting JNDI dialects (Denis Odorcic)
-- ACTIVERECORD_JDBC-146: Fix create_table to not append encoding (Marc Slemko)
-- All green on SQLite3 Rails master ActiveRecord tests
-- ACTIVERECORD_JDBC-140: Sync postgres add/change column code from Rails master
-- ACTIVERECORD_JDBC-139: TEXT/DATE on PostgreSQL should not have limits
-
-== 1.0.3 (11/29/10)
-
-- ACTIVERECORD_JDBC-143: Implement table_exists? fixing association
- table names with schema prefixes
-- Cleanup of column code for hsqldb (Denis Odorcic)
-- Rails 3.0.3 support - add Arel 2 visitors for all adapters
-- Fix MySQL date types to not have limits (Chris Lowder)
-- ACTIVERECORD_JDBC-141: Better schema support in H2
-
-== 1.0.2
-
-- ACTIVERECORD_JDBC-134: Fix conflicting adapter/column superclasses
-- ACTIVERECORD_JDBC-135: Fix regression on PG with boolean and :limit
-- Slew of Derby fixes courtesy of Denis Odorcic
-
-== 1.0.1
-
-- Fix db:test:purge issue affecting all adapters in 1.0.0 due to
- incorrect fix to JRUBY-5081 in 8b4b9c5
-
-== 1.0.0
-
-- Thanks to David Kellum, Dmitry Denisov, Dwayne Litzenberger, Gregor
- Schmidt, James Walker, John Duff, Joshua Suggs, Nicholas J Kreucher,
- Peter Donald, Geoff Longman, Uwe Kubosch, Youhei Kondou, Michael
- Pitman, Alex B, and Ryan Bell for their contributions to this
- release.
-- BIG set of DB2 updates (Thanks Nick Kreucher)
-- Deprecate jdbc_adapter/rake_tasks
-- (1.0.0.beta1)
-- Make database-specific extensions only load when necessary
-- Allow for discovery of database extensions outside of ar-jdbc
- proper. This should allow for custom database development to be
- developed and released without relying on AR-JDBC core.
-- Get AR's own tests running as close to 100% as possible. MySQL is
- currently 100%, SQLite3 is close.
-- JRUBY-4876: Bump up Derby's max index name length (Uwe Kubosch)
-- (1.0.0.beta2)
-- 98 commits since beta1
-- MSSQL updates from dlitz and realityforge
-- ACTIVERECORD_JDBC-131: Fix string slug issue for DB2 (Youhei Kondou)
-- JRUBY-1642: Don't use H2 INFORMATION_SCHEMA in table or column
- searches
-- JRUBY-4972: Attempt to deal with type(0)/:limit => 0 by not setting
- it808e213
-- JRUBY-5040: Fix issue with limits on timestamps in MySQL
-- JRUBY-3555: Allow setting Derby schema with 'schema:' option
-- ACTIVERECORD_JDBC-98: Make sure we actuall raise an error when
- inappropriately configured
-- ACTIVERECORD_JDBC-112: Add schema dumper tests for already-fixed
- MySQL type limits
-- ACTIVERECORD_JDBC-113: Fix PG float precision issue
-- ACTIVERECORD_JDBC-103: Fix decimal options for PG add/change column
- (Michael Pitman)
-- ACTIVERECORD_JDBC-127: Fix quoting of Date vs. Time(stamp) for
- Oracle (Lenny Marks)
-- Oracle: Sort out the NUMBER vs NUMBER(x) vs NUMBER(x,y) situation.
-- JRUBY-3051: Think we finally got the PG mixed-case patches applied.
-- JRUBY-5081: Consolidate code for dropping DB via postgres
-- ACTIVERECORD_JDBC-101: Add override of LONGVARCHAR => CLOB for
- informix
-- ACTIVERECORD_JDBC-107: Fix MySQL update_all issue on AR 2.3
-- ACTIVERECORD_JDBC-124: Filter out special _row_num column
-- ACTIVERECORD_JDBC-126: Fix sql 2000 limit/offset per Michael Pitman
-- ACTIVERECORD_JDBC-125: Add tweak to limit/offset code for HABTM
- queries (alex b)
-- ACTIVERECORD_JDBC-129: Don't have limits for text, binary or bit
- fields
-- (1.0.0 final)
-- Fix a few more SQLite3 AR tests
-- SQLite3: handle ":memory:" database
-- Release new SQLite3 driver 3.6.14.2 and new Derby driver 10.6.2.1
-
-== 0.9.7
-
-- JRUBY-4781: Fix multiple database connection collision issue w/
- Oracle
-- ACTIVERECORD_JDBC-115: Support SAVEPOINTS for MySQL and PG so that
- nested transactions can be faked
-- ACTIVERECORD_JDBC-116: Handle schema.table better for MySQL (thanks
- Dilshod Mukhtarov)
-- Fix 'Wrong # of arguments (2 for 1)' issue with #create_database for
- MySQL and AR 3.0
-- SQLServer 2000 support (thanks Jay McGaffigan)
-
-== 0.9.6
-
-- The Oracle release!
-- Oracle should be working much better with this release. Also updated
- to work with Rails 3.
-- Get all unit tests running cleanly on Oracle, fixing previous
- datetime/timezone issues.
-- ACTIVERECORD_JDBC-83: Add :sequence_start_value option to
- create_table, following oracle_enhanced adapter
-- ACTIVERECORD_JDBC-33: Don't double-quote table names in oracle
-- ACTIVERECORD_JDBC-17: Fix Oracle primary keys so that /^NUMBER$/ => :integer
-- Fix remaining blockers ACTIVERECORD_JDBC-82, JRUBY-3675,
- ACTIVERECORD_JDBC-22, ACTIVERECORD_JDBC-27, JRUBY-4759
-
-== 0.9.5
-
-- The MSSQL release, courtesy of Mike Williams and Lonely
- Planet.
-- JRuby + AR-JDBC is now seen as the hassle-free way of using Rails
- with SQLServer!
-- Many fixes for MSSQL, including ACTIVERECORD_JDBC-18,
- ACTIVERECORD_JDBC-41, ACTIVERECORD_JDBC-56, ACTIVERECORD_JDBC-94,
- ACTIVERECORD_JDBC-99, JRUBY-3805, JRUBY-3793, JRUBY-4221
-- All tests pass on Rails 3.0.0.beta3!
-
-== 0.9.4
-
-- ACTIVERECORD_JDBC-96: DB2 JdbcSpec cannot dump schema correctly
- (Youhei Kondou)
-- ACTIVERECORD_JDBC-97: Dont use Rails 3 deprecated constants (David
- Calavera)
-- Updates for rake db:schema:dump compatibility with Rails 2.3+ and
- MySQL (Joakim Kolsjö)
-- Rails 3.0.0.beta2 compatibility
-- Return of Derby, H2, Hsqldb support (requires AR >= 3.0.0.beta2)
-
-== 0.9.3
-
-- Rails 3 compatibility
-- PLEASE NOTE: ActiveRecord in Rails 3 has changed in a way that
- doesn't allow non-standard DBs (such as the Derby and H2 embedded
- DBs) to work. We're investigating the effort required to support
- these databases and hope to have something for a future release.
-- ACTIVERECORD_JDBC-91: Fix schema search path for PostgreSQL (Alex
- Kuebo)
-- ACTIVERECORD_JDBC-87: DB2 ID insert fix (Youhei Kondou)
-- ACTIVERECORD_JDBC-90: MSSQL fix for DATEs (jlangenauer)
-- ACTIVERECORD_JDBC-93: Fix string IDs for sqlite3, hsql/h2 (moser)
-- ACTIVERECORD_JDBC-86: Fix Derby queries starting with VALUES (Dwayne Litzenberger)
-- ACTIVERECORD_JDBC-95: Fix INSERT ... RETURNING for PostgreSQL
-
-== 0.9.2
-
-- The main, highly awaited fix for this release is a solution to the
- rake db:create/db:drop issue. The main change is a new 'jdbc' rails
- generator that should be run once to prepare a Rails application to
- use JDBC. The upside of this generator is that you no longer will
- need to alter database.yml for JDBC. See the README.txt for details.
-- Cleanup and reconnect if errors occur during begin/rollback
- (Jean-Dominique Morani, Christian Seiler)
-- ACTIVERECORD_JDBC-1: Add #drop_database method for oracle (does the
- same thing as recreate_database)
-- Sqlite3 and MSSQL fixes (Jean-Dominique Morani)
-- JRUBY-3512: Treat LONGVARCHAR as a CLOB for Mssql
-- JRUBY-3624: Upgrade Derby to 10.5.3.0 and add native limit/offset
- support (Christopher Saunders)
-- JRUBY-3616: Fix postgres non-sequence primary keys (David Kellum)
-- JRUBY-3669: Fix Oracle case with unconfigured schema (Dan Powell)
-- Fixed quote_column_name of jdbc_oracle to accept numbers (Marcelo
- Murad)
-- Fix for mysql tables with non standard primary keys such that the
- schema dump is correct (Nick Zalabak)
-- MSSQL fixes from Mike Luu:
- - add support for MSSQL uniqueidentifier datatype
- - always quote strings using unicode identifier for MSSQL
-- Changes primary_key generation to use always instead of by default
- for DB2 (Amos King)
-- Improves the SQLite adapter by fixing rename_column, change_column,
- change_column_default, changing remove_column, and adding
- remove_columns (Ryan Baumann)
-- More oracle love courtesy Ben Browning and Jens Himmelreich
-- JRUBY-3608: Add missing change_column_null method for postgres
-- JRUBY-3508: Fix quoting of integer and float columns
-
-== 0.9.1
-
-- We did a lot of internal cleanup this release in the hopes of
- simplifying the code and increasing performance.
-- Many SQLite updates (thanks Nils Christian Haugen)
-- JRUBY-2912: Fix MSSQL create/drop database (Joern Hartmann)
-- JRUBY-2767: Mistake in selecting identity with H2/HSQLDB
-- JRUBY-2884: jdbc_postgre.rb issue handling nil booleans (also a fix
- for hsqldb/h2) + tests
-- JRUBY-2995: activerecord jdbc derby adapter should quote columns
- called 'year'
-- JRUBY-2897: jdbc_postgre.rb needs microsecond support
-- JRUBY-3282: Upgrade to derby 10.4.2.0 to allow unique constraints
- with nullable columns
-- Update h2 from 1.0.63 to 1.1.107 in driver
-- JRUBY-3026: [Derby] Allow select/delete/update conditions with
- comparison to NULL using '='
-- JRUBY-2996: ...(actually this fixes only remaining issue of this bug
- which was symbols making into quote were exploding
-- JRUBY-2691: Update sybase driver to pass simple unit tests with jtds
- and verify it works with the new dialect keyword. patch by Leigh
- Kennedy
-- Make :float type work on h2,hsql [returned as string]. Make :float
- work on hsqldb (no paren value supported). Make REAL_TYPE just
- return RubyFloat
-- JRUBY-3222: Upgrade #type_to_sql to variation of AR 2.1.2 version
-- Add patch supplied in JRUBY-3489 (patch by Jean-Dominique Morani)
-- Various Oracle fixes by edsono
-- JRUBY-2688: Don't hard-code MySQL connection character encoding to
- utf8
-
-== 0.9
-
-- Now updated to support ActiveRecord 2.2. JNDI-based connections will
- automatically connect/disconnect for every AR connection pool
- checkout/checkin. For best results, set your pool: parameter >= the
- actual maximum size of the JNDI connection pool. (We'll look at how
- to eliminate the need to configure AR's pool in the future.)
-- NEW! Informix support courtesy of Javier Fernandez-Ivern.
-- Backport another Oracle CLOB issue, thanks Edson César.
-- Rubyforge #22018: chomp final trailing semicolon for oracle
-- JRUBY-2848: Fix NPE error in set_native_database_types
-- Rework oracle lob saving callback to be Rails 2.1 friendly (assist
- from court3nay)
-- JRUBY-2715: Add create/drop database methods to Postgres (Peter Williams)
-- JRUBY-3183: Fix structure dump for Postgres (Ryan Bell)
-- JRUBY-3184: recreate_database for test database working for PG (Ryan Bell)
-- JRUBY-3186: disable referential integrity for PG (Ryan Bell)
-- Authoritative repository now hosted at
- git://github.com/nicksieger/activerecord-jdbc-adapter.git; rubyforge
- svn trunk cleaned out.
-
-== 0.8.2
-
-- Added an optional config key called :dialect. Using :dialect allows you to
- override the default SQL dialect for the driver class being used. There are
- a few cases for this:
- - Using using Sybase w/ the jTDS driver.
- - Using rebranded drivers.
- - It makes more sense to use :dialect, rather then :driver when using JNDI.
-- JRUBY-2619: Typo with :test config causing problems with dev database (Igor Minar)
-- 20524, JRUBY-2612: Since when did I think that there was a #true? method on Object?
-
-== 0.8.1
-
-- Now sporting a JDBC sqlite3 adapter! Thanks Joseph Athman.
-- Added support for InterSystems Cache database (Ryan Bell)
-- Fix for JRUBY-2256
-- JRUBY-1638, JRUBY-2404, JRUBY-2463: schema.table handling and Oracle NUMBER fixes (Darcy Schultz & Jesse Hu)
-- Add structure dump and other DDL-ish for DB2 (courtesy abedra and stuarthalloway)
-- Fix missing quote_table_name function under Rails 1.2.6 and earlier
-- Small tweaks to jdbc.rake to select proper config
-- JRUBY-2011: Fix MSSQL string un-quoting issue (Silvio Fonseca)
-- JRUBY-1977, 17427: Fix information_schema select issue with MSSQL (Matt Burke)
-- 20479: Improve get_table_name for MSSQL (Aslak Hellesøy)
-- 20243: numerics improvements for MSSQL (Aslak Hellesøy)
-- 20172: don't quote table names for MSSQL (Thor Marius Henrichsen)
-- 19729: check for primary key existence in postgres during insert (Martin Luder)
-- JRUBY-2297, 18846: retrying failing SQL statements is harmful when not autocommitting (Craig McMillan)
-- 10021: very preliminary sybase support. (Mark Atkinson) Not usable until collision w/ sqlserver driver is resolved.
-- JRUBY-2312, JRUBY-2319, JRUBY-2322: Oracle timestamping issues (Jesse Hu & Michael König)
-- JRUBY-2422: Fix MySQL referential integrity and rollback issues
-- JRUBY-2382: mysql string quoting fails with ArrayIndexOutofBoundsException
-
-== 0.8
-
-- NOTE: This release is only compatible with JRuby 1.1RC3 or later.
-- Because of recent API changes in trunk in preparation for JRuby 1.1, this release is not
- backward compatible with previous JRuby releases. Hence the version bump.
-- Internal: convert Java methods to be defined with annotations
-- Fix problem with reserved words coming back pre-quoted from #indexes in postgres
-- JRUBY-2205: Fix N^2 allocation of bytelists for mysql quoting (taw)
-- Attempt a fix for Rubyforge 18059
-- Upgrade derby to 10.3.2.1
-- Fix db:create etc. in the case where JDBC is loaded in Rails' preinitializer.rb
-- Fix db:drop to actually work
-- Fix for Rubyforge #11567 (Matt Williams)
-
-== 0.7.2
-
-- JRUBY-1905: add_column for derby, hsqldb, and postgresql (Stephen Bannasch)
-- Fix db:create for JDBC
-- Support Rails 2 with the old "require 'jdbc_adapter'" approach
-- JRUBY-1966: Instead of searching for just tables, search for views and tables.
-- JRUBY-1583: DB2 numeric quoting (Ryan Shillington)
-- JRUBY-1634: Oracle DATE type mapping (Daniel Wintschel)
-- JRUBY-1543: rename_column issue with more recent MySQL drivers (Oliver Schmelzle)
-- Rubyforge #15074: ConnectionAdapters::JdbcAdapter.indexes is missing name and
- schema_name parameters in the method signature (Igor Minar)
-- Rubyforge #13558: definition for the indexes method (T Meyarivan)
-- JRUBY-2051: handle schemaname and tablename more correctly for columns
-- JRUBY-2102: Postgres Adapter cannot handle datetime type (Rainer Hahnekamp)
-- JRUBY-2018: Oracle behind ActiveRecord-JDBC fails with "Invalid column index" (K Venkatasubramaniyan)
-- JRUBY-2012: jdbc_mysql structure dump fails for mysql views (Tyler Jennings)
-
-== 0.7.1
-
-- Add adapter and driver for H2 courtesy of Caleb Land
-- Fix "undefined method `last' for {}:Hash" error introduced with new Rake 0.8.1 (JRUBY-1859)
-
-== 0.7
-
-- PLEASE NOTE: This release is not compatible with JRuby releases earlier than
- 1.0.3 or 1.1b2. If you must use JRuby 1.0.2 or earlier, please install the
- 0.6 release.
-- Release coincides with JRuby 1.0.3 and JRuby 1.1b2 releases
-- Simultaneous support for JRuby trunk and 1.0 branch
-- Get rid of log_no_bench method, so we time SQL execution again.
-- Implement #select_rows
-- MySQL migration and quoting updates
-
-== 0.6
-
-- Gem is renamed to "activerecord-jdbc-adapter" to follow new conventions
- introduced in Rails 2.0 for third-party adapters. Rails 2.0 compatibility is
- introduced.
-- Add dependency on ActiveRecord >= 1.14 (from the Rails 1.1.x release)
-- New drivers (jdbc-XXX) and adapter (activerecord-jdbcXXX-adapter) gems
- available separately. See the README.txt file for details.
-- Plain "jdbc" driver is still available if you want to use the full
- driver/url way of specifying the driver.
-- More bugfixes to Oracle and SQLServer courtesy of Ola & ThoughtWorks
-
-== 0.5
-
-- Release coincides with JRuby 1.0.1 release
-- It is no longer necessary to specify :driver and :url configuration
- parameters for the mysql, postgresql, oracle, derby, hsqldb, and h2
- adapters. The previous configuration is still valid and compatible, but for
- new applications, this makes it possible to use the exact same database.yml
- configuration as Rails applications running under native Ruby.
-- JDBC drivers can now be dynamically loaded by Ruby code, without being on
- the classpath prior to launching JRuby. Simply use "require
- 'jdbc-driver.jar'" in JRuby code to add it to the runtime classpath.
-- Updates to HSQL, MS SQLServer, Postgres, Oracle and Derby adapters
-
-== 0.4
-
-- Release coincides with JRuby 1.0 release
-- Shoring up PostgreSQL (courtesy Dudley Flanders) and HSQL (courtesy Matthew
- Williams)
-- Fix timestamps on Oracle to use DATE (as everything else)
-- Derby fixes: Fix for open result set issue, better structure dump, quoting,
- column type changing
-- Sybase type recognition fix (courtesy Dean Mao)
-
-== 0.3.1
-
-- Derby critical fixes shortly after 0.3
-
-== 0.3
-
-- Release coincides with JRuby 1.0.0RC1 release
-- Improvements for Derby, Postgres, and Oracle, all of which are running
- > 95% of AR tests
-
-== 0.2.4
-
-- Release coincides with JRuby 0.9.9 release
-- JRuby 0.9.9 is required
-- MySQL close to 100% working
-- Derby improvements
-- DECIMAL/NUMERIC/FLOAT/REAL bugs fixed with type recognition for Oracle,
- Postgres, etc.
-- HSQLDB has regressed this release and may not be functioning; we'll get it
- fixed for the next one
-
-== 0.2.3
-
-- Release coincides (and compatible) with JRuby 0.9.8 release
-- 8 bugs fixed: see http://rubyurl.com/0Da
-- Improvements and compatibility fixes for Rails 1.2.x
-
-== 0.2.1, 0.2.2
-
-- Early releases, added better support for multiple databases
-
-== 0.0.1
-
-- Initial, very alpha release
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Manifest.txt b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Manifest.txt
deleted file mode 100644
index 79054a8d699..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Manifest.txt
+++ /dev/null
@@ -1,187 +0,0 @@
-History.txt
-Manifest.txt
-README.txt
-Rakefile
-LICENSE.txt
-lib/activerecord-jdbc-adapter.rb
-lib/arjdbc.rb
-lib/jdbc_adapter.rb
-lib/pg.rb
-lib/active_record/connection_adapters/derby_adapter.rb
-lib/active_record/connection_adapters/h2_adapter.rb
-lib/active_record/connection_adapters/hsqldb_adapter.rb
-lib/active_record/connection_adapters/informix_adapter.rb
-lib/active_record/connection_adapters/jdbc_adapter.rb
-lib/active_record/connection_adapters/jndi_adapter.rb
-lib/active_record/connection_adapters/mssql_adapter.rb
-lib/active_record/connection_adapters/mysql2_adapter.rb
-lib/active_record/connection_adapters/mysql_adapter.rb
-lib/active_record/connection_adapters/oracle_adapter.rb
-lib/active_record/connection_adapters/postgresql_adapter.rb
-lib/active_record/connection_adapters/sqlite3_adapter.rb
-lib/arel/engines/sql/compilers/db2_compiler.rb
-lib/arel/engines/sql/compilers/derby_compiler.rb
-lib/arel/engines/sql/compilers/h2_compiler.rb
-lib/arel/engines/sql/compilers/hsqldb_compiler.rb
-lib/arel/engines/sql/compilers/jdbc_compiler.rb
-lib/arel/engines/sql/compilers/mssql_compiler.rb
-lib/arel/visitors/compat.rb
-lib/arel/visitors/db2.rb
-lib/arel/visitors/derby.rb
-lib/arel/visitors/firebird.rb
-lib/arel/visitors/hsqldb.rb
-lib/arel/visitors/sql_server.rb
-lib/arjdbc/db2.rb
-lib/arjdbc/derby.rb
-lib/arjdbc/discover.rb
-lib/arjdbc/firebird.rb
-lib/arjdbc/h2.rb
-lib/arjdbc/hsqldb.rb
-lib/arjdbc/informix.rb
-lib/arjdbc/jdbc.rb
-lib/arjdbc/mimer.rb
-lib/arjdbc/mssql.rb
-lib/arjdbc/mysql.rb
-lib/arjdbc/oracle.rb
-lib/arjdbc/postgresql.rb
-lib/arjdbc/sqlite3.rb
-lib/arjdbc/sybase.rb
-lib/arjdbc/version.rb
-lib/arjdbc/db2/adapter.rb
-lib/arjdbc/derby/adapter.rb
-lib/arjdbc/derby/connection_methods.rb
-lib/arjdbc/firebird/adapter.rb
-lib/arjdbc/h2/adapter.rb
-lib/arjdbc/h2/connection_methods.rb
-lib/arjdbc/hsqldb/adapter.rb
-lib/arjdbc/hsqldb/connection_methods.rb
-lib/arjdbc/informix/adapter.rb
-lib/arjdbc/informix/connection_methods.rb
-lib/arjdbc/jdbc/adapter.rb
-lib/arjdbc/jdbc/callbacks.rb
-lib/arjdbc/jdbc/column.rb
-lib/arjdbc/jdbc/compatibility.rb
-lib/arjdbc/jdbc/connection.rb
-lib/arjdbc/jdbc/connection_methods.rb
-lib/arjdbc/jdbc/core_ext.rb
-lib/arjdbc/jdbc/discover.rb
-lib/arjdbc/jdbc/driver.rb
-lib/arjdbc/jdbc/extension.rb
-lib/arjdbc/jdbc/java.rb
-lib/arjdbc/jdbc/missing_functionality_helper.rb
-lib/arjdbc/jdbc/quoted_primary_key.rb
-lib/arjdbc/jdbc/railtie.rb
-lib/arjdbc/jdbc/rake_tasks.rb
-lib/arjdbc/jdbc/require_driver.rb
-lib/arjdbc/jdbc/type_converter.rb
-lib/arjdbc/mimer/adapter.rb
-lib/arjdbc/mssql/adapter.rb
-lib/arjdbc/mssql/connection_methods.rb
-lib/arjdbc/mssql/limit_helpers.rb
-lib/arjdbc/mssql/tsql_helper.rb
-lib/arjdbc/mysql/adapter.rb
-lib/arjdbc/mysql/connection_methods.rb
-lib/arjdbc/oracle/adapter.rb
-lib/arjdbc/oracle/connection_methods.rb
-lib/arjdbc/postgresql/adapter.rb
-lib/arjdbc/postgresql/connection_methods.rb
-lib/arjdbc/sqlite3/adapter.rb
-lib/arjdbc/sqlite3/connection_methods.rb
-lib/arjdbc/sybase/adapter.rb
-lib/generators/jdbc/jdbc_generator.rb
-lib/jdbc_adapter/rake_tasks.rb
-lib/jdbc_adapter/version.rb
-lib/arjdbc/jdbc/adapter_java.jar
-test/abstract_db_create.rb
-test/db2_simple_test.rb
-test/derby_migration_test.rb
-test/derby_multibyte_test.rb
-test/derby_simple_test.rb
-test/generic_jdbc_connection_test.rb
-test/h2_simple_test.rb
-test/has_many_through.rb
-test/helper.rb
-test/hsqldb_simple_test.rb
-test/informix_simple_test.rb
-test/jdbc_common.rb
-test/jndi_callbacks_test.rb
-test/jndi_test.rb
-test/manualTestDatabase.rb
-test/mssql_db_create_test.rb
-test/mssql_identity_insert_test.rb
-test/mssql_legacy_types_test.rb
-test/mssql_limit_offset_test.rb
-test/mssql_multibyte_test.rb
-test/mssql_simple_test.rb
-test/mysql_db_create_test.rb
-test/mysql_info_test.rb
-test/mysql_multibyte_test.rb
-test/mysql_nonstandard_primary_key_test.rb
-test/mysql_simple_test.rb
-test/oracle_simple_test.rb
-test/oracle_specific_test.rb
-test/pick_rails_version.rb
-test/postgres_db_create_test.rb
-test/postgres_drop_db_test.rb
-test/postgres_information_schema_leak_test.rb
-test/postgres_mixed_case_test.rb
-test/postgres_native_type_mapping_test.rb
-test/postgres_nonseq_pkey_test.rb
-test/postgres_reserved_test.rb
-test/postgres_schema_search_path_test.rb
-test/postgres_simple_test.rb
-test/postgres_table_alias_length_test.rb
-test/simple.rb
-test/sqlite3_simple_test.rb
-test/sybase_jtds_simple_test.rb
-test/activerecord/connection_adapters/type_conversion_test.rb
-test/activerecord/connections/native_jdbc_mysql/connection.rb
-test/db/db2.rb
-test/db/derby.rb
-test/db/h2.rb
-test/db/hsqldb.rb
-test/db/informix.rb
-test/db/jdbc.rb
-test/db/jndi_config.rb
-test/db/logger.rb
-test/db/mssql.rb
-test/db/mysql.rb
-test/db/oracle.rb
-test/db/postgres.rb
-test/db/sqlite3.rb
-test/models/add_not_null_column_to_table.rb
-test/models/auto_id.rb
-test/models/data_types.rb
-test/models/entry.rb
-test/models/mixed_case.rb
-test/models/reserved_word.rb
-test/models/string_id.rb
-test/models/validates_uniqueness_of_string.rb
-lib/arjdbc/jdbc/jdbc.rake
-src/java/arjdbc/db2/DB2RubyJdbcConnection.java
-src/java/arjdbc/derby/DerbyModule.java
-src/java/arjdbc/h2/H2RubyJdbcConnection.java
-src/java/arjdbc/informix/InformixRubyJdbcConnection.java
-src/java/arjdbc/jdbc/AdapterJavaService.java
-src/java/arjdbc/jdbc/JdbcConnectionFactory.java
-src/java/arjdbc/jdbc/RubyJdbcConnection.java
-src/java/arjdbc/jdbc/SQLBlock.java
-src/java/arjdbc/mssql/MssqlRubyJdbcConnection.java
-src/java/arjdbc/mysql/MySQLModule.java
-src/java/arjdbc/mysql/MySQLRubyJdbcConnection.java
-src/java/arjdbc/oracle/OracleRubyJdbcConnection.java
-src/java/arjdbc/postgresql/PostgresqlRubyJdbcConnection.java
-src/java/arjdbc/sqlite3/Sqlite3RubyJdbcConnection.java
-rakelib/compile.rake
-rakelib/db.rake
-rakelib/package.rake
-rakelib/rails.rake
-rakelib/test.rake
-rails_generators/jdbc_generator.rb
-rails_generators/templates
-rails_generators/templates/config
-rails_generators/templates/lib
-rails_generators/templates/config/initializers
-rails_generators/templates/config/initializers/jdbc.rb
-rails_generators/templates/lib/tasks
-rails_generators/templates/lib/tasks/jdbc.rake
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Rakefile b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Rakefile
deleted file mode 100644
index 3181c30ab76..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/activerecord-jdbc-adapter-1.1.3/Rakefile
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'rake/testtask'
-require 'rake/clean'
-CLEAN.include 'derby*', 'test.db.*','test/reports', 'test.sqlite3','lib/**/*.jar','manifest.mf', '*.log'
-
-task :default => [:java_compile, :test]
-
-task :filelist do
- puts FileList['pkg/**/*'].inspect
-end
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Changelog b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Changelog
deleted file mode 100755
index dc30bdd1954..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Changelog
+++ /dev/null
@@ -1,50 +0,0 @@
-= color-tools Change Log
-
-== color-utils 1.3.0
-* Added new metallic colours suggested by Jim Freeze <jfn@freeze.org>. These
- are in the namespace Color::Metallic.
-* Colours that were defined in the Color namespace (e.g., Color::Red,
- Color::AliceBlue) are now defined in Color::RGB (e.g., Color::RGB::Red,
- Color::RGB::AliceBlue). They are added back to the Color namespace on the
- first use of the old colours and a warning is printed. In version 1.4, this
- warning will be printed on every use of the old colours. In version 1.5,
- the backwards compatible support for colours like Color::Red will be
- removed completely.
-* Added the Color::CSS module, color/css or Color::CSS that provides a name
- lookup of Color::RGB-namespaced constants with Color::CSS[name]. Most of
- these colours (which are mirrored from the Color::RGB default colours) are
- only "officially" recognised under the CSS3 colour module or SVG.
-* Added the Color::HSL colour space and some helper utilities to Color::RGB
- for colour manipulation using the HSL value.
-* Controlled internal value replacement to be between 0 and 1 for all
- colours.
-* Updated Color::Palette::Gimp to more meaningfully deal with duplicate named
- colours. Named colours now return an array of colours.
-* Indicated the plans for some methods and constants out to color-tools 2.0.
-* Added unit tests and fixed a number of hidden bugs because of them.
-
-== color-utils 1.2.0
-* Changed installer from a custom-written install.rb to setup.rb
- 3.3.1-modified.
-* Added Color::GreyScale (or Color::GrayScale).
-* Added Color::YIQ. This colour definition is incomplete; it does not have
- conversions from YIQ to other colour spaces.
-
-== color-utils 1.1.0
-* Added color/palette/gimp to support the reading and use of GIMP color
- palettes.
-
-== color-utils 1.0.0
-* Initial release.
-
-#--
-# Colour management with Ruby.
-#
-# Copyright 2005 Austin Ziegler
-# http://rubyforge.org/ruby-pdf/
-#
-# Licensed under a MIT-style licence.
-#
-# $Id: Changelog,v 1.8 2005/08/08 02:44:17 austin Exp $
-#++
-# vim: sts=2 sw=2 ts=4 et ai tw=77
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Install b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Install
deleted file mode 100755
index 8cf063e208f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/Install
+++ /dev/null
@@ -1,18 +0,0 @@
-Installing this package is as simple as:
-
-% ruby setup.rb
-
-Alternatively, you can use the RubyGem version of color-tools available as
-color-tools-1.3.0.gem from the usual sources.
-
-#--
-# Colour management with Ruby.
-#
-# Copyright 2005 Austin Ziegler
-# http://rubyforge.org/ruby-pdf/
-#
-# Licensed under a MIT-style licence.
-#
-# $Id: Install,v 1.6 2005/08/05 23:07:20 austin Exp $
-#++
-# vim: sts=2 sw=2 ts=4 et ai tw=77
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/metaconfig b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/metaconfig
deleted file mode 100755
index b0fcdcbacf5..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/metaconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env ruby
-#--
-# Colour management with Ruby.
-#
-# Copyright 2005 Austin Ziegler
-# http://rubyforge.org/ruby-pdf/
-#
-# Licensed under a MIT-style licence.
-#
-# $Id: metaconfig,v 1.2 2005/08/05 23:07:20 austin Exp $
-#++
-# vim: sts=2 sw=2 ts=4 et ai tw=77
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/pre-setup.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/pre-setup.rb
deleted file mode 100755
index d6815db45be..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/pre-setup.rb
+++ /dev/null
@@ -1,55 +0,0 @@
-#--
-# Colour management with Ruby.
-#
-# Copyright 2005 Austin Ziegler
-# http://rubyforge.org/ruby-pdf/
-#
-# Licensed under a MIT-style licence.
-#
-# $Id: pre-setup.rb,v 1.5 2005/08/08 02:53:16 austin Exp $
-#++
-# vim: sts=2 sw=2 ts=4 et ai tw=77
-
-require 'rdoc/rdoc'
-
-def build_rdoc(options)
- RDoc::RDoc.new.document(options)
-rescue RDoc::RDocError => e
- $stderr.puts e.message
-rescue Exception => e
- $stderr.puts "Couldn't build RDoc documentation\n#{e.message}"
-end
-
-def build_ri(files)
- RDoc::RDoc.new.document(files)
-rescue RDoc::RDocError => e
- $stderr.puts e.message
-rescue Exception => e
- $stderr.puts "Couldn't build Ri documentation\n#{e.message}"
-end
-
-def run_tests(test_list)
- return if test_list.empty?
-
- require 'test/unit/ui/console/testrunner'
- $:.unshift "lib"
- test_list.each do |test|
- next if File.directory?(test)
- require test
- end
-
- tests = []
- ObjectSpace.each_object { |o| tests << o if o.kind_of?(Class) }
- tests.delete_if { |o| !o.ancestors.include?(Test::Unit::TestCase) }
- tests.delete_if { |o| o == Test::Unit::TestCase }
-
- tests.each { |test| Test::Unit::UI::Console::TestRunner.run(test) }
- $:.shift
-end
-
-rdoc = %w(--main README --line-numbers --title color-tools)
-ri = %w(--ri-site --merge)
-dox = %w(README Changelog lib)
-build_rdoc rdoc + dox
-build_ri ri + dox
-run_tests Dir["tests/test_*.rb"]
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/setup.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/setup.rb
deleted file mode 100755
index 0673386f9b7..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/color-tools-1.3.0/setup.rb
+++ /dev/null
@@ -1,1366 +0,0 @@
-#
-# setup.rb
-#
-# Copyright (c) 2000-2004 Minero Aoki
-#
-# This program is free software.
-# You can distribute/modify this program under the terms of
-# the GNU LGPL, Lesser General Public License version 2.1.
-#
-
-unless Enumerable.method_defined?(:map) # Ruby 1.4.6
- module Enumerable
- alias map collect
- end
-end
-
-unless File.respond_to?(:read) # Ruby 1.6
- def File.read(fname)
- open(fname) {|f|
- return f.read
- }
- end
-end
-
-def File.binread(fname)
- open(fname, 'rb') {|f|
- return f.read
- }
-end
-
-# for corrupted windows stat(2)
-def File.dir?(path)
- File.directory?((path[-1,1] == '/') ? path : path + '/')
-end
-
-
-class SetupError < StandardError; end
-
-def setup_rb_error(msg)
- raise SetupError, msg
-end
-
-#
-# Config
-#
-
-if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
- ARGV.delete(arg)
- require arg.split(/=/, 2)[1]
- $".push 'rbconfig.rb'
-else
- require 'rbconfig'
-end
-
-def multipackage_install?
- FileTest.directory?(File.dirname($0) + '/packages')
-end
-
-
-class ConfigItem
- def initialize(name, template, default, desc)
- @name = name.freeze
- @template = template
- @value = default
- @default = default.dup.freeze
- @description = desc
- end
-
- attr_reader :name
- attr_reader :description
-
- attr_accessor :default
- alias help_default default
-
- def help_opt
- "--#{@name}=#{@template}"
- end
-
- def value
- @value
- end
-
- def eval(table)
- @value.gsub(%r<\$([^/]+)>) { table[$1] }
- end
-
- def set(val)
- @value = check(val)
- end
-
- private
-
- def check(val)
- setup_rb_error "config: --#{name} requires argument" unless val
- val
- end
-end
-
-class BoolItem < ConfigItem
- def config_type
- 'bool'
- end
-
- def help_opt
- "--#{@name}"
- end
-
- private
-
- def check(val)
- return 'yes' unless val
- unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val
- setup_rb_error "config: --#{@name} accepts only yes/no for argument"
- end
- (/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
- end
-end
-
-class PathItem < ConfigItem
- def config_type
- 'path'
- end
-
- private
-
- def check(path)
- setup_rb_error "config: --#{@name} requires argument" unless path
- path[0,1] == '$' ? path : File.expand_path(path)
- end
-end
-
-class ProgramItem < ConfigItem
- def config_type
- 'program'
- end
-end
-
-class SelectItem < ConfigItem
- def initialize(name, template, default, desc)
- super
- @ok = template.split('/')
- end
-
- def config_type
- 'select'
- end
-
- private
-
- def check(val)
- unless @ok.include?(val.strip)
- setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
- end
- val.strip
- end
-end
-
-class PackageSelectionItem < ConfigItem
- def initialize(name, template, default, help_default, desc)
- super name, template, default, desc
- @help_default = help_default
- end
-
- attr_reader :help_default
-
- def config_type
- 'package'
- end
-
- private
-
- def check(val)
- unless File.dir?("packages/#{val}")
- setup_rb_error "config: no such package: #{val}"
- end
- val
- end
-end
-
-class ConfigTable_class
-
- def initialize(items)
- @items = items
- @table = {}
- items.each do |i|
- @table[i.name] = i
- end
- ALIASES.each do |ali, name|
- @table[ali] = @table[name]
- end
- @script_extensions = ['rb']
- end
-
- attr_accessor :script_extensions
-
- include Enumerable
-
- def each(&block)
- @items.each(&block)
- end
-
- def key?(name)
- @table.key?(name)
- end
-
- def lookup(name)
- @table[name] or raise ArgumentError, "no such config item: #{name}"
- end
-
- def add(item)
- @items.push item
- @table[item.name] = item
- end
-
- def remove(name)
- item = lookup(name)
- @items.delete_if {|i| i.name == name }
- @table.delete_if {|name, i| i.name == name }
- item
- end
-
- def new
- dup()
- end
-
- def savefile
- '.config'
- end
-
- def load
- begin
- t = dup()
- File.foreach(savefile()) do |line|
- k, v = *line.split(/=/, 2)
- t[k] = v.strip
- end
- t
- rescue Errno::ENOENT
- setup_rb_error $!.message + "#{File.basename($0)} config first"
- end
- end
-
- def save
- @items.each {|i| i.value }
- File.open(savefile(), 'w') {|f|
- @items.each do |i|
- f.printf "%s=%s\n", i.name, i.value if i.value
- end
- }
- end
-
- def [](key)
- lookup(key).eval(self)
- end
-
- def []=(key, val)
- lookup(key).set val
- end
-
-end
-
-c = ::Config::CONFIG
-
-rubypath = c['bindir'] + '/' + c['ruby_install_name']
-
-major = c['MAJOR'].to_i
-minor = c['MINOR'].to_i
-teeny = c['TEENY'].to_i
-version = "#{major}.#{minor}"
-
-# ruby ver. >= 1.4.4?
-newpath_p = ((major >= 2) or
- ((major == 1) and
- ((minor >= 5) or
- ((minor == 4) and (teeny >= 4)))))
-
-if c['rubylibdir']
- # V < 1.6.3
- _stdruby = c['rubylibdir']
- _siteruby = c['sitedir']
- _siterubyver = c['sitelibdir']
- _siterubyverarch = c['sitearchdir']
-elsif newpath_p
- # 1.4.4 <= V <= 1.6.3
- _stdruby = "$prefix/lib/ruby/#{version}"
- _siteruby = c['sitedir']
- _siterubyver = "$siteruby/#{version}"
- _siterubyverarch = "$siterubyver/#{c['arch']}"
-else
- # V < 1.4.4
- _stdruby = "$prefix/lib/ruby/#{version}"
- _siteruby = "$prefix/lib/ruby/#{version}/site_ruby"
- _siterubyver = _siteruby
- _siterubyverarch = "$siterubyver/#{c['arch']}"
-end
-libdir = '-* dummy libdir *-'
-stdruby = '-* dummy rubylibdir *-'
-siteruby = '-* dummy site_ruby *-'
-siterubyver = '-* dummy site_ruby version *-'
-parameterize = lambda {|path|
- path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')\
- .sub(/\A#{Regexp.quote(libdir)}/, '$libdir')\
- .sub(/\A#{Regexp.quote(stdruby)}/, '$stdruby')\
- .sub(/\A#{Regexp.quote(siteruby)}/, '$siteruby')\
- .sub(/\A#{Regexp.quote(siterubyver)}/, '$siterubyver')
-}
-libdir = parameterize.call(c['libdir'])
-stdruby = parameterize.call(_stdruby)
-siteruby = parameterize.call(_siteruby)
-siterubyver = parameterize.call(_siterubyver)
-siterubyverarch = parameterize.call(_siterubyverarch)
-
-if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
- makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
-else
- makeprog = 'make'
-end
-
-common_conf = [
- PathItem.new('prefix', 'path', c['prefix'],
- 'path prefix of target environment'),
- PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
- 'the directory for commands'),
- PathItem.new('libdir', 'path', libdir,
- 'the directory for libraries'),
- PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
- 'the directory for shared data'),
- PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
- 'the directory for man pages'),
- PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
- 'the directory for man pages'),
- PathItem.new('stdruby', 'path', stdruby,
- 'the directory for standard ruby libraries'),
- PathItem.new('siteruby', 'path', siteruby,
- 'the directory for version-independent aux ruby libraries'),
- PathItem.new('siterubyver', 'path', siterubyver,
- 'the directory for aux ruby libraries'),
- PathItem.new('siterubyverarch', 'path', siterubyverarch,
- 'the directory for aux ruby binaries'),
- PathItem.new('rbdir', 'path', '$siterubyver',
- 'the directory for ruby scripts'),
- PathItem.new('sodir', 'path', '$siterubyverarch',
- 'the directory for ruby extentions'),
- PathItem.new('rubypath', 'path', rubypath,
- 'the path to set to #! line'),
- ProgramItem.new('rubyprog', 'name', rubypath,
- 'the ruby program using for installation'),
- ProgramItem.new('makeprog', 'name', makeprog,
- 'the make program to compile ruby extentions'),
- SelectItem.new('shebang', 'all/ruby/never', 'ruby',
- 'shebang line (#!) editing mode'),
- BoolItem.new('without-ext', 'yes/no', 'no',
- 'does not compile/install ruby extentions')
-]
-class ConfigTable_class # open again
- ALIASES = {
- 'std-ruby' => 'stdruby',
- 'site-ruby-common' => 'siteruby', # For backward compatibility
- 'site-ruby' => 'siterubyver', # For backward compatibility
- 'bin-dir' => 'bindir',
- 'bin-dir' => 'bindir',
- 'rb-dir' => 'rbdir',
- 'so-dir' => 'sodir',
- 'data-dir' => 'datadir',
- 'ruby-path' => 'rubypath',
- 'ruby-prog' => 'rubyprog',
- 'ruby' => 'rubyprog',
- 'make-prog' => 'makeprog',
- 'make' => 'makeprog'
- }
-end
-multipackage_conf = [
- PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
- 'package names that you want to install'),
- PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
- 'package names that you do not want to install')
-]
-if multipackage_install?
- ConfigTable = ConfigTable_class.new(common_conf + multipackage_conf)
-else
- ConfigTable = ConfigTable_class.new(common_conf)
-end
-
-
-module MetaConfigAPI
-
- def eval_file_ifexist(fname)
- instance_eval File.read(fname), fname, 1 if File.file?(fname)
- end
-
- def config_names
- ConfigTable.map {|i| i.name }
- end
-
- def config?(name)
- ConfigTable.key?(name)
- end
-
- def bool_config?(name)
- ConfigTable.lookup(name).config_type == 'bool'
- end
-
- def path_config?(name)
- ConfigTable.lookup(name).config_type == 'path'
- end
-
- def value_config?(name)
- case ConfigTable.lookup(name).config_type
- when 'bool', 'path'
- true
- else
- false
- end
- end
-
- def add_config(item)
- ConfigTable.add item
- end
-
- def add_bool_config(name, default, desc)
- ConfigTable.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
- end
-
- def add_path_config(name, default, desc)
- ConfigTable.add PathItem.new(name, 'path', default, desc)
- end
-
- def set_config_default(name, default)
- ConfigTable.lookup(name).default = default
- end
-
- def remove_config(name)
- ConfigTable.remove(name)
- end
-
- def add_script_extension(ext)
- ConfigTable.script_extensions << ext
- end
-end
-
-
-#
-# File Operations
-#
-
-module FileOperations
-
- def mkdir_p(dirname, prefix = nil)
- dirname = prefix + File.expand_path(dirname) if prefix
- $stderr.puts "mkdir -p #{dirname}" if verbose?
- return if no_harm?
-
- # does not check '/'... it's too abnormal case
- dirs = File.expand_path(dirname).split(%r<(?=/)>)
- if /\A[a-z]:\z/i =~ dirs[0]
- disk = dirs.shift
- dirs[0] = disk + dirs[0]
- end
- dirs.each_index do |idx|
- path = dirs[0..idx].join('')
- Dir.mkdir path unless File.dir?(path)
- end
- end
-
- def rm_f(fname)
- $stderr.puts "rm -f #{fname}" if verbose?
- return if no_harm?
-
- if File.exist?(fname) or File.symlink?(fname)
- File.chmod 0777, fname
- File.unlink fname
- end
- end
-
- def rm_rf(dn)
- $stderr.puts "rm -rf #{dn}" if verbose?
- return if no_harm?
-
- Dir.chdir dn
- Dir.foreach('.') do |fn|
- next if fn == '.'
- next if fn == '..'
- if File.dir?(fn)
- verbose_off {
- rm_rf fn
- }
- else
- verbose_off {
- rm_f fn
- }
- end
- end
- Dir.chdir '..'
- Dir.rmdir dn
- end
-
- def move_file(src, dest)
- File.unlink dest if File.exist?(dest)
- begin
- File.rename src, dest
- rescue
- File.open(dest, 'wb') {|f| f.write File.binread(src) }
- File.chmod File.stat(src).mode, dest
- File.unlink src
- end
- end
-
- def install(from, dest, mode, prefix = nil)
- $stderr.puts "install #{from} #{dest}" if verbose?
- return if no_harm?
-
- realdest = prefix ? prefix + File.expand_path(dest) : dest
- realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
- str = File.binread(from)
- if diff?(str, realdest)
- verbose_off {
- rm_f realdest if File.exist?(realdest)
- }
- File.open(realdest, 'wb') {|f|
- f.write str
- }
- File.chmod mode, realdest
-
- File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
- if prefix
- f.puts realdest.sub(prefix, '')
- else
- f.puts realdest
- end
- }
- end
- end
-
- def diff?(new_content, path)
- return true unless File.exist?(path)
- new_content != File.binread(path)
- end
-
- def command(str)
- $stderr.puts str if verbose?
- system str or raise RuntimeError, "'system #{str}' failed"
- end
-
- def ruby(str)
- command config('rubyprog') + ' ' + str
- end
-
- def make(task = '')
- command config('makeprog') + ' ' + task
- end
-
- def extdir?(dir)
- File.exist?(dir + '/MANIFEST')
- end
-
- def all_files_in(dirname)
- Dir.open(dirname) {|d|
- return d.select {|ent| File.file?("#{dirname}/#{ent}") }
- }
- end
-
- REJECT_DIRS = %w(
- CVS SCCS RCS CVS.adm .svn
- )
-
- def all_dirs_in(dirname)
- Dir.open(dirname) {|d|
- return d.select {|n| File.dir?("#{dirname}/#{n}") } - %w(. ..) - REJECT_DIRS
- }
- end
-
-end
-
-
-#
-# Main Installer
-#
-
-module HookUtils
-
- def run_hook(name)
- try_run_hook "#{curr_srcdir()}/#{name}" or
- try_run_hook "#{curr_srcdir()}/#{name}.rb"
- end
-
- def try_run_hook(fname)
- return false unless File.file?(fname)
- begin
- instance_eval File.read(fname), fname, 1
- rescue
- setup_rb_error "hook #{fname} failed:\n" + $!.message
- end
- true
- end
-
-end
-
-
-module HookScriptAPI
-
- def get_config(key)
- @config[key]
- end
-
- alias config get_config
-
- def set_config(key, val)
- @config[key] = val
- end
-
- #
- # srcdir/objdir (works only in the package directory)
- #
-
- #abstract srcdir_root
- #abstract objdir_root
- #abstract relpath
-
- def curr_srcdir
- "#{srcdir_root()}/#{relpath()}"
- end
-
- def curr_objdir
- "#{objdir_root()}/#{relpath()}"
- end
-
- def srcfile(path)
- "#{curr_srcdir()}/#{path}"
- end
-
- def srcexist?(path)
- File.exist?(srcfile(path))
- end
-
- def srcdirectory?(path)
- File.dir?(srcfile(path))
- end
-
- def srcfile?(path)
- File.file? srcfile(path)
- end
-
- def srcentries(path = '.')
- Dir.open("#{curr_srcdir()}/#{path}") {|d|
- return d.to_a - %w(. ..)
- }
- end
-
- def srcfiles(path = '.')
- srcentries(path).select {|fname|
- File.file?(File.join(curr_srcdir(), path, fname))
- }
- end
-
- def srcdirectories(path = '.')
- srcentries(path).select {|fname|
- File.dir?(File.join(curr_srcdir(), path, fname))
- }
- end
-
-end
-
-
-class ToplevelInstaller
-
- Version = '3.3.1'
- Copyright = 'Copyright (c) 2000-2004 Minero Aoki'
-
- TASKS = [
- [ 'all', 'do config, setup, then install' ],
- [ 'config', 'saves your configurations' ],
- [ 'show', 'shows current configuration' ],
- [ 'setup', 'compiles ruby extentions and others' ],
- [ 'install', 'installs files' ],
- [ 'clean', "does `make clean' for each extention" ],
- [ 'distclean',"does `make distclean' for each extention" ]
- ]
-
- def ToplevelInstaller.invoke
- instance().invoke
- end
-
- @singleton = nil
-
- def ToplevelInstaller.instance
- @singleton ||= new(File.dirname($0))
- @singleton
- end
-
- include MetaConfigAPI
-
- def initialize(ardir_root)
- @config = nil
- @options = { 'verbose' => true }
- @ardir = File.expand_path(ardir_root)
- end
-
- def inspect
- "#<#{self.class} #{__id__()}>"
- end
-
- def invoke
- run_metaconfigs
- case task = parsearg_global()
- when nil, 'all'
- @config = load_config('config')
- parsearg_config
- init_installers
- exec_config
- exec_setup
- exec_install
- else
- @config = load_config(task)
- __send__ "parsearg_#{task}"
- init_installers
- __send__ "exec_#{task}"
- end
- end
-
- def run_metaconfigs
- eval_file_ifexist "#{@ardir}/metaconfig"
- end
-
- def load_config(task)
- case task
- when 'config'
- ConfigTable.new
- when 'clean', 'distclean'
- if File.exist?(ConfigTable.savefile)
- then ConfigTable.load
- else ConfigTable.new
- end
- else
- ConfigTable.load
- end
- end
-
- def init_installers
- @installer = Installer.new(@config, @options, @ardir, File.expand_path('.'))
- end
-
- #
- # Hook Script API bases
- #
-
- def srcdir_root
- @ardir
- end
-
- def objdir_root
- '.'
- end
-
- def relpath
- '.'
- end
-
- #
- # Option Parsing
- #
-
- def parsearg_global
- valid_task = /\A(?:#{TASKS.map {|task,desc| task }.join '|'})\z/
-
- while arg = ARGV.shift
- case arg
- when /\A\w+\z/
- setup_rb_error "invalid task: #{arg}" unless valid_task =~ arg
- return arg
-
- when '-q', '--quiet'
- @options['verbose'] = false
-
- when '--verbose'
- @options['verbose'] = true
-
- when '-h', '--help'
- print_usage $stdout
- exit 0
-
- when '-v', '--version'
- puts "#{File.basename($0)} version #{Version}"
- exit 0
-
- when '--copyright'
- puts Copyright
- exit 0
-
- else
- setup_rb_error "unknown global option '#{arg}'"
- end
- end
-
- nil
- end
-
-
- def parsearg_no_options
- unless ARGV.empty?
- setup_rb_error "#{task}: unknown options: #{ARGV.join ' '}"
- end
- end
-
- alias parsearg_show parsearg_no_options
- alias parsearg_setup parsearg_no_options
- alias parsearg_clean parsearg_no_options
- alias parsearg_distclean parsearg_no_options
-
- def parsearg_config
- re = /\A--(#{ConfigTable.map {|i| i.name }.join('|')})(?:=(.*))?\z/
- @options['config-opt'] = []
-
- while i = ARGV.shift
- if /\A--?\z/ =~ i
- @options['config-opt'] = ARGV.dup
- break
- end
- m = re.match(i) or setup_rb_error "config: unknown option #{i}"
- name, value = *m.to_a[1,2]
- @config[name] = value
- end
- end
-
- def parsearg_install
- @options['no-harm'] = false
- @options['install-prefix'] = ''
- while a = ARGV.shift
- case a
- when /\A--no-harm\z/
- @options['no-harm'] = true
- when /\A--prefix=(.*)\z/
- path = $1
- path = File.expand_path(path) unless path[0,1] == '/'
- @options['install-prefix'] = path
- else
- setup_rb_error "install: unknown option #{a}"
- end
- end
- end
-
- def print_usage(out)
- out.puts 'Typical Installation Procedure:'
- out.puts " $ ruby #{File.basename $0} config"
- out.puts " $ ruby #{File.basename $0} setup"
- out.puts " # ruby #{File.basename $0} install (may require root privilege)"
- out.puts
- out.puts 'Detailed Usage:'
- out.puts " ruby #{File.basename $0} <global option>"
- out.puts " ruby #{File.basename $0} [<global options>] <task> [<task options>]"
-
- fmt = " %-24s %s\n"
- out.puts
- out.puts 'Global options:'
- out.printf fmt, '-q,--quiet', 'suppress message outputs'
- out.printf fmt, ' --verbose', 'output messages verbosely'
- out.printf fmt, '-h,--help', 'print this message'
- out.printf fmt, '-v,--version', 'print version and quit'
- out.printf fmt, ' --copyright', 'print copyright and quit'
- out.puts
- out.puts 'Tasks:'
- TASKS.each do |name, desc|
- out.printf fmt, name, desc
- end
-
- fmt = " %-24s %s [%s]\n"
- out.puts
- out.puts 'Options for CONFIG or ALL:'
- ConfigTable.each do |item|
- out.printf fmt, item.help_opt, item.description, item.help_default
- end
- out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's"
- out.puts
- out.puts 'Options for INSTALL:'
- out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
- out.printf fmt, '--prefix=path', 'install path prefix', '$prefix'
- out.puts
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- @installer.exec_config
- @config.save # must be final
- end
-
- def exec_setup
- @installer.exec_setup
- end
-
- def exec_install
- @installer.exec_install
- end
-
- def exec_show
- ConfigTable.each do |i|
- printf "%-20s %s\n", i.name, i.value
- end
- end
-
- def exec_clean
- @installer.exec_clean
- end
-
- def exec_distclean
- @installer.exec_distclean
- end
-
-end
-
-
-class ToplevelInstallerMulti < ToplevelInstaller
-
- include HookUtils
- include HookScriptAPI
- include FileOperations
-
- def initialize(ardir)
- super
- @packages = all_dirs_in("#{@ardir}/packages")
- raise 'no package exists' if @packages.empty?
- end
-
- def run_metaconfigs
- eval_file_ifexist "#{@ardir}/metaconfig"
- @packages.each do |name|
- eval_file_ifexist "#{@ardir}/packages/#{name}/metaconfig"
- end
- end
-
- def init_installers
- @installers = {}
- @packages.each do |pack|
- @installers[pack] = Installer.new(@config, @options,
- "#{@ardir}/packages/#{pack}",
- "packages/#{pack}")
- end
-
- with = extract_selection(config('with'))
- without = extract_selection(config('without'))
- @selected = @installers.keys.select {|name|
- (with.empty? or with.include?(name)) \
- and not without.include?(name)
- }
- end
-
- def extract_selection(list)
- a = list.split(/,/)
- a.each do |name|
- setup_rb_error "no such package: #{name}" unless @installers.key?(name)
- end
- a
- end
-
- def print_usage(f)
- super
- f.puts 'Inluded packages:'
- f.puts ' ' + @packages.sort.join(' ')
- f.puts
- end
-
- #
- # multi-package metaconfig API
- #
-
- attr_reader :packages
-
- def declare_packages(list)
- raise 'package list is empty' if list.empty?
- list.each do |name|
- raise "directory packages/#{name} does not exist"\
- unless File.dir?("#{@ardir}/packages/#{name}")
- end
- @packages = list
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- run_hook 'pre-config'
- each_selected_installers {|inst| inst.exec_config }
- run_hook 'post-config'
- @config.save # must be final
- end
-
- def exec_setup
- run_hook 'pre-setup'
- each_selected_installers {|inst| inst.exec_setup }
- run_hook 'post-setup'
- end
-
- def exec_install
- run_hook 'pre-install'
- each_selected_installers {|inst| inst.exec_install }
- run_hook 'post-install'
- end
-
- def exec_clean
- rm_f ConfigTable.savefile
- run_hook 'pre-clean'
- each_selected_installers {|inst| inst.exec_clean }
- run_hook 'post-clean'
- end
-
- def exec_distclean
- rm_f ConfigTable.savefile
- run_hook 'pre-distclean'
- each_selected_installers {|inst| inst.exec_distclean }
- run_hook 'post-distclean'
- end
-
- #
- # lib
- #
-
- def each_selected_installers
- Dir.mkdir 'packages' unless File.dir?('packages')
- @selected.each do |pack|
- $stderr.puts "Processing the package `#{pack}' ..." if @options['verbose']
- Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
- Dir.chdir "packages/#{pack}"
- yield @installers[pack]
- Dir.chdir '../..'
- end
- end
-
- def verbose?
- @options['verbose']
- end
-
- def no_harm?
- @options['no-harm']
- end
-
-end
-
-
-class Installer
-
- FILETYPES = %w( bin lib ext data )
-
- include HookScriptAPI
- include HookUtils
- include FileOperations
-
- def initialize(config, opt, srcroot, objroot)
- @config = config
- @options = opt
- @srcdir = File.expand_path(srcroot)
- @objdir = File.expand_path(objroot)
- @currdir = '.'
- end
-
- def inspect
- "#<#{self.class} #{File.basename(@srcdir)}>"
- end
-
- #
- # Hook Script API base methods
- #
-
- def srcdir_root
- @srcdir
- end
-
- def objdir_root
- @objdir
- end
-
- def relpath
- @currdir
- end
-
- #
- # configs/options
- #
-
- def no_harm?
- @options['no-harm']
- end
-
- def verbose?
- @options['verbose']
- end
-
- def verbose_off
- begin
- save, @options['verbose'] = @options['verbose'], false
- yield
- ensure
- @options['verbose'] = save
- end
- end
-
- #
- # TASK config
- #
-
- def exec_config
- exec_task_traverse 'config'
- end
-
- def config_dir_bin(rel)
- end
-
- def config_dir_lib(rel)
- end
-
- def config_dir_ext(rel)
- extconf if extdir?(curr_srcdir())
- end
-
- def extconf
- opt = @options['config-opt'].join(' ')
- command "#{config('rubyprog')} #{curr_srcdir()}/extconf.rb #{opt}"
- end
-
- def config_dir_data(rel)
- end
-
- #
- # TASK setup
- #
-
- def exec_setup
- exec_task_traverse 'setup'
- end
-
- def setup_dir_bin(rel)
- all_files_in(curr_srcdir()).each do |fname|
- adjust_shebang "#{curr_srcdir()}/#{fname}"
- end
- end
-
- def adjust_shebang(path)
- return if no_harm?
- tmpfile = File.basename(path) + '.tmp'
- begin
- File.open(path, 'rb') {|r|
- first = r.gets
- return unless File.basename(config('rubypath')) == 'ruby'
- return unless File.basename(first.sub(/\A\#!/, '').split[0]) == 'ruby'
- $stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
- File.open(tmpfile, 'wb') {|w|
- w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
- w.write r.read
- }
- move_file tmpfile, File.basename(path)
- }
- ensure
- File.unlink tmpfile if File.exist?(tmpfile)
- end
- end
-
- def setup_dir_lib(rel)
- end
-
- def setup_dir_ext(rel)
- make if extdir?(curr_srcdir())
- end
-
- def setup_dir_data(rel)
- end
-
- #
- # TASK install
- #
-
- def exec_install
- rm_f 'InstalledFiles'
- exec_task_traverse 'install'
- end
-
- def install_dir_bin(rel)
- install_files collect_filenames_auto(), "#{config('bindir')}/#{rel}", 0755
- end
-
- def install_dir_lib(rel)
- install_files ruby_scripts(), "#{config('rbdir')}/#{rel}", 0644
- end
-
- def install_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- install_files ruby_extentions('.'),
- "#{config('sodir')}/#{File.dirname(rel)}",
- 0555
- end
-
- def install_dir_data(rel)
- install_files collect_filenames_auto(), "#{config('datadir')}/#{rel}", 0644
- end
-
- def install_files(list, dest, mode)
- mkdir_p dest, @options['install-prefix']
- list.each do |fname|
- install fname, dest, mode, @options['install-prefix']
- end
- end
-
- def ruby_scripts
- collect_filenames_auto().select {|n| /\.(#{ConfigTable.script_extensions.join('|')})\z/ =~ n }
- end
-
- # picked up many entries from cvs-1.11.1/src/ignore.c
- reject_patterns = %w(
- core RCSLOG tags TAGS .make.state
- .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
- *~ *.old *.bak *.BAK *.orig *.rej _$* *$
-
- *.org *.in .*
- )
- mapping = {
- '.' => '\.',
- '$' => '\$',
- '#' => '\#',
- '*' => '.*'
- }
- REJECT_PATTERNS = Regexp.new('\A(?:' +
- reject_patterns.map {|pat|
- pat.gsub(/[\.\$\#\*]/) {|ch| mapping[ch] }
- }.join('|') +
- ')\z')
-
- def collect_filenames_auto
- mapdir((existfiles() - hookfiles()).reject {|fname|
- REJECT_PATTERNS =~ fname
- })
- end
-
- def existfiles
- all_files_in(curr_srcdir()) | all_files_in('.')
- end
-
- def hookfiles
- %w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
- %w( config setup install clean ).map {|t| sprintf(fmt, t) }
- }.flatten
- end
-
- def mapdir(filelist)
- filelist.map {|fname|
- if File.exist?(fname) # objdir
- fname
- else # srcdir
- File.join(curr_srcdir(), fname)
- end
- }
- end
-
- def ruby_extentions(dir)
- Dir.open(dir) {|d|
- ents = d.select {|fname| /\.#{::Config::CONFIG['DLEXT']}\z/ =~ fname }
- if ents.empty?
- setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
- end
- return ents
- }
- end
-
- #
- # TASK clean
- #
-
- def exec_clean
- exec_task_traverse 'clean'
- rm_f ConfigTable.savefile
- rm_f 'InstalledFiles'
- end
-
- def clean_dir_bin(rel)
- end
-
- def clean_dir_lib(rel)
- end
-
- def clean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'clean' if File.file?('Makefile')
- end
-
- def clean_dir_data(rel)
- end
-
- #
- # TASK distclean
- #
-
- def exec_distclean
- exec_task_traverse 'distclean'
- rm_f ConfigTable.savefile
- rm_f 'InstalledFiles'
- end
-
- def distclean_dir_bin(rel)
- end
-
- def distclean_dir_lib(rel)
- end
-
- def distclean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'distclean' if File.file?('Makefile')
- end
-
- #
- # lib
- #
-
- def exec_task_traverse(task)
- run_hook "pre-#{task}"
- FILETYPES.each do |type|
- if config('without-ext') == 'yes' and type == 'ext'
- $stderr.puts 'skipping ext/* by user option' if verbose?
- next
- end
- traverse task, type, "#{task}_dir_#{type}"
- end
- run_hook "post-#{task}"
- end
-
- def traverse(task, rel, mid)
- dive_into(rel) {
- run_hook "pre-#{task}"
- __send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '')
- all_dirs_in(curr_srcdir()).each do |d|
- traverse task, "#{rel}/#{d}", mid
- end
- run_hook "post-#{task}"
- }
- end
-
- def dive_into(rel)
- return unless File.dir?("#{@srcdir}/#{rel}")
-
- dir = File.basename(rel)
- Dir.mkdir dir unless File.dir?(dir)
- prevdir = Dir.pwd
- Dir.chdir dir
- $stderr.puts '---> ' + rel if verbose?
- @currdir = rel
- yield
- Dir.chdir prevdir
- $stderr.puts '<--- ' + rel if verbose?
- @currdir = File.dirname(rel)
- end
-
-end
-
-
-if $0 == __FILE__
- begin
- if multipackage_install?
- ToplevelInstallerMulti.invoke
- else
- ToplevelInstaller.invoke
- end
- rescue SetupError
- raise if $DEBUG
- $stderr.puts $!.message
- $stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
- exit 1
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/Rakefile b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/Rakefile
deleted file mode 100755
index d5eebae2934..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/Rakefile
+++ /dev/null
@@ -1,95 +0,0 @@
-require "rake/rdoctask"
-require "rake/testtask"
-require "rake/gempackagetask"
-
-require "rubygems"
-
-dir = File.dirname(__FILE__)
-lib = File.join(dir, "lib", "faster_csv.rb")
-version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d)\1/, 2]
-
-task :default => [:test]
-
-Rake::TestTask.new do |test|
- test.libs << "test"
- test.test_files = [ "test/ts_all.rb" ]
- test.verbose = true
-end
-
-Rake::RDocTask.new do |rdoc|
- rdoc.main = "README"
- rdoc.rdoc_dir = "doc/html"
- rdoc.title = "FasterCSV Documentation"
- rdoc.rdoc_files.include( "README", "INSTALL",
- "TODO", "CHANGELOG",
- "AUTHORS", "COPYING",
- "LICENSE", "lib/" )
-end
-
-desc "Upload current documentation to Rubyforge"
-task :upload_docs => [:rdoc] do
- sh "scp -r doc/html/* " +
- "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/fastercsv/"
-end
-
-desc "Show library's code statistics"
-task :stats do
- require 'code_statistics'
- CodeStatistics.new( ["FasterCSV", "lib"],
- ["Units", "test"] ).to_s
-end
-
-desc "Time FasterCSV and CSV"
-task :benchmark do
- TESTS = 6
- path = "test/test_data.csv"
- sh %Q{time ruby -r csv -e } +
- %Q{'#{TESTS}.times { CSV.foreach("#{path}") { |row| } }'}
- sh %Q{time ruby -r lightcsv -e } +
- %Q{'#{TESTS}.times { LightCsv.foreach("#{path}") { |row| } }'}
- sh %Q{time ruby -r lib/faster_csv -e } +
- %Q{'#{TESTS}.times { FasterCSV.foreach("#{path}") { |row| } }'}
-end
-
-spec = Gem::Specification.new do |spec|
- spec.name = "fastercsv"
- spec.version = version
-
- spec.platform = Gem::Platform::RUBY
- spec.summary = "FasterCSV is CSV, but faster, smaller, and cleaner."
-
- spec.test_suite_file = "test/ts_all.rb"
- spec.files = Dir.glob("{lib,test,examples}/**/*.rb").
- reject { |item| item.include?(".svn") } +
- Dir.glob("{test,examples}/**/*.csv").
- reject { |item| item.include?(".svn") } +
- ["Rakefile", "setup.rb"]
-
- spec.has_rdoc = true
- spec.extra_rdoc_files = %w[ AUTHORS COPYING README INSTALL TODO CHANGELOG
- LICENSE ]
- spec.rdoc_options << "--title" << "FasterCSV Documentation" <<
- "--main" << "README"
-
- spec.require_path = "lib"
-
- spec.author = "James Edward Gray II"
- spec.email = "james@grayproductions.net"
- spec.rubyforge_project = "fastercsv"
- spec.homepage = "http://fastercsv.rubyforge.org"
- spec.description = <<END_DESC
-FasterCSV is intended as a complete replacement to the CSV standard library. It
-is significantly faster and smaller while still being pure Ruby code. It also
-strives for a better interface.
-END_DESC
-end
-
-Rake::GemPackageTask.new(spec) do |pkg|
- pkg.need_zip = true
- pkg.need_tar = true
-end
-
-desc "Add new files to Subversion"
-task :add_to_svn do
- sh %Q{svn status | ruby -nae 'system "svn add \#{$F[1]}" if $F[0] == "?"' }
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/TODO b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/TODO
deleted file mode 100755
index b689cf473a4..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/TODO
+++ /dev/null
@@ -1,6 +0,0 @@
-= To Do List
-
-The following is a list of planned expansions for FasterCSV, in no particular
-order.
-
- * Rent this space...
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/setup.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/setup.rb
deleted file mode 100755
index 0807023db26..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/fastercsv-1.4.0/setup.rb
+++ /dev/null
@@ -1,1360 +0,0 @@
-#
-# setup.rb
-#
-# Copyright (c) 2000-2004 Minero Aoki
-#
-# This program is free software.
-# You can distribute/modify this program under the terms of
-# the GNU LGPL, Lesser General Public License version 2.1.
-#
-
-unless Enumerable.method_defined?(:map) # Ruby 1.4.6
- module Enumerable
- alias map collect
- end
-end
-
-unless File.respond_to?(:read) # Ruby 1.6
- def File.read(fname)
- open(fname) {|f|
- return f.read
- }
- end
-end
-
-def File.binread(fname)
- open(fname, 'rb') {|f|
- return f.read
- }
-end
-
-# for corrupted windows stat(2)
-def File.dir?(path)
- File.directory?((path[-1,1] == '/') ? path : path + '/')
-end
-
-
-class SetupError < StandardError; end
-
-def setup_rb_error(msg)
- raise SetupError, msg
-end
-
-#
-# Config
-#
-
-if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg }
- ARGV.delete(arg)
- require arg.split(/=/, 2)[1]
- $".push 'rbconfig.rb'
-else
- require 'rbconfig'
-end
-
-def multipackage_install?
- FileTest.directory?(File.dirname($0) + '/packages')
-end
-
-
-class ConfigItem
- def initialize(name, template, default, desc)
- @name = name.freeze
- @template = template
- @value = default
- @default = default.dup.freeze
- @description = desc
- end
-
- attr_reader :name
- attr_reader :description
-
- attr_accessor :default
- alias help_default default
-
- def help_opt
- "--#{@name}=#{@template}"
- end
-
- def value
- @value
- end
-
- def eval(table)
- @value.gsub(%r<\$([^/]+)>) { table[$1] }
- end
-
- def set(val)
- @value = check(val)
- end
-
- private
-
- def check(val)
- setup_rb_error "config: --#{name} requires argument" unless val
- val
- end
-end
-
-class BoolItem < ConfigItem
- def config_type
- 'bool'
- end
-
- def help_opt
- "--#{@name}"
- end
-
- private
-
- def check(val)
- return 'yes' unless val
- unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val
- setup_rb_error "config: --#{@name} accepts only yes/no for argument"
- end
- (/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no'
- end
-end
-
-class PathItem < ConfigItem
- def config_type
- 'path'
- end
-
- private
-
- def check(path)
- setup_rb_error "config: --#{@name} requires argument" unless path
- path[0,1] == '$' ? path : File.expand_path(path)
- end
-end
-
-class ProgramItem < ConfigItem
- def config_type
- 'program'
- end
-end
-
-class SelectItem < ConfigItem
- def initialize(name, template, default, desc)
- super
- @ok = template.split('/')
- end
-
- def config_type
- 'select'
- end
-
- private
-
- def check(val)
- unless @ok.include?(val.strip)
- setup_rb_error "config: use --#{@name}=#{@template} (#{val})"
- end
- val.strip
- end
-end
-
-class PackageSelectionItem < ConfigItem
- def initialize(name, template, default, help_default, desc)
- super name, template, default, desc
- @help_default = help_default
- end
-
- attr_reader :help_default
-
- def config_type
- 'package'
- end
-
- private
-
- def check(val)
- unless File.dir?("packages/#{val}")
- setup_rb_error "config: no such package: #{val}"
- end
- val
- end
-end
-
-class ConfigTable_class
-
- def initialize(items)
- @items = items
- @table = {}
- items.each do |i|
- @table[i.name] = i
- end
- ALIASES.each do |ali, name|
- @table[ali] = @table[name]
- end
- end
-
- include Enumerable
-
- def each(&block)
- @items.each(&block)
- end
-
- def key?(name)
- @table.key?(name)
- end
-
- def lookup(name)
- @table[name] or raise ArgumentError, "no such config item: #{name}"
- end
-
- def add(item)
- @items.push item
- @table[item.name] = item
- end
-
- def remove(name)
- item = lookup(name)
- @items.delete_if {|i| i.name == name }
- @table.delete_if {|name, i| i.name == name }
- item
- end
-
- def new
- dup()
- end
-
- def savefile
- '.config'
- end
-
- def load
- begin
- t = dup()
- File.foreach(savefile()) do |line|
- k, v = *line.split(/=/, 2)
- t[k] = v.strip
- end
- t
- rescue Errno::ENOENT
- setup_rb_error $!.message + "#{File.basename($0)} config first"
- end
- end
-
- def save
- @items.each {|i| i.value }
- File.open(savefile(), 'w') {|f|
- @items.each do |i|
- f.printf "%s=%s\n", i.name, i.value if i.value
- end
- }
- end
-
- def [](key)
- lookup(key).eval(self)
- end
-
- def []=(key, val)
- lookup(key).set val
- end
-
-end
-
-c = ::Config::CONFIG
-
-rubypath = c['bindir'] + '/' + c['ruby_install_name']
-
-major = c['MAJOR'].to_i
-minor = c['MINOR'].to_i
-teeny = c['TEENY'].to_i
-version = "#{major}.#{minor}"
-
-# ruby ver. >= 1.4.4?
-newpath_p = ((major >= 2) or
- ((major == 1) and
- ((minor >= 5) or
- ((minor == 4) and (teeny >= 4)))))
-
-if c['rubylibdir']
- # V < 1.6.3
- _stdruby = c['rubylibdir']
- _siteruby = c['sitedir']
- _siterubyver = c['sitelibdir']
- _siterubyverarch = c['sitearchdir']
-elsif newpath_p
- # 1.4.4 <= V <= 1.6.3
- _stdruby = "$prefix/lib/ruby/#{version}"
- _siteruby = c['sitedir']
- _siterubyver = "$siteruby/#{version}"
- _siterubyverarch = "$siterubyver/#{c['arch']}"
-else
- # V < 1.4.4
- _stdruby = "$prefix/lib/ruby/#{version}"
- _siteruby = "$prefix/lib/ruby/#{version}/site_ruby"
- _siterubyver = _siteruby
- _siterubyverarch = "$siterubyver/#{c['arch']}"
-end
-libdir = '-* dummy libdir *-'
-stdruby = '-* dummy rubylibdir *-'
-siteruby = '-* dummy site_ruby *-'
-siterubyver = '-* dummy site_ruby version *-'
-parameterize = lambda {|path|
- path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')\
- .sub(/\A#{Regexp.quote(libdir)}/, '$libdir')\
- .sub(/\A#{Regexp.quote(stdruby)}/, '$stdruby')\
- .sub(/\A#{Regexp.quote(siteruby)}/, '$siteruby')\
- .sub(/\A#{Regexp.quote(siterubyver)}/, '$siterubyver')
-}
-libdir = parameterize.call(c['libdir'])
-stdruby = parameterize.call(_stdruby)
-siteruby = parameterize.call(_siteruby)
-siterubyver = parameterize.call(_siterubyver)
-siterubyverarch = parameterize.call(_siterubyverarch)
-
-if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }
- makeprog = arg.sub(/'/, '').split(/=/, 2)[1]
-else
- makeprog = 'make'
-end
-
-common_conf = [
- PathItem.new('prefix', 'path', c['prefix'],
- 'path prefix of target environment'),
- PathItem.new('bindir', 'path', parameterize.call(c['bindir']),
- 'the directory for commands'),
- PathItem.new('libdir', 'path', libdir,
- 'the directory for libraries'),
- PathItem.new('datadir', 'path', parameterize.call(c['datadir']),
- 'the directory for shared data'),
- PathItem.new('mandir', 'path', parameterize.call(c['mandir']),
- 'the directory for man pages'),
- PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']),
- 'the directory for man pages'),
- PathItem.new('stdruby', 'path', stdruby,
- 'the directory for standard ruby libraries'),
- PathItem.new('siteruby', 'path', siteruby,
- 'the directory for version-independent aux ruby libraries'),
- PathItem.new('siterubyver', 'path', siterubyver,
- 'the directory for aux ruby libraries'),
- PathItem.new('siterubyverarch', 'path', siterubyverarch,
- 'the directory for aux ruby binaries'),
- PathItem.new('rbdir', 'path', '$siterubyver',
- 'the directory for ruby scripts'),
- PathItem.new('sodir', 'path', '$siterubyverarch',
- 'the directory for ruby extentions'),
- PathItem.new('rubypath', 'path', rubypath,
- 'the path to set to #! line'),
- ProgramItem.new('rubyprog', 'name', rubypath,
- 'the ruby program using for installation'),
- ProgramItem.new('makeprog', 'name', makeprog,
- 'the make program to compile ruby extentions'),
- SelectItem.new('shebang', 'all/ruby/never', 'ruby',
- 'shebang line (#!) editing mode'),
- BoolItem.new('without-ext', 'yes/no', 'no',
- 'does not compile/install ruby extentions')
-]
-class ConfigTable_class # open again
- ALIASES = {
- 'std-ruby' => 'stdruby',
- 'site-ruby-common' => 'siteruby', # For backward compatibility
- 'site-ruby' => 'siterubyver', # For backward compatibility
- 'bin-dir' => 'bindir',
- 'bin-dir' => 'bindir',
- 'rb-dir' => 'rbdir',
- 'so-dir' => 'sodir',
- 'data-dir' => 'datadir',
- 'ruby-path' => 'rubypath',
- 'ruby-prog' => 'rubyprog',
- 'ruby' => 'rubyprog',
- 'make-prog' => 'makeprog',
- 'make' => 'makeprog'
- }
-end
-multipackage_conf = [
- PackageSelectionItem.new('with', 'name,name...', '', 'ALL',
- 'package names that you want to install'),
- PackageSelectionItem.new('without', 'name,name...', '', 'NONE',
- 'package names that you do not want to install')
-]
-if multipackage_install?
- ConfigTable = ConfigTable_class.new(common_conf + multipackage_conf)
-else
- ConfigTable = ConfigTable_class.new(common_conf)
-end
-
-
-module MetaConfigAPI
-
- def eval_file_ifexist(fname)
- instance_eval File.read(fname), fname, 1 if File.file?(fname)
- end
-
- def config_names
- ConfigTable.map {|i| i.name }
- end
-
- def config?(name)
- ConfigTable.key?(name)
- end
-
- def bool_config?(name)
- ConfigTable.lookup(name).config_type == 'bool'
- end
-
- def path_config?(name)
- ConfigTable.lookup(name).config_type == 'path'
- end
-
- def value_config?(name)
- case ConfigTable.lookup(name).config_type
- when 'bool', 'path'
- true
- else
- false
- end
- end
-
- def add_config(item)
- ConfigTable.add item
- end
-
- def add_bool_config(name, default, desc)
- ConfigTable.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc)
- end
-
- def add_path_config(name, default, desc)
- ConfigTable.add PathItem.new(name, 'path', default, desc)
- end
-
- def set_config_default(name, default)
- ConfigTable.lookup(name).default = default
- end
-
- def remove_config(name)
- ConfigTable.remove(name)
- end
-
-end
-
-
-#
-# File Operations
-#
-
-module FileOperations
-
- def mkdir_p(dirname, prefix = nil)
- dirname = prefix + File.expand_path(dirname) if prefix
- $stderr.puts "mkdir -p #{dirname}" if verbose?
- return if no_harm?
-
- # does not check '/'... it's too abnormal case
- dirs = File.expand_path(dirname).split(%r<(?=/)>)
- if /\A[a-z]:\z/i =~ dirs[0]
- disk = dirs.shift
- dirs[0] = disk + dirs[0]
- end
- dirs.each_index do |idx|
- path = dirs[0..idx].join('')
- Dir.mkdir path unless File.dir?(path)
- end
- end
-
- def rm_f(fname)
- $stderr.puts "rm -f #{fname}" if verbose?
- return if no_harm?
-
- if File.exist?(fname) or File.symlink?(fname)
- File.chmod 0777, fname
- File.unlink fname
- end
- end
-
- def rm_rf(dn)
- $stderr.puts "rm -rf #{dn}" if verbose?
- return if no_harm?
-
- Dir.chdir dn
- Dir.foreach('.') do |fn|
- next if fn == '.'
- next if fn == '..'
- if File.dir?(fn)
- verbose_off {
- rm_rf fn
- }
- else
- verbose_off {
- rm_f fn
- }
- end
- end
- Dir.chdir '..'
- Dir.rmdir dn
- end
-
- def move_file(src, dest)
- File.unlink dest if File.exist?(dest)
- begin
- File.rename src, dest
- rescue
- File.open(dest, 'wb') {|f| f.write File.binread(src) }
- File.chmod File.stat(src).mode, dest
- File.unlink src
- end
- end
-
- def install(from, dest, mode, prefix = nil)
- $stderr.puts "install #{from} #{dest}" if verbose?
- return if no_harm?
-
- realdest = prefix ? prefix + File.expand_path(dest) : dest
- realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest)
- str = File.binread(from)
- if diff?(str, realdest)
- verbose_off {
- rm_f realdest if File.exist?(realdest)
- }
- File.open(realdest, 'wb') {|f|
- f.write str
- }
- File.chmod mode, realdest
-
- File.open("#{objdir_root()}/InstalledFiles", 'a') {|f|
- if prefix
- f.puts realdest.sub(prefix, '')
- else
- f.puts realdest
- end
- }
- end
- end
-
- def diff?(new_content, path)
- return true unless File.exist?(path)
- new_content != File.binread(path)
- end
-
- def command(str)
- $stderr.puts str if verbose?
- system str or raise RuntimeError, "'system #{str}' failed"
- end
-
- def ruby(str)
- command config('rubyprog') + ' ' + str
- end
-
- def make(task = '')
- command config('makeprog') + ' ' + task
- end
-
- def extdir?(dir)
- File.exist?(dir + '/MANIFEST')
- end
-
- def all_files_in(dirname)
- Dir.open(dirname) {|d|
- return d.select {|ent| File.file?("#{dirname}/#{ent}") }
- }
- end
-
- REJECT_DIRS = %w(
- CVS SCCS RCS CVS.adm .svn
- )
-
- def all_dirs_in(dirname)
- Dir.open(dirname) {|d|
- return d.select {|n| File.dir?("#{dirname}/#{n}") } - %w(. ..) - REJECT_DIRS
- }
- end
-
-end
-
-
-#
-# Main Installer
-#
-
-module HookUtils
-
- def run_hook(name)
- try_run_hook "#{curr_srcdir()}/#{name}" or
- try_run_hook "#{curr_srcdir()}/#{name}.rb"
- end
-
- def try_run_hook(fname)
- return false unless File.file?(fname)
- begin
- instance_eval File.read(fname), fname, 1
- rescue
- setup_rb_error "hook #{fname} failed:\n" + $!.message
- end
- true
- end
-
-end
-
-
-module HookScriptAPI
-
- def get_config(key)
- @config[key]
- end
-
- alias config get_config
-
- def set_config(key, val)
- @config[key] = val
- end
-
- #
- # srcdir/objdir (works only in the package directory)
- #
-
- #abstract srcdir_root
- #abstract objdir_root
- #abstract relpath
-
- def curr_srcdir
- "#{srcdir_root()}/#{relpath()}"
- end
-
- def curr_objdir
- "#{objdir_root()}/#{relpath()}"
- end
-
- def srcfile(path)
- "#{curr_srcdir()}/#{path}"
- end
-
- def srcexist?(path)
- File.exist?(srcfile(path))
- end
-
- def srcdirectory?(path)
- File.dir?(srcfile(path))
- end
-
- def srcfile?(path)
- File.file? srcfile(path)
- end
-
- def srcentries(path = '.')
- Dir.open("#{curr_srcdir()}/#{path}") {|d|
- return d.to_a - %w(. ..)
- }
- end
-
- def srcfiles(path = '.')
- srcentries(path).select {|fname|
- File.file?(File.join(curr_srcdir(), path, fname))
- }
- end
-
- def srcdirectories(path = '.')
- srcentries(path).select {|fname|
- File.dir?(File.join(curr_srcdir(), path, fname))
- }
- end
-
-end
-
-
-class ToplevelInstaller
-
- Version = '3.3.1'
- Copyright = 'Copyright (c) 2000-2004 Minero Aoki'
-
- TASKS = [
- [ 'all', 'do config, setup, then install' ],
- [ 'config', 'saves your configurations' ],
- [ 'show', 'shows current configuration' ],
- [ 'setup', 'compiles ruby extentions and others' ],
- [ 'install', 'installs files' ],
- [ 'clean', "does `make clean' for each extention" ],
- [ 'distclean',"does `make distclean' for each extention" ]
- ]
-
- def ToplevelInstaller.invoke
- instance().invoke
- end
-
- @singleton = nil
-
- def ToplevelInstaller.instance
- @singleton ||= new(File.dirname($0))
- @singleton
- end
-
- include MetaConfigAPI
-
- def initialize(ardir_root)
- @config = nil
- @options = { 'verbose' => true }
- @ardir = File.expand_path(ardir_root)
- end
-
- def inspect
- "#<#{self.class} #{__id__()}>"
- end
-
- def invoke
- run_metaconfigs
- case task = parsearg_global()
- when nil, 'all'
- @config = load_config('config')
- parsearg_config
- init_installers
- exec_config
- exec_setup
- exec_install
- else
- @config = load_config(task)
- __send__ "parsearg_#{task}"
- init_installers
- __send__ "exec_#{task}"
- end
- end
-
- def run_metaconfigs
- eval_file_ifexist "#{@ardir}/metaconfig"
- end
-
- def load_config(task)
- case task
- when 'config'
- ConfigTable.new
- when 'clean', 'distclean'
- if File.exist?(ConfigTable.savefile)
- then ConfigTable.load
- else ConfigTable.new
- end
- else
- ConfigTable.load
- end
- end
-
- def init_installers
- @installer = Installer.new(@config, @options, @ardir, File.expand_path('.'))
- end
-
- #
- # Hook Script API bases
- #
-
- def srcdir_root
- @ardir
- end
-
- def objdir_root
- '.'
- end
-
- def relpath
- '.'
- end
-
- #
- # Option Parsing
- #
-
- def parsearg_global
- valid_task = /\A(?:#{TASKS.map {|task,desc| task }.join '|'})\z/
-
- while arg = ARGV.shift
- case arg
- when /\A\w+\z/
- setup_rb_error "invalid task: #{arg}" unless valid_task =~ arg
- return arg
-
- when '-q', '--quiet'
- @options['verbose'] = false
-
- when '--verbose'
- @options['verbose'] = true
-
- when '-h', '--help'
- print_usage $stdout
- exit 0
-
- when '-v', '--version'
- puts "#{File.basename($0)} version #{Version}"
- exit 0
-
- when '--copyright'
- puts Copyright
- exit 0
-
- else
- setup_rb_error "unknown global option '#{arg}'"
- end
- end
-
- nil
- end
-
-
- def parsearg_no_options
- unless ARGV.empty?
- setup_rb_error "#{task}: unknown options: #{ARGV.join ' '}"
- end
- end
-
- alias parsearg_show parsearg_no_options
- alias parsearg_setup parsearg_no_options
- alias parsearg_clean parsearg_no_options
- alias parsearg_distclean parsearg_no_options
-
- def parsearg_config
- re = /\A--(#{ConfigTable.map {|i| i.name }.join('|')})(?:=(.*))?\z/
- @options['config-opt'] = []
-
- while i = ARGV.shift
- if /\A--?\z/ =~ i
- @options['config-opt'] = ARGV.dup
- break
- end
- m = re.match(i) or setup_rb_error "config: unknown option #{i}"
- name, value = *m.to_a[1,2]
- @config[name] = value
- end
- end
-
- def parsearg_install
- @options['no-harm'] = false
- @options['install-prefix'] = ''
- while a = ARGV.shift
- case a
- when /\A--no-harm\z/
- @options['no-harm'] = true
- when /\A--prefix=(.*)\z/
- path = $1
- path = File.expand_path(path) unless path[0,1] == '/'
- @options['install-prefix'] = path
- else
- setup_rb_error "install: unknown option #{a}"
- end
- end
- end
-
- def print_usage(out)
- out.puts 'Typical Installation Procedure:'
- out.puts " $ ruby #{File.basename $0} config"
- out.puts " $ ruby #{File.basename $0} setup"
- out.puts " # ruby #{File.basename $0} install (may require root privilege)"
- out.puts
- out.puts 'Detailed Usage:'
- out.puts " ruby #{File.basename $0} <global option>"
- out.puts " ruby #{File.basename $0} [<global options>] <task> [<task options>]"
-
- fmt = " %-24s %s\n"
- out.puts
- out.puts 'Global options:'
- out.printf fmt, '-q,--quiet', 'suppress message outputs'
- out.printf fmt, ' --verbose', 'output messages verbosely'
- out.printf fmt, '-h,--help', 'print this message'
- out.printf fmt, '-v,--version', 'print version and quit'
- out.printf fmt, ' --copyright', 'print copyright and quit'
- out.puts
- out.puts 'Tasks:'
- TASKS.each do |name, desc|
- out.printf fmt, name, desc
- end
-
- fmt = " %-24s %s [%s]\n"
- out.puts
- out.puts 'Options for CONFIG or ALL:'
- ConfigTable.each do |item|
- out.printf fmt, item.help_opt, item.description, item.help_default
- end
- out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's"
- out.puts
- out.puts 'Options for INSTALL:'
- out.printf fmt, '--no-harm', 'only display what to do if given', 'off'
- out.printf fmt, '--prefix=path', 'install path prefix', '$prefix'
- out.puts
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- @installer.exec_config
- @config.save # must be final
- end
-
- def exec_setup
- @installer.exec_setup
- end
-
- def exec_install
- @installer.exec_install
- end
-
- def exec_show
- ConfigTable.each do |i|
- printf "%-20s %s\n", i.name, i.value
- end
- end
-
- def exec_clean
- @installer.exec_clean
- end
-
- def exec_distclean
- @installer.exec_distclean
- end
-
-end
-
-
-class ToplevelInstallerMulti < ToplevelInstaller
-
- include HookUtils
- include HookScriptAPI
- include FileOperations
-
- def initialize(ardir)
- super
- @packages = all_dirs_in("#{@ardir}/packages")
- raise 'no package exists' if @packages.empty?
- end
-
- def run_metaconfigs
- eval_file_ifexist "#{@ardir}/metaconfig"
- @packages.each do |name|
- eval_file_ifexist "#{@ardir}/packages/#{name}/metaconfig"
- end
- end
-
- def init_installers
- @installers = {}
- @packages.each do |pack|
- @installers[pack] = Installer.new(@config, @options,
- "#{@ardir}/packages/#{pack}",
- "packages/#{pack}")
- end
-
- with = extract_selection(config('with'))
- without = extract_selection(config('without'))
- @selected = @installers.keys.select {|name|
- (with.empty? or with.include?(name)) \
- and not without.include?(name)
- }
- end
-
- def extract_selection(list)
- a = list.split(/,/)
- a.each do |name|
- setup_rb_error "no such package: #{name}" unless @installers.key?(name)
- end
- a
- end
-
- def print_usage(f)
- super
- f.puts 'Inluded packages:'
- f.puts ' ' + @packages.sort.join(' ')
- f.puts
- end
-
- #
- # multi-package metaconfig API
- #
-
- attr_reader :packages
-
- def declare_packages(list)
- raise 'package list is empty' if list.empty?
- list.each do |name|
- raise "directory packages/#{name} does not exist"\
- unless File.dir?("#{@ardir}/packages/#{name}")
- end
- @packages = list
- end
-
- #
- # Task Handlers
- #
-
- def exec_config
- run_hook 'pre-config'
- each_selected_installers {|inst| inst.exec_config }
- run_hook 'post-config'
- @config.save # must be final
- end
-
- def exec_setup
- run_hook 'pre-setup'
- each_selected_installers {|inst| inst.exec_setup }
- run_hook 'post-setup'
- end
-
- def exec_install
- run_hook 'pre-install'
- each_selected_installers {|inst| inst.exec_install }
- run_hook 'post-install'
- end
-
- def exec_clean
- rm_f ConfigTable.savefile
- run_hook 'pre-clean'
- each_selected_installers {|inst| inst.exec_clean }
- run_hook 'post-clean'
- end
-
- def exec_distclean
- rm_f ConfigTable.savefile
- run_hook 'pre-distclean'
- each_selected_installers {|inst| inst.exec_distclean }
- run_hook 'post-distclean'
- end
-
- #
- # lib
- #
-
- def each_selected_installers
- Dir.mkdir 'packages' unless File.dir?('packages')
- @selected.each do |pack|
- $stderr.puts "Processing the package `#{pack}' ..." if @options['verbose']
- Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}")
- Dir.chdir "packages/#{pack}"
- yield @installers[pack]
- Dir.chdir '../..'
- end
- end
-
- def verbose?
- @options['verbose']
- end
-
- def no_harm?
- @options['no-harm']
- end
-
-end
-
-
-class Installer
-
- FILETYPES = %w( bin lib ext data )
-
- include HookScriptAPI
- include HookUtils
- include FileOperations
-
- def initialize(config, opt, srcroot, objroot)
- @config = config
- @options = opt
- @srcdir = File.expand_path(srcroot)
- @objdir = File.expand_path(objroot)
- @currdir = '.'
- end
-
- def inspect
- "#<#{self.class} #{File.basename(@srcdir)}>"
- end
-
- #
- # Hook Script API base methods
- #
-
- def srcdir_root
- @srcdir
- end
-
- def objdir_root
- @objdir
- end
-
- def relpath
- @currdir
- end
-
- #
- # configs/options
- #
-
- def no_harm?
- @options['no-harm']
- end
-
- def verbose?
- @options['verbose']
- end
-
- def verbose_off
- begin
- save, @options['verbose'] = @options['verbose'], false
- yield
- ensure
- @options['verbose'] = save
- end
- end
-
- #
- # TASK config
- #
-
- def exec_config
- exec_task_traverse 'config'
- end
-
- def config_dir_bin(rel)
- end
-
- def config_dir_lib(rel)
- end
-
- def config_dir_ext(rel)
- extconf if extdir?(curr_srcdir())
- end
-
- def extconf
- opt = @options['config-opt'].join(' ')
- command "#{config('rubyprog')} #{curr_srcdir()}/extconf.rb #{opt}"
- end
-
- def config_dir_data(rel)
- end
-
- #
- # TASK setup
- #
-
- def exec_setup
- exec_task_traverse 'setup'
- end
-
- def setup_dir_bin(rel)
- all_files_in(curr_srcdir()).each do |fname|
- adjust_shebang "#{curr_srcdir()}/#{fname}"
- end
- end
-
- def adjust_shebang(path)
- return if no_harm?
- tmpfile = File.basename(path) + '.tmp'
- begin
- File.open(path, 'rb') {|r|
- first = r.gets
- return unless File.basename(config('rubypath')) == 'ruby'
- return unless File.basename(first.sub(/\A\#!/, '').split[0]) == 'ruby'
- $stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose?
- File.open(tmpfile, 'wb') {|w|
- w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath'))
- w.write r.read
- }
- move_file tmpfile, File.basename(path)
- }
- ensure
- File.unlink tmpfile if File.exist?(tmpfile)
- end
- end
-
- def setup_dir_lib(rel)
- end
-
- def setup_dir_ext(rel)
- make if extdir?(curr_srcdir())
- end
-
- def setup_dir_data(rel)
- end
-
- #
- # TASK install
- #
-
- def exec_install
- rm_f 'InstalledFiles'
- exec_task_traverse 'install'
- end
-
- def install_dir_bin(rel)
- install_files collect_filenames_auto(), "#{config('bindir')}/#{rel}", 0755
- end
-
- def install_dir_lib(rel)
- install_files ruby_scripts(), "#{config('rbdir')}/#{rel}", 0644
- end
-
- def install_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- install_files ruby_extentions('.'),
- "#{config('sodir')}/#{File.dirname(rel)}",
- 0555
- end
-
- def install_dir_data(rel)
- install_files collect_filenames_auto(), "#{config('datadir')}/#{rel}", 0644
- end
-
- def install_files(list, dest, mode)
- mkdir_p dest, @options['install-prefix']
- list.each do |fname|
- install fname, dest, mode, @options['install-prefix']
- end
- end
-
- def ruby_scripts
- collect_filenames_auto().select {|n| /\.rb\z/ =~ n }
- end
-
- # picked up many entries from cvs-1.11.1/src/ignore.c
- reject_patterns = %w(
- core RCSLOG tags TAGS .make.state
- .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb
- *~ *.old *.bak *.BAK *.orig *.rej _$* *$
-
- *.org *.in .*
- )
- mapping = {
- '.' => '\.',
- '$' => '\$',
- '#' => '\#',
- '*' => '.*'
- }
- REJECT_PATTERNS = Regexp.new('\A(?:' +
- reject_patterns.map {|pat|
- pat.gsub(/[\.\$\#\*]/) {|ch| mapping[ch] }
- }.join('|') +
- ')\z')
-
- def collect_filenames_auto
- mapdir((existfiles() - hookfiles()).reject {|fname|
- REJECT_PATTERNS =~ fname
- })
- end
-
- def existfiles
- all_files_in(curr_srcdir()) | all_files_in('.')
- end
-
- def hookfiles
- %w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt|
- %w( config setup install clean ).map {|t| sprintf(fmt, t) }
- }.flatten
- end
-
- def mapdir(filelist)
- filelist.map {|fname|
- if File.exist?(fname) # objdir
- fname
- else # srcdir
- File.join(curr_srcdir(), fname)
- end
- }
- end
-
- def ruby_extentions(dir)
- Dir.open(dir) {|d|
- ents = d.select {|fname| /\.#{::Config::CONFIG['DLEXT']}\z/ =~ fname }
- if ents.empty?
- setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first"
- end
- return ents
- }
- end
-
- #
- # TASK clean
- #
-
- def exec_clean
- exec_task_traverse 'clean'
- rm_f ConfigTable.savefile
- rm_f 'InstalledFiles'
- end
-
- def clean_dir_bin(rel)
- end
-
- def clean_dir_lib(rel)
- end
-
- def clean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'clean' if File.file?('Makefile')
- end
-
- def clean_dir_data(rel)
- end
-
- #
- # TASK distclean
- #
-
- def exec_distclean
- exec_task_traverse 'distclean'
- rm_f ConfigTable.savefile
- rm_f 'InstalledFiles'
- end
-
- def distclean_dir_bin(rel)
- end
-
- def distclean_dir_lib(rel)
- end
-
- def distclean_dir_ext(rel)
- return unless extdir?(curr_srcdir())
- make 'distclean' if File.file?('Makefile')
- end
-
- #
- # lib
- #
-
- def exec_task_traverse(task)
- run_hook "pre-#{task}"
- FILETYPES.each do |type|
- if config('without-ext') == 'yes' and type == 'ext'
- $stderr.puts 'skipping ext/* by user option' if verbose?
- next
- end
- traverse task, type, "#{task}_dir_#{type}"
- end
- run_hook "post-#{task}"
- end
-
- def traverse(task, rel, mid)
- dive_into(rel) {
- run_hook "pre-#{task}"
- __send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '')
- all_dirs_in(curr_srcdir()).each do |d|
- traverse task, "#{rel}/#{d}", mid
- end
- run_hook "post-#{task}"
- }
- end
-
- def dive_into(rel)
- return unless File.dir?("#{@srcdir}/#{rel}")
-
- dir = File.basename(rel)
- Dir.mkdir dir unless File.dir?(dir)
- prevdir = Dir.pwd
- Dir.chdir dir
- $stderr.puts '---> ' + rel if verbose?
- @currdir = rel
- yield
- Dir.chdir prevdir
- $stderr.puts '<--- ' + rel if verbose?
- @currdir = File.dirname(rel)
- end
-
-end
-
-
-if $0 == __FILE__
- begin
- if multipackage_install?
- ToplevelInstallerMulti.invoke
- else
- ToplevelInstaller.invoke
- end
- rescue SetupError
- raise if $DEBUG
- $stderr.puts $!.message
- $stderr.puts "Try 'ruby #{$0} --help' for detailed usage."
- exit 1
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/i18n-0.4.2/CHANGELOG.textile b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/i18n-0.4.2/CHANGELOG.textile
deleted file mode 100644
index 31b4fb2e5d9..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/i18n-0.4.2/CHANGELOG.textile
+++ /dev/null
@@ -1,143 +0,0 @@
-h1. Changelog
-
-h2. 0.4.2 (2010-10-26)
-
-* "Improve UTF8 handling":http://github.com/svenfuchs/i18n/commit/e8d5820a3b08eeca28de1a2b9c8a6ad2b9e6476c
-* "Expose I18n::VERSION":http://github.com/svenfuchs/i18n/commit/b832037bac94c7144f45f3ff5e3b4e4089781726
-* "Better deprecation output":http://github.com/svenfuchs/i18n/commit/2bee924464b8a9c33d3d7852eb1c8423aa38cc25
-
-h2. 0.4.1 (2010-06-05)
-
-* "Fix interpolation failure on Ruby 1.9":http://github.com/svenfuchs/i18n/commit/8d45bedb11c4136c00e853d104b00a8e67ec4894
-
-h2. 0.4.0 (2010-05-27)
-
-* "The localization proc also receives the object as option":http://github.com/svenfuchs/i18n/commit/4a8cd9fa660daaa3078e24c5851353ca377d9213
-
-h2. 0.4.0.beta1 (2010-05-03)
-
-* "Renamed Fast backend to Memoize backend":http://github.com/svenfuchs/i18n/commit/f7f7dc12c00a19d3876223771e14f8671ff313cd
-
-* "Deprecate {{}} as interpolation syntax":http://github.com/svenfuchs/i18n/commit/8894ee521ef5788c415b625a6daf522af4c416e0
-
-* "Allow nil translation to be stored again":http://github.com/svenfuchs/i18n/commit/f2074f1e82d10c2e9a801c8cc2f2a0c7c30703ba
-
-h2. 0.4.0.beta (2010-04-30)
-
-* "Added a KeyValue backend":http://github.com/svenfuchs/i18n/commit/28ca5f53ade7f545f8c0804e93564d4686b416a4
-
-* "Added transliteration support":http://github.com/svenfuchs/i18n/commit/928fdb4794959e779e90f360eb01ba043672d8d5
-
-* "Create Flatten backend module to aid handling flatten translations":http://github.com/svenfuchs/i18n/commit/2ec9d6998aa8facd7b15a3ef47a96cf2471cd8a1
-
-* "Decouple the external separator (used when storing translations) from the internal separator in Fast and ActiveRecord backends":http://github.com/svenfuchs/i18n/commit/274cb4daa0ca5e3b2bd23b45eb7f9fc58f75a79d
-
-h2. 0.3.7 (2010-04-17)
-
-* "Speed up I18n.normalize_keys by caching reused normalizations and producing less garbage":http://github.com/svenfuchs/i18n/commit/819dac0fea9c29e6545801aa107e63e355728cd4
-
-h2. 0.3.6 (2010-03-23)
-
-* "Move gettext po parser to lib":http://github.com/svenfuchs/i18n/commit/b2f038663b55727ac2327e6f07a46ba5d69d600c
-
-* "Move I18n configuration to I18n.config":http://github.com/svenfuchs/i18n/commit/4a7baea86663ead8c681008c3e80a622f0546b07
-
-h2. 0.3.5 (2010-02-26)
-
-* "Delegate I18n.normalize_translation_keys to I18n.normalize_keys and deprecate
-the former":http://github.com/svenfuchs/i18n/commit/7284b04d5f5dd9679cb68875515cdd0cdfc96fef
-
-h2. 0.3.4 (2010-02-25)
-
-* "Rename I18n.normalize_translation_keys to I18n.normalize_keys and finally make it public":http://github.com/svenfuchs/i18n/commit/20b05fe5802df6c90fb70a4e3760b2b851b791b3
-
-* "Added CLDR supoprt":http://github.com/svenfuchs/i18n/commit/860eadf671a231e7f5dffb1bb27fa318ff7a8786
-
-h2. 0.3.3 (2009-12-29)
-
-* "Use lib/i18n/version":http://github.com/svenfuchs/i18n/commit/ff426c8e7a2438b814cb303adadec292dacb752e
-
-* "Added a benchmark suite":http://github.com/svenfuchs/i18n/commit/f9b5b9b113097724638bdab96862ffa404e67e70
-
-* "Ensure links can be handled recursively":http://github.com/svenfuchs/i18n/commit/2c50bd209f3fc24fe9dfa694c81be64340f09b7d
-
-* "Make sure we can lookup false values as translation data":http://github.com/svenfuchs/i18n/commit/561c82ba4b8921d03bfdf56cb2d0c2f287629001
-
-* "Added Fast backend module":http://github.com/svenfuchs/i18n/commit/bd2f09f0a251ca793b0e8ecc7e32177a2f091c23
-
-* "Added InterpolationCompiler backend module":http://github.com/svenfuchs/i18n/commit/91810887d1abfb28996a9183bc9004678290d28b
-
-h2. 0.3.2 (2009-12-12)
-
-* "Added Cascade backend":http://github.com/svenfuchs/i18n/commit/8009aef293e9ef8564c9005090d8380feabcaf6f
-
-h2. 0.3.1 (2009-12-11)
-
-* "Add PoParser to gemspec":http://github.com/svenfuchs/i18n/commit/d6b2763f39c932f66adb039b96882a472f883c51
-* "Enable custom separators for ActiveRecord backend":http://github.com/svenfuchs/i18n/commit/9341d3fcfc951cc31807ba672d2b5d90909ef3e5
-* "Pass interpolation values to interpolation procs":http://github.com/svenfuchs/i18n/commit/39c2ed8fbad645671cd5520ce7ad0aeefe2b0cca
-* "Fix that ngettext supports keys with dots":http://github.com/svenfuchs/i18n/commit/7362a43c34364d500de8899cfcca6bf1a5e6d1c8
-
-h2. 0.3.0 (2009-11-30)
-
-* "Gettext backend and helpers":http://github.com/svenfuchs/i18n/commit/35a1740d2f10b808548af352006950da4017e374
-* "Metadata module":http://github.com/svenfuchs/i18n/commit/2677208555179b36fcbe958c0e8bc642cf5bc020
-* "Basic ActiveRecord backend":http://github.com/svenfuchs/i18n/commit/786632d0b42de423ecf0969622efc87f1691e2a2
-* "Set encoding to UTF8 for all files":http://github.com/svenfuchs/i18n/commit/9be3d4a311b5bf583eec5d39986176cc40c112f2
-* "Chain backend":http://github.com/svenfuchs/i18n/commit/08259ffb88b3005403648d77bc1cbca0b92f3cf5
-* "Backend/cache implementation":http://github.com/svenfuchs/i18n/commit/e7bf15351cd2e27f5972eb40e65a5dd6f4a0feed
-* "Pluralization module":http://github.com/svenfuchs/i18n/commit/9ca4c9ed52d4706566a6abeb2d78722dcc5d4764
-* "add and adapt Globalize2 fallback implementation":http://github.com/svenfuchs/i18n/commit/1b37a303b27d6222b17162804b06323e5628768f
-* "move Simple backend implementation to a Base backend class and extend Simple from Base.":http://github.com/svenfuchs/i18n/commit/32ddc80a04e6aa247f6d6613bde7f78c73396cb4
-
-h2. 0.2.0 (2009-07-12)
-
-* "Allow using Ruby 1.9 syntax for string interpolation (API addition)":http://github.com/svenfuchs/i18n/commit/c6e0b06d512f2af57199a843a1d8a40241b32861
-* "Allow configuring the default scope separator, allow to pass a custom scope separator(API addition)":http://github.com/svenfuchs/i18n/commit/5b75bfbc348061adc11e3790187a187275bfd471 (e.g. I18n.t(:'foo|bar', :separator => '|')
-* "Pass :format option to #translate for #localize more useful lambda support":http://github.com/svenfuchs/i18n/commit/e277711b3c844fe7589b8d3f9af0f7d1b969a273
-* "Refactor Simple backend #resolve to #default and #resolve for more consistency. Now allows to pass lambdas as defaults and re-resolve Symbols":http://github.com/svenfuchs/i18n/commit/8c4ce3d923ce5fa73e973fe28217e18165549aba
-* "Add lambda support to #translate (API addition)":http://github.com/svenfuchs/i18n/commit/c90e62d8f7d3d5b78f34cfe328d871b58884f115
-* "Add lambda support to #localize (API addition)":http://github.com/svenfuchs/i18n/commit/9d390afcf33f3f469bb95e6888147152f6cc7442
-
-h2. 0.1.3 (2009-02-27)
-
-* "Remove unnecessary string encoding handling in the i18n simple backend which made the backend break on Ruby 1.9":http://github.com/svenfuchs/i18n/commit/4c3a970783861a94f2e89f46714fb3434e4f4f8d
-
-h2. 0.1.2 (2009-01-09)
-
-* "added #available_locales (returns an array of locales for which translations are available)":http://github.com/svenfuchs/i18n/commit/411f8fe7c8f3f89e9b6b921fa62ed66cb92f3af4
-* "flatten load_path before using it so that a nested array of paths won't throw up":http://github.com/svenfuchs/i18n/commit/d473a068a2b90aba98135deb225d6eb6d8104d70
-
-h2. 0.1.1 (2008-11-20)
-
-* "Use :'en' as a default locale (in favor of :'en-US')":http://github.com/svenfuchs/i18n/commit/c4b10b246aecf7da78cb2568dd0d2ab7e6b8a230
-* "Add #reload! to Simple backend":http://github.com/svenfuchs/i18n/commit/36dd2bd9973b9e1559728749a9daafa44693e964
-
-h2. 0.1.0 (2008-10-25)
-
-* "Fix Simple backend to distinguish false from nil values":http://github.com/svenfuchs/i18n/commit/39d9a47da14b5f3ba126af48923af8c30e135166
-* "Add #load_path to public api, add initialize to simple backend and remove #load_translations from public api":http://github.com/svenfuchs/i18n/commit/c4c5649e6bc8f020f1aaf5a5470bde048e22c82d
-* "Speed up Backend::Simple#interpolate":http://github.com/svenfuchs/i18n/commit/9e1ac6bf8833304e036323ec9932b9f33c468a35
-* "Remove #populate and #store_translations from public API":http://github.com/svenfuchs/i18n/commit/f4e514a80be7feb509f66824ee311905e2940900
-* "Use :other instead of :many as a plural key":http://github.com/svenfuchs/i18n/commit/0f8f20a2552bf6a2aa758d8fdd62a7154e4a1bf6
-* "Use a class instead of a module for Simple backend":http://github.com/svenfuchs/i18n/commit/08f051aa61320c17debde24a83268bc74e33b995
-* "Make Simple backend #interpolate deal with non-ASCII string encodings":http://github.com/svenfuchs/i18n/commit/d84a3f3f55543c084d5dc5d1fed613b8df148789
-* "Fix default arrays of non-existant keys returning the default array":http://github.com/svenfuchs/i18n/commit/6c04ca86c87f97dc78f07c2a4023644e5ba8b839
-
-h2. Initial implementation (June/July 2008)
-
-Initial implementation by "Sven Fuchs":http://www.workingwithrails.com/person/9963-sven-fuchs based on previous discussion/consensus of the rails-i18n team (alphabetical order) and many others:
-
-* "Matt Aimonetti":http://railsontherun.com
-* "Sven Fuchs":http://www.workingwithrails.com/person/9963-sven-fuchs
-* "Joshua Harvey":http://www.workingwithrails.com/person/759-joshua-harvey
-* "Saimon Moore":http://saimonmoore.net
-* "Stephan Soller":http://www.arkanis-development.de
-
-h2. More information
-
-* "Homepage":http://rails-i18n.org
-* "Wiki":http://rails-i18n.org/wiki
-* "Mailinglist":http://groups.google.com/group/rails-i18n
-* "About the project/history":http://www.artweb-design.de/2008/7/18/finally-ruby-on-rails-gets-internationalized
-* "Initial API Intro":http://www.artweb-design.de/2008/7/18/the-ruby-on-rails-i18n-core-api \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/Rakefile b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/Rakefile
deleted file mode 100644
index ad7723a5a7b..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/Rakefile
+++ /dev/null
@@ -1,365 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rdoc/task'
-require 'rubygems/package_task'
-
-require 'date'
-require 'rbconfig'
-
-require File.join(File.dirname(__FILE__), 'lib/rails', 'version')
-
-PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
-PKG_NAME = 'rails'
-PKG_VERSION = Rails::VERSION::STRING + PKG_BUILD
-PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
-PKG_DESTINATION = ENV["RAILS_PKG_DESTINATION"] || "../#{PKG_NAME}"
-
-RELEASE_NAME = "REL #{PKG_VERSION}"
-
-RUBY_FORGE_PROJECT = "rails"
-RUBY_FORGE_USER = "webster132"
-
-
-task :default => :test
-
-## This is required until the regular test task
-## below passes. It's not ideal, but at least
-## we can see the failures
-task :test do
- Dir['test/**/*_test.rb'].all? do |file|
- ruby = File.join(*RbConfig::CONFIG.values_at('bindir', 'RUBY_INSTALL_NAME'))
- system(ruby, '-Itest', file)
- end or raise "Failures"
-end
-
-Rake::TestTask.new("regular_test") do |t|
- t.libs << 'test'
- t.pattern = 'test/**/*_test.rb'
- t.warning = true
- t.verbose = true
-end
-
-
-BASE_DIRS = %w(
- app
- config/environments
- config/initializers
- config/locales
- db
- doc
- log
- lib
- lib/tasks
- public
- script
- script/performance
- test
- vendor
- vendor/plugins
- tmp/sessions
- tmp/cache
- tmp/sockets
- tmp/pids
-)
-
-APP_DIRS = %w( models controllers helpers views views/layouts )
-PUBLIC_DIRS = %w( images javascripts stylesheets )
-TEST_DIRS = %w( fixtures unit functional mocks mocks/development mocks/test )
-
-LOG_FILES = %w( server.log development.log test.log production.log )
-HTML_FILES = %w( 422.html 404.html 500.html index.html robots.txt favicon.ico images/rails.png
- javascripts/prototype.js javascripts/application.js
- javascripts/effects.js javascripts/dragdrop.js javascripts/controls.js )
-BIN_FILES = %w( about console destroy generate performance/benchmarker performance/profiler runner server plugin )
-
-VENDOR_LIBS = %w( actionpack activerecord actionmailer activesupport activeresource railties )
-
-
-desc "Generates a fresh Rails package with documentation"
-task :fresh_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content, :generate_documentation ]
-
-desc "Generates a fresh Rails package using GEMs with documentation"
-task :fresh_gem_rails => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_ties_content, :copy_gem_environment ]
-
-desc "Generates a fresh Rails package without documentation (faster)"
-task :fresh_rails_without_docs => [ :clean, :make_dir_structure, :initialize_file_stubs, :copy_vendor_libraries, :copy_ties_content ]
-
-desc "Generates a fresh Rails package without documentation (faster)"
-task :fresh_rails_without_docs_using_links => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
-
-desc "Generates minimal Rails package using symlinks"
-task :dev => [ :clean, :make_dir_structure, :initialize_file_stubs, :link_vendor_libraries, :copy_ties_content ]
-
-desc "Packages the fresh Rails package with documentation"
-task :package => [ :clean, :fresh_rails ] do
- system %{cd ..; tar -czvf #{PKG_NAME}-#{PKG_VERSION}.tgz #{PKG_NAME}}
- system %{cd ..; zip -r #{PKG_NAME}-#{PKG_VERSION}.zip #{PKG_NAME}}
-end
-
-task :clean do
- rm_rf PKG_DESTINATION
-end
-
-# Get external spinoffs -------------------------------------------------------------------
-
-desc "Updates railties to the latest version of the javascript spinoffs"
-task :update_js do
- for js in %w( prototype controls dragdrop effects )
- rm "html/javascripts/#{js}.js"
- cp "./../actionpack/lib/action_view/helpers/javascripts/#{js}.js", "html/javascripts"
- end
-end
-
-# Make directory structure ----------------------------------------------------------------
-
-def make_dest_dirs(dirs, path = '.')
- mkdir_p dirs.map { |dir| File.join(PKG_DESTINATION, path.to_s, dir) }
-end
-
-desc "Make the directory structure for the new Rails application"
-task :make_dir_structure => [ :make_base_dirs, :make_app_dirs, :make_public_dirs, :make_test_dirs ]
-
-task(:make_base_dirs) { make_dest_dirs BASE_DIRS }
-task(:make_app_dirs) { make_dest_dirs APP_DIRS, 'app' }
-task(:make_public_dirs) { make_dest_dirs PUBLIC_DIRS, 'public' }
-task(:make_test_dirs) { make_dest_dirs TEST_DIRS, 'test' }
-
-
-# Initialize file stubs -------------------------------------------------------------------
-
-desc "Initialize empty file stubs (such as for logging)"
-task :initialize_file_stubs => [ :initialize_log_files ]
-
-task :initialize_log_files do
- log_dir = File.join(PKG_DESTINATION, 'log')
- chmod 0777, log_dir
- LOG_FILES.each do |log_file|
- log_path = File.join(log_dir, log_file)
- touch log_path
- chmod 0666, log_path
- end
-end
-
-
-# Copy Vendors ----------------------------------------------------------------------------
-
-desc "Copy in all the Rails packages to vendor"
-task :copy_vendor_libraries do
- mkdir File.join(PKG_DESTINATION, 'vendor', 'rails')
- VENDOR_LIBS.each { |dir| cp_r File.join('..', dir), File.join(PKG_DESTINATION, 'vendor', 'rails', dir) }
- FileUtils.rm_r(Dir.glob(File.join(PKG_DESTINATION, 'vendor', 'rails', "**", ".svn")))
-end
-
-desc "Link in all the Rails packages to vendor"
-task :link_vendor_libraries do
- mkdir File.join(PKG_DESTINATION, 'vendor', 'rails')
- VENDOR_LIBS.each { |dir| ln_s File.join('..', '..', '..', dir), File.join(PKG_DESTINATION, 'vendor', 'rails', dir) }
-end
-
-
-# Copy Ties Content -----------------------------------------------------------------------
-
-desc "Make copies of all the default content of ties"
-task :copy_ties_content => [
- :copy_rootfiles, :copy_dispatches, :copy_html_files, :copy_application,
- :copy_configs, :copy_binfiles, :copy_test_helpers, :copy_app_doc_readme ]
-
-task :copy_dispatches do
- copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.rb")
- chmod 0755, "#{PKG_DESTINATION}/public/dispatch.rb"
-
- copy_with_rewritten_ruby_path("dispatches/dispatch.rb", "#{PKG_DESTINATION}/public/dispatch.cgi")
- chmod 0755, "#{PKG_DESTINATION}/public/dispatch.cgi"
-
- copy_with_rewritten_ruby_path("dispatches/dispatch.fcgi", "#{PKG_DESTINATION}/public/dispatch.fcgi")
- chmod 0755, "#{PKG_DESTINATION}/public/dispatch.fcgi"
-end
-
-task :copy_html_files do
- HTML_FILES.each { |file| cp File.join('html', file), File.join(PKG_DESTINATION, 'public', file) }
-end
-
-task :copy_application do
- cp "helpers/application_controller.rb", "#{PKG_DESTINATION}/app/controllers/application_controller.rb"
- cp "helpers/application_helper.rb", "#{PKG_DESTINATION}/app/helpers/application_helper.rb"
-end
-
-task :copy_configs do
- app_name = "rails"
- socket = nil
- require 'erb'
- File.open("#{PKG_DESTINATION}/config/database.yml", 'w') {|f| f.write ERB.new(IO.read("configs/databases/sqlite3.yml"), nil, '-').result(binding)}
-
- cp "configs/routes.rb", "#{PKG_DESTINATION}/config/routes.rb"
-
- cp "configs/initializers/backtrace_silencers.rb", "#{PKG_DESTINATION}/config/initializers/backtrace_silencers.rb"
- cp "configs/initializers/inflections.rb", "#{PKG_DESTINATION}/config/initializers/inflections.rb"
- cp "configs/initializers/mime_types.rb", "#{PKG_DESTINATION}/config/initializers/mime_types.rb"
- cp "configs/initializers/new_rails_defaults.rb", "#{PKG_DESTINATION}/config/initializers/new_rails_defaults.rb"
-
- cp "configs/locales/en.yml", "#{PKG_DESTINATION}/config/locales/en.yml"
-
- cp "configs/seeds.rb", "#{PKG_DESTINATION}/db/seeds.rb"
-
- cp "environments/boot.rb", "#{PKG_DESTINATION}/config/boot.rb"
- File.open("#{PKG_DESTINATION}/config/environment.rb", 'w') {|f| f.write ERB.new(IO.read("environments/environment.rb"), nil, '-').result(binding)}
- cp "environments/production.rb", "#{PKG_DESTINATION}/config/environments/production.rb"
- cp "environments/development.rb", "#{PKG_DESTINATION}/config/environments/development.rb"
- cp "environments/test.rb", "#{PKG_DESTINATION}/config/environments/test.rb"
-
-end
-
-task :copy_binfiles do
- BIN_FILES.each do |file|
- dest_file = File.join(PKG_DESTINATION, 'script', file)
- copy_with_rewritten_ruby_path(File.join('bin', file), dest_file)
- chmod 0755, dest_file
- end
-end
-
-task :copy_rootfiles do
- cp "fresh_rakefile", "#{PKG_DESTINATION}/Rakefile"
- cp "README", "#{PKG_DESTINATION}/README"
- cp "CHANGELOG", "#{PKG_DESTINATION}/CHANGELOG"
-end
-
-task :copy_test_helpers do
- cp "helpers/test_helper.rb", "#{PKG_DESTINATION}/test/test_helper.rb"
-end
-
-task :copy_app_doc_readme do
- cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
-end
-
-def copy_with_rewritten_ruby_path(src_file, dest_file)
- ruby = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
-
- File.open(dest_file, 'w') do |df|
- File.open(src_file) do |sf|
- line = sf.gets
- if (line =~ /#!.+ruby\s*/) != nil
- df.puts("#!#{ruby}")
- else
- df.puts(line)
- end
- df.write(sf.read)
- end
- end
-end
-
-desc 'Generate guides (for authors), use ONLY=foo to process just "foo.textile"'
-task :generate_guides do
- ruby "guides/rails_guides.rb"
-end
-
-
-# Generate documentation ------------------------------------------------------------------
-
-desc "Generate documentation for the framework and for the empty application"
-task :generate_documentation => [ :generate_app_doc, :generate_rails_framework_doc ]
-
-task :generate_rails_framework_doc do
- system %{cd #{PKG_DESTINATION}; rake doc:rails}
-end
-
-task :generate_app_doc do
- cp "doc/README_FOR_APP", "#{PKG_DESTINATION}/doc/README_FOR_APP"
- system %{cd #{PKG_DESTINATION}; rake doc:app}
-end
-
-RDoc::Task.new { |rdoc|
- rdoc.rdoc_dir = 'doc'
- rdoc.title = "Railties -- Gluing the Engine to the Rails"
- rdoc.options << '--line-numbers' << '--inline-source' << '--accessor' << 'cattr_accessor=object'
- rdoc.options << '--charset' << 'utf-8'
- rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
- rdoc.rdoc_files.include('README', 'CHANGELOG')
- rdoc.rdoc_files.include('lib/*.rb')
- rdoc.rdoc_files.include('lib/rails/*.rb')
- rdoc.rdoc_files.include('lib/rails_generator/*.rb')
- rdoc.rdoc_files.include('lib/commands/**/*.rb')
-}
-
-# Generate GEM ----------------------------------------------------------------------------
-
-task :copy_gem_environment do
- cp "environments/environment.rb", "#{PKG_DESTINATION}/config/environment.rb"
- chmod 0755, dest_file
-end
-
-
-PKG_FILES = FileList[
- '[a-zA-Z]*',
- 'bin/**/*',
- 'builtin/**/*',
- 'configs/**/*',
- 'doc/**/*',
- 'dispatches/**/*',
- 'environments/**/*',
- 'helpers/**/*',
- 'generators/**/*',
- 'html/**/*',
- 'lib/**/*'
-] - [ 'test' ]
-
-spec = Gem::Specification.new do |s|
- s.platform = Gem::Platform::RUBY
- s.name = 'rails'
- s.version = PKG_VERSION
- s.summary = "Web-application framework with template engine, control-flow layer, and ORM."
- s.description = <<-EOF
- Rails is a framework for building web-application using CGI, FCGI, mod_ruby, or WEBrick
- on top of either MySQL, PostgreSQL, SQLite, DB2, SQL Server, or Oracle with eRuby- or Builder-based templates.
- EOF
-
- s.add_dependency('rake', '>= 0.8.3')
- s.add_dependency('activesupport', '= 2.3.15' + PKG_BUILD)
- s.add_dependency('activerecord', '= 2.3.15' + PKG_BUILD)
- s.add_dependency('actionpack', '= 2.3.15' + PKG_BUILD)
- s.add_dependency('actionmailer', '= 2.3.15' + PKG_BUILD)
- s.add_dependency('activeresource', '= 2.3.15' + PKG_BUILD)
-
- s.rdoc_options << '--exclude' << '.'
-
- s.files = PKG_FILES
- s.require_path = 'lib'
- s.bindir = "bin" # Use these for applications.
- s.executables = ["rails"]
-
- s.author = "David Heinemeier Hansson"
- s.email = "david@loudthinking.com"
- s.homepage = "http://www.rubyonrails.org"
- s.rubyforge_project = "rails"
-end
-
-Gem::PackageTask.new(spec) do |pkg|
- pkg.gem_spec = spec
-end
-
-
-# Publishing -------------------------------------------------------
-desc "Publish the rails gem"
-task :pgem => [:gem] do
- Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
- `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
-end
-
-desc "Publish the guides"
-task :pguides => :generate_guides do
- mkdir_p 'pkg'
- `tar -czf pkg/guides.gz guides/output`
- Rake::SshFilePublisher.new("web.rubyonrails.org", "/u/sites/guides.rubyonrails.org/public", "pkg", "guides.gz").upload
- `ssh web.rubyonrails.org 'cd /u/sites/guides.rubyonrails.org/public/ && tar -xvzf guides.gz && mv guides/output/* . && rm -rf guides*'`
-end
-
-desc "Publish the release files to RubyForge."
-task :release => [ :package ] do
- require 'rake/contrib/rubyforgepublisher'
- require 'rubyforge'
-
- packages = %w( gem ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
-
- rubyforge = RubyForge.new
- rubyforge.login
- rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info.rb
deleted file mode 100644
index b2799f0955f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info.rb
+++ /dev/null
@@ -1,131 +0,0 @@
-module Rails
- module Info
- mattr_accessor :properties
- class << (@@properties = [])
- def names
- map &:first
- end
-
- def value_for(property_name)
- if property = assoc(property_name)
- property.last
- end
- end
- end
-
- class << self #:nodoc:
- def property(name, value = nil)
- value ||= yield
- properties << [name, value] if value
- rescue Exception
- end
-
- def frameworks
- %w( active_record action_pack active_resource action_mailer active_support )
- end
-
- def framework_version(framework)
- if Object.const_defined?(framework.classify)
- require "#{framework}/version"
- "#{framework.classify}::VERSION::STRING".constantize
- end
- end
-
- def edge_rails_revision(info = git_info)
- info[/commit ([a-z0-9-]+)/, 1] || freeze_edge_version
- end
-
- def freeze_edge_version
- if File.exist?(rails_vendor_root)
- begin
- File.readlines(File.join(rails_vendor_root,'REVISION')).first.strip
- rescue
- Dir[File.join(rails_vendor_root, 'TAG_*')].first.scan(/_(.+)$/).first.first rescue 'unknown'
- end
- end
- end
-
- def to_s
- column_width = properties.names.map {|name| name.length}.max
- ["About your application's environment", *properties.map do |property|
- "%-#{column_width}s %s" % property
- end] * "\n"
- end
-
- alias inspect to_s
-
- def to_html
- '<table>'.tap do |table|
- properties.each do |(name, value)|
- table << %(<tr><td class="name">#{CGI.escapeHTML(name.to_s)}</td>)
- table << %(<td class="value">#{CGI.escapeHTML(value.to_s)}</td></tr>)
- end
- table << '</table>'
- end
- end
-
- protected
- def rails_vendor_root
- @rails_vendor_root ||= "#{RAILS_ROOT}/vendor/rails"
- end
-
- def git_info
- env_lang, ENV['LC_ALL'] = ENV['LC_ALL'], 'C'
- Dir.chdir(rails_vendor_root) do
- silence_stderr { `git log -n 1` }
- end
- ensure
- ENV['LC_ALL'] = env_lang
- end
- end
-
- # The Ruby version and platform, e.g. "1.8.2 (powerpc-darwin8.2.0)".
- property 'Ruby version', "#{RUBY_VERSION} (#{RUBY_PLATFORM})"
-
- # The RubyGems version, if it's installed.
- property 'RubyGems version' do
- Gem::RubyGemsVersion
- end
-
- property 'Rack version' do
- ::Rack.release
- end
-
- # The Rails version.
- property 'Rails version' do
- Rails::VERSION::STRING
- end
-
- # Versions of each Rails framework (Active Record, Action Pack,
- # Active Resource, Action Mailer, and Active Support).
- frameworks.each do |framework|
- property "#{framework.titlecase} version" do
- framework_version(framework)
- end
- end
-
- # The Rails Git revision, if it's checked out into vendor/rails.
- property 'Edge Rails revision' do
- edge_rails_revision
- end
-
- # The application's location on the filesystem.
- property 'Application root' do
- File.expand_path(RAILS_ROOT)
- end
-
- # The current Rails environment (development, test, or production).
- property 'Environment' do
- RAILS_ENV
- end
-
- # The name of the database adapter for the current environment.
- property 'Database adapter' do
- ActiveRecord::Base.configurations[RAILS_ENV]['adapter']
- end
-
- property 'Database schema version' do
- ActiveRecord::Migrator.current_version rescue nil
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_controller.rb
deleted file mode 100644
index 05745d606d2..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_controller.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-class Rails::InfoController < ActionController::Base
- def properties
- if consider_all_requests_local || local_request?
- render :inline => Rails::Info.to_html
- else
- render :text => '<p>For security purposes, this information is only available to local requests.</p>', :status => 500
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_helper.rb
deleted file mode 100644
index e5605a8d9be..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails/info_helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module Rails::InfoHelper
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails_info_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails_info_controller.rb
deleted file mode 100644
index 2009eb3a994..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/builtin/rails_info/rails_info_controller.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-# Alias to ensure old public.html still works.
-RailsInfoController = Rails::InfoController
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/fresh_rakefile b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/fresh_rakefile
deleted file mode 100755
index 3bb0e8592a4..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/fresh_rakefile
+++ /dev/null
@@ -1,10 +0,0 @@
-# Add your own tasks in files placed in lib/tasks ending in .rake,
-# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
-
-require(File.join(File.dirname(__FILE__), 'config', 'boot'))
-
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-require 'tasks/rails'
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/404.html b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/404.html
deleted file mode 100644
index eff660b90c3..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/404.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <title>The page you were looking for doesn't exist (404)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/404.html -->
- <div class="dialog">
- <h1>The page you were looking for doesn't exist.</h1>
- <p>You may have mistyped the address or the page may have moved.</p>
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/422.html b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/422.html
deleted file mode 100644
index b54e4a3cadb..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/422.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <title>The change you wanted was rejected (422)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/422.html -->
- <div class="dialog">
- <h1>The change you wanted was rejected.</h1>
- <p>Maybe you tried to change something you didn't have access to.</p>
- </div>
-</body>
-</html> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/500.html b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/500.html
deleted file mode 100644
index ec3bbf02c43..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/500.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <title>We're sorry, but something went wrong (500)</title>
- <style type="text/css">
- body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
- div.dialog {
- width: 25em;
- padding: 0 4em;
- margin: 4em auto 0 auto;
- border: 1px solid #ccc;
- border-right-color: #999;
- border-bottom-color: #999;
- }
- h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
- </style>
-</head>
-
-<body>
- <!-- This file lives in public/500.html -->
- <div class="dialog">
- <h1>We're sorry, but something went wrong.</h1>
- <p>We've been notified about this issue and we'll take a look at it shortly.</p>
- </div>
-</body>
-</html>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/favicon.ico b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/favicon.ico
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/favicon.ico
+++ /dev/null
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/images/rails.png b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/images/rails.png
deleted file mode 100644
index d5edc04e65f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/images/rails.png
+++ /dev/null
Binary files differ
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/index.html b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/index.html
deleted file mode 100644
index 0dd5189fb7d..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/index.html
+++ /dev/null
@@ -1,275 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html>
- <head>
- <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
- <title>Ruby on Rails: Welcome aboard</title>
- <style type="text/css" media="screen">
- body {
- margin: 0;
- margin-bottom: 25px;
- padding: 0;
- background-color: #f0f0f0;
- font-family: "Lucida Grande", "Bitstream Vera Sans", "Verdana";
- font-size: 13px;
- color: #333;
- }
-
- h1 {
- font-size: 28px;
- color: #000;
- }
-
- a {color: #03c}
- a:hover {
- background-color: #03c;
- color: white;
- text-decoration: none;
- }
-
-
- #page {
- background-color: #f0f0f0;
- width: 750px;
- margin: 0;
- margin-left: auto;
- margin-right: auto;
- }
-
- #content {
- float: left;
- background-color: white;
- border: 3px solid #aaa;
- border-top: none;
- padding: 25px;
- width: 500px;
- }
-
- #sidebar {
- float: right;
- width: 175px;
- }
-
- #footer {
- clear: both;
- }
-
-
- #header, #about, #getting-started {
- padding-left: 75px;
- padding-right: 30px;
- }
-
-
- #header {
- background-image: url("images/rails.png");
- background-repeat: no-repeat;
- background-position: top left;
- height: 64px;
- }
- #header h1, #header h2 {margin: 0}
- #header h2 {
- color: #888;
- font-weight: normal;
- font-size: 16px;
- }
-
-
- #about h3 {
- margin: 0;
- margin-bottom: 10px;
- font-size: 14px;
- }
-
- #about-content {
- background-color: #ffd;
- border: 1px solid #fc0;
- margin-left: -11px;
- }
- #about-content table {
- margin-top: 10px;
- margin-bottom: 10px;
- font-size: 11px;
- border-collapse: collapse;
- }
- #about-content td {
- padding: 10px;
- padding-top: 3px;
- padding-bottom: 3px;
- }
- #about-content td.name {color: #555}
- #about-content td.value {color: #000}
-
- #about-content.failure {
- background-color: #fcc;
- border: 1px solid #f00;
- }
- #about-content.failure p {
- margin: 0;
- padding: 10px;
- }
-
-
- #getting-started {
- border-top: 1px solid #ccc;
- margin-top: 25px;
- padding-top: 15px;
- }
- #getting-started h1 {
- margin: 0;
- font-size: 20px;
- }
- #getting-started h2 {
- margin: 0;
- font-size: 14px;
- font-weight: normal;
- color: #333;
- margin-bottom: 25px;
- }
- #getting-started ol {
- margin-left: 0;
- padding-left: 0;
- }
- #getting-started li {
- font-size: 18px;
- color: #888;
- margin-bottom: 25px;
- }
- #getting-started li h2 {
- margin: 0;
- font-weight: normal;
- font-size: 18px;
- color: #333;
- }
- #getting-started li p {
- color: #555;
- font-size: 13px;
- }
-
-
- #search {
- margin: 0;
- padding-top: 10px;
- padding-bottom: 10px;
- font-size: 11px;
- }
- #search input {
- font-size: 11px;
- margin: 2px;
- }
- #search-text {width: 170px}
-
-
- #sidebar ul {
- margin-left: 0;
- padding-left: 0;
- }
- #sidebar ul h3 {
- margin-top: 25px;
- font-size: 16px;
- padding-bottom: 10px;
- border-bottom: 1px solid #ccc;
- }
- #sidebar li {
- list-style-type: none;
- }
- #sidebar ul.links li {
- margin-bottom: 5px;
- }
-
- </style>
- <script type="text/javascript" src="javascripts/prototype.js"></script>
- <script type="text/javascript" src="javascripts/effects.js"></script>
- <script type="text/javascript">
- function about() {
- if (Element.empty('about-content')) {
- new Ajax.Updater('about-content', 'rails/info/properties', {
- method: 'get',
- onFailure: function() {Element.classNames('about-content').add('failure')},
- onComplete: function() {new Effect.BlindDown('about-content', {duration: 0.25})}
- });
- } else {
- new Effect[Element.visible('about-content') ?
- 'BlindUp' : 'BlindDown']('about-content', {duration: 0.25});
- }
- }
-
- window.onload = function() {
- $('search-text').value = '';
- $('search').onsubmit = function() {
- $('search-text').value = 'site:rubyonrails.org ' + $F('search-text');
- }
- }
- </script>
- </head>
- <body>
- <div id="page">
- <div id="sidebar">
- <ul id="sidebar-items">
- <li>
- <form id="search" action="http://www.google.com/search" method="get">
- <input type="hidden" name="hl" value="en" />
- <input type="text" id="search-text" name="q" value="site:rubyonrails.org " />
- <input type="submit" value="Search" /> the Rails site
- </form>
- </li>
-
- <li>
- <h3>Join the community</h3>
- <ul class="links">
- <li><a href="http://www.rubyonrails.org/">Ruby on Rails</a></li>
- <li><a href="http://weblog.rubyonrails.org/">Official weblog</a></li>
- <li><a href="http://wiki.rubyonrails.org/">Wiki</a></li>
- </ul>
- </li>
-
- <li>
- <h3>Browse the documentation</h3>
- <ul class="links">
- <li><a href="http://api.rubyonrails.org/">Rails API</a></li>
- <li><a href="http://stdlib.rubyonrails.org/">Ruby standard library</a></li>
- <li><a href="http://corelib.rubyonrails.org/">Ruby core</a></li>
- <li><a href="http://guides.rubyonrails.org/">Rails Guides</a></li>
- </ul>
- </li>
- </ul>
- </div>
-
- <div id="content">
- <div id="header">
- <h1>Welcome aboard</h1>
- <h2>You&rsquo;re riding Ruby on Rails!</h2>
- </div>
-
- <div id="about">
- <h3><a href="rails/info/properties" onclick="about(); return false">About your application&rsquo;s environment</a></h3>
- <div id="about-content" style="display: none"></div>
- </div>
-
- <div id="getting-started">
- <h1>Getting started</h1>
- <h2>Here&rsquo;s how to get rolling:</h2>
-
- <ol>
- <li>
- <h2>Use <tt>script/generate</tt> to create your models and controllers</h2>
- <p>To see all available options, run it without parameters.</p>
- </li>
-
- <li>
- <h2>Set up a default route and remove or rename this file</h2>
- <p>Routes are set up in config/routes.rb.</p>
- </li>
-
- <li>
- <h2>Create your database</h2>
- <p>Run <tt>rake db:migrate</tt> to create your database. If you're not using SQLite (the default), edit <tt>config/database.yml</tt> with your username and password.</p>
- </li>
- </ol>
- </div>
- </div>
-
- <div id="footer">&nbsp;</div>
- </div>
- </body>
-</html> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/application.js b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/application.js
deleted file mode 100644
index fe4577696b2..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/application.js
+++ /dev/null
@@ -1,2 +0,0 @@
-// Place your application-specific JavaScript functions and classes here
-// This file is automatically included by javascript_include_tag :defaults
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/controls.js b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/controls.js
deleted file mode 100644
index ca29aefdd1f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/controls.js
+++ /dev/null
@@ -1,963 +0,0 @@
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005-2008 Ivan Krstic (http://blogs.law.harvard.edu/ivan)
-// (c) 2005-2008 Jon Tirsen (http://www.tirsen.com)
-// Contributors:
-// Richard Livsey
-// Rahul Bhargava
-// Rob Wills
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-// Autocompleter.Base handles all the autocompletion functionality
-// that's independent of the data source for autocompletion. This
-// includes drawing the autocompletion menu, observing keyboard
-// and mouse events, and similar.
-//
-// Specific autocompleters need to provide, at the very least,
-// a getUpdatedChoices function that will be invoked every time
-// the text inside the monitored textbox changes. This method
-// should get the text for which to provide autocompletion by
-// invoking this.getToken(), NOT by directly accessing
-// this.element.value. This is to allow incremental tokenized
-// autocompletion. Specific auto-completion logic (AJAX, etc)
-// belongs in getUpdatedChoices.
-//
-// Tokenized incremental autocompletion is enabled automatically
-// when an autocompleter is instantiated with the 'tokens' option
-// in the options parameter, e.g.:
-// new Ajax.Autocompleter('id','upd', '/url/', { tokens: ',' });
-// will incrementally autocomplete with a comma as the token.
-// Additionally, ',' in the above example can be replaced with
-// a token array, e.g. { tokens: [',', '\n'] } which
-// enables autocompletion on multiple tokens. This is most
-// useful when one of the tokens is \n (a newline), as it
-// allows smart autocompletion after linebreaks.
-
-if(typeof Effect == 'undefined')
- throw("controls.js requires including script.aculo.us' effects.js library");
-
-var Autocompleter = { };
-Autocompleter.Base = Class.create({
- baseInitialize: function(element, update, options) {
- element = $(element);
- this.element = element;
- this.update = $(update);
- this.hasFocus = false;
- this.changed = false;
- this.active = false;
- this.index = 0;
- this.entryCount = 0;
- this.oldElementValue = this.element.value;
-
- if(this.setOptions)
- this.setOptions(options);
- else
- this.options = options || { };
-
- this.options.paramName = this.options.paramName || this.element.name;
- this.options.tokens = this.options.tokens || [];
- this.options.frequency = this.options.frequency || 0.4;
- this.options.minChars = this.options.minChars || 1;
- this.options.onShow = this.options.onShow ||
- function(element, update){
- if(!update.style.position || update.style.position=='absolute') {
- update.style.position = 'absolute';
- Position.clone(element, update, {
- setHeight: false,
- offsetTop: element.offsetHeight
- });
- }
- Effect.Appear(update,{duration:0.15});
- };
- this.options.onHide = this.options.onHide ||
- function(element, update){ new Effect.Fade(update,{duration:0.15}) };
-
- if(typeof(this.options.tokens) == 'string')
- this.options.tokens = new Array(this.options.tokens);
- // Force carriage returns as token delimiters anyway
- if (!this.options.tokens.include('\n'))
- this.options.tokens.push('\n');
-
- this.observer = null;
-
- this.element.setAttribute('autocomplete','off');
-
- Element.hide(this.update);
-
- Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this));
- Event.observe(this.element, 'keydown', this.onKeyPress.bindAsEventListener(this));
- },
-
- show: function() {
- if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update);
- if(!this.iefix &&
- (Prototype.Browser.IE) &&
- (Element.getStyle(this.update, 'position')=='absolute')) {
- new Insertion.After(this.update,
- '<iframe id="' + this.update.id + '_iefix" '+
- 'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" ' +
- 'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');
- this.iefix = $(this.update.id+'_iefix');
- }
- if(this.iefix) setTimeout(this.fixIEOverlapping.bind(this), 50);
- },
-
- fixIEOverlapping: function() {
- Position.clone(this.update, this.iefix, {setTop:(!this.update.style.height)});
- this.iefix.style.zIndex = 1;
- this.update.style.zIndex = 2;
- Element.show(this.iefix);
- },
-
- hide: function() {
- this.stopIndicator();
- if(Element.getStyle(this.update, 'display')!='none') this.options.onHide(this.element, this.update);
- if(this.iefix) Element.hide(this.iefix);
- },
-
- startIndicator: function() {
- if(this.options.indicator) Element.show(this.options.indicator);
- },
-
- stopIndicator: function() {
- if(this.options.indicator) Element.hide(this.options.indicator);
- },
-
- onKeyPress: function(event) {
- if(this.active)
- switch(event.keyCode) {
- case Event.KEY_TAB:
- case Event.KEY_RETURN:
- this.selectEntry();
- Event.stop(event);
- case Event.KEY_ESC:
- this.hide();
- this.active = false;
- Event.stop(event);
- return;
- case Event.KEY_LEFT:
- case Event.KEY_RIGHT:
- return;
- case Event.KEY_UP:
- this.markPrevious();
- this.render();
- Event.stop(event);
- return;
- case Event.KEY_DOWN:
- this.markNext();
- this.render();
- Event.stop(event);
- return;
- }
- else
- if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||
- (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return;
-
- this.changed = true;
- this.hasFocus = true;
-
- if(this.observer) clearTimeout(this.observer);
- this.observer =
- setTimeout(this.onObserverEvent.bind(this), this.options.frequency*1000);
- },
-
- activate: function() {
- this.changed = false;
- this.hasFocus = true;
- this.getUpdatedChoices();
- },
-
- onHover: function(event) {
- var element = Event.findElement(event, 'LI');
- if(this.index != element.autocompleteIndex)
- {
- this.index = element.autocompleteIndex;
- this.render();
- }
- Event.stop(event);
- },
-
- onClick: function(event) {
- var element = Event.findElement(event, 'LI');
- this.index = element.autocompleteIndex;
- this.selectEntry();
- this.hide();
- },
-
- onBlur: function(event) {
- // needed to make click events working
- setTimeout(this.hide.bind(this), 250);
- this.hasFocus = false;
- this.active = false;
- },
-
- render: function() {
- if(this.entryCount > 0) {
- for (var i = 0; i < this.entryCount; i++)
- this.index==i ?
- Element.addClassName(this.getEntry(i),"selected") :
- Element.removeClassName(this.getEntry(i),"selected");
- if(this.hasFocus) {
- this.show();
- this.active = true;
- }
- } else {
- this.active = false;
- this.hide();
- }
- },
-
- markPrevious: function() {
- if(this.index > 0) this.index--;
- else this.index = this.entryCount-1;
- this.getEntry(this.index).scrollIntoView(true);
- },
-
- markNext: function() {
- if(this.index < this.entryCount-1) this.index++;
- else this.index = 0;
- this.getEntry(this.index).scrollIntoView(false);
- },
-
- getEntry: function(index) {
- return this.update.firstChild.childNodes[index];
- },
-
- getCurrentEntry: function() {
- return this.getEntry(this.index);
- },
-
- selectEntry: function() {
- this.active = false;
- this.updateElement(this.getCurrentEntry());
- },
-
- updateElement: function(selectedElement) {
- if (this.options.updateElement) {
- this.options.updateElement(selectedElement);
- return;
- }
- var value = '';
- if (this.options.select) {
- var nodes = $(selectedElement).select('.' + this.options.select) || [];
- if(nodes.length>0) value = Element.collectTextNodes(nodes[0], this.options.select);
- } else
- value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
-
- var bounds = this.getTokenBounds();
- if (bounds[0] != -1) {
- var newValue = this.element.value.substr(0, bounds[0]);
- var whitespace = this.element.value.substr(bounds[0]).match(/^\s+/);
- if (whitespace)
- newValue += whitespace[0];
- this.element.value = newValue + value + this.element.value.substr(bounds[1]);
- } else {
- this.element.value = value;
- }
- this.oldElementValue = this.element.value;
- this.element.focus();
-
- if (this.options.afterUpdateElement)
- this.options.afterUpdateElement(this.element, selectedElement);
- },
-
- updateChoices: function(choices) {
- if(!this.changed && this.hasFocus) {
- this.update.innerHTML = choices;
- Element.cleanWhitespace(this.update);
- Element.cleanWhitespace(this.update.down());
-
- if(this.update.firstChild && this.update.down().childNodes) {
- this.entryCount =
- this.update.down().childNodes.length;
- for (var i = 0; i < this.entryCount; i++) {
- var entry = this.getEntry(i);
- entry.autocompleteIndex = i;
- this.addObservers(entry);
- }
- } else {
- this.entryCount = 0;
- }
-
- this.stopIndicator();
- this.index = 0;
-
- if(this.entryCount==1 && this.options.autoSelect) {
- this.selectEntry();
- this.hide();
- } else {
- this.render();
- }
- }
- },
-
- addObservers: function(element) {
- Event.observe(element, "mouseover", this.onHover.bindAsEventListener(this));
- Event.observe(element, "click", this.onClick.bindAsEventListener(this));
- },
-
- onObserverEvent: function() {
- this.changed = false;
- this.tokenBounds = null;
- if(this.getToken().length>=this.options.minChars) {
- this.getUpdatedChoices();
- } else {
- this.active = false;
- this.hide();
- }
- this.oldElementValue = this.element.value;
- },
-
- getToken: function() {
- var bounds = this.getTokenBounds();
- return this.element.value.substring(bounds[0], bounds[1]).strip();
- },
-
- getTokenBounds: function() {
- if (null != this.tokenBounds) return this.tokenBounds;
- var value = this.element.value;
- if (value.strip().empty()) return [-1, 0];
- var diff = arguments.callee.getFirstDifferencePos(value, this.oldElementValue);
- var offset = (diff == this.oldElementValue.length ? 1 : 0);
- var prevTokenPos = -1, nextTokenPos = value.length;
- var tp;
- for (var index = 0, l = this.options.tokens.length; index < l; ++index) {
- tp = value.lastIndexOf(this.options.tokens[index], diff + offset - 1);
- if (tp > prevTokenPos) prevTokenPos = tp;
- tp = value.indexOf(this.options.tokens[index], diff + offset);
- if (-1 != tp && tp < nextTokenPos) nextTokenPos = tp;
- }
- return (this.tokenBounds = [prevTokenPos + 1, nextTokenPos]);
- }
-});
-
-Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos = function(newS, oldS) {
- var boundary = Math.min(newS.length, oldS.length);
- for (var index = 0; index < boundary; ++index)
- if (newS[index] != oldS[index])
- return index;
- return boundary;
-};
-
-Ajax.Autocompleter = Class.create(Autocompleter.Base, {
- initialize: function(element, update, url, options) {
- this.baseInitialize(element, update, options);
- this.options.asynchronous = true;
- this.options.onComplete = this.onComplete.bind(this);
- this.options.defaultParams = this.options.parameters || null;
- this.url = url;
- },
-
- getUpdatedChoices: function() {
- this.startIndicator();
-
- var entry = encodeURIComponent(this.options.paramName) + '=' +
- encodeURIComponent(this.getToken());
-
- this.options.parameters = this.options.callback ?
- this.options.callback(this.element, entry) : entry;
-
- if(this.options.defaultParams)
- this.options.parameters += '&' + this.options.defaultParams;
-
- new Ajax.Request(this.url, this.options);
- },
-
- onComplete: function(request) {
- this.updateChoices(request.responseText);
- }
-});
-
-// The local array autocompleter. Used when you'd prefer to
-// inject an array of autocompletion options into the page, rather
-// than sending out Ajax queries, which can be quite slow sometimes.
-//
-// The constructor takes four parameters. The first two are, as usual,
-// the id of the monitored textbox, and id of the autocompletion menu.
-// The third is the array you want to autocomplete from, and the fourth
-// is the options block.
-//
-// Extra local autocompletion options:
-// - choices - How many autocompletion choices to offer
-//
-// - partialSearch - If false, the autocompleter will match entered
-// text only at the beginning of strings in the
-// autocomplete array. Defaults to true, which will
-// match text at the beginning of any *word* in the
-// strings in the autocomplete array. If you want to
-// search anywhere in the string, additionally set
-// the option fullSearch to true (default: off).
-//
-// - fullSsearch - Search anywhere in autocomplete array strings.
-//
-// - partialChars - How many characters to enter before triggering
-// a partial match (unlike minChars, which defines
-// how many characters are required to do any match
-// at all). Defaults to 2.
-//
-// - ignoreCase - Whether to ignore case when autocompleting.
-// Defaults to true.
-//
-// It's possible to pass in a custom function as the 'selector'
-// option, if you prefer to write your own autocompletion logic.
-// In that case, the other options above will not apply unless
-// you support them.
-
-Autocompleter.Local = Class.create(Autocompleter.Base, {
- initialize: function(element, update, array, options) {
- this.baseInitialize(element, update, options);
- this.options.array = array;
- },
-
- getUpdatedChoices: function() {
- this.updateChoices(this.options.selector(this));
- },
-
- setOptions: function(options) {
- this.options = Object.extend({
- choices: 10,
- partialSearch: true,
- partialChars: 2,
- ignoreCase: true,
- fullSearch: false,
- selector: function(instance) {
- var ret = []; // Beginning matches
- var partial = []; // Inside matches
- var entry = instance.getToken();
- var count = 0;
-
- for (var i = 0; i < instance.options.array.length &&
- ret.length < instance.options.choices ; i++) {
-
- var elem = instance.options.array[i];
- var foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase()) :
- elem.indexOf(entry);
-
- while (foundPos != -1) {
- if (foundPos == 0 && elem.length != entry.length) {
- ret.push("<li><strong>" + elem.substr(0, entry.length) + "</strong>" +
- elem.substr(entry.length) + "</li>");
- break;
- } else if (entry.length >= instance.options.partialChars &&
- instance.options.partialSearch && foundPos != -1) {
- if (instance.options.fullSearch || /\s/.test(elem.substr(foundPos-1,1))) {
- partial.push("<li>" + elem.substr(0, foundPos) + "<strong>" +
- elem.substr(foundPos, entry.length) + "</strong>" + elem.substr(
- foundPos + entry.length) + "</li>");
- break;
- }
- }
-
- foundPos = instance.options.ignoreCase ?
- elem.toLowerCase().indexOf(entry.toLowerCase(), foundPos + 1) :
- elem.indexOf(entry, foundPos + 1);
-
- }
- }
- if (partial.length)
- ret = ret.concat(partial.slice(0, instance.options.choices - ret.length));
- return "<ul>" + ret.join('') + "</ul>";
- }
- }, options || { });
- }
-});
-
-// AJAX in-place editor and collection editor
-// Full rewrite by Christophe Porteneuve <tdd@tddsworld.com> (April 2007).
-
-// Use this if you notice weird scrolling problems on some browsers,
-// the DOM might be a bit confused when this gets called so do this
-// waits 1 ms (with setTimeout) until it does the activation
-Field.scrollFreeActivate = function(field) {
- setTimeout(function() {
- Field.activate(field);
- }, 1);
-};
-
-Ajax.InPlaceEditor = Class.create({
- initialize: function(element, url, options) {
- this.url = url;
- this.element = element = $(element);
- this.prepareOptions();
- this._controls = { };
- arguments.callee.dealWithDeprecatedOptions(options); // DEPRECATION LAYER!!!
- Object.extend(this.options, options || { });
- if (!this.options.formId && this.element.id) {
- this.options.formId = this.element.id + '-inplaceeditor';
- if ($(this.options.formId))
- this.options.formId = '';
- }
- if (this.options.externalControl)
- this.options.externalControl = $(this.options.externalControl);
- if (!this.options.externalControl)
- this.options.externalControlOnly = false;
- this._originalBackground = this.element.getStyle('background-color') || 'transparent';
- this.element.title = this.options.clickToEditText;
- this._boundCancelHandler = this.handleFormCancellation.bind(this);
- this._boundComplete = (this.options.onComplete || Prototype.emptyFunction).bind(this);
- this._boundFailureHandler = this.handleAJAXFailure.bind(this);
- this._boundSubmitHandler = this.handleFormSubmission.bind(this);
- this._boundWrapperHandler = this.wrapUp.bind(this);
- this.registerListeners();
- },
- checkForEscapeOrReturn: function(e) {
- if (!this._editing || e.ctrlKey || e.altKey || e.shiftKey) return;
- if (Event.KEY_ESC == e.keyCode)
- this.handleFormCancellation(e);
- else if (Event.KEY_RETURN == e.keyCode)
- this.handleFormSubmission(e);
- },
- createControl: function(mode, handler, extraClasses) {
- var control = this.options[mode + 'Control'];
- var text = this.options[mode + 'Text'];
- if ('button' == control) {
- var btn = document.createElement('input');
- btn.type = 'submit';
- btn.value = text;
- btn.className = 'editor_' + mode + '_button';
- if ('cancel' == mode)
- btn.onclick = this._boundCancelHandler;
- this._form.appendChild(btn);
- this._controls[mode] = btn;
- } else if ('link' == control) {
- var link = document.createElement('a');
- link.href = '#';
- link.appendChild(document.createTextNode(text));
- link.onclick = 'cancel' == mode ? this._boundCancelHandler : this._boundSubmitHandler;
- link.className = 'editor_' + mode + '_link';
- if (extraClasses)
- link.className += ' ' + extraClasses;
- this._form.appendChild(link);
- this._controls[mode] = link;
- }
- },
- createEditField: function() {
- var text = (this.options.loadTextURL ? this.options.loadingText : this.getText());
- var fld;
- if (1 >= this.options.rows && !/\r|\n/.test(this.getText())) {
- fld = document.createElement('input');
- fld.type = 'text';
- var size = this.options.size || this.options.cols || 0;
- if (0 < size) fld.size = size;
- } else {
- fld = document.createElement('textarea');
- fld.rows = (1 >= this.options.rows ? this.options.autoRows : this.options.rows);
- fld.cols = this.options.cols || 40;
- }
- fld.name = this.options.paramName;
- fld.value = text; // No HTML breaks conversion anymore
- fld.className = 'editor_field';
- if (this.options.submitOnBlur)
- fld.onblur = this._boundSubmitHandler;
- this._controls.editor = fld;
- if (this.options.loadTextURL)
- this.loadExternalText();
- this._form.appendChild(this._controls.editor);
- },
- createForm: function() {
- var ipe = this;
- function addText(mode, condition) {
- var text = ipe.options['text' + mode + 'Controls'];
- if (!text || condition === false) return;
- ipe._form.appendChild(document.createTextNode(text));
- };
- this._form = $(document.createElement('form'));
- this._form.id = this.options.formId;
- this._form.addClassName(this.options.formClassName);
- this._form.onsubmit = this._boundSubmitHandler;
- this.createEditField();
- if ('textarea' == this._controls.editor.tagName.toLowerCase())
- this._form.appendChild(document.createElement('br'));
- if (this.options.onFormCustomization)
- this.options.onFormCustomization(this, this._form);
- addText('Before', this.options.okControl || this.options.cancelControl);
- this.createControl('ok', this._boundSubmitHandler);
- addText('Between', this.options.okControl && this.options.cancelControl);
- this.createControl('cancel', this._boundCancelHandler, 'editor_cancel');
- addText('After', this.options.okControl || this.options.cancelControl);
- },
- destroy: function() {
- if (this._oldInnerHTML)
- this.element.innerHTML = this._oldInnerHTML;
- this.leaveEditMode();
- this.unregisterListeners();
- },
- enterEditMode: function(e) {
- if (this._saving || this._editing) return;
- this._editing = true;
- this.triggerCallback('onEnterEditMode');
- if (this.options.externalControl)
- this.options.externalControl.hide();
- this.element.hide();
- this.createForm();
- this.element.parentNode.insertBefore(this._form, this.element);
- if (!this.options.loadTextURL)
- this.postProcessEditField();
- if (e) Event.stop(e);
- },
- enterHover: function(e) {
- if (this.options.hoverClassName)
- this.element.addClassName(this.options.hoverClassName);
- if (this._saving) return;
- this.triggerCallback('onEnterHover');
- },
- getText: function() {
- return this.element.innerHTML.unescapeHTML();
- },
- handleAJAXFailure: function(transport) {
- this.triggerCallback('onFailure', transport);
- if (this._oldInnerHTML) {
- this.element.innerHTML = this._oldInnerHTML;
- this._oldInnerHTML = null;
- }
- },
- handleFormCancellation: function(e) {
- this.wrapUp();
- if (e) Event.stop(e);
- },
- handleFormSubmission: function(e) {
- var form = this._form;
- var value = $F(this._controls.editor);
- this.prepareSubmission();
- var params = this.options.callback(form, value) || '';
- if (Object.isString(params))
- params = params.toQueryParams();
- params.editorId = this.element.id;
- if (this.options.htmlResponse) {
- var options = Object.extend({ evalScripts: true }, this.options.ajaxOptions);
- Object.extend(options, {
- parameters: params,
- onComplete: this._boundWrapperHandler,
- onFailure: this._boundFailureHandler
- });
- new Ajax.Updater({ success: this.element }, this.url, options);
- } else {
- var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
- Object.extend(options, {
- parameters: params,
- onComplete: this._boundWrapperHandler,
- onFailure: this._boundFailureHandler
- });
- new Ajax.Request(this.url, options);
- }
- if (e) Event.stop(e);
- },
- leaveEditMode: function() {
- this.element.removeClassName(this.options.savingClassName);
- this.removeForm();
- this.leaveHover();
- this.element.style.backgroundColor = this._originalBackground;
- this.element.show();
- if (this.options.externalControl)
- this.options.externalControl.show();
- this._saving = false;
- this._editing = false;
- this._oldInnerHTML = null;
- this.triggerCallback('onLeaveEditMode');
- },
- leaveHover: function(e) {
- if (this.options.hoverClassName)
- this.element.removeClassName(this.options.hoverClassName);
- if (this._saving) return;
- this.triggerCallback('onLeaveHover');
- },
- loadExternalText: function() {
- this._form.addClassName(this.options.loadingClassName);
- this._controls.editor.disabled = true;
- var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
- Object.extend(options, {
- parameters: 'editorId=' + encodeURIComponent(this.element.id),
- onComplete: Prototype.emptyFunction,
- onSuccess: function(transport) {
- this._form.removeClassName(this.options.loadingClassName);
- var text = transport.responseText;
- if (this.options.stripLoadedTextTags)
- text = text.stripTags();
- this._controls.editor.value = text;
- this._controls.editor.disabled = false;
- this.postProcessEditField();
- }.bind(this),
- onFailure: this._boundFailureHandler
- });
- new Ajax.Request(this.options.loadTextURL, options);
- },
- postProcessEditField: function() {
- var fpc = this.options.fieldPostCreation;
- if (fpc)
- $(this._controls.editor)['focus' == fpc ? 'focus' : 'activate']();
- },
- prepareOptions: function() {
- this.options = Object.clone(Ajax.InPlaceEditor.DefaultOptions);
- Object.extend(this.options, Ajax.InPlaceEditor.DefaultCallbacks);
- [this._extraDefaultOptions].flatten().compact().each(function(defs) {
- Object.extend(this.options, defs);
- }.bind(this));
- },
- prepareSubmission: function() {
- this._saving = true;
- this.removeForm();
- this.leaveHover();
- this.showSaving();
- },
- registerListeners: function() {
- this._listeners = { };
- var listener;
- $H(Ajax.InPlaceEditor.Listeners).each(function(pair) {
- listener = this[pair.value].bind(this);
- this._listeners[pair.key] = listener;
- if (!this.options.externalControlOnly)
- this.element.observe(pair.key, listener);
- if (this.options.externalControl)
- this.options.externalControl.observe(pair.key, listener);
- }.bind(this));
- },
- removeForm: function() {
- if (!this._form) return;
- this._form.remove();
- this._form = null;
- this._controls = { };
- },
- showSaving: function() {
- this._oldInnerHTML = this.element.innerHTML;
- this.element.innerHTML = this.options.savingText;
- this.element.addClassName(this.options.savingClassName);
- this.element.style.backgroundColor = this._originalBackground;
- this.element.show();
- },
- triggerCallback: function(cbName, arg) {
- if ('function' == typeof this.options[cbName]) {
- this.options[cbName](this, arg);
- }
- },
- unregisterListeners: function() {
- $H(this._listeners).each(function(pair) {
- if (!this.options.externalControlOnly)
- this.element.stopObserving(pair.key, pair.value);
- if (this.options.externalControl)
- this.options.externalControl.stopObserving(pair.key, pair.value);
- }.bind(this));
- },
- wrapUp: function(transport) {
- this.leaveEditMode();
- // Can't use triggerCallback due to backward compatibility: requires
- // binding + direct element
- this._boundComplete(transport, this.element);
- }
-});
-
-Object.extend(Ajax.InPlaceEditor.prototype, {
- dispose: Ajax.InPlaceEditor.prototype.destroy
-});
-
-Ajax.InPlaceCollectionEditor = Class.create(Ajax.InPlaceEditor, {
- initialize: function($super, element, url, options) {
- this._extraDefaultOptions = Ajax.InPlaceCollectionEditor.DefaultOptions;
- $super(element, url, options);
- },
-
- createEditField: function() {
- var list = document.createElement('select');
- list.name = this.options.paramName;
- list.size = 1;
- this._controls.editor = list;
- this._collection = this.options.collection || [];
- if (this.options.loadCollectionURL)
- this.loadCollection();
- else
- this.checkForExternalText();
- this._form.appendChild(this._controls.editor);
- },
-
- loadCollection: function() {
- this._form.addClassName(this.options.loadingClassName);
- this.showLoadingText(this.options.loadingCollectionText);
- var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
- Object.extend(options, {
- parameters: 'editorId=' + encodeURIComponent(this.element.id),
- onComplete: Prototype.emptyFunction,
- onSuccess: function(transport) {
- var js = transport.responseText.strip();
- if (!/^\[.*\]$/.test(js)) // TODO: improve sanity check
- throw('Server returned an invalid collection representation.');
- this._collection = eval(js);
- this.checkForExternalText();
- }.bind(this),
- onFailure: this.onFailure
- });
- new Ajax.Request(this.options.loadCollectionURL, options);
- },
-
- showLoadingText: function(text) {
- this._controls.editor.disabled = true;
- var tempOption = this._controls.editor.firstChild;
- if (!tempOption) {
- tempOption = document.createElement('option');
- tempOption.value = '';
- this._controls.editor.appendChild(tempOption);
- tempOption.selected = true;
- }
- tempOption.update((text || '').stripScripts().stripTags());
- },
-
- checkForExternalText: function() {
- this._text = this.getText();
- if (this.options.loadTextURL)
- this.loadExternalText();
- else
- this.buildOptionList();
- },
-
- loadExternalText: function() {
- this.showLoadingText(this.options.loadingText);
- var options = Object.extend({ method: 'get' }, this.options.ajaxOptions);
- Object.extend(options, {
- parameters: 'editorId=' + encodeURIComponent(this.element.id),
- onComplete: Prototype.emptyFunction,
- onSuccess: function(transport) {
- this._text = transport.responseText.strip();
- this.buildOptionList();
- }.bind(this),
- onFailure: this.onFailure
- });
- new Ajax.Request(this.options.loadTextURL, options);
- },
-
- buildOptionList: function() {
- this._form.removeClassName(this.options.loadingClassName);
- this._collection = this._collection.map(function(entry) {
- return 2 === entry.length ? entry : [entry, entry].flatten();
- });
- var marker = ('value' in this.options) ? this.options.value : this._text;
- var textFound = this._collection.any(function(entry) {
- return entry[0] == marker;
- }.bind(this));
- this._controls.editor.update('');
- var option;
- this._collection.each(function(entry, index) {
- option = document.createElement('option');
- option.value = entry[0];
- option.selected = textFound ? entry[0] == marker : 0 == index;
- option.appendChild(document.createTextNode(entry[1]));
- this._controls.editor.appendChild(option);
- }.bind(this));
- this._controls.editor.disabled = false;
- Field.scrollFreeActivate(this._controls.editor);
- }
-});
-
-//**** DEPRECATION LAYER FOR InPlace[Collection]Editor! ****
-//**** This only exists for a while, in order to let ****
-//**** users adapt to the new API. Read up on the new ****
-//**** API and convert your code to it ASAP! ****
-
-Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions = function(options) {
- if (!options) return;
- function fallback(name, expr) {
- if (name in options || expr === undefined) return;
- options[name] = expr;
- };
- fallback('cancelControl', (options.cancelLink ? 'link' : (options.cancelButton ? 'button' :
- options.cancelLink == options.cancelButton == false ? false : undefined)));
- fallback('okControl', (options.okLink ? 'link' : (options.okButton ? 'button' :
- options.okLink == options.okButton == false ? false : undefined)));
- fallback('highlightColor', options.highlightcolor);
- fallback('highlightEndColor', options.highlightendcolor);
-};
-
-Object.extend(Ajax.InPlaceEditor, {
- DefaultOptions: {
- ajaxOptions: { },
- autoRows: 3, // Use when multi-line w/ rows == 1
- cancelControl: 'link', // 'link'|'button'|false
- cancelText: 'cancel',
- clickToEditText: 'Click to edit',
- externalControl: null, // id|elt
- externalControlOnly: false,
- fieldPostCreation: 'activate', // 'activate'|'focus'|false
- formClassName: 'inplaceeditor-form',
- formId: null, // id|elt
- highlightColor: '#ffff99',
- highlightEndColor: '#ffffff',
- hoverClassName: '',
- htmlResponse: true,
- loadingClassName: 'inplaceeditor-loading',
- loadingText: 'Loading...',
- okControl: 'button', // 'link'|'button'|false
- okText: 'ok',
- paramName: 'value',
- rows: 1, // If 1 and multi-line, uses autoRows
- savingClassName: 'inplaceeditor-saving',
- savingText: 'Saving...',
- size: 0,
- stripLoadedTextTags: false,
- submitOnBlur: false,
- textAfterControls: '',
- textBeforeControls: '',
- textBetweenControls: ''
- },
- DefaultCallbacks: {
- callback: function(form) {
- return Form.serialize(form);
- },
- onComplete: function(transport, element) {
- // For backward compatibility, this one is bound to the IPE, and passes
- // the element directly. It was too often customized, so we don't break it.
- new Effect.Highlight(element, {
- startcolor: this.options.highlightColor, keepBackgroundImage: true });
- },
- onEnterEditMode: null,
- onEnterHover: function(ipe) {
- ipe.element.style.backgroundColor = ipe.options.highlightColor;
- if (ipe._effect)
- ipe._effect.cancel();
- },
- onFailure: function(transport, ipe) {
- alert('Error communication with the server: ' + transport.responseText.stripTags());
- },
- onFormCustomization: null, // Takes the IPE and its generated form, after editor, before controls.
- onLeaveEditMode: null,
- onLeaveHover: function(ipe) {
- ipe._effect = new Effect.Highlight(ipe.element, {
- startcolor: ipe.options.highlightColor, endcolor: ipe.options.highlightEndColor,
- restorecolor: ipe._originalBackground, keepBackgroundImage: true
- });
- }
- },
- Listeners: {
- click: 'enterEditMode',
- keydown: 'checkForEscapeOrReturn',
- mouseover: 'enterHover',
- mouseout: 'leaveHover'
- }
-});
-
-Ajax.InPlaceCollectionEditor.DefaultOptions = {
- loadingCollectionText: 'Loading options...'
-};
-
-// Delayed observer, like Form.Element.Observer,
-// but waits for delay after last key input
-// Ideal for live-search fields
-
-Form.Element.DelayedObserver = Class.create({
- initialize: function(element, delay, callback) {
- this.delay = delay || 0.5;
- this.element = $(element);
- this.callback = callback;
- this.timer = null;
- this.lastValue = $F(this.element);
- Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));
- },
- delayedListener: function(event) {
- if(this.lastValue == $F(this.element)) return;
- if(this.timer) clearTimeout(this.timer);
- this.timer = setTimeout(this.onTimerEvent.bind(this), this.delay * 1000);
- this.lastValue = $F(this.element);
- },
- onTimerEvent: function() {
- this.timer = null;
- this.callback(this.element, $F(this.element));
- }
-}); \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/dragdrop.js b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/dragdrop.js
deleted file mode 100644
index 07229f986f5..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/dragdrop.js
+++ /dev/null
@@ -1,973 +0,0 @@
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// (c) 2005-2008 Sammi Williams (http://www.oriontransfer.co.nz, sammi@oriontransfer.co.nz)
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-if(Object.isUndefined(Effect))
- throw("dragdrop.js requires including script.aculo.us' effects.js library");
-
-var Droppables = {
- drops: [],
-
- remove: function(element) {
- this.drops = this.drops.reject(function(d) { return d.element==$(element) });
- },
-
- add: function(element) {
- element = $(element);
- var options = Object.extend({
- greedy: true,
- hoverclass: null,
- tree: false
- }, arguments[1] || { });
-
- // cache containers
- if(options.containment) {
- options._containers = [];
- var containment = options.containment;
- if(Object.isArray(containment)) {
- containment.each( function(c) { options._containers.push($(c)) });
- } else {
- options._containers.push($(containment));
- }
- }
-
- if(options.accept) options.accept = [options.accept].flatten();
-
- Element.makePositioned(element); // fix IE
- options.element = element;
-
- this.drops.push(options);
- },
-
- findDeepestChild: function(drops) {
- deepest = drops[0];
-
- for (i = 1; i < drops.length; ++i)
- if (Element.isParent(drops[i].element, deepest.element))
- deepest = drops[i];
-
- return deepest;
- },
-
- isContained: function(element, drop) {
- var containmentNode;
- if(drop.tree) {
- containmentNode = element.treeNode;
- } else {
- containmentNode = element.parentNode;
- }
- return drop._containers.detect(function(c) { return containmentNode == c });
- },
-
- isAffected: function(point, element, drop) {
- return (
- (drop.element!=element) &&
- ((!drop._containers) ||
- this.isContained(element, drop)) &&
- ((!drop.accept) ||
- (Element.classNames(element).detect(
- function(v) { return drop.accept.include(v) } ) )) &&
- Position.within(drop.element, point[0], point[1]) );
- },
-
- deactivate: function(drop) {
- if(drop.hoverclass)
- Element.removeClassName(drop.element, drop.hoverclass);
- this.last_active = null;
- },
-
- activate: function(drop) {
- if(drop.hoverclass)
- Element.addClassName(drop.element, drop.hoverclass);
- this.last_active = drop;
- },
-
- show: function(point, element) {
- if(!this.drops.length) return;
- var drop, affected = [];
-
- this.drops.each( function(drop) {
- if(Droppables.isAffected(point, element, drop))
- affected.push(drop);
- });
-
- if(affected.length>0)
- drop = Droppables.findDeepestChild(affected);
-
- if(this.last_active && this.last_active != drop) this.deactivate(this.last_active);
- if (drop) {
- Position.within(drop.element, point[0], point[1]);
- if(drop.onHover)
- drop.onHover(element, drop.element, Position.overlap(drop.overlap, drop.element));
-
- if (drop != this.last_active) Droppables.activate(drop);
- }
- },
-
- fire: function(event, element) {
- if(!this.last_active) return;
- Position.prepare();
-
- if (this.isAffected([Event.pointerX(event), Event.pointerY(event)], element, this.last_active))
- if (this.last_active.onDrop) {
- this.last_active.onDrop(element, this.last_active.element, event);
- return true;
- }
- },
-
- reset: function() {
- if(this.last_active)
- this.deactivate(this.last_active);
- }
-};
-
-var Draggables = {
- drags: [],
- observers: [],
-
- register: function(draggable) {
- if(this.drags.length == 0) {
- this.eventMouseUp = this.endDrag.bindAsEventListener(this);
- this.eventMouseMove = this.updateDrag.bindAsEventListener(this);
- this.eventKeypress = this.keyPress.bindAsEventListener(this);
-
- Event.observe(document, "mouseup", this.eventMouseUp);
- Event.observe(document, "mousemove", this.eventMouseMove);
- Event.observe(document, "keypress", this.eventKeypress);
- }
- this.drags.push(draggable);
- },
-
- unregister: function(draggable) {
- this.drags = this.drags.reject(function(d) { return d==draggable });
- if(this.drags.length == 0) {
- Event.stopObserving(document, "mouseup", this.eventMouseUp);
- Event.stopObserving(document, "mousemove", this.eventMouseMove);
- Event.stopObserving(document, "keypress", this.eventKeypress);
- }
- },
-
- activate: function(draggable) {
- if(draggable.options.delay) {
- this._timeout = setTimeout(function() {
- Draggables._timeout = null;
- window.focus();
- Draggables.activeDraggable = draggable;
- }.bind(this), draggable.options.delay);
- } else {
- window.focus(); // allows keypress events if window isn't currently focused, fails for Safari
- this.activeDraggable = draggable;
- }
- },
-
- deactivate: function() {
- this.activeDraggable = null;
- },
-
- updateDrag: function(event) {
- if(!this.activeDraggable) return;
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- // Mozilla-based browsers fire successive mousemove events with
- // the same coordinates, prevent needless redrawing (moz bug?)
- if(this._lastPointer && (this._lastPointer.inspect() == pointer.inspect())) return;
- this._lastPointer = pointer;
-
- this.activeDraggable.updateDrag(event, pointer);
- },
-
- endDrag: function(event) {
- if(this._timeout) {
- clearTimeout(this._timeout);
- this._timeout = null;
- }
- if(!this.activeDraggable) return;
- this._lastPointer = null;
- this.activeDraggable.endDrag(event);
- this.activeDraggable = null;
- },
-
- keyPress: function(event) {
- if(this.activeDraggable)
- this.activeDraggable.keyPress(event);
- },
-
- addObserver: function(observer) {
- this.observers.push(observer);
- this._cacheObserverCallbacks();
- },
-
- removeObserver: function(element) { // element instead of observer fixes mem leaks
- this.observers = this.observers.reject( function(o) { return o.element==element });
- this._cacheObserverCallbacks();
- },
-
- notify: function(eventName, draggable, event) { // 'onStart', 'onEnd', 'onDrag'
- if(this[eventName+'Count'] > 0)
- this.observers.each( function(o) {
- if(o[eventName]) o[eventName](eventName, draggable, event);
- });
- if(draggable.options[eventName]) draggable.options[eventName](draggable, event);
- },
-
- _cacheObserverCallbacks: function() {
- ['onStart','onEnd','onDrag'].each( function(eventName) {
- Draggables[eventName+'Count'] = Draggables.observers.select(
- function(o) { return o[eventName]; }
- ).length;
- });
- }
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Draggable = Class.create({
- initialize: function(element) {
- var defaults = {
- handle: false,
- reverteffect: function(element, top_offset, left_offset) {
- var dur = Math.sqrt(Math.abs(top_offset^2)+Math.abs(left_offset^2))*0.02;
- new Effect.Move(element, { x: -left_offset, y: -top_offset, duration: dur,
- queue: {scope:'_draggable', position:'end'}
- });
- },
- endeffect: function(element) {
- var toOpacity = Object.isNumber(element._opacity) ? element._opacity : 1.0;
- new Effect.Opacity(element, {duration:0.2, from:0.7, to:toOpacity,
- queue: {scope:'_draggable', position:'end'},
- afterFinish: function(){
- Draggable._dragging[element] = false
- }
- });
- },
- zindex: 1000,
- revert: false,
- quiet: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- snap: false, // false, or xy or [x,y] or function(x,y){ return [x,y] }
- delay: 0
- };
-
- if(!arguments[1] || Object.isUndefined(arguments[1].endeffect))
- Object.extend(defaults, {
- starteffect: function(element) {
- element._opacity = Element.getOpacity(element);
- Draggable._dragging[element] = true;
- new Effect.Opacity(element, {duration:0.2, from:element._opacity, to:0.7});
- }
- });
-
- var options = Object.extend(defaults, arguments[1] || { });
-
- this.element = $(element);
-
- if(options.handle && Object.isString(options.handle))
- this.handle = this.element.down('.'+options.handle, 0);
-
- if(!this.handle) this.handle = $(options.handle);
- if(!this.handle) this.handle = this.element;
-
- if(options.scroll && !options.scroll.scrollTo && !options.scroll.outerHTML) {
- options.scroll = $(options.scroll);
- this._isScrollChild = Element.childOf(this.element, options.scroll);
- }
-
- Element.makePositioned(this.element); // fix IE
-
- this.options = options;
- this.dragging = false;
-
- this.eventMouseDown = this.initDrag.bindAsEventListener(this);
- Event.observe(this.handle, "mousedown", this.eventMouseDown);
-
- Draggables.register(this);
- },
-
- destroy: function() {
- Event.stopObserving(this.handle, "mousedown", this.eventMouseDown);
- Draggables.unregister(this);
- },
-
- currentDelta: function() {
- return([
- parseInt(Element.getStyle(this.element,'left') || '0'),
- parseInt(Element.getStyle(this.element,'top') || '0')]);
- },
-
- initDrag: function(event) {
- if(!Object.isUndefined(Draggable._dragging[this.element]) &&
- Draggable._dragging[this.element]) return;
- if(Event.isLeftClick(event)) {
- // abort on form elements, fixes a Firefox issue
- var src = Event.element(event);
- if((tag_name = src.tagName.toUpperCase()) && (
- tag_name=='INPUT' ||
- tag_name=='SELECT' ||
- tag_name=='OPTION' ||
- tag_name=='BUTTON' ||
- tag_name=='TEXTAREA')) return;
-
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- var pos = Position.cumulativeOffset(this.element);
- this.offset = [0,1].map( function(i) { return (pointer[i] - pos[i]) });
-
- Draggables.activate(this);
- Event.stop(event);
- }
- },
-
- startDrag: function(event) {
- this.dragging = true;
- if(!this.delta)
- this.delta = this.currentDelta();
-
- if(this.options.zindex) {
- this.originalZ = parseInt(Element.getStyle(this.element,'z-index') || 0);
- this.element.style.zIndex = this.options.zindex;
- }
-
- if(this.options.ghosting) {
- this._clone = this.element.cloneNode(true);
- this._originallyAbsolute = (this.element.getStyle('position') == 'absolute');
- if (!this._originallyAbsolute)
- Position.absolutize(this.element);
- this.element.parentNode.insertBefore(this._clone, this.element);
- }
-
- if(this.options.scroll) {
- if (this.options.scroll == window) {
- var where = this._getWindowScroll(this.options.scroll);
- this.originalScrollLeft = where.left;
- this.originalScrollTop = where.top;
- } else {
- this.originalScrollLeft = this.options.scroll.scrollLeft;
- this.originalScrollTop = this.options.scroll.scrollTop;
- }
- }
-
- Draggables.notify('onStart', this, event);
-
- if(this.options.starteffect) this.options.starteffect(this.element);
- },
-
- updateDrag: function(event, pointer) {
- if(!this.dragging) this.startDrag(event);
-
- if(!this.options.quiet){
- Position.prepare();
- Droppables.show(pointer, this.element);
- }
-
- Draggables.notify('onDrag', this, event);
-
- this.draw(pointer);
- if(this.options.change) this.options.change(this);
-
- if(this.options.scroll) {
- this.stopScrolling();
-
- var p;
- if (this.options.scroll == window) {
- with(this._getWindowScroll(this.options.scroll)) { p = [ left, top, left+width, top+height ]; }
- } else {
- p = Position.page(this.options.scroll);
- p[0] += this.options.scroll.scrollLeft + Position.deltaX;
- p[1] += this.options.scroll.scrollTop + Position.deltaY;
- p.push(p[0]+this.options.scroll.offsetWidth);
- p.push(p[1]+this.options.scroll.offsetHeight);
- }
- var speed = [0,0];
- if(pointer[0] < (p[0]+this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[0]+this.options.scrollSensitivity);
- if(pointer[1] < (p[1]+this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[1]+this.options.scrollSensitivity);
- if(pointer[0] > (p[2]-this.options.scrollSensitivity)) speed[0] = pointer[0]-(p[2]-this.options.scrollSensitivity);
- if(pointer[1] > (p[3]-this.options.scrollSensitivity)) speed[1] = pointer[1]-(p[3]-this.options.scrollSensitivity);
- this.startScrolling(speed);
- }
-
- // fix AppleWebKit rendering
- if(Prototype.Browser.WebKit) window.scrollBy(0,0);
-
- Event.stop(event);
- },
-
- finishDrag: function(event, success) {
- this.dragging = false;
-
- if(this.options.quiet){
- Position.prepare();
- var pointer = [Event.pointerX(event), Event.pointerY(event)];
- Droppables.show(pointer, this.element);
- }
-
- if(this.options.ghosting) {
- if (!this._originallyAbsolute)
- Position.relativize(this.element);
- delete this._originallyAbsolute;
- Element.remove(this._clone);
- this._clone = null;
- }
-
- var dropped = false;
- if(success) {
- dropped = Droppables.fire(event, this.element);
- if (!dropped) dropped = false;
- }
- if(dropped && this.options.onDropped) this.options.onDropped(this.element);
- Draggables.notify('onEnd', this, event);
-
- var revert = this.options.revert;
- if(revert && Object.isFunction(revert)) revert = revert(this.element);
-
- var d = this.currentDelta();
- if(revert && this.options.reverteffect) {
- if (dropped == 0 || revert != 'failure')
- this.options.reverteffect(this.element,
- d[1]-this.delta[1], d[0]-this.delta[0]);
- } else {
- this.delta = d;
- }
-
- if(this.options.zindex)
- this.element.style.zIndex = this.originalZ;
-
- if(this.options.endeffect)
- this.options.endeffect(this.element);
-
- Draggables.deactivate(this);
- Droppables.reset();
- },
-
- keyPress: function(event) {
- if(event.keyCode!=Event.KEY_ESC) return;
- this.finishDrag(event, false);
- Event.stop(event);
- },
-
- endDrag: function(event) {
- if(!this.dragging) return;
- this.stopScrolling();
- this.finishDrag(event, true);
- Event.stop(event);
- },
-
- draw: function(point) {
- var pos = Position.cumulativeOffset(this.element);
- if(this.options.ghosting) {
- var r = Position.realOffset(this.element);
- pos[0] += r[0] - Position.deltaX; pos[1] += r[1] - Position.deltaY;
- }
-
- var d = this.currentDelta();
- pos[0] -= d[0]; pos[1] -= d[1];
-
- if(this.options.scroll && (this.options.scroll != window && this._isScrollChild)) {
- pos[0] -= this.options.scroll.scrollLeft-this.originalScrollLeft;
- pos[1] -= this.options.scroll.scrollTop-this.originalScrollTop;
- }
-
- var p = [0,1].map(function(i){
- return (point[i]-pos[i]-this.offset[i])
- }.bind(this));
-
- if(this.options.snap) {
- if(Object.isFunction(this.options.snap)) {
- p = this.options.snap(p[0],p[1],this);
- } else {
- if(Object.isArray(this.options.snap)) {
- p = p.map( function(v, i) {
- return (v/this.options.snap[i]).round()*this.options.snap[i] }.bind(this));
- } else {
- p = p.map( function(v) {
- return (v/this.options.snap).round()*this.options.snap }.bind(this));
- }
- }}
-
- var style = this.element.style;
- if((!this.options.constraint) || (this.options.constraint=='horizontal'))
- style.left = p[0] + "px";
- if((!this.options.constraint) || (this.options.constraint=='vertical'))
- style.top = p[1] + "px";
-
- if(style.visibility=="hidden") style.visibility = ""; // fix gecko rendering
- },
-
- stopScrolling: function() {
- if(this.scrollInterval) {
- clearInterval(this.scrollInterval);
- this.scrollInterval = null;
- Draggables._lastScrollPointer = null;
- }
- },
-
- startScrolling: function(speed) {
- if(!(speed[0] || speed[1])) return;
- this.scrollSpeed = [speed[0]*this.options.scrollSpeed,speed[1]*this.options.scrollSpeed];
- this.lastScrolled = new Date();
- this.scrollInterval = setInterval(this.scroll.bind(this), 10);
- },
-
- scroll: function() {
- var current = new Date();
- var delta = current - this.lastScrolled;
- this.lastScrolled = current;
- if(this.options.scroll == window) {
- with (this._getWindowScroll(this.options.scroll)) {
- if (this.scrollSpeed[0] || this.scrollSpeed[1]) {
- var d = delta / 1000;
- this.options.scroll.scrollTo( left + d*this.scrollSpeed[0], top + d*this.scrollSpeed[1] );
- }
- }
- } else {
- this.options.scroll.scrollLeft += this.scrollSpeed[0] * delta / 1000;
- this.options.scroll.scrollTop += this.scrollSpeed[1] * delta / 1000;
- }
-
- Position.prepare();
- Droppables.show(Draggables._lastPointer, this.element);
- Draggables.notify('onDrag', this);
- if (this._isScrollChild) {
- Draggables._lastScrollPointer = Draggables._lastScrollPointer || $A(Draggables._lastPointer);
- Draggables._lastScrollPointer[0] += this.scrollSpeed[0] * delta / 1000;
- Draggables._lastScrollPointer[1] += this.scrollSpeed[1] * delta / 1000;
- if (Draggables._lastScrollPointer[0] < 0)
- Draggables._lastScrollPointer[0] = 0;
- if (Draggables._lastScrollPointer[1] < 0)
- Draggables._lastScrollPointer[1] = 0;
- this.draw(Draggables._lastScrollPointer);
- }
-
- if(this.options.change) this.options.change(this);
- },
-
- _getWindowScroll: function(w) {
- var T, L, W, H;
- with (w.document) {
- if (w.document.documentElement && documentElement.scrollTop) {
- T = documentElement.scrollTop;
- L = documentElement.scrollLeft;
- } else if (w.document.body) {
- T = body.scrollTop;
- L = body.scrollLeft;
- }
- if (w.innerWidth) {
- W = w.innerWidth;
- H = w.innerHeight;
- } else if (w.document.documentElement && documentElement.clientWidth) {
- W = documentElement.clientWidth;
- H = documentElement.clientHeight;
- } else {
- W = body.offsetWidth;
- H = body.offsetHeight;
- }
- }
- return { top: T, left: L, width: W, height: H };
- }
-});
-
-Draggable._dragging = { };
-
-/*--------------------------------------------------------------------------*/
-
-var SortableObserver = Class.create({
- initialize: function(element, observer) {
- this.element = $(element);
- this.observer = observer;
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onStart: function() {
- this.lastValue = Sortable.serialize(this.element);
- },
-
- onEnd: function() {
- Sortable.unmark();
- if(this.lastValue != Sortable.serialize(this.element))
- this.observer(this.element)
- }
-});
-
-var Sortable = {
- SERIALIZE_RULE: /^[^_\-](?:[A-Za-z0-9\-\_]*)[_](.*)$/,
-
- sortables: { },
-
- _findRootElement: function(element) {
- while (element.tagName.toUpperCase() != "BODY") {
- if(element.id && Sortable.sortables[element.id]) return element;
- element = element.parentNode;
- }
- },
-
- options: function(element) {
- element = Sortable._findRootElement($(element));
- if(!element) return;
- return Sortable.sortables[element.id];
- },
-
- destroy: function(element){
- element = $(element);
- var s = Sortable.sortables[element.id];
-
- if(s) {
- Draggables.removeObserver(s.element);
- s.droppables.each(function(d){ Droppables.remove(d) });
- s.draggables.invoke('destroy');
-
- delete Sortable.sortables[s.element.id];
- }
- },
-
- create: function(element) {
- element = $(element);
- var options = Object.extend({
- element: element,
- tag: 'li', // assumes li children, override with tag: 'tagname'
- dropOnEmpty: false,
- tree: false,
- treeTag: 'ul',
- overlap: 'vertical', // one of 'vertical', 'horizontal'
- constraint: 'vertical', // one of 'vertical', 'horizontal', false
- containment: element, // also takes array of elements (or id's); or false
- handle: false, // or a CSS class
- only: false,
- delay: 0,
- hoverclass: null,
- ghosting: false,
- quiet: false,
- scroll: false,
- scrollSensitivity: 20,
- scrollSpeed: 15,
- format: this.SERIALIZE_RULE,
-
- // these take arrays of elements or ids and can be
- // used for better initialization performance
- elements: false,
- handles: false,
-
- onChange: Prototype.emptyFunction,
- onUpdate: Prototype.emptyFunction
- }, arguments[1] || { });
-
- // clear any old sortable with same element
- this.destroy(element);
-
- // build options for the draggables
- var options_for_draggable = {
- revert: true,
- quiet: options.quiet,
- scroll: options.scroll,
- scrollSpeed: options.scrollSpeed,
- scrollSensitivity: options.scrollSensitivity,
- delay: options.delay,
- ghosting: options.ghosting,
- constraint: options.constraint,
- handle: options.handle };
-
- if(options.starteffect)
- options_for_draggable.starteffect = options.starteffect;
-
- if(options.reverteffect)
- options_for_draggable.reverteffect = options.reverteffect;
- else
- if(options.ghosting) options_for_draggable.reverteffect = function(element) {
- element.style.top = 0;
- element.style.left = 0;
- };
-
- if(options.endeffect)
- options_for_draggable.endeffect = options.endeffect;
-
- if(options.zindex)
- options_for_draggable.zindex = options.zindex;
-
- // build options for the droppables
- var options_for_droppable = {
- overlap: options.overlap,
- containment: options.containment,
- tree: options.tree,
- hoverclass: options.hoverclass,
- onHover: Sortable.onHover
- };
-
- var options_for_tree = {
- onHover: Sortable.onEmptyHover,
- overlap: options.overlap,
- containment: options.containment,
- hoverclass: options.hoverclass
- };
-
- // fix for gecko engine
- Element.cleanWhitespace(element);
-
- options.draggables = [];
- options.droppables = [];
-
- // drop on empty handling
- if(options.dropOnEmpty || options.tree) {
- Droppables.add(element, options_for_tree);
- options.droppables.push(element);
- }
-
- (options.elements || this.findElements(element, options) || []).each( function(e,i) {
- var handle = options.handles ? $(options.handles[i]) :
- (options.handle ? $(e).select('.' + options.handle)[0] : e);
- options.draggables.push(
- new Draggable(e, Object.extend(options_for_draggable, { handle: handle })));
- Droppables.add(e, options_for_droppable);
- if(options.tree) e.treeNode = element;
- options.droppables.push(e);
- });
-
- if(options.tree) {
- (Sortable.findTreeElements(element, options) || []).each( function(e) {
- Droppables.add(e, options_for_tree);
- e.treeNode = element;
- options.droppables.push(e);
- });
- }
-
- // keep reference
- this.sortables[element.id] = options;
-
- // for onupdate
- Draggables.addObserver(new SortableObserver(element, options.onUpdate));
-
- },
-
- // return all suitable-for-sortable elements in a guaranteed order
- findElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.tag);
- },
-
- findTreeElements: function(element, options) {
- return Element.findChildren(
- element, options.only, options.tree ? true : false, options.treeTag);
- },
-
- onHover: function(element, dropon, overlap) {
- if(Element.isParent(dropon, element)) return;
-
- if(overlap > .33 && overlap < .66 && Sortable.options(dropon).tree) {
- return;
- } else if(overlap>0.5) {
- Sortable.mark(dropon, 'before');
- if(dropon.previousSibling != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, dropon);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- } else {
- Sortable.mark(dropon, 'after');
- var nextElement = dropon.nextSibling || null;
- if(nextElement != element) {
- var oldParentNode = element.parentNode;
- element.style.visibility = "hidden"; // fix gecko rendering
- dropon.parentNode.insertBefore(element, nextElement);
- if(dropon.parentNode!=oldParentNode)
- Sortable.options(oldParentNode).onChange(element);
- Sortable.options(dropon.parentNode).onChange(element);
- }
- }
- },
-
- onEmptyHover: function(element, dropon, overlap) {
- var oldParentNode = element.parentNode;
- var droponOptions = Sortable.options(dropon);
-
- if(!Element.isParent(dropon, element)) {
- var index;
-
- var children = Sortable.findElements(dropon, {tag: droponOptions.tag, only: droponOptions.only});
- var child = null;
-
- if(children) {
- var offset = Element.offsetSize(dropon, droponOptions.overlap) * (1.0 - overlap);
-
- for (index = 0; index < children.length; index += 1) {
- if (offset - Element.offsetSize (children[index], droponOptions.overlap) >= 0) {
- offset -= Element.offsetSize (children[index], droponOptions.overlap);
- } else if (offset - (Element.offsetSize (children[index], droponOptions.overlap) / 2) >= 0) {
- child = index + 1 < children.length ? children[index + 1] : null;
- break;
- } else {
- child = children[index];
- break;
- }
- }
- }
-
- dropon.insertBefore(element, child);
-
- Sortable.options(oldParentNode).onChange(element);
- droponOptions.onChange(element);
- }
- },
-
- unmark: function() {
- if(Sortable._marker) Sortable._marker.hide();
- },
-
- mark: function(dropon, position) {
- // mark on ghosting only
- var sortable = Sortable.options(dropon.parentNode);
- if(sortable && !sortable.ghosting) return;
-
- if(!Sortable._marker) {
- Sortable._marker =
- ($('dropmarker') || Element.extend(document.createElement('DIV'))).
- hide().addClassName('dropmarker').setStyle({position:'absolute'});
- document.getElementsByTagName("body").item(0).appendChild(Sortable._marker);
- }
- var offsets = Position.cumulativeOffset(dropon);
- Sortable._marker.setStyle({left: offsets[0]+'px', top: offsets[1] + 'px'});
-
- if(position=='after')
- if(sortable.overlap == 'horizontal')
- Sortable._marker.setStyle({left: (offsets[0]+dropon.clientWidth) + 'px'});
- else
- Sortable._marker.setStyle({top: (offsets[1]+dropon.clientHeight) + 'px'});
-
- Sortable._marker.show();
- },
-
- _tree: function(element, options, parent) {
- var children = Sortable.findElements(element, options) || [];
-
- for (var i = 0; i < children.length; ++i) {
- var match = children[i].id.match(options.format);
-
- if (!match) continue;
-
- var child = {
- id: encodeURIComponent(match ? match[1] : null),
- element: element,
- parent: parent,
- children: [],
- position: parent.children.length,
- container: $(children[i]).down(options.treeTag)
- };
-
- /* Get the element containing the children and recurse over it */
- if (child.container)
- this._tree(child.container, options, child);
-
- parent.children.push (child);
- }
-
- return parent;
- },
-
- tree: function(element) {
- element = $(element);
- var sortableOptions = this.options(element);
- var options = Object.extend({
- tag: sortableOptions.tag,
- treeTag: sortableOptions.treeTag,
- only: sortableOptions.only,
- name: element.id,
- format: sortableOptions.format
- }, arguments[1] || { });
-
- var root = {
- id: null,
- parent: null,
- children: [],
- container: element,
- position: 0
- };
-
- return Sortable._tree(element, options, root);
- },
-
- /* Construct a [i] index for a particular node */
- _constructIndex: function(node) {
- var index = '';
- do {
- if (node.id) index = '[' + node.position + ']' + index;
- } while ((node = node.parent) != null);
- return index;
- },
-
- sequence: function(element) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[1] || { });
-
- return $(this.findElements(element, options) || []).map( function(item) {
- return item.id.match(options.format) ? item.id.match(options.format)[1] : '';
- });
- },
-
- setSequence: function(element, new_sequence) {
- element = $(element);
- var options = Object.extend(this.options(element), arguments[2] || { });
-
- var nodeMap = { };
- this.findElements(element, options).each( function(n) {
- if (n.id.match(options.format))
- nodeMap[n.id.match(options.format)[1]] = [n, n.parentNode];
- n.parentNode.removeChild(n);
- });
-
- new_sequence.each(function(ident) {
- var n = nodeMap[ident];
- if (n) {
- n[1].appendChild(n[0]);
- delete nodeMap[ident];
- }
- });
- },
-
- serialize: function(element) {
- element = $(element);
- var options = Object.extend(Sortable.options(element), arguments[1] || { });
- var name = encodeURIComponent(
- (arguments[1] && arguments[1].name) ? arguments[1].name : element.id);
-
- if (options.tree) {
- return Sortable.tree(element, arguments[1]).children.map( function (item) {
- return [name + Sortable._constructIndex(item) + "[id]=" +
- encodeURIComponent(item.id)].concat(item.children.map(arguments.callee));
- }).flatten().join('&');
- } else {
- return Sortable.sequence(element, arguments[1]).map( function(item) {
- return name + "[]=" + encodeURIComponent(item);
- }).join('&');
- }
- }
-};
-
-// Returns true if child is contained within element
-Element.isParent = function(child, element) {
- if (!child.parentNode || child == element) return false;
- if (child.parentNode == element) return true;
- return Element.isParent(child.parentNode, element);
-};
-
-Element.findChildren = function(element, only, recursive, tagName) {
- if(!element.hasChildNodes()) return null;
- tagName = tagName.toUpperCase();
- if(only) only = [only].flatten();
- var elements = [];
- $A(element.childNodes).each( function(e) {
- if(e.tagName && e.tagName.toUpperCase()==tagName &&
- (!only || (Element.classNames(e).detect(function(v) { return only.include(v) }))))
- elements.push(e);
- if(recursive) {
- var grandchildren = Element.findChildren(e, only, recursive, tagName);
- if(grandchildren) elements.push(grandchildren);
- }
- });
-
- return (elements.length>0 ? elements.flatten() : []);
-};
-
-Element.offsetSize = function (element, type) {
- return element['offset' + ((type=='vertical' || type=='height') ? 'Height' : 'Width')];
-}; \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/effects.js b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/effects.js
deleted file mode 100644
index 5a639d2dea9..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/effects.js
+++ /dev/null
@@ -1,1128 +0,0 @@
-// Copyright (c) 2005-2008 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
-// Contributors:
-// Justin Palmer (http://encytemedia.com/)
-// Mark Pilgrim (http://diveintomark.org/)
-// Martin Bialasinki
-//
-// script.aculo.us is freely distributable under the terms of an MIT-style license.
-// For details, see the script.aculo.us web site: http://script.aculo.us/
-
-// converts rgb() and #xxx to #xxxxxx format,
-// returns self (or first argument) if not convertable
-String.prototype.parseColor = function() {
- var color = '#';
- if (this.slice(0,4) == 'rgb(') {
- var cols = this.slice(4,this.length-1).split(',');
- var i=0; do { color += parseInt(cols[i]).toColorPart() } while (++i<3);
- } else {
- if (this.slice(0,1) == '#') {
- if (this.length==4) for(var i=1;i<4;i++) color += (this.charAt(i) + this.charAt(i)).toLowerCase();
- if (this.length==7) color = this.toLowerCase();
- }
- }
- return (color.length==7 ? color : (arguments[0] || this));
-};
-
-/*--------------------------------------------------------------------------*/
-
-Element.collectTextNodes = function(element) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- (node.hasChildNodes() ? Element.collectTextNodes(node) : ''));
- }).flatten().join('');
-};
-
-Element.collectTextNodesIgnoreClass = function(element, className) {
- return $A($(element).childNodes).collect( function(node) {
- return (node.nodeType==3 ? node.nodeValue :
- ((node.hasChildNodes() && !Element.hasClassName(node,className)) ?
- Element.collectTextNodesIgnoreClass(node, className) : ''));
- }).flatten().join('');
-};
-
-Element.setContentZoom = function(element, percent) {
- element = $(element);
- element.setStyle({fontSize: (percent/100) + 'em'});
- if (Prototype.Browser.WebKit) window.scrollBy(0,0);
- return element;
-};
-
-Element.getInlineOpacity = function(element){
- return $(element).style.opacity || '';
-};
-
-Element.forceRerendering = function(element) {
- try {
- element = $(element);
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch(e) { }
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Effect = {
- _elementDoesNotExistError: {
- name: 'ElementDoesNotExistError',
- message: 'The specified DOM element does not exist, but is required for this effect to operate'
- },
- Transitions: {
- linear: Prototype.K,
- sinoidal: function(pos) {
- return (-Math.cos(pos*Math.PI)/2) + .5;
- },
- reverse: function(pos) {
- return 1-pos;
- },
- flicker: function(pos) {
- var pos = ((-Math.cos(pos*Math.PI)/4) + .75) + Math.random()/4;
- return pos > 1 ? 1 : pos;
- },
- wobble: function(pos) {
- return (-Math.cos(pos*Math.PI*(9*pos))/2) + .5;
- },
- pulse: function(pos, pulses) {
- return (-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2) + .5;
- },
- spring: function(pos) {
- return 1 - (Math.cos(pos * 4.5 * Math.PI) * Math.exp(-pos * 6));
- },
- none: function(pos) {
- return 0;
- },
- full: function(pos) {
- return 1;
- }
- },
- DefaultOptions: {
- duration: 1.0, // seconds
- fps: 100, // 100= assume 66fps max.
- sync: false, // true for combining
- from: 0.0,
- to: 1.0,
- delay: 0.0,
- queue: 'parallel'
- },
- tagifyText: function(element) {
- var tagifyStyle = 'position:relative';
- if (Prototype.Browser.IE) tagifyStyle += ';zoom:1';
-
- element = $(element);
- $A(element.childNodes).each( function(child) {
- if (child.nodeType==3) {
- child.nodeValue.toArray().each( function(character) {
- element.insertBefore(
- new Element('span', {style: tagifyStyle}).update(
- character == ' ' ? String.fromCharCode(160) : character),
- child);
- });
- Element.remove(child);
- }
- });
- },
- multiple: function(element, effect) {
- var elements;
- if (((typeof element == 'object') ||
- Object.isFunction(element)) &&
- (element.length))
- elements = element;
- else
- elements = $(element).childNodes;
-
- var options = Object.extend({
- speed: 0.1,
- delay: 0.0
- }, arguments[2] || { });
- var masterDelay = options.delay;
-
- $A(elements).each( function(element, index) {
- new effect(element, Object.extend(options, { delay: index * options.speed + masterDelay }));
- });
- },
- PAIRS: {
- 'slide': ['SlideDown','SlideUp'],
- 'blind': ['BlindDown','BlindUp'],
- 'appear': ['Appear','Fade']
- },
- toggle: function(element, effect) {
- element = $(element);
- effect = (effect || 'appear').toLowerCase();
- var options = Object.extend({
- queue: { position:'end', scope:(element.id || 'global'), limit: 1 }
- }, arguments[2] || { });
- Effect[element.visible() ?
- Effect.PAIRS[effect][1] : Effect.PAIRS[effect][0]](element, options);
- }
-};
-
-Effect.DefaultOptions.transition = Effect.Transitions.sinoidal;
-
-/* ------------- core effects ------------- */
-
-Effect.ScopedQueue = Class.create(Enumerable, {
- initialize: function() {
- this.effects = [];
- this.interval = null;
- },
- _each: function(iterator) {
- this.effects._each(iterator);
- },
- add: function(effect) {
- var timestamp = new Date().getTime();
-
- var position = Object.isString(effect.options.queue) ?
- effect.options.queue : effect.options.queue.position;
-
- switch(position) {
- case 'front':
- // move unstarted effects after this effect
- this.effects.findAll(function(e){ return e.state=='idle' }).each( function(e) {
- e.startOn += effect.finishOn;
- e.finishOn += effect.finishOn;
- });
- break;
- case 'with-last':
- timestamp = this.effects.pluck('startOn').max() || timestamp;
- break;
- case 'end':
- // start effect after last queued effect has finished
- timestamp = this.effects.pluck('finishOn').max() || timestamp;
- break;
- }
-
- effect.startOn += timestamp;
- effect.finishOn += timestamp;
-
- if (!effect.options.queue.limit || (this.effects.length < effect.options.queue.limit))
- this.effects.push(effect);
-
- if (!this.interval)
- this.interval = setInterval(this.loop.bind(this), 15);
- },
- remove: function(effect) {
- this.effects = this.effects.reject(function(e) { return e==effect });
- if (this.effects.length == 0) {
- clearInterval(this.interval);
- this.interval = null;
- }
- },
- loop: function() {
- var timePos = new Date().getTime();
- for(var i=0, len=this.effects.length;i<len;i++)
- this.effects[i] && this.effects[i].loop(timePos);
- }
-});
-
-Effect.Queues = {
- instances: $H(),
- get: function(queueName) {
- if (!Object.isString(queueName)) return queueName;
-
- return this.instances.get(queueName) ||
- this.instances.set(queueName, new Effect.ScopedQueue());
- }
-};
-Effect.Queue = Effect.Queues.get('global');
-
-Effect.Base = Class.create({
- position: null,
- start: function(options) {
- function codeForEvent(options,eventName){
- return (
- (options[eventName+'Internal'] ? 'this.options.'+eventName+'Internal(this);' : '') +
- (options[eventName] ? 'this.options.'+eventName+'(this);' : '')
- );
- }
- if (options && options.transition === false) options.transition = Effect.Transitions.linear;
- this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
- this.currentFrame = 0;
- this.state = 'idle';
- this.startOn = this.options.delay*1000;
- this.finishOn = this.startOn+(this.options.duration*1000);
- this.fromToDelta = this.options.to-this.options.from;
- this.totalTime = this.finishOn-this.startOn;
- this.totalFrames = this.options.fps*this.options.duration;
-
- this.render = (function() {
- function dispatch(effect, eventName) {
- if (effect.options[eventName + 'Internal'])
- effect.options[eventName + 'Internal'](effect);
- if (effect.options[eventName])
- effect.options[eventName](effect);
- }
-
- return function(pos) {
- if (this.state === "idle") {
- this.state = "running";
- dispatch(this, 'beforeSetup');
- if (this.setup) this.setup();
- dispatch(this, 'afterSetup');
- }
- if (this.state === "running") {
- pos = (this.options.transition(pos) * this.fromToDelta) + this.options.from;
- this.position = pos;
- dispatch(this, 'beforeUpdate');
- if (this.update) this.update(pos);
- dispatch(this, 'afterUpdate');
- }
- };
- })();
-
- this.event('beforeStart');
- if (!this.options.sync)
- Effect.Queues.get(Object.isString(this.options.queue) ?
- 'global' : this.options.queue.scope).add(this);
- },
- loop: function(timePos) {
- if (timePos >= this.startOn) {
- if (timePos >= this.finishOn) {
- this.render(1.0);
- this.cancel();
- this.event('beforeFinish');
- if (this.finish) this.finish();
- this.event('afterFinish');
- return;
- }
- var pos = (timePos - this.startOn) / this.totalTime,
- frame = (pos * this.totalFrames).round();
- if (frame > this.currentFrame) {
- this.render(pos);
- this.currentFrame = frame;
- }
- }
- },
- cancel: function() {
- if (!this.options.sync)
- Effect.Queues.get(Object.isString(this.options.queue) ?
- 'global' : this.options.queue.scope).remove(this);
- this.state = 'finished';
- },
- event: function(eventName) {
- if (this.options[eventName + 'Internal']) this.options[eventName + 'Internal'](this);
- if (this.options[eventName]) this.options[eventName](this);
- },
- inspect: function() {
- var data = $H();
- for(property in this)
- if (!Object.isFunction(this[property])) data.set(property, this[property]);
- return '#<Effect:' + data.inspect() + ',options:' + $H(this.options).inspect() + '>';
- }
-});
-
-Effect.Parallel = Class.create(Effect.Base, {
- initialize: function(effects) {
- this.effects = effects || [];
- this.start(arguments[1]);
- },
- update: function(position) {
- this.effects.invoke('render', position);
- },
- finish: function(position) {
- this.effects.each( function(effect) {
- effect.render(1.0);
- effect.cancel();
- effect.event('beforeFinish');
- if (effect.finish) effect.finish(position);
- effect.event('afterFinish');
- });
- }
-});
-
-Effect.Tween = Class.create(Effect.Base, {
- initialize: function(object, from, to) {
- object = Object.isString(object) ? $(object) : object;
- var args = $A(arguments), method = args.last(),
- options = args.length == 5 ? args[3] : null;
- this.method = Object.isFunction(method) ? method.bind(object) :
- Object.isFunction(object[method]) ? object[method].bind(object) :
- function(value) { object[method] = value };
- this.start(Object.extend({ from: from, to: to }, options || { }));
- },
- update: function(position) {
- this.method(position);
- }
-});
-
-Effect.Event = Class.create(Effect.Base, {
- initialize: function() {
- this.start(Object.extend({ duration: 0 }, arguments[0] || { }));
- },
- update: Prototype.emptyFunction
-});
-
-Effect.Opacity = Class.create(Effect.Base, {
- initialize: function(element) {
- this.element = $(element);
- if (!this.element) throw(Effect._elementDoesNotExistError);
- // make this work on IE on elements without 'layout'
- if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
- this.element.setStyle({zoom: 1});
- var options = Object.extend({
- from: this.element.getOpacity() || 0.0,
- to: 1.0
- }, arguments[1] || { });
- this.start(options);
- },
- update: function(position) {
- this.element.setOpacity(position);
- }
-});
-
-Effect.Move = Class.create(Effect.Base, {
- initialize: function(element) {
- this.element = $(element);
- if (!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({
- x: 0,
- y: 0,
- mode: 'relative'
- }, arguments[1] || { });
- this.start(options);
- },
- setup: function() {
- this.element.makePositioned();
- this.originalLeft = parseFloat(this.element.getStyle('left') || '0');
- this.originalTop = parseFloat(this.element.getStyle('top') || '0');
- if (this.options.mode == 'absolute') {
- this.options.x = this.options.x - this.originalLeft;
- this.options.y = this.options.y - this.originalTop;
- }
- },
- update: function(position) {
- this.element.setStyle({
- left: (this.options.x * position + this.originalLeft).round() + 'px',
- top: (this.options.y * position + this.originalTop).round() + 'px'
- });
- }
-});
-
-// for backwards compatibility
-Effect.MoveBy = function(element, toTop, toLeft) {
- return new Effect.Move(element,
- Object.extend({ x: toLeft, y: toTop }, arguments[3] || { }));
-};
-
-Effect.Scale = Class.create(Effect.Base, {
- initialize: function(element, percent) {
- this.element = $(element);
- if (!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({
- scaleX: true,
- scaleY: true,
- scaleContent: true,
- scaleFromCenter: false,
- scaleMode: 'box', // 'box' or 'contents' or { } with provided values
- scaleFrom: 100.0,
- scaleTo: percent
- }, arguments[2] || { });
- this.start(options);
- },
- setup: function() {
- this.restoreAfterFinish = this.options.restoreAfterFinish || false;
- this.elementPositioning = this.element.getStyle('position');
-
- this.originalStyle = { };
- ['top','left','width','height','fontSize'].each( function(k) {
- this.originalStyle[k] = this.element.style[k];
- }.bind(this));
-
- this.originalTop = this.element.offsetTop;
- this.originalLeft = this.element.offsetLeft;
-
- var fontSize = this.element.getStyle('font-size') || '100%';
- ['em','px','%','pt'].each( function(fontSizeType) {
- if (fontSize.indexOf(fontSizeType)>0) {
- this.fontSize = parseFloat(fontSize);
- this.fontSizeType = fontSizeType;
- }
- }.bind(this));
-
- this.factor = (this.options.scaleTo - this.options.scaleFrom)/100;
-
- this.dims = null;
- if (this.options.scaleMode=='box')
- this.dims = [this.element.offsetHeight, this.element.offsetWidth];
- if (/^content/.test(this.options.scaleMode))
- this.dims = [this.element.scrollHeight, this.element.scrollWidth];
- if (!this.dims)
- this.dims = [this.options.scaleMode.originalHeight,
- this.options.scaleMode.originalWidth];
- },
- update: function(position) {
- var currentScale = (this.options.scaleFrom/100.0) + (this.factor * position);
- if (this.options.scaleContent && this.fontSize)
- this.element.setStyle({fontSize: this.fontSize * currentScale + this.fontSizeType });
- this.setDimensions(this.dims[0] * currentScale, this.dims[1] * currentScale);
- },
- finish: function(position) {
- if (this.restoreAfterFinish) this.element.setStyle(this.originalStyle);
- },
- setDimensions: function(height, width) {
- var d = { };
- if (this.options.scaleX) d.width = width.round() + 'px';
- if (this.options.scaleY) d.height = height.round() + 'px';
- if (this.options.scaleFromCenter) {
- var topd = (height - this.dims[0])/2;
- var leftd = (width - this.dims[1])/2;
- if (this.elementPositioning == 'absolute') {
- if (this.options.scaleY) d.top = this.originalTop-topd + 'px';
- if (this.options.scaleX) d.left = this.originalLeft-leftd + 'px';
- } else {
- if (this.options.scaleY) d.top = -topd + 'px';
- if (this.options.scaleX) d.left = -leftd + 'px';
- }
- }
- this.element.setStyle(d);
- }
-});
-
-Effect.Highlight = Class.create(Effect.Base, {
- initialize: function(element) {
- this.element = $(element);
- if (!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({ startcolor: '#ffff99' }, arguments[1] || { });
- this.start(options);
- },
- setup: function() {
- // Prevent executing on elements not in the layout flow
- if (this.element.getStyle('display')=='none') { this.cancel(); return; }
- // Disable background image during the effect
- this.oldStyle = { };
- if (!this.options.keepBackgroundImage) {
- this.oldStyle.backgroundImage = this.element.getStyle('background-image');
- this.element.setStyle({backgroundImage: 'none'});
- }
- if (!this.options.endcolor)
- this.options.endcolor = this.element.getStyle('background-color').parseColor('#ffffff');
- if (!this.options.restorecolor)
- this.options.restorecolor = this.element.getStyle('background-color');
- // init color calculations
- this._base = $R(0,2).map(function(i){ return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16) }.bind(this));
- this._delta = $R(0,2).map(function(i){ return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i] }.bind(this));
- },
- update: function(position) {
- this.element.setStyle({backgroundColor: $R(0,2).inject('#',function(m,v,i){
- return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart()); }.bind(this)) });
- },
- finish: function() {
- this.element.setStyle(Object.extend(this.oldStyle, {
- backgroundColor: this.options.restorecolor
- }));
- }
-});
-
-Effect.ScrollTo = function(element) {
- var options = arguments[1] || { },
- scrollOffsets = document.viewport.getScrollOffsets(),
- elementOffsets = $(element).cumulativeOffset();
-
- if (options.offset) elementOffsets[1] += options.offset;
-
- return new Effect.Tween(null,
- scrollOffsets.top,
- elementOffsets[1],
- options,
- function(p){ scrollTo(scrollOffsets.left, p.round()); }
- );
-};
-
-/* ------------- combination effects ------------- */
-
-Effect.Fade = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- var options = Object.extend({
- from: element.getOpacity() || 1.0,
- to: 0.0,
- afterFinishInternal: function(effect) {
- if (effect.options.to!=0) return;
- effect.element.hide().setStyle({opacity: oldOpacity});
- }
- }, arguments[1] || { });
- return new Effect.Opacity(element,options);
-};
-
-Effect.Appear = function(element) {
- element = $(element);
- var options = Object.extend({
- from: (element.getStyle('display') == 'none' ? 0.0 : element.getOpacity() || 0.0),
- to: 1.0,
- // force Safari to render floated elements properly
- afterFinishInternal: function(effect) {
- effect.element.forceRerendering();
- },
- beforeSetup: function(effect) {
- effect.element.setOpacity(effect.options.from).show();
- }}, arguments[1] || { });
- return new Effect.Opacity(element,options);
-};
-
-Effect.Puff = function(element) {
- element = $(element);
- var oldStyle = {
- opacity: element.getInlineOpacity(),
- position: element.getStyle('position'),
- top: element.style.top,
- left: element.style.left,
- width: element.style.width,
- height: element.style.height
- };
- return new Effect.Parallel(
- [ new Effect.Scale(element, 200,
- { sync: true, scaleFromCenter: true, scaleContent: true, restoreAfterFinish: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 } ) ],
- Object.extend({ duration: 1.0,
- beforeSetupInternal: function(effect) {
- Position.absolutize(effect.effects[0].element);
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide().setStyle(oldStyle); }
- }, arguments[1] || { })
- );
-};
-
-Effect.BlindUp = function(element) {
- element = $(element);
- element.makeClipping();
- return new Effect.Scale(element, 0,
- Object.extend({ scaleContent: false,
- scaleX: false,
- restoreAfterFinish: true,
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping();
- }
- }, arguments[1] || { })
- );
-};
-
-Effect.BlindDown = function(element) {
- element = $(element);
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
- scaleFrom: 0,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makeClipping().setStyle({height: '0px'}).show();
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping();
- }
- }, arguments[1] || { }));
-};
-
-Effect.SwitchOff = function(element) {
- element = $(element);
- var oldOpacity = element.getInlineOpacity();
- return new Effect.Appear(element, Object.extend({
- duration: 0.4,
- from: 0,
- transition: Effect.Transitions.flicker,
- afterFinishInternal: function(effect) {
- new Effect.Scale(effect.element, 1, {
- duration: 0.3, scaleFromCenter: true,
- scaleX: false, scaleContent: false, restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makePositioned().makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping().undoPositioned().setStyle({opacity: oldOpacity});
- }
- });
- }
- }, arguments[1] || { }));
-};
-
-Effect.DropOut = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left'),
- opacity: element.getInlineOpacity() };
- return new Effect.Parallel(
- [ new Effect.Move(element, {x: 0, y: 100, sync: true }),
- new Effect.Opacity(element, { sync: true, to: 0.0 }) ],
- Object.extend(
- { duration: 0.5,
- beforeSetup: function(effect) {
- effect.effects[0].element.makePositioned();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);
- }
- }, arguments[1] || { }));
-};
-
-Effect.Shake = function(element) {
- element = $(element);
- var options = Object.extend({
- distance: 20,
- duration: 0.5
- }, arguments[1] || {});
- var distance = parseFloat(options.distance);
- var split = parseFloat(options.duration) / 10.0;
- var oldStyle = {
- top: element.getStyle('top'),
- left: element.getStyle('left') };
- return new Effect.Move(element,
- { x: distance, y: 0, duration: split, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: distance*2, y: 0, duration: split*2, afterFinishInternal: function(effect) {
- new Effect.Move(effect.element,
- { x: -distance, y: 0, duration: split, afterFinishInternal: function(effect) {
- effect.element.undoPositioned().setStyle(oldStyle);
- }}); }}); }}); }}); }}); }});
-};
-
-Effect.SlideDown = function(element) {
- element = $(element).cleanWhitespace();
- // SlideDown need to have the content of the element wrapped in a container element with fixed height!
- var oldInnerBottom = element.down().getStyle('bottom');
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, 100, Object.extend({
- scaleContent: false,
- scaleX: false,
- scaleFrom: window.opera ? 0 : 1,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makePositioned();
- effect.element.down().makePositioned();
- if (window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping().setStyle({height: '0px'}).show();
- },
- afterUpdateInternal: function(effect) {
- effect.element.down().setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
- },
- afterFinishInternal: function(effect) {
- effect.element.undoClipping().undoPositioned();
- effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom}); }
- }, arguments[1] || { })
- );
-};
-
-Effect.SlideUp = function(element) {
- element = $(element).cleanWhitespace();
- var oldInnerBottom = element.down().getStyle('bottom');
- var elementDimensions = element.getDimensions();
- return new Effect.Scale(element, window.opera ? 0 : 1,
- Object.extend({ scaleContent: false,
- scaleX: false,
- scaleMode: 'box',
- scaleFrom: 100,
- scaleMode: {originalHeight: elementDimensions.height, originalWidth: elementDimensions.width},
- restoreAfterFinish: true,
- afterSetup: function(effect) {
- effect.element.makePositioned();
- effect.element.down().makePositioned();
- if (window.opera) effect.element.setStyle({top: ''});
- effect.element.makeClipping().show();
- },
- afterUpdateInternal: function(effect) {
- effect.element.down().setStyle({bottom:
- (effect.dims[0] - effect.element.clientHeight) + 'px' });
- },
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping().undoPositioned();
- effect.element.down().undoPositioned().setStyle({bottom: oldInnerBottom});
- }
- }, arguments[1] || { })
- );
-};
-
-// Bug in opera makes the TD containing this element expand for a instance after finish
-Effect.Squish = function(element) {
- return new Effect.Scale(element, window.opera ? 1 : 0, {
- restoreAfterFinish: true,
- beforeSetup: function(effect) {
- effect.element.makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping();
- }
- });
-};
-
-Effect.Grow = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.full
- }, arguments[1] || { });
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var initialMoveX, initialMoveY;
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- initialMoveX = initialMoveY = moveX = moveY = 0;
- break;
- case 'top-right':
- initialMoveX = dims.width;
- initialMoveY = moveY = 0;
- moveX = -dims.width;
- break;
- case 'bottom-left':
- initialMoveX = moveX = 0;
- initialMoveY = dims.height;
- moveY = -dims.height;
- break;
- case 'bottom-right':
- initialMoveX = dims.width;
- initialMoveY = dims.height;
- moveX = -dims.width;
- moveY = -dims.height;
- break;
- case 'center':
- initialMoveX = dims.width / 2;
- initialMoveY = dims.height / 2;
- moveX = -dims.width / 2;
- moveY = -dims.height / 2;
- break;
- }
-
- return new Effect.Move(element, {
- x: initialMoveX,
- y: initialMoveY,
- duration: 0.01,
- beforeSetup: function(effect) {
- effect.element.hide().makeClipping().makePositioned();
- },
- afterFinishInternal: function(effect) {
- new Effect.Parallel(
- [ new Effect.Opacity(effect.element, { sync: true, to: 1.0, from: 0.0, transition: options.opacityTransition }),
- new Effect.Move(effect.element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition }),
- new Effect.Scale(effect.element, 100, {
- scaleMode: { originalHeight: dims.height, originalWidth: dims.width },
- sync: true, scaleFrom: window.opera ? 1 : 0, transition: options.scaleTransition, restoreAfterFinish: true})
- ], Object.extend({
- beforeSetup: function(effect) {
- effect.effects[0].element.setStyle({height: '0px'}).show();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);
- }
- }, options)
- );
- }
- });
-};
-
-Effect.Shrink = function(element) {
- element = $(element);
- var options = Object.extend({
- direction: 'center',
- moveTransition: Effect.Transitions.sinoidal,
- scaleTransition: Effect.Transitions.sinoidal,
- opacityTransition: Effect.Transitions.none
- }, arguments[1] || { });
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- height: element.style.height,
- width: element.style.width,
- opacity: element.getInlineOpacity() };
-
- var dims = element.getDimensions();
- var moveX, moveY;
-
- switch (options.direction) {
- case 'top-left':
- moveX = moveY = 0;
- break;
- case 'top-right':
- moveX = dims.width;
- moveY = 0;
- break;
- case 'bottom-left':
- moveX = 0;
- moveY = dims.height;
- break;
- case 'bottom-right':
- moveX = dims.width;
- moveY = dims.height;
- break;
- case 'center':
- moveX = dims.width / 2;
- moveY = dims.height / 2;
- break;
- }
-
- return new Effect.Parallel(
- [ new Effect.Opacity(element, { sync: true, to: 0.0, from: 1.0, transition: options.opacityTransition }),
- new Effect.Scale(element, window.opera ? 1 : 0, { sync: true, transition: options.scaleTransition, restoreAfterFinish: true}),
- new Effect.Move(element, { x: moveX, y: moveY, sync: true, transition: options.moveTransition })
- ], Object.extend({
- beforeStartInternal: function(effect) {
- effect.effects[0].element.makePositioned().makeClipping();
- },
- afterFinishInternal: function(effect) {
- effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle); }
- }, options)
- );
-};
-
-Effect.Pulsate = function(element) {
- element = $(element);
- var options = arguments[1] || { },
- oldOpacity = element.getInlineOpacity(),
- transition = options.transition || Effect.Transitions.linear,
- reverser = function(pos){
- return 1 - transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2) + .5);
- };
-
- return new Effect.Opacity(element,
- Object.extend(Object.extend({ duration: 2.0, from: 0,
- afterFinishInternal: function(effect) { effect.element.setStyle({opacity: oldOpacity}); }
- }, options), {transition: reverser}));
-};
-
-Effect.Fold = function(element) {
- element = $(element);
- var oldStyle = {
- top: element.style.top,
- left: element.style.left,
- width: element.style.width,
- height: element.style.height };
- element.makeClipping();
- return new Effect.Scale(element, 5, Object.extend({
- scaleContent: false,
- scaleX: false,
- afterFinishInternal: function(effect) {
- new Effect.Scale(element, 1, {
- scaleContent: false,
- scaleY: false,
- afterFinishInternal: function(effect) {
- effect.element.hide().undoClipping().setStyle(oldStyle);
- } });
- }}, arguments[1] || { }));
-};
-
-Effect.Morph = Class.create(Effect.Base, {
- initialize: function(element) {
- this.element = $(element);
- if (!this.element) throw(Effect._elementDoesNotExistError);
- var options = Object.extend({
- style: { }
- }, arguments[1] || { });
-
- if (!Object.isString(options.style)) this.style = $H(options.style);
- else {
- if (options.style.include(':'))
- this.style = options.style.parseStyle();
- else {
- this.element.addClassName(options.style);
- this.style = $H(this.element.getStyles());
- this.element.removeClassName(options.style);
- var css = this.element.getStyles();
- this.style = this.style.reject(function(style) {
- return style.value == css[style.key];
- });
- options.afterFinishInternal = function(effect) {
- effect.element.addClassName(effect.options.style);
- effect.transforms.each(function(transform) {
- effect.element.style[transform.style] = '';
- });
- };
- }
- }
- this.start(options);
- },
-
- setup: function(){
- function parseColor(color){
- if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
- color = color.parseColor();
- return $R(0,2).map(function(i){
- return parseInt( color.slice(i*2+1,i*2+3), 16 );
- });
- }
- this.transforms = this.style.map(function(pair){
- var property = pair[0], value = pair[1], unit = null;
-
- if (value.parseColor('#zzzzzz') != '#zzzzzz') {
- value = value.parseColor();
- unit = 'color';
- } else if (property == 'opacity') {
- value = parseFloat(value);
- if (Prototype.Browser.IE && (!this.element.currentStyle.hasLayout))
- this.element.setStyle({zoom: 1});
- } else if (Element.CSS_LENGTH.test(value)) {
- var components = value.match(/^([\+\-]?[0-9\.]+)(.*)$/);
- value = parseFloat(components[1]);
- unit = (components.length == 3) ? components[2] : null;
- }
-
- var originalValue = this.element.getStyle(property);
- return {
- style: property.camelize(),
- originalValue: unit=='color' ? parseColor(originalValue) : parseFloat(originalValue || 0),
- targetValue: unit=='color' ? parseColor(value) : value,
- unit: unit
- };
- }.bind(this)).reject(function(transform){
- return (
- (transform.originalValue == transform.targetValue) ||
- (
- transform.unit != 'color' &&
- (isNaN(transform.originalValue) || isNaN(transform.targetValue))
- )
- );
- });
- },
- update: function(position) {
- var style = { }, transform, i = this.transforms.length;
- while(i--)
- style[(transform = this.transforms[i]).style] =
- transform.unit=='color' ? '#'+
- (Math.round(transform.originalValue[0]+
- (transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart() +
- (Math.round(transform.originalValue[1]+
- (transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart() +
- (Math.round(transform.originalValue[2]+
- (transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart() :
- (transform.originalValue +
- (transform.targetValue - transform.originalValue) * position).toFixed(3) +
- (transform.unit === null ? '' : transform.unit);
- this.element.setStyle(style, true);
- }
-});
-
-Effect.Transform = Class.create({
- initialize: function(tracks){
- this.tracks = [];
- this.options = arguments[1] || { };
- this.addTracks(tracks);
- },
- addTracks: function(tracks){
- tracks.each(function(track){
- track = $H(track);
- var data = track.values().first();
- this.tracks.push($H({
- ids: track.keys().first(),
- effect: Effect.Morph,
- options: { style: data }
- }));
- }.bind(this));
- return this;
- },
- play: function(){
- return new Effect.Parallel(
- this.tracks.map(function(track){
- var ids = track.get('ids'), effect = track.get('effect'), options = track.get('options');
- var elements = [$(ids) || $$(ids)].flatten();
- return elements.map(function(e){ return new effect(e, Object.extend({ sync:true }, options)) });
- }).flatten(),
- this.options
- );
- }
-});
-
-Element.CSS_PROPERTIES = $w(
- 'backgroundColor backgroundPosition borderBottomColor borderBottomStyle ' +
- 'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth ' +
- 'borderRightColor borderRightStyle borderRightWidth borderSpacing ' +
- 'borderTopColor borderTopStyle borderTopWidth bottom clip color ' +
- 'fontSize fontWeight height left letterSpacing lineHeight ' +
- 'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+
- 'maxWidth minHeight minWidth opacity outlineColor outlineOffset ' +
- 'outlineWidth paddingBottom paddingLeft paddingRight paddingTop ' +
- 'right textIndent top width wordSpacing zIndex');
-
-Element.CSS_LENGTH = /^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;
-
-String.__parseStyleElement = document.createElement('div');
-String.prototype.parseStyle = function(){
- var style, styleRules = $H();
- if (Prototype.Browser.WebKit)
- style = new Element('div',{style:this}).style;
- else {
- String.__parseStyleElement.innerHTML = '<div style="' + this + '"></div>';
- style = String.__parseStyleElement.childNodes[0].style;
- }
-
- Element.CSS_PROPERTIES.each(function(property){
- if (style[property]) styleRules.set(property, style[property]);
- });
-
- if (Prototype.Browser.IE && this.include('opacity'))
- styleRules.set('opacity', this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);
-
- return styleRules;
-};
-
-if (document.defaultView && document.defaultView.getComputedStyle) {
- Element.getStyles = function(element) {
- var css = document.defaultView.getComputedStyle($(element), null);
- return Element.CSS_PROPERTIES.inject({ }, function(styles, property) {
- styles[property] = css[property];
- return styles;
- });
- };
-} else {
- Element.getStyles = function(element) {
- element = $(element);
- var css = element.currentStyle, styles;
- styles = Element.CSS_PROPERTIES.inject({ }, function(results, property) {
- results[property] = css[property];
- return results;
- });
- if (!styles.opacity) styles.opacity = element.getOpacity();
- return styles;
- };
-}
-
-Effect.Methods = {
- morph: function(element, style) {
- element = $(element);
- new Effect.Morph(element, Object.extend({ style: style }, arguments[2] || { }));
- return element;
- },
- visualEffect: function(element, effect, options) {
- element = $(element);
- var s = effect.dasherize().camelize(), klass = s.charAt(0).toUpperCase() + s.substring(1);
- new Effect[klass](element, options);
- return element;
- },
- highlight: function(element, options) {
- element = $(element);
- new Effect.Highlight(element, options);
- return element;
- }
-};
-
-$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+
- 'pulsate shake puff squish switchOff dropOut').each(
- function(effect) {
- Effect.Methods[effect] = function(element, options){
- element = $(element);
- Effect[effect.charAt(0).toUpperCase() + effect.substring(1)](element, options);
- return element;
- };
- }
-);
-
-$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(
- function(f) { Effect.Methods[f] = Element[f]; }
-);
-
-Element.addMethods(Effect.Methods); \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/prototype.js b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/prototype.js
deleted file mode 100644
index dfe8ab4e136..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/javascripts/prototype.js
+++ /dev/null
@@ -1,4320 +0,0 @@
-/* Prototype JavaScript framework, version 1.6.0.3
- * (c) 2005-2008 Sam Stephenson
- *
- * Prototype is freely distributable under the terms of an MIT-style license.
- * For details, see the Prototype web site: http://www.prototypejs.org/
- *
- *--------------------------------------------------------------------------*/
-
-var Prototype = {
- Version: '1.6.0.3',
-
- Browser: {
- IE: !!(window.attachEvent &&
- navigator.userAgent.indexOf('Opera') === -1),
- Opera: navigator.userAgent.indexOf('Opera') > -1,
- WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1,
- Gecko: navigator.userAgent.indexOf('Gecko') > -1 &&
- navigator.userAgent.indexOf('KHTML') === -1,
- MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/)
- },
-
- BrowserFeatures: {
- XPath: !!document.evaluate,
- SelectorsAPI: !!document.querySelector,
- ElementExtensions: !!window.HTMLElement,
- SpecificElementExtensions:
- document.createElement('div')['__proto__'] &&
- document.createElement('div')['__proto__'] !==
- document.createElement('form')['__proto__']
- },
-
- ScriptFragment: '<script[^>]*>([\\S\\s]*?)<\/script>',
- JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/,
-
- emptyFunction: function() { },
- K: function(x) { return x }
-};
-
-if (Prototype.Browser.MobileSafari)
- Prototype.BrowserFeatures.SpecificElementExtensions = false;
-
-
-/* Based on Alex Arnell's inheritance implementation. */
-var Class = {
- create: function() {
- var parent = null, properties = $A(arguments);
- if (Object.isFunction(properties[0]))
- parent = properties.shift();
-
- function klass() {
- this.initialize.apply(this, arguments);
- }
-
- Object.extend(klass, Class.Methods);
- klass.superclass = parent;
- klass.subclasses = [];
-
- if (parent) {
- var subclass = function() { };
- subclass.prototype = parent.prototype;
- klass.prototype = new subclass;
- parent.subclasses.push(klass);
- }
-
- for (var i = 0; i < properties.length; i++)
- klass.addMethods(properties[i]);
-
- if (!klass.prototype.initialize)
- klass.prototype.initialize = Prototype.emptyFunction;
-
- klass.prototype.constructor = klass;
-
- return klass;
- }
-};
-
-Class.Methods = {
- addMethods: function(source) {
- var ancestor = this.superclass && this.superclass.prototype;
- var properties = Object.keys(source);
-
- if (!Object.keys({ toString: true }).length)
- properties.push("toString", "valueOf");
-
- for (var i = 0, length = properties.length; i < length; i++) {
- var property = properties[i], value = source[property];
- if (ancestor && Object.isFunction(value) &&
- value.argumentNames().first() == "$super") {
- var method = value;
- value = (function(m) {
- return function() { return ancestor[m].apply(this, arguments) };
- })(property).wrap(method);
-
- value.valueOf = method.valueOf.bind(method);
- value.toString = method.toString.bind(method);
- }
- this.prototype[property] = value;
- }
-
- return this;
- }
-};
-
-var Abstract = { };
-
-Object.extend = function(destination, source) {
- for (var property in source)
- destination[property] = source[property];
- return destination;
-};
-
-Object.extend(Object, {
- inspect: function(object) {
- try {
- if (Object.isUndefined(object)) return 'undefined';
- if (object === null) return 'null';
- return object.inspect ? object.inspect() : String(object);
- } catch (e) {
- if (e instanceof RangeError) return '...';
- throw e;
- }
- },
-
- toJSON: function(object) {
- var type = typeof object;
- switch (type) {
- case 'undefined':
- case 'function':
- case 'unknown': return;
- case 'boolean': return object.toString();
- }
-
- if (object === null) return 'null';
- if (object.toJSON) return object.toJSON();
- if (Object.isElement(object)) return;
-
- var results = [];
- for (var property in object) {
- var value = Object.toJSON(object[property]);
- if (!Object.isUndefined(value))
- results.push(property.toJSON() + ': ' + value);
- }
-
- return '{' + results.join(', ') + '}';
- },
-
- toQueryString: function(object) {
- return $H(object).toQueryString();
- },
-
- toHTML: function(object) {
- return object && object.toHTML ? object.toHTML() : String.interpret(object);
- },
-
- keys: function(object) {
- var keys = [];
- for (var property in object)
- keys.push(property);
- return keys;
- },
-
- values: function(object) {
- var values = [];
- for (var property in object)
- values.push(object[property]);
- return values;
- },
-
- clone: function(object) {
- return Object.extend({ }, object);
- },
-
- isElement: function(object) {
- return !!(object && object.nodeType == 1);
- },
-
- isArray: function(object) {
- return object != null && typeof object == "object" &&
- 'splice' in object && 'join' in object;
- },
-
- isHash: function(object) {
- return object instanceof Hash;
- },
-
- isFunction: function(object) {
- return typeof object == "function";
- },
-
- isString: function(object) {
- return typeof object == "string";
- },
-
- isNumber: function(object) {
- return typeof object == "number";
- },
-
- isUndefined: function(object) {
- return typeof object == "undefined";
- }
-});
-
-Object.extend(Function.prototype, {
- argumentNames: function() {
- var names = this.toString().match(/^[\s\(]*function[^(]*\(([^\)]*)\)/)[1]
- .replace(/\s+/g, '').split(',');
- return names.length == 1 && !names[0] ? [] : names;
- },
-
- bind: function() {
- if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
- var __method = this, args = $A(arguments), object = args.shift();
- return function() {
- return __method.apply(object, args.concat($A(arguments)));
- }
- },
-
- bindAsEventListener: function() {
- var __method = this, args = $A(arguments), object = args.shift();
- return function(event) {
- return __method.apply(object, [event || window.event].concat(args));
- }
- },
-
- curry: function() {
- if (!arguments.length) return this;
- var __method = this, args = $A(arguments);
- return function() {
- return __method.apply(this, args.concat($A(arguments)));
- }
- },
-
- delay: function() {
- var __method = this, args = $A(arguments), timeout = args.shift() * 1000;
- return window.setTimeout(function() {
- return __method.apply(__method, args);
- }, timeout);
- },
-
- defer: function() {
- var args = [0.01].concat($A(arguments));
- return this.delay.apply(this, args);
- },
-
- wrap: function(wrapper) {
- var __method = this;
- return function() {
- return wrapper.apply(this, [__method.bind(this)].concat($A(arguments)));
- }
- },
-
- methodize: function() {
- if (this._methodized) return this._methodized;
- var __method = this;
- return this._methodized = function() {
- return __method.apply(null, [this].concat($A(arguments)));
- };
- }
-});
-
-Date.prototype.toJSON = function() {
- return '"' + this.getUTCFullYear() + '-' +
- (this.getUTCMonth() + 1).toPaddedString(2) + '-' +
- this.getUTCDate().toPaddedString(2) + 'T' +
- this.getUTCHours().toPaddedString(2) + ':' +
- this.getUTCMinutes().toPaddedString(2) + ':' +
- this.getUTCSeconds().toPaddedString(2) + 'Z"';
-};
-
-var Try = {
- these: function() {
- var returnValue;
-
- for (var i = 0, length = arguments.length; i < length; i++) {
- var lambda = arguments[i];
- try {
- returnValue = lambda();
- break;
- } catch (e) { }
- }
-
- return returnValue;
- }
-};
-
-RegExp.prototype.match = RegExp.prototype.test;
-
-RegExp.escape = function(str) {
- return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
-};
-
-/*--------------------------------------------------------------------------*/
-
-var PeriodicalExecuter = Class.create({
- initialize: function(callback, frequency) {
- this.callback = callback;
- this.frequency = frequency;
- this.currentlyExecuting = false;
-
- this.registerCallback();
- },
-
- registerCallback: function() {
- this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000);
- },
-
- execute: function() {
- this.callback(this);
- },
-
- stop: function() {
- if (!this.timer) return;
- clearInterval(this.timer);
- this.timer = null;
- },
-
- onTimerEvent: function() {
- if (!this.currentlyExecuting) {
- try {
- this.currentlyExecuting = true;
- this.execute();
- } finally {
- this.currentlyExecuting = false;
- }
- }
- }
-});
-Object.extend(String, {
- interpret: function(value) {
- return value == null ? '' : String(value);
- },
- specialChar: {
- '\b': '\\b',
- '\t': '\\t',
- '\n': '\\n',
- '\f': '\\f',
- '\r': '\\r',
- '\\': '\\\\'
- }
-});
-
-Object.extend(String.prototype, {
- gsub: function(pattern, replacement) {
- var result = '', source = this, match;
- replacement = arguments.callee.prepareReplacement(replacement);
-
- while (source.length > 0) {
- if (match = source.match(pattern)) {
- result += source.slice(0, match.index);
- result += String.interpret(replacement(match));
- source = source.slice(match.index + match[0].length);
- } else {
- result += source, source = '';
- }
- }
- return result;
- },
-
- sub: function(pattern, replacement, count) {
- replacement = this.gsub.prepareReplacement(replacement);
- count = Object.isUndefined(count) ? 1 : count;
-
- return this.gsub(pattern, function(match) {
- if (--count < 0) return match[0];
- return replacement(match);
- });
- },
-
- scan: function(pattern, iterator) {
- this.gsub(pattern, iterator);
- return String(this);
- },
-
- truncate: function(length, truncation) {
- length = length || 30;
- truncation = Object.isUndefined(truncation) ? '...' : truncation;
- return this.length > length ?
- this.slice(0, length - truncation.length) + truncation : String(this);
- },
-
- strip: function() {
- return this.replace(/^\s+/, '').replace(/\s+$/, '');
- },
-
- stripTags: function() {
- return this.replace(/<\/?[^>]+>/gi, '');
- },
-
- stripScripts: function() {
- return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), '');
- },
-
- extractScripts: function() {
- var matchAll = new RegExp(Prototype.ScriptFragment, 'img');
- var matchOne = new RegExp(Prototype.ScriptFragment, 'im');
- return (this.match(matchAll) || []).map(function(scriptTag) {
- return (scriptTag.match(matchOne) || ['', ''])[1];
- });
- },
-
- evalScripts: function() {
- return this.extractScripts().map(function(script) { return eval(script) });
- },
-
- escapeHTML: function() {
- var self = arguments.callee;
- self.text.data = this;
- return self.div.innerHTML;
- },
-
- unescapeHTML: function() {
- var div = new Element('div');
- div.innerHTML = this.stripTags();
- return div.childNodes[0] ? (div.childNodes.length > 1 ?
- $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) :
- div.childNodes[0].nodeValue) : '';
- },
-
- toQueryParams: function(separator) {
- var match = this.strip().match(/([^?#]*)(#.*)?$/);
- if (!match) return { };
-
- return match[1].split(separator || '&').inject({ }, function(hash, pair) {
- if ((pair = pair.split('='))[0]) {
- var key = decodeURIComponent(pair.shift());
- var value = pair.length > 1 ? pair.join('=') : pair[0];
- if (value != undefined) value = decodeURIComponent(value);
-
- if (key in hash) {
- if (!Object.isArray(hash[key])) hash[key] = [hash[key]];
- hash[key].push(value);
- }
- else hash[key] = value;
- }
- return hash;
- });
- },
-
- toArray: function() {
- return this.split('');
- },
-
- succ: function() {
- return this.slice(0, this.length - 1) +
- String.fromCharCode(this.charCodeAt(this.length - 1) + 1);
- },
-
- times: function(count) {
- return count < 1 ? '' : new Array(count + 1).join(this);
- },
-
- camelize: function() {
- var parts = this.split('-'), len = parts.length;
- if (len == 1) return parts[0];
-
- var camelized = this.charAt(0) == '-'
- ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1)
- : parts[0];
-
- for (var i = 1; i < len; i++)
- camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
-
- return camelized;
- },
-
- capitalize: function() {
- return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase();
- },
-
- underscore: function() {
- return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase();
- },
-
- dasherize: function() {
- return this.gsub(/_/,'-');
- },
-
- inspect: function(useDoubleQuotes) {
- var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) {
- var character = String.specialChar[match[0]];
- return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16);
- });
- if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"';
- return "'" + escapedString.replace(/'/g, '\\\'') + "'";
- },
-
- toJSON: function() {
- return this.inspect(true);
- },
-
- unfilterJSON: function(filter) {
- return this.sub(filter || Prototype.JSONFilter, '#{1}');
- },
-
- isJSON: function() {
- var str = this;
- if (str.blank()) return false;
- str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, '');
- return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str);
- },
-
- evalJSON: function(sanitize) {
- var json = this.unfilterJSON();
- try {
- if (!sanitize || json.isJSON()) return eval('(' + json + ')');
- } catch (e) { }
- throw new SyntaxError('Badly formed JSON string: ' + this.inspect());
- },
-
- include: function(pattern) {
- return this.indexOf(pattern) > -1;
- },
-
- startsWith: function(pattern) {
- return this.indexOf(pattern) === 0;
- },
-
- endsWith: function(pattern) {
- var d = this.length - pattern.length;
- return d >= 0 && this.lastIndexOf(pattern) === d;
- },
-
- empty: function() {
- return this == '';
- },
-
- blank: function() {
- return /^\s*$/.test(this);
- },
-
- interpolate: function(object, pattern) {
- return new Template(this, pattern).evaluate(object);
- }
-});
-
-if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, {
- escapeHTML: function() {
- return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;');
- },
- unescapeHTML: function() {
- return this.stripTags().replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>');
- }
-});
-
-String.prototype.gsub.prepareReplacement = function(replacement) {
- if (Object.isFunction(replacement)) return replacement;
- var template = new Template(replacement);
- return function(match) { return template.evaluate(match) };
-};
-
-String.prototype.parseQuery = String.prototype.toQueryParams;
-
-Object.extend(String.prototype.escapeHTML, {
- div: document.createElement('div'),
- text: document.createTextNode('')
-});
-
-String.prototype.escapeHTML.div.appendChild(String.prototype.escapeHTML.text);
-
-var Template = Class.create({
- initialize: function(template, pattern) {
- this.template = template.toString();
- this.pattern = pattern || Template.Pattern;
- },
-
- evaluate: function(object) {
- if (Object.isFunction(object.toTemplateReplacements))
- object = object.toTemplateReplacements();
-
- return this.template.gsub(this.pattern, function(match) {
- if (object == null) return '';
-
- var before = match[1] || '';
- if (before == '\\') return match[2];
-
- var ctx = object, expr = match[3];
- var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/;
- match = pattern.exec(expr);
- if (match == null) return before;
-
- while (match != null) {
- var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1];
- ctx = ctx[comp];
- if (null == ctx || '' == match[3]) break;
- expr = expr.substring('[' == match[3] ? match[1].length : match[0].length);
- match = pattern.exec(expr);
- }
-
- return before + String.interpret(ctx);
- });
- }
-});
-Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/;
-
-var $break = { };
-
-var Enumerable = {
- each: function(iterator, context) {
- var index = 0;
- try {
- this._each(function(value) {
- iterator.call(context, value, index++);
- });
- } catch (e) {
- if (e != $break) throw e;
- }
- return this;
- },
-
- eachSlice: function(number, iterator, context) {
- var index = -number, slices = [], array = this.toArray();
- if (number < 1) return array;
- while ((index += number) < array.length)
- slices.push(array.slice(index, index+number));
- return slices.collect(iterator, context);
- },
-
- all: function(iterator, context) {
- iterator = iterator || Prototype.K;
- var result = true;
- this.each(function(value, index) {
- result = result && !!iterator.call(context, value, index);
- if (!result) throw $break;
- });
- return result;
- },
-
- any: function(iterator, context) {
- iterator = iterator || Prototype.K;
- var result = false;
- this.each(function(value, index) {
- if (result = !!iterator.call(context, value, index))
- throw $break;
- });
- return result;
- },
-
- collect: function(iterator, context) {
- iterator = iterator || Prototype.K;
- var results = [];
- this.each(function(value, index) {
- results.push(iterator.call(context, value, index));
- });
- return results;
- },
-
- detect: function(iterator, context) {
- var result;
- this.each(function(value, index) {
- if (iterator.call(context, value, index)) {
- result = value;
- throw $break;
- }
- });
- return result;
- },
-
- findAll: function(iterator, context) {
- var results = [];
- this.each(function(value, index) {
- if (iterator.call(context, value, index))
- results.push(value);
- });
- return results;
- },
-
- grep: function(filter, iterator, context) {
- iterator = iterator || Prototype.K;
- var results = [];
-
- if (Object.isString(filter))
- filter = new RegExp(filter);
-
- this.each(function(value, index) {
- if (filter.match(value))
- results.push(iterator.call(context, value, index));
- });
- return results;
- },
-
- include: function(object) {
- if (Object.isFunction(this.indexOf))
- if (this.indexOf(object) != -1) return true;
-
- var found = false;
- this.each(function(value) {
- if (value == object) {
- found = true;
- throw $break;
- }
- });
- return found;
- },
-
- inGroupsOf: function(number, fillWith) {
- fillWith = Object.isUndefined(fillWith) ? null : fillWith;
- return this.eachSlice(number, function(slice) {
- while(slice.length < number) slice.push(fillWith);
- return slice;
- });
- },
-
- inject: function(memo, iterator, context) {
- this.each(function(value, index) {
- memo = iterator.call(context, memo, value, index);
- });
- return memo;
- },
-
- invoke: function(method) {
- var args = $A(arguments).slice(1);
- return this.map(function(value) {
- return value[method].apply(value, args);
- });
- },
-
- max: function(iterator, context) {
- iterator = iterator || Prototype.K;
- var result;
- this.each(function(value, index) {
- value = iterator.call(context, value, index);
- if (result == null || value >= result)
- result = value;
- });
- return result;
- },
-
- min: function(iterator, context) {
- iterator = iterator || Prototype.K;
- var result;
- this.each(function(value, index) {
- value = iterator.call(context, value, index);
- if (result == null || value < result)
- result = value;
- });
- return result;
- },
-
- partition: function(iterator, context) {
- iterator = iterator || Prototype.K;
- var trues = [], falses = [];
- this.each(function(value, index) {
- (iterator.call(context, value, index) ?
- trues : falses).push(value);
- });
- return [trues, falses];
- },
-
- pluck: function(property) {
- var results = [];
- this.each(function(value) {
- results.push(value[property]);
- });
- return results;
- },
-
- reject: function(iterator, context) {
- var results = [];
- this.each(function(value, index) {
- if (!iterator.call(context, value, index))
- results.push(value);
- });
- return results;
- },
-
- sortBy: function(iterator, context) {
- return this.map(function(value, index) {
- return {
- value: value,
- criteria: iterator.call(context, value, index)
- };
- }).sort(function(left, right) {
- var a = left.criteria, b = right.criteria;
- return a < b ? -1 : a > b ? 1 : 0;
- }).pluck('value');
- },
-
- toArray: function() {
- return this.map();
- },
-
- zip: function() {
- var iterator = Prototype.K, args = $A(arguments);
- if (Object.isFunction(args.last()))
- iterator = args.pop();
-
- var collections = [this].concat(args).map($A);
- return this.map(function(value, index) {
- return iterator(collections.pluck(index));
- });
- },
-
- size: function() {
- return this.toArray().length;
- },
-
- inspect: function() {
- return '#<Enumerable:' + this.toArray().inspect() + '>';
- }
-};
-
-Object.extend(Enumerable, {
- map: Enumerable.collect,
- find: Enumerable.detect,
- select: Enumerable.findAll,
- filter: Enumerable.findAll,
- member: Enumerable.include,
- entries: Enumerable.toArray,
- every: Enumerable.all,
- some: Enumerable.any
-});
-function $A(iterable) {
- if (!iterable) return [];
- if (iterable.toArray) return iterable.toArray();
- var length = iterable.length || 0, results = new Array(length);
- while (length--) results[length] = iterable[length];
- return results;
-}
-
-if (Prototype.Browser.WebKit) {
- $A = function(iterable) {
- if (!iterable) return [];
- // In Safari, only use the `toArray` method if it's not a NodeList.
- // A NodeList is a function, has an function `item` property, and a numeric
- // `length` property. Adapted from Google Doctype.
- if (!(typeof iterable === 'function' && typeof iterable.length ===
- 'number' && typeof iterable.item === 'function') && iterable.toArray)
- return iterable.toArray();
- var length = iterable.length || 0, results = new Array(length);
- while (length--) results[length] = iterable[length];
- return results;
- };
-}
-
-Array.from = $A;
-
-Object.extend(Array.prototype, Enumerable);
-
-if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse;
-
-Object.extend(Array.prototype, {
- _each: function(iterator) {
- for (var i = 0, length = this.length; i < length; i++)
- iterator(this[i]);
- },
-
- clear: function() {
- this.length = 0;
- return this;
- },
-
- first: function() {
- return this[0];
- },
-
- last: function() {
- return this[this.length - 1];
- },
-
- compact: function() {
- return this.select(function(value) {
- return value != null;
- });
- },
-
- flatten: function() {
- return this.inject([], function(array, value) {
- return array.concat(Object.isArray(value) ?
- value.flatten() : [value]);
- });
- },
-
- without: function() {
- var values = $A(arguments);
- return this.select(function(value) {
- return !values.include(value);
- });
- },
-
- reverse: function(inline) {
- return (inline !== false ? this : this.toArray())._reverse();
- },
-
- reduce: function() {
- return this.length > 1 ? this : this[0];
- },
-
- uniq: function(sorted) {
- return this.inject([], function(array, value, index) {
- if (0 == index || (sorted ? array.last() != value : !array.include(value)))
- array.push(value);
- return array;
- });
- },
-
- intersect: function(array) {
- return this.uniq().findAll(function(item) {
- return array.detect(function(value) { return item === value });
- });
- },
-
- clone: function() {
- return [].concat(this);
- },
-
- size: function() {
- return this.length;
- },
-
- inspect: function() {
- return '[' + this.map(Object.inspect).join(', ') + ']';
- },
-
- toJSON: function() {
- var results = [];
- this.each(function(object) {
- var value = Object.toJSON(object);
- if (!Object.isUndefined(value)) results.push(value);
- });
- return '[' + results.join(', ') + ']';
- }
-});
-
-// use native browser JS 1.6 implementation if available
-if (Object.isFunction(Array.prototype.forEach))
- Array.prototype._each = Array.prototype.forEach;
-
-if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) {
- i || (i = 0);
- var length = this.length;
- if (i < 0) i = length + i;
- for (; i < length; i++)
- if (this[i] === item) return i;
- return -1;
-};
-
-if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) {
- i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1;
- var n = this.slice(0, i).reverse().indexOf(item);
- return (n < 0) ? n : i - n - 1;
-};
-
-Array.prototype.toArray = Array.prototype.clone;
-
-function $w(string) {
- if (!Object.isString(string)) return [];
- string = string.strip();
- return string ? string.split(/\s+/) : [];
-}
-
-if (Prototype.Browser.Opera){
- Array.prototype.concat = function() {
- var array = [];
- for (var i = 0, length = this.length; i < length; i++) array.push(this[i]);
- for (var i = 0, length = arguments.length; i < length; i++) {
- if (Object.isArray(arguments[i])) {
- for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++)
- array.push(arguments[i][j]);
- } else {
- array.push(arguments[i]);
- }
- }
- return array;
- };
-}
-Object.extend(Number.prototype, {
- toColorPart: function() {
- return this.toPaddedString(2, 16);
- },
-
- succ: function() {
- return this + 1;
- },
-
- times: function(iterator, context) {
- $R(0, this, true).each(iterator, context);
- return this;
- },
-
- toPaddedString: function(length, radix) {
- var string = this.toString(radix || 10);
- return '0'.times(length - string.length) + string;
- },
-
- toJSON: function() {
- return isFinite(this) ? this.toString() : 'null';
- }
-});
-
-$w('abs round ceil floor').each(function(method){
- Number.prototype[method] = Math[method].methodize();
-});
-function $H(object) {
- return new Hash(object);
-};
-
-var Hash = Class.create(Enumerable, (function() {
-
- function toQueryPair(key, value) {
- if (Object.isUndefined(value)) return key;
- return key + '=' + encodeURIComponent(String.interpret(value));
- }
-
- return {
- initialize: function(object) {
- this._object = Object.isHash(object) ? object.toObject() : Object.clone(object);
- },
-
- _each: function(iterator) {
- for (var key in this._object) {
- var value = this._object[key], pair = [key, value];
- pair.key = key;
- pair.value = value;
- iterator(pair);
- }
- },
-
- set: function(key, value) {
- return this._object[key] = value;
- },
-
- get: function(key) {
- // simulating poorly supported hasOwnProperty
- if (this._object[key] !== Object.prototype[key])
- return this._object[key];
- },
-
- unset: function(key) {
- var value = this._object[key];
- delete this._object[key];
- return value;
- },
-
- toObject: function() {
- return Object.clone(this._object);
- },
-
- keys: function() {
- return this.pluck('key');
- },
-
- values: function() {
- return this.pluck('value');
- },
-
- index: function(value) {
- var match = this.detect(function(pair) {
- return pair.value === value;
- });
- return match && match.key;
- },
-
- merge: function(object) {
- return this.clone().update(object);
- },
-
- update: function(object) {
- return new Hash(object).inject(this, function(result, pair) {
- result.set(pair.key, pair.value);
- return result;
- });
- },
-
- toQueryString: function() {
- return this.inject([], function(results, pair) {
- var key = encodeURIComponent(pair.key), values = pair.value;
-
- if (values && typeof values == 'object') {
- if (Object.isArray(values))
- return results.concat(values.map(toQueryPair.curry(key)));
- } else results.push(toQueryPair(key, values));
- return results;
- }).join('&');
- },
-
- inspect: function() {
- return '#<Hash:{' + this.map(function(pair) {
- return pair.map(Object.inspect).join(': ');
- }).join(', ') + '}>';
- },
-
- toJSON: function() {
- return Object.toJSON(this.toObject());
- },
-
- clone: function() {
- return new Hash(this);
- }
- }
-})());
-
-Hash.prototype.toTemplateReplacements = Hash.prototype.toObject;
-Hash.from = $H;
-var ObjectRange = Class.create(Enumerable, {
- initialize: function(start, end, exclusive) {
- this.start = start;
- this.end = end;
- this.exclusive = exclusive;
- },
-
- _each: function(iterator) {
- var value = this.start;
- while (this.include(value)) {
- iterator(value);
- value = value.succ();
- }
- },
-
- include: function(value) {
- if (value < this.start)
- return false;
- if (this.exclusive)
- return value < this.end;
- return value <= this.end;
- }
-});
-
-var $R = function(start, end, exclusive) {
- return new ObjectRange(start, end, exclusive);
-};
-
-var Ajax = {
- getTransport: function() {
- return Try.these(
- function() {return new XMLHttpRequest()},
- function() {return new ActiveXObject('Msxml2.XMLHTTP')},
- function() {return new ActiveXObject('Microsoft.XMLHTTP')}
- ) || false;
- },
-
- activeRequestCount: 0
-};
-
-Ajax.Responders = {
- responders: [],
-
- _each: function(iterator) {
- this.responders._each(iterator);
- },
-
- register: function(responder) {
- if (!this.include(responder))
- this.responders.push(responder);
- },
-
- unregister: function(responder) {
- this.responders = this.responders.without(responder);
- },
-
- dispatch: function(callback, request, transport, json) {
- this.each(function(responder) {
- if (Object.isFunction(responder[callback])) {
- try {
- responder[callback].apply(responder, [request, transport, json]);
- } catch (e) { }
- }
- });
- }
-};
-
-Object.extend(Ajax.Responders, Enumerable);
-
-Ajax.Responders.register({
- onCreate: function() { Ajax.activeRequestCount++ },
- onComplete: function() { Ajax.activeRequestCount-- }
-});
-
-Ajax.Base = Class.create({
- initialize: function(options) {
- this.options = {
- method: 'post',
- asynchronous: true,
- contentType: 'application/x-www-form-urlencoded',
- encoding: 'UTF-8',
- parameters: '',
- evalJSON: true,
- evalJS: true
- };
- Object.extend(this.options, options || { });
-
- this.options.method = this.options.method.toLowerCase();
-
- if (Object.isString(this.options.parameters))
- this.options.parameters = this.options.parameters.toQueryParams();
- else if (Object.isHash(this.options.parameters))
- this.options.parameters = this.options.parameters.toObject();
- }
-});
-
-Ajax.Request = Class.create(Ajax.Base, {
- _complete: false,
-
- initialize: function($super, url, options) {
- $super(options);
- this.transport = Ajax.getTransport();
- this.request(url);
- },
-
- request: function(url) {
- this.url = url;
- this.method = this.options.method;
- var params = Object.clone(this.options.parameters);
-
- if (!['get', 'post'].include(this.method)) {
- // simulate other verbs over post
- params['_method'] = this.method;
- this.method = 'post';
- }
-
- this.parameters = params;
-
- if (params = Object.toQueryString(params)) {
- // when GET, append parameters to URL
- if (this.method == 'get')
- this.url += (this.url.include('?') ? '&' : '?') + params;
- else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent))
- params += '&_=';
- }
-
- try {
- var response = new Ajax.Response(this);
- if (this.options.onCreate) this.options.onCreate(response);
- Ajax.Responders.dispatch('onCreate', this, response);
-
- this.transport.open(this.method.toUpperCase(), this.url,
- this.options.asynchronous);
-
- if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1);
-
- this.transport.onreadystatechange = this.onStateChange.bind(this);
- this.setRequestHeaders();
-
- this.body = this.method == 'post' ? (this.options.postBody || params) : null;
- this.transport.send(this.body);
-
- /* Force Firefox to handle ready state 4 for synchronous requests */
- if (!this.options.asynchronous && this.transport.overrideMimeType)
- this.onStateChange();
-
- }
- catch (e) {
- this.dispatchException(e);
- }
- },
-
- onStateChange: function() {
- var readyState = this.transport.readyState;
- if (readyState > 1 && !((readyState == 4) && this._complete))
- this.respondToReadyState(this.transport.readyState);
- },
-
- setRequestHeaders: function() {
- var headers = {
- 'X-Requested-With': 'XMLHttpRequest',
- 'X-Prototype-Version': Prototype.Version,
- 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
- };
-
- if (this.method == 'post') {
- headers['Content-type'] = this.options.contentType +
- (this.options.encoding ? '; charset=' + this.options.encoding : '');
-
- /* Force "Connection: close" for older Mozilla browsers to work
- * around a bug where XMLHttpRequest sends an incorrect
- * Content-length header. See Mozilla Bugzilla #246651.
- */
- if (this.transport.overrideMimeType &&
- (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005)
- headers['Connection'] = 'close';
- }
-
- // user-defined headers
- if (typeof this.options.requestHeaders == 'object') {
- var extras = this.options.requestHeaders;
-
- if (Object.isFunction(extras.push))
- for (var i = 0, length = extras.length; i < length; i += 2)
- headers[extras[i]] = extras[i+1];
- else
- $H(extras).each(function(pair) { headers[pair.key] = pair.value });
- }
-
- for (var name in headers)
- this.transport.setRequestHeader(name, headers[name]);
- },
-
- success: function() {
- var status = this.getStatus();
- return !status || (status >= 200 && status < 300);
- },
-
- getStatus: function() {
- try {
- return this.transport.status || 0;
- } catch (e) { return 0 }
- },
-
- respondToReadyState: function(readyState) {
- var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this);
-
- if (state == 'Complete') {
- try {
- this._complete = true;
- (this.options['on' + response.status]
- || this.options['on' + (this.success() ? 'Success' : 'Failure')]
- || Prototype.emptyFunction)(response, response.headerJSON);
- } catch (e) {
- this.dispatchException(e);
- }
-
- var contentType = response.getHeader('Content-type');
- if (this.options.evalJS == 'force'
- || (this.options.evalJS && this.isSameOrigin() && contentType
- && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i)))
- this.evalResponse();
- }
-
- try {
- (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON);
- Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON);
- } catch (e) {
- this.dispatchException(e);
- }
-
- if (state == 'Complete') {
- // avoid memory leak in MSIE: clean up
- this.transport.onreadystatechange = Prototype.emptyFunction;
- }
- },
-
- isSameOrigin: function() {
- var m = this.url.match(/^\s*https?:\/\/[^\/]*/);
- return !m || (m[0] == '#{protocol}//#{domain}#{port}'.interpolate({
- protocol: location.protocol,
- domain: document.domain,
- port: location.port ? ':' + location.port : ''
- }));
- },
-
- getHeader: function(name) {
- try {
- return this.transport.getResponseHeader(name) || null;
- } catch (e) { return null }
- },
-
- evalResponse: function() {
- try {
- return eval((this.transport.responseText || '').unfilterJSON());
- } catch (e) {
- this.dispatchException(e);
- }
- },
-
- dispatchException: function(exception) {
- (this.options.onException || Prototype.emptyFunction)(this, exception);
- Ajax.Responders.dispatch('onException', this, exception);
- }
-});
-
-Ajax.Request.Events =
- ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete'];
-
-Ajax.Response = Class.create({
- initialize: function(request){
- this.request = request;
- var transport = this.transport = request.transport,
- readyState = this.readyState = transport.readyState;
-
- if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) {
- this.status = this.getStatus();
- this.statusText = this.getStatusText();
- this.responseText = String.interpret(transport.responseText);
- this.headerJSON = this._getHeaderJSON();
- }
-
- if(readyState == 4) {
- var xml = transport.responseXML;
- this.responseXML = Object.isUndefined(xml) ? null : xml;
- this.responseJSON = this._getResponseJSON();
- }
- },
-
- status: 0,
- statusText: '',
-
- getStatus: Ajax.Request.prototype.getStatus,
-
- getStatusText: function() {
- try {
- return this.transport.statusText || '';
- } catch (e) { return '' }
- },
-
- getHeader: Ajax.Request.prototype.getHeader,
-
- getAllHeaders: function() {
- try {
- return this.getAllResponseHeaders();
- } catch (e) { return null }
- },
-
- getResponseHeader: function(name) {
- return this.transport.getResponseHeader(name);
- },
-
- getAllResponseHeaders: function() {
- return this.transport.getAllResponseHeaders();
- },
-
- _getHeaderJSON: function() {
- var json = this.getHeader('X-JSON');
- if (!json) return null;
- json = decodeURIComponent(escape(json));
- try {
- return json.evalJSON(this.request.options.sanitizeJSON ||
- !this.request.isSameOrigin());
- } catch (e) {
- this.request.dispatchException(e);
- }
- },
-
- _getResponseJSON: function() {
- var options = this.request.options;
- if (!options.evalJSON || (options.evalJSON != 'force' &&
- !(this.getHeader('Content-type') || '').include('application/json')) ||
- this.responseText.blank())
- return null;
- try {
- return this.responseText.evalJSON(options.sanitizeJSON ||
- !this.request.isSameOrigin());
- } catch (e) {
- this.request.dispatchException(e);
- }
- }
-});
-
-Ajax.Updater = Class.create(Ajax.Request, {
- initialize: function($super, container, url, options) {
- this.container = {
- success: (container.success || container),
- failure: (container.failure || (container.success ? null : container))
- };
-
- options = Object.clone(options);
- var onComplete = options.onComplete;
- options.onComplete = (function(response, json) {
- this.updateContent(response.responseText);
- if (Object.isFunction(onComplete)) onComplete(response, json);
- }).bind(this);
-
- $super(url, options);
- },
-
- updateContent: function(responseText) {
- var receiver = this.container[this.success() ? 'success' : 'failure'],
- options = this.options;
-
- if (!options.evalScripts) responseText = responseText.stripScripts();
-
- if (receiver = $(receiver)) {
- if (options.insertion) {
- if (Object.isString(options.insertion)) {
- var insertion = { }; insertion[options.insertion] = responseText;
- receiver.insert(insertion);
- }
- else options.insertion(receiver, responseText);
- }
- else receiver.update(responseText);
- }
- }
-});
-
-Ajax.PeriodicalUpdater = Class.create(Ajax.Base, {
- initialize: function($super, container, url, options) {
- $super(options);
- this.onComplete = this.options.onComplete;
-
- this.frequency = (this.options.frequency || 2);
- this.decay = (this.options.decay || 1);
-
- this.updater = { };
- this.container = container;
- this.url = url;
-
- this.start();
- },
-
- start: function() {
- this.options.onComplete = this.updateComplete.bind(this);
- this.onTimerEvent();
- },
-
- stop: function() {
- this.updater.options.onComplete = undefined;
- clearTimeout(this.timer);
- (this.onComplete || Prototype.emptyFunction).apply(this, arguments);
- },
-
- updateComplete: function(response) {
- if (this.options.decay) {
- this.decay = (response.responseText == this.lastText ?
- this.decay * this.options.decay : 1);
-
- this.lastText = response.responseText;
- }
- this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency);
- },
-
- onTimerEvent: function() {
- this.updater = new Ajax.Updater(this.container, this.url, this.options);
- }
-});
-function $(element) {
- if (arguments.length > 1) {
- for (var i = 0, elements = [], length = arguments.length; i < length; i++)
- elements.push($(arguments[i]));
- return elements;
- }
- if (Object.isString(element))
- element = document.getElementById(element);
- return Element.extend(element);
-}
-
-if (Prototype.BrowserFeatures.XPath) {
- document._getElementsByXPath = function(expression, parentElement) {
- var results = [];
- var query = document.evaluate(expression, $(parentElement) || document,
- null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);
- for (var i = 0, length = query.snapshotLength; i < length; i++)
- results.push(Element.extend(query.snapshotItem(i)));
- return results;
- };
-}
-
-/*--------------------------------------------------------------------------*/
-
-if (!window.Node) var Node = { };
-
-if (!Node.ELEMENT_NODE) {
- // DOM level 2 ECMAScript Language Binding
- Object.extend(Node, {
- ELEMENT_NODE: 1,
- ATTRIBUTE_NODE: 2,
- TEXT_NODE: 3,
- CDATA_SECTION_NODE: 4,
- ENTITY_REFERENCE_NODE: 5,
- ENTITY_NODE: 6,
- PROCESSING_INSTRUCTION_NODE: 7,
- COMMENT_NODE: 8,
- DOCUMENT_NODE: 9,
- DOCUMENT_TYPE_NODE: 10,
- DOCUMENT_FRAGMENT_NODE: 11,
- NOTATION_NODE: 12
- });
-}
-
-(function() {
- var element = this.Element;
- this.Element = function(tagName, attributes) {
- attributes = attributes || { };
- tagName = tagName.toLowerCase();
- var cache = Element.cache;
- if (Prototype.Browser.IE && attributes.name) {
- tagName = '<' + tagName + ' name="' + attributes.name + '">';
- delete attributes.name;
- return Element.writeAttribute(document.createElement(tagName), attributes);
- }
- if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName));
- return Element.writeAttribute(cache[tagName].cloneNode(false), attributes);
- };
- Object.extend(this.Element, element || { });
- if (element) this.Element.prototype = element.prototype;
-}).call(window);
-
-Element.cache = { };
-
-Element.Methods = {
- visible: function(element) {
- return $(element).style.display != 'none';
- },
-
- toggle: function(element) {
- element = $(element);
- Element[Element.visible(element) ? 'hide' : 'show'](element);
- return element;
- },
-
- hide: function(element) {
- element = $(element);
- element.style.display = 'none';
- return element;
- },
-
- show: function(element) {
- element = $(element);
- element.style.display = '';
- return element;
- },
-
- remove: function(element) {
- element = $(element);
- element.parentNode.removeChild(element);
- return element;
- },
-
- update: function(element, content) {
- element = $(element);
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) return element.update().insert(content);
- content = Object.toHTML(content);
- element.innerHTML = content.stripScripts();
- content.evalScripts.bind(content).defer();
- return element;
- },
-
- replace: function(element, content) {
- element = $(element);
- if (content && content.toElement) content = content.toElement();
- else if (!Object.isElement(content)) {
- content = Object.toHTML(content);
- var range = element.ownerDocument.createRange();
- range.selectNode(element);
- content.evalScripts.bind(content).defer();
- content = range.createContextualFragment(content.stripScripts());
- }
- element.parentNode.replaceChild(content, element);
- return element;
- },
-
- insert: function(element, insertions) {
- element = $(element);
-
- if (Object.isString(insertions) || Object.isNumber(insertions) ||
- Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML)))
- insertions = {bottom:insertions};
-
- var content, insert, tagName, childNodes;
-
- for (var position in insertions) {
- content = insertions[position];
- position = position.toLowerCase();
- insert = Element._insertionTranslations[position];
-
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) {
- insert(element, content);
- continue;
- }
-
- content = Object.toHTML(content);
-
- tagName = ((position == 'before' || position == 'after')
- ? element.parentNode : element).tagName.toUpperCase();
-
- childNodes = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
-
- if (position == 'top' || position == 'after') childNodes.reverse();
- childNodes.each(insert.curry(element));
-
- content.evalScripts.bind(content).defer();
- }
-
- return element;
- },
-
- wrap: function(element, wrapper, attributes) {
- element = $(element);
- if (Object.isElement(wrapper))
- $(wrapper).writeAttribute(attributes || { });
- else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes);
- else wrapper = new Element('div', wrapper);
- if (element.parentNode)
- element.parentNode.replaceChild(wrapper, element);
- wrapper.appendChild(element);
- return wrapper;
- },
-
- inspect: function(element) {
- element = $(element);
- var result = '<' + element.tagName.toLowerCase();
- $H({'id': 'id', 'className': 'class'}).each(function(pair) {
- var property = pair.first(), attribute = pair.last();
- var value = (element[property] || '').toString();
- if (value) result += ' ' + attribute + '=' + value.inspect(true);
- });
- return result + '>';
- },
-
- recursivelyCollect: function(element, property) {
- element = $(element);
- var elements = [];
- while (element = element[property])
- if (element.nodeType == 1)
- elements.push(Element.extend(element));
- return elements;
- },
-
- ancestors: function(element) {
- return $(element).recursivelyCollect('parentNode');
- },
-
- descendants: function(element) {
- return $(element).select("*");
- },
-
- firstDescendant: function(element) {
- element = $(element).firstChild;
- while (element && element.nodeType != 1) element = element.nextSibling;
- return $(element);
- },
-
- immediateDescendants: function(element) {
- if (!(element = $(element).firstChild)) return [];
- while (element && element.nodeType != 1) element = element.nextSibling;
- if (element) return [element].concat($(element).nextSiblings());
- return [];
- },
-
- previousSiblings: function(element) {
- return $(element).recursivelyCollect('previousSibling');
- },
-
- nextSiblings: function(element) {
- return $(element).recursivelyCollect('nextSibling');
- },
-
- siblings: function(element) {
- element = $(element);
- return element.previousSiblings().reverse().concat(element.nextSiblings());
- },
-
- match: function(element, selector) {
- if (Object.isString(selector))
- selector = new Selector(selector);
- return selector.match($(element));
- },
-
- up: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return $(element.parentNode);
- var ancestors = element.ancestors();
- return Object.isNumber(expression) ? ancestors[expression] :
- Selector.findElement(ancestors, expression, index);
- },
-
- down: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return element.firstDescendant();
- return Object.isNumber(expression) ? element.descendants()[expression] :
- Element.select(element, expression)[index || 0];
- },
-
- previous: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element));
- var previousSiblings = element.previousSiblings();
- return Object.isNumber(expression) ? previousSiblings[expression] :
- Selector.findElement(previousSiblings, expression, index);
- },
-
- next: function(element, expression, index) {
- element = $(element);
- if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element));
- var nextSiblings = element.nextSiblings();
- return Object.isNumber(expression) ? nextSiblings[expression] :
- Selector.findElement(nextSiblings, expression, index);
- },
-
- select: function() {
- var args = $A(arguments), element = $(args.shift());
- return Selector.findChildElements(element, args);
- },
-
- adjacent: function() {
- var args = $A(arguments), element = $(args.shift());
- return Selector.findChildElements(element.parentNode, args).without(element);
- },
-
- identify: function(element) {
- element = $(element);
- var id = element.readAttribute('id'), self = arguments.callee;
- if (id) return id;
- do { id = 'anonymous_element_' + self.counter++ } while ($(id));
- element.writeAttribute('id', id);
- return id;
- },
-
- readAttribute: function(element, name) {
- element = $(element);
- if (Prototype.Browser.IE) {
- var t = Element._attributeTranslations.read;
- if (t.values[name]) return t.values[name](element, name);
- if (t.names[name]) name = t.names[name];
- if (name.include(':')) {
- return (!element.attributes || !element.attributes[name]) ? null :
- element.attributes[name].value;
- }
- }
- return element.getAttribute(name);
- },
-
- writeAttribute: function(element, name, value) {
- element = $(element);
- var attributes = { }, t = Element._attributeTranslations.write;
-
- if (typeof name == 'object') attributes = name;
- else attributes[name] = Object.isUndefined(value) ? true : value;
-
- for (var attr in attributes) {
- name = t.names[attr] || attr;
- value = attributes[attr];
- if (t.values[attr]) name = t.values[attr](element, value);
- if (value === false || value === null)
- element.removeAttribute(name);
- else if (value === true)
- element.setAttribute(name, name);
- else element.setAttribute(name, value);
- }
- return element;
- },
-
- getHeight: function(element) {
- return $(element).getDimensions().height;
- },
-
- getWidth: function(element) {
- return $(element).getDimensions().width;
- },
-
- classNames: function(element) {
- return new Element.ClassNames(element);
- },
-
- hasClassName: function(element, className) {
- if (!(element = $(element))) return;
- var elementClassName = element.className;
- return (elementClassName.length > 0 && (elementClassName == className ||
- new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName)));
- },
-
- addClassName: function(element, className) {
- if (!(element = $(element))) return;
- if (!element.hasClassName(className))
- element.className += (element.className ? ' ' : '') + className;
- return element;
- },
-
- removeClassName: function(element, className) {
- if (!(element = $(element))) return;
- element.className = element.className.replace(
- new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip();
- return element;
- },
-
- toggleClassName: function(element, className) {
- if (!(element = $(element))) return;
- return element[element.hasClassName(className) ?
- 'removeClassName' : 'addClassName'](className);
- },
-
- // removes whitespace-only text node children
- cleanWhitespace: function(element) {
- element = $(element);
- var node = element.firstChild;
- while (node) {
- var nextNode = node.nextSibling;
- if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
- element.removeChild(node);
- node = nextNode;
- }
- return element;
- },
-
- empty: function(element) {
- return $(element).innerHTML.blank();
- },
-
- descendantOf: function(element, ancestor) {
- element = $(element), ancestor = $(ancestor);
-
- if (element.compareDocumentPosition)
- return (element.compareDocumentPosition(ancestor) & 8) === 8;
-
- if (ancestor.contains)
- return ancestor.contains(element) && ancestor !== element;
-
- while (element = element.parentNode)
- if (element == ancestor) return true;
-
- return false;
- },
-
- scrollTo: function(element) {
- element = $(element);
- var pos = element.cumulativeOffset();
- window.scrollTo(pos[0], pos[1]);
- return element;
- },
-
- getStyle: function(element, style) {
- element = $(element);
- style = style == 'float' ? 'cssFloat' : style.camelize();
- var value = element.style[style];
- if (!value || value == 'auto') {
- var css = document.defaultView.getComputedStyle(element, null);
- value = css ? css[style] : null;
- }
- if (style == 'opacity') return value ? parseFloat(value) : 1.0;
- return value == 'auto' ? null : value;
- },
-
- getOpacity: function(element) {
- return $(element).getStyle('opacity');
- },
-
- setStyle: function(element, styles) {
- element = $(element);
- var elementStyle = element.style, match;
- if (Object.isString(styles)) {
- element.style.cssText += ';' + styles;
- return styles.include('opacity') ?
- element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element;
- }
- for (var property in styles)
- if (property == 'opacity') element.setOpacity(styles[property]);
- else
- elementStyle[(property == 'float' || property == 'cssFloat') ?
- (Object.isUndefined(elementStyle.styleFloat) ? 'cssFloat' : 'styleFloat') :
- property] = styles[property];
-
- return element;
- },
-
- setOpacity: function(element, value) {
- element = $(element);
- element.style.opacity = (value == 1 || value === '') ? '' :
- (value < 0.00001) ? 0 : value;
- return element;
- },
-
- getDimensions: function(element) {
- element = $(element);
- var display = element.getStyle('display');
- if (display != 'none' && display != null) // Safari bug
- return {width: element.offsetWidth, height: element.offsetHeight};
-
- // All *Width and *Height properties give 0 on elements with display none,
- // so enable the element temporarily
- var els = element.style;
- var originalVisibility = els.visibility;
- var originalPosition = els.position;
- var originalDisplay = els.display;
- els.visibility = 'hidden';
- els.position = 'absolute';
- els.display = 'block';
- var originalWidth = element.clientWidth;
- var originalHeight = element.clientHeight;
- els.display = originalDisplay;
- els.position = originalPosition;
- els.visibility = originalVisibility;
- return {width: originalWidth, height: originalHeight};
- },
-
- makePositioned: function(element) {
- element = $(element);
- var pos = Element.getStyle(element, 'position');
- if (pos == 'static' || !pos) {
- element._madePositioned = true;
- element.style.position = 'relative';
- // Opera returns the offset relative to the positioning context, when an
- // element is position relative but top and left have not been defined
- if (Prototype.Browser.Opera) {
- element.style.top = 0;
- element.style.left = 0;
- }
- }
- return element;
- },
-
- undoPositioned: function(element) {
- element = $(element);
- if (element._madePositioned) {
- element._madePositioned = undefined;
- element.style.position =
- element.style.top =
- element.style.left =
- element.style.bottom =
- element.style.right = '';
- }
- return element;
- },
-
- makeClipping: function(element) {
- element = $(element);
- if (element._overflow) return element;
- element._overflow = Element.getStyle(element, 'overflow') || 'auto';
- if (element._overflow !== 'hidden')
- element.style.overflow = 'hidden';
- return element;
- },
-
- undoClipping: function(element) {
- element = $(element);
- if (!element._overflow) return element;
- element.style.overflow = element._overflow == 'auto' ? '' : element._overflow;
- element._overflow = null;
- return element;
- },
-
- cumulativeOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- } while (element);
- return Element._returnOffset(valueL, valueT);
- },
-
- positionedOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- element = element.offsetParent;
- if (element) {
- if (element.tagName.toUpperCase() == 'BODY') break;
- var p = Element.getStyle(element, 'position');
- if (p !== 'static') break;
- }
- } while (element);
- return Element._returnOffset(valueL, valueT);
- },
-
- absolutize: function(element) {
- element = $(element);
- if (element.getStyle('position') == 'absolute') return element;
- // Position.prepare(); // To be done manually by Scripty when it needs it.
-
- var offsets = element.positionedOffset();
- var top = offsets[1];
- var left = offsets[0];
- var width = element.clientWidth;
- var height = element.clientHeight;
-
- element._originalLeft = left - parseFloat(element.style.left || 0);
- element._originalTop = top - parseFloat(element.style.top || 0);
- element._originalWidth = element.style.width;
- element._originalHeight = element.style.height;
-
- element.style.position = 'absolute';
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.width = width + 'px';
- element.style.height = height + 'px';
- return element;
- },
-
- relativize: function(element) {
- element = $(element);
- if (element.getStyle('position') == 'relative') return element;
- // Position.prepare(); // To be done manually by Scripty when it needs it.
-
- element.style.position = 'relative';
- var top = parseFloat(element.style.top || 0) - (element._originalTop || 0);
- var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0);
-
- element.style.top = top + 'px';
- element.style.left = left + 'px';
- element.style.height = element._originalHeight;
- element.style.width = element._originalWidth;
- return element;
- },
-
- cumulativeScrollOffset: function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.scrollTop || 0;
- valueL += element.scrollLeft || 0;
- element = element.parentNode;
- } while (element);
- return Element._returnOffset(valueL, valueT);
- },
-
- getOffsetParent: function(element) {
- if (element.offsetParent) return $(element.offsetParent);
- if (element == document.body) return $(element);
-
- while ((element = element.parentNode) && element != document.body)
- if (Element.getStyle(element, 'position') != 'static')
- return $(element);
-
- return $(document.body);
- },
-
- viewportOffset: function(forElement) {
- var valueT = 0, valueL = 0;
-
- var element = forElement;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
-
- // Safari fix
- if (element.offsetParent == document.body &&
- Element.getStyle(element, 'position') == 'absolute') break;
-
- } while (element = element.offsetParent);
-
- element = forElement;
- do {
- if (!Prototype.Browser.Opera || (element.tagName && (element.tagName.toUpperCase() == 'BODY'))) {
- valueT -= element.scrollTop || 0;
- valueL -= element.scrollLeft || 0;
- }
- } while (element = element.parentNode);
-
- return Element._returnOffset(valueL, valueT);
- },
-
- clonePosition: function(element, source) {
- var options = Object.extend({
- setLeft: true,
- setTop: true,
- setWidth: true,
- setHeight: true,
- offsetTop: 0,
- offsetLeft: 0
- }, arguments[2] || { });
-
- // find page position of source
- source = $(source);
- var p = source.viewportOffset();
-
- // find coordinate system to use
- element = $(element);
- var delta = [0, 0];
- var parent = null;
- // delta [0,0] will do fine with position: fixed elements,
- // position:absolute needs offsetParent deltas
- if (Element.getStyle(element, 'position') == 'absolute') {
- parent = element.getOffsetParent();
- delta = parent.viewportOffset();
- }
-
- // correct by body offsets (fixes Safari)
- if (parent == document.body) {
- delta[0] -= document.body.offsetLeft;
- delta[1] -= document.body.offsetTop;
- }
-
- // set position
- if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
- if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px';
- if (options.setWidth) element.style.width = source.offsetWidth + 'px';
- if (options.setHeight) element.style.height = source.offsetHeight + 'px';
- return element;
- }
-};
-
-Element.Methods.identify.counter = 1;
-
-Object.extend(Element.Methods, {
- getElementsBySelector: Element.Methods.select,
- childElements: Element.Methods.immediateDescendants
-});
-
-Element._attributeTranslations = {
- write: {
- names: {
- className: 'class',
- htmlFor: 'for'
- },
- values: { }
- }
-};
-
-if (Prototype.Browser.Opera) {
- Element.Methods.getStyle = Element.Methods.getStyle.wrap(
- function(proceed, element, style) {
- switch (style) {
- case 'left': case 'top': case 'right': case 'bottom':
- if (proceed(element, 'position') === 'static') return null;
- case 'height': case 'width':
- // returns '0px' for hidden elements; we want it to return null
- if (!Element.visible(element)) return null;
-
- // returns the border-box dimensions rather than the content-box
- // dimensions, so we subtract padding and borders from the value
- var dim = parseInt(proceed(element, style), 10);
-
- if (dim !== element['offset' + style.capitalize()])
- return dim + 'px';
-
- var properties;
- if (style === 'height') {
- properties = ['border-top-width', 'padding-top',
- 'padding-bottom', 'border-bottom-width'];
- }
- else {
- properties = ['border-left-width', 'padding-left',
- 'padding-right', 'border-right-width'];
- }
- return properties.inject(dim, function(memo, property) {
- var val = proceed(element, property);
- return val === null ? memo : memo - parseInt(val, 10);
- }) + 'px';
- default: return proceed(element, style);
- }
- }
- );
-
- Element.Methods.readAttribute = Element.Methods.readAttribute.wrap(
- function(proceed, element, attribute) {
- if (attribute === 'title') return element.title;
- return proceed(element, attribute);
- }
- );
-}
-
-else if (Prototype.Browser.IE) {
- // IE doesn't report offsets correctly for static elements, so we change them
- // to "relative" to get the values, then change them back.
- Element.Methods.getOffsetParent = Element.Methods.getOffsetParent.wrap(
- function(proceed, element) {
- element = $(element);
- // IE throws an error if element is not in document
- try { element.offsetParent }
- catch(e) { return $(document.body) }
- var position = element.getStyle('position');
- if (position !== 'static') return proceed(element);
- element.setStyle({ position: 'relative' });
- var value = proceed(element);
- element.setStyle({ position: position });
- return value;
- }
- );
-
- $w('positionedOffset viewportOffset').each(function(method) {
- Element.Methods[method] = Element.Methods[method].wrap(
- function(proceed, element) {
- element = $(element);
- try { element.offsetParent }
- catch(e) { return Element._returnOffset(0,0) }
- var position = element.getStyle('position');
- if (position !== 'static') return proceed(element);
- // Trigger hasLayout on the offset parent so that IE6 reports
- // accurate offsetTop and offsetLeft values for position: fixed.
- var offsetParent = element.getOffsetParent();
- if (offsetParent && offsetParent.getStyle('position') === 'fixed')
- offsetParent.setStyle({ zoom: 1 });
- element.setStyle({ position: 'relative' });
- var value = proceed(element);
- element.setStyle({ position: position });
- return value;
- }
- );
- });
-
- Element.Methods.cumulativeOffset = Element.Methods.cumulativeOffset.wrap(
- function(proceed, element) {
- try { element.offsetParent }
- catch(e) { return Element._returnOffset(0,0) }
- return proceed(element);
- }
- );
-
- Element.Methods.getStyle = function(element, style) {
- element = $(element);
- style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize();
- var value = element.style[style];
- if (!value && element.currentStyle) value = element.currentStyle[style];
-
- if (style == 'opacity') {
- if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/))
- if (value[1]) return parseFloat(value[1]) / 100;
- return 1.0;
- }
-
- if (value == 'auto') {
- if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none'))
- return element['offset' + style.capitalize()] + 'px';
- return null;
- }
- return value;
- };
-
- Element.Methods.setOpacity = function(element, value) {
- function stripAlpha(filter){
- return filter.replace(/alpha\([^\)]*\)/gi,'');
- }
- element = $(element);
- var currentStyle = element.currentStyle;
- if ((currentStyle && !currentStyle.hasLayout) ||
- (!currentStyle && element.style.zoom == 'normal'))
- element.style.zoom = 1;
-
- var filter = element.getStyle('filter'), style = element.style;
- if (value == 1 || value === '') {
- (filter = stripAlpha(filter)) ?
- style.filter = filter : style.removeAttribute('filter');
- return element;
- } else if (value < 0.00001) value = 0;
- style.filter = stripAlpha(filter) +
- 'alpha(opacity=' + (value * 100) + ')';
- return element;
- };
-
- Element._attributeTranslations = {
- read: {
- names: {
- 'class': 'className',
- 'for': 'htmlFor'
- },
- values: {
- _getAttr: function(element, attribute) {
- return element.getAttribute(attribute, 2);
- },
- _getAttrNode: function(element, attribute) {
- var node = element.getAttributeNode(attribute);
- return node ? node.value : "";
- },
- _getEv: function(element, attribute) {
- attribute = element.getAttribute(attribute);
- return attribute ? attribute.toString().slice(23, -2) : null;
- },
- _flag: function(element, attribute) {
- return $(element).hasAttribute(attribute) ? attribute : null;
- },
- style: function(element) {
- return element.style.cssText.toLowerCase();
- },
- title: function(element) {
- return element.title;
- }
- }
- }
- };
-
- Element._attributeTranslations.write = {
- names: Object.extend({
- cellpadding: 'cellPadding',
- cellspacing: 'cellSpacing'
- }, Element._attributeTranslations.read.names),
- values: {
- checked: function(element, value) {
- element.checked = !!value;
- },
-
- style: function(element, value) {
- element.style.cssText = value ? value : '';
- }
- }
- };
-
- Element._attributeTranslations.has = {};
-
- $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' +
- 'encType maxLength readOnly longDesc frameBorder').each(function(attr) {
- Element._attributeTranslations.write.names[attr.toLowerCase()] = attr;
- Element._attributeTranslations.has[attr.toLowerCase()] = attr;
- });
-
- (function(v) {
- Object.extend(v, {
- href: v._getAttr,
- src: v._getAttr,
- type: v._getAttr,
- action: v._getAttrNode,
- disabled: v._flag,
- checked: v._flag,
- readonly: v._flag,
- multiple: v._flag,
- onload: v._getEv,
- onunload: v._getEv,
- onclick: v._getEv,
- ondblclick: v._getEv,
- onmousedown: v._getEv,
- onmouseup: v._getEv,
- onmouseover: v._getEv,
- onmousemove: v._getEv,
- onmouseout: v._getEv,
- onfocus: v._getEv,
- onblur: v._getEv,
- onkeypress: v._getEv,
- onkeydown: v._getEv,
- onkeyup: v._getEv,
- onsubmit: v._getEv,
- onreset: v._getEv,
- onselect: v._getEv,
- onchange: v._getEv
- });
- })(Element._attributeTranslations.read.values);
-}
-
-else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) {
- Element.Methods.setOpacity = function(element, value) {
- element = $(element);
- element.style.opacity = (value == 1) ? 0.999999 :
- (value === '') ? '' : (value < 0.00001) ? 0 : value;
- return element;
- };
-}
-
-else if (Prototype.Browser.WebKit) {
- Element.Methods.setOpacity = function(element, value) {
- element = $(element);
- element.style.opacity = (value == 1 || value === '') ? '' :
- (value < 0.00001) ? 0 : value;
-
- if (value == 1)
- if(element.tagName.toUpperCase() == 'IMG' && element.width) {
- element.width++; element.width--;
- } else try {
- var n = document.createTextNode(' ');
- element.appendChild(n);
- element.removeChild(n);
- } catch (e) { }
-
- return element;
- };
-
- // Safari returns margins on body which is incorrect if the child is absolutely
- // positioned. For performance reasons, redefine Element#cumulativeOffset for
- // KHTML/WebKit only.
- Element.Methods.cumulativeOffset = function(element) {
- var valueT = 0, valueL = 0;
- do {
- valueT += element.offsetTop || 0;
- valueL += element.offsetLeft || 0;
- if (element.offsetParent == document.body)
- if (Element.getStyle(element, 'position') == 'absolute') break;
-
- element = element.offsetParent;
- } while (element);
-
- return Element._returnOffset(valueL, valueT);
- };
-}
-
-if (Prototype.Browser.IE || Prototype.Browser.Opera) {
- // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements
- Element.Methods.update = function(element, content) {
- element = $(element);
-
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) return element.update().insert(content);
-
- content = Object.toHTML(content);
- var tagName = element.tagName.toUpperCase();
-
- if (tagName in Element._insertionTranslations.tags) {
- $A(element.childNodes).each(function(node) { element.removeChild(node) });
- Element._getContentFromAnonymousElement(tagName, content.stripScripts())
- .each(function(node) { element.appendChild(node) });
- }
- else element.innerHTML = content.stripScripts();
-
- content.evalScripts.bind(content).defer();
- return element;
- };
-}
-
-if ('outerHTML' in document.createElement('div')) {
- Element.Methods.replace = function(element, content) {
- element = $(element);
-
- if (content && content.toElement) content = content.toElement();
- if (Object.isElement(content)) {
- element.parentNode.replaceChild(content, element);
- return element;
- }
-
- content = Object.toHTML(content);
- var parent = element.parentNode, tagName = parent.tagName.toUpperCase();
-
- if (Element._insertionTranslations.tags[tagName]) {
- var nextSibling = element.next();
- var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts());
- parent.removeChild(element);
- if (nextSibling)
- fragments.each(function(node) { parent.insertBefore(node, nextSibling) });
- else
- fragments.each(function(node) { parent.appendChild(node) });
- }
- else element.outerHTML = content.stripScripts();
-
- content.evalScripts.bind(content).defer();
- return element;
- };
-}
-
-Element._returnOffset = function(l, t) {
- var result = [l, t];
- result.left = l;
- result.top = t;
- return result;
-};
-
-Element._getContentFromAnonymousElement = function(tagName, html) {
- var div = new Element('div'), t = Element._insertionTranslations.tags[tagName];
- if (t) {
- div.innerHTML = t[0] + html + t[1];
- t[2].times(function() { div = div.firstChild });
- } else div.innerHTML = html;
- return $A(div.childNodes);
-};
-
-Element._insertionTranslations = {
- before: function(element, node) {
- element.parentNode.insertBefore(node, element);
- },
- top: function(element, node) {
- element.insertBefore(node, element.firstChild);
- },
- bottom: function(element, node) {
- element.appendChild(node);
- },
- after: function(element, node) {
- element.parentNode.insertBefore(node, element.nextSibling);
- },
- tags: {
- TABLE: ['<table>', '</table>', 1],
- TBODY: ['<table><tbody>', '</tbody></table>', 2],
- TR: ['<table><tbody><tr>', '</tr></tbody></table>', 3],
- TD: ['<table><tbody><tr><td>', '</td></tr></tbody></table>', 4],
- SELECT: ['<select>', '</select>', 1]
- }
-};
-
-(function() {
- Object.extend(this.tags, {
- THEAD: this.tags.TBODY,
- TFOOT: this.tags.TBODY,
- TH: this.tags.TD
- });
-}).call(Element._insertionTranslations);
-
-Element.Methods.Simulated = {
- hasAttribute: function(element, attribute) {
- attribute = Element._attributeTranslations.has[attribute] || attribute;
- var node = $(element).getAttributeNode(attribute);
- return !!(node && node.specified);
- }
-};
-
-Element.Methods.ByTag = { };
-
-Object.extend(Element, Element.Methods);
-
-if (!Prototype.BrowserFeatures.ElementExtensions &&
- document.createElement('div')['__proto__']) {
- window.HTMLElement = { };
- window.HTMLElement.prototype = document.createElement('div')['__proto__'];
- Prototype.BrowserFeatures.ElementExtensions = true;
-}
-
-Element.extend = (function() {
- if (Prototype.BrowserFeatures.SpecificElementExtensions)
- return Prototype.K;
-
- var Methods = { }, ByTag = Element.Methods.ByTag;
-
- var extend = Object.extend(function(element) {
- if (!element || element._extendedByPrototype ||
- element.nodeType != 1 || element == window) return element;
-
- var methods = Object.clone(Methods),
- tagName = element.tagName.toUpperCase(), property, value;
-
- // extend methods for specific tags
- if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]);
-
- for (property in methods) {
- value = methods[property];
- if (Object.isFunction(value) && !(property in element))
- element[property] = value.methodize();
- }
-
- element._extendedByPrototype = Prototype.emptyFunction;
- return element;
-
- }, {
- refresh: function() {
- // extend methods for all tags (Safari doesn't need this)
- if (!Prototype.BrowserFeatures.ElementExtensions) {
- Object.extend(Methods, Element.Methods);
- Object.extend(Methods, Element.Methods.Simulated);
- }
- }
- });
-
- extend.refresh();
- return extend;
-})();
-
-Element.hasAttribute = function(element, attribute) {
- if (element.hasAttribute) return element.hasAttribute(attribute);
- return Element.Methods.Simulated.hasAttribute(element, attribute);
-};
-
-Element.addMethods = function(methods) {
- var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag;
-
- if (!methods) {
- Object.extend(Form, Form.Methods);
- Object.extend(Form.Element, Form.Element.Methods);
- Object.extend(Element.Methods.ByTag, {
- "FORM": Object.clone(Form.Methods),
- "INPUT": Object.clone(Form.Element.Methods),
- "SELECT": Object.clone(Form.Element.Methods),
- "TEXTAREA": Object.clone(Form.Element.Methods)
- });
- }
-
- if (arguments.length == 2) {
- var tagName = methods;
- methods = arguments[1];
- }
-
- if (!tagName) Object.extend(Element.Methods, methods || { });
- else {
- if (Object.isArray(tagName)) tagName.each(extend);
- else extend(tagName);
- }
-
- function extend(tagName) {
- tagName = tagName.toUpperCase();
- if (!Element.Methods.ByTag[tagName])
- Element.Methods.ByTag[tagName] = { };
- Object.extend(Element.Methods.ByTag[tagName], methods);
- }
-
- function copy(methods, destination, onlyIfAbsent) {
- onlyIfAbsent = onlyIfAbsent || false;
- for (var property in methods) {
- var value = methods[property];
- if (!Object.isFunction(value)) continue;
- if (!onlyIfAbsent || !(property in destination))
- destination[property] = value.methodize();
- }
- }
-
- function findDOMClass(tagName) {
- var klass;
- var trans = {
- "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph",
- "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList",
- "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading",
- "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote",
- "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION":
- "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD":
- "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR":
- "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET":
- "FrameSet", "IFRAME": "IFrame"
- };
- if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element';
- if (window[klass]) return window[klass];
- klass = 'HTML' + tagName + 'Element';
- if (window[klass]) return window[klass];
- klass = 'HTML' + tagName.capitalize() + 'Element';
- if (window[klass]) return window[klass];
-
- window[klass] = { };
- window[klass].prototype = document.createElement(tagName)['__proto__'];
- return window[klass];
- }
-
- if (F.ElementExtensions) {
- copy(Element.Methods, HTMLElement.prototype);
- copy(Element.Methods.Simulated, HTMLElement.prototype, true);
- }
-
- if (F.SpecificElementExtensions) {
- for (var tag in Element.Methods.ByTag) {
- var klass = findDOMClass(tag);
- if (Object.isUndefined(klass)) continue;
- copy(T[tag], klass.prototype);
- }
- }
-
- Object.extend(Element, Element.Methods);
- delete Element.ByTag;
-
- if (Element.extend.refresh) Element.extend.refresh();
- Element.cache = { };
-};
-
-document.viewport = {
- getDimensions: function() {
- var dimensions = { }, B = Prototype.Browser;
- $w('width height').each(function(d) {
- var D = d.capitalize();
- if (B.WebKit && !document.evaluate) {
- // Safari <3.0 needs self.innerWidth/Height
- dimensions[d] = self['inner' + D];
- } else if (B.Opera && parseFloat(window.opera.version()) < 9.5) {
- // Opera <9.5 needs document.body.clientWidth/Height
- dimensions[d] = document.body['client' + D]
- } else {
- dimensions[d] = document.documentElement['client' + D];
- }
- });
- return dimensions;
- },
-
- getWidth: function() {
- return this.getDimensions().width;
- },
-
- getHeight: function() {
- return this.getDimensions().height;
- },
-
- getScrollOffsets: function() {
- return Element._returnOffset(
- window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft,
- window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop);
- }
-};
-/* Portions of the Selector class are derived from Jack Slocum's DomQuery,
- * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style
- * license. Please see http://www.yui-ext.com/ for more information. */
-
-var Selector = Class.create({
- initialize: function(expression) {
- this.expression = expression.strip();
-
- if (this.shouldUseSelectorsAPI()) {
- this.mode = 'selectorsAPI';
- } else if (this.shouldUseXPath()) {
- this.mode = 'xpath';
- this.compileXPathMatcher();
- } else {
- this.mode = "normal";
- this.compileMatcher();
- }
-
- },
-
- shouldUseXPath: function() {
- if (!Prototype.BrowserFeatures.XPath) return false;
-
- var e = this.expression;
-
- // Safari 3 chokes on :*-of-type and :empty
- if (Prototype.Browser.WebKit &&
- (e.include("-of-type") || e.include(":empty")))
- return false;
-
- // XPath can't do namespaced attributes, nor can it read
- // the "checked" property from DOM nodes
- if ((/(\[[\w-]*?:|:checked)/).test(e))
- return false;
-
- return true;
- },
-
- shouldUseSelectorsAPI: function() {
- if (!Prototype.BrowserFeatures.SelectorsAPI) return false;
-
- if (!Selector._div) Selector._div = new Element('div');
-
- // Make sure the browser treats the selector as valid. Test on an
- // isolated element to minimize cost of this check.
- try {
- Selector._div.querySelector(this.expression);
- } catch(e) {
- return false;
- }
-
- return true;
- },
-
- compileMatcher: function() {
- var e = this.expression, ps = Selector.patterns, h = Selector.handlers,
- c = Selector.criteria, le, p, m;
-
- if (Selector._cache[e]) {
- this.matcher = Selector._cache[e];
- return;
- }
-
- this.matcher = ["this.matcher = function(root) {",
- "var r = root, h = Selector.handlers, c = false, n;"];
-
- while (e && le != e && (/\S/).test(e)) {
- le = e;
- for (var i in ps) {
- p = ps[i];
- if (m = e.match(p)) {
- this.matcher.push(Object.isFunction(c[i]) ? c[i](m) :
- new Template(c[i]).evaluate(m));
- e = e.replace(m[0], '');
- break;
- }
- }
- }
-
- this.matcher.push("return h.unique(n);\n}");
- eval(this.matcher.join('\n'));
- Selector._cache[this.expression] = this.matcher;
- },
-
- compileXPathMatcher: function() {
- var e = this.expression, ps = Selector.patterns,
- x = Selector.xpath, le, m;
-
- if (Selector._cache[e]) {
- this.xpath = Selector._cache[e]; return;
- }
-
- this.matcher = ['.//*'];
- while (e && le != e && (/\S/).test(e)) {
- le = e;
- for (var i in ps) {
- if (m = e.match(ps[i])) {
- this.matcher.push(Object.isFunction(x[i]) ? x[i](m) :
- new Template(x[i]).evaluate(m));
- e = e.replace(m[0], '');
- break;
- }
- }
- }
-
- this.xpath = this.matcher.join('');
- Selector._cache[this.expression] = this.xpath;
- },
-
- findElements: function(root) {
- root = root || document;
- var e = this.expression, results;
-
- switch (this.mode) {
- case 'selectorsAPI':
- // querySelectorAll queries document-wide, then filters to descendants
- // of the context element. That's not what we want.
- // Add an explicit context to the selector if necessary.
- if (root !== document) {
- var oldId = root.id, id = $(root).identify();
- e = "#" + id + " " + e;
- }
-
- results = $A(root.querySelectorAll(e)).map(Element.extend);
- root.id = oldId;
-
- return results;
- case 'xpath':
- return document._getElementsByXPath(this.xpath, root);
- default:
- return this.matcher(root);
- }
- },
-
- match: function(element) {
- this.tokens = [];
-
- var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
- var le, p, m;
-
- while (e && le !== e && (/\S/).test(e)) {
- le = e;
- for (var i in ps) {
- p = ps[i];
- if (m = e.match(p)) {
- // use the Selector.assertions methods unless the selector
- // is too complex.
- if (as[i]) {
- this.tokens.push([i, Object.clone(m)]);
- e = e.replace(m[0], '');
- } else {
- // reluctantly do a document-wide search
- // and look for a match in the array
- return this.findElements(document).include(element);
- }
- }
- }
- }
-
- var match = true, name, matches;
- for (var i = 0, token; token = this.tokens[i]; i++) {
- name = token[0], matches = token[1];
- if (!Selector.assertions[name](element, matches)) {
- match = false; break;
- }
- }
-
- return match;
- },
-
- toString: function() {
- return this.expression;
- },
-
- inspect: function() {
- return "#<Selector:" + this.expression.inspect() + ">";
- }
-});
-
-Object.extend(Selector, {
- _cache: { },
-
- xpath: {
- descendant: "//*",
- child: "/*",
- adjacent: "/following-sibling::*[1]",
- laterSibling: '/following-sibling::*',
- tagName: function(m) {
- if (m[1] == '*') return '';
- return "[local-name()='" + m[1].toLowerCase() +
- "' or local-name()='" + m[1].toUpperCase() + "']";
- },
- className: "[contains(concat(' ', @class, ' '), ' #{1} ')]",
- id: "[@id='#{1}']",
- attrPresence: function(m) {
- m[1] = m[1].toLowerCase();
- return new Template("[@#{1}]").evaluate(m);
- },
- attr: function(m) {
- m[1] = m[1].toLowerCase();
- m[3] = m[5] || m[6];
- return new Template(Selector.xpath.operators[m[2]]).evaluate(m);
- },
- pseudo: function(m) {
- var h = Selector.xpath.pseudos[m[1]];
- if (!h) return '';
- if (Object.isFunction(h)) return h(m);
- return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m);
- },
- operators: {
- '=': "[@#{1}='#{3}']",
- '!=': "[@#{1}!='#{3}']",
- '^=': "[starts-with(@#{1}, '#{3}')]",
- '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']",
- '*=': "[contains(@#{1}, '#{3}')]",
- '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]",
- '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]"
- },
- pseudos: {
- 'first-child': '[not(preceding-sibling::*)]',
- 'last-child': '[not(following-sibling::*)]',
- 'only-child': '[not(preceding-sibling::* or following-sibling::*)]',
- 'empty': "[count(*) = 0 and (count(text()) = 0)]",
- 'checked': "[@checked]",
- 'disabled': "[(@disabled) and (@type!='hidden')]",
- 'enabled': "[not(@disabled) and (@type!='hidden')]",
- 'not': function(m) {
- var e = m[6], p = Selector.patterns,
- x = Selector.xpath, le, v;
-
- var exclusion = [];
- while (e && le != e && (/\S/).test(e)) {
- le = e;
- for (var i in p) {
- if (m = e.match(p[i])) {
- v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m);
- exclusion.push("(" + v.substring(1, v.length - 1) + ")");
- e = e.replace(m[0], '');
- break;
- }
- }
- }
- return "[not(" + exclusion.join(" and ") + ")]";
- },
- 'nth-child': function(m) {
- return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m);
- },
- 'nth-last-child': function(m) {
- return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m);
- },
- 'nth-of-type': function(m) {
- return Selector.xpath.pseudos.nth("position() ", m);
- },
- 'nth-last-of-type': function(m) {
- return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m);
- },
- 'first-of-type': function(m) {
- m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m);
- },
- 'last-of-type': function(m) {
- m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m);
- },
- 'only-of-type': function(m) {
- var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m);
- },
- nth: function(fragment, m) {
- var mm, formula = m[6], predicate;
- if (formula == 'even') formula = '2n+0';
- if (formula == 'odd') formula = '2n+1';
- if (mm = formula.match(/^(\d+)$/)) // digit only
- return '[' + fragment + "= " + mm[1] + ']';
- if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
- if (mm[1] == "-") mm[1] = -1;
- var a = mm[1] ? Number(mm[1]) : 1;
- var b = mm[2] ? Number(mm[2]) : 0;
- predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " +
- "((#{fragment} - #{b}) div #{a} >= 0)]";
- return new Template(predicate).evaluate({
- fragment: fragment, a: a, b: b });
- }
- }
- }
- },
-
- criteria: {
- tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;',
- className: 'n = h.className(n, r, "#{1}", c); c = false;',
- id: 'n = h.id(n, r, "#{1}", c); c = false;',
- attrPresence: 'n = h.attrPresence(n, r, "#{1}", c); c = false;',
- attr: function(m) {
- m[3] = (m[5] || m[6]);
- return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}", c); c = false;').evaluate(m);
- },
- pseudo: function(m) {
- if (m[6]) m[6] = m[6].replace(/"/g, '\\"');
- return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m);
- },
- descendant: 'c = "descendant";',
- child: 'c = "child";',
- adjacent: 'c = "adjacent";',
- laterSibling: 'c = "laterSibling";'
- },
-
- patterns: {
- // combinators must be listed first
- // (and descendant needs to be last combinator)
- laterSibling: /^\s*~\s*/,
- child: /^\s*>\s*/,
- adjacent: /^\s*\+\s*/,
- descendant: /^\s/,
-
- // selectors follow
- tagName: /^\s*(\*|[\w\-]+)(\b|$)?/,
- id: /^#([\w\-\*]+)(\b|$)/,
- className: /^\.([\w\-\*]+)(\b|$)/,
- pseudo:
-/^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s|[:+~>]))/,
- attrPresence: /^\[((?:[\w]+:)?[\w]+)\]/,
- attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/
- },
-
- // for Selector.match and Element#match
- assertions: {
- tagName: function(element, matches) {
- return matches[1].toUpperCase() == element.tagName.toUpperCase();
- },
-
- className: function(element, matches) {
- return Element.hasClassName(element, matches[1]);
- },
-
- id: function(element, matches) {
- return element.id === matches[1];
- },
-
- attrPresence: function(element, matches) {
- return Element.hasAttribute(element, matches[1]);
- },
-
- attr: function(element, matches) {
- var nodeValue = Element.readAttribute(element, matches[1]);
- return nodeValue && Selector.operators[matches[2]](nodeValue, matches[5] || matches[6]);
- }
- },
-
- handlers: {
- // UTILITY FUNCTIONS
- // joins two collections
- concat: function(a, b) {
- for (var i = 0, node; node = b[i]; i++)
- a.push(node);
- return a;
- },
-
- // marks an array of nodes for counting
- mark: function(nodes) {
- var _true = Prototype.emptyFunction;
- for (var i = 0, node; node = nodes[i]; i++)
- node._countedByPrototype = _true;
- return nodes;
- },
-
- unmark: function(nodes) {
- for (var i = 0, node; node = nodes[i]; i++)
- node._countedByPrototype = undefined;
- return nodes;
- },
-
- // mark each child node with its position (for nth calls)
- // "ofType" flag indicates whether we're indexing for nth-of-type
- // rather than nth-child
- index: function(parentNode, reverse, ofType) {
- parentNode._countedByPrototype = Prototype.emptyFunction;
- if (reverse) {
- for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) {
- var node = nodes[i];
- if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
- }
- } else {
- for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++)
- if (node.nodeType == 1 && (!ofType || node._countedByPrototype)) node.nodeIndex = j++;
- }
- },
-
- // filters out duplicates and extends all nodes
- unique: function(nodes) {
- if (nodes.length == 0) return nodes;
- var results = [], n;
- for (var i = 0, l = nodes.length; i < l; i++)
- if (!(n = nodes[i])._countedByPrototype) {
- n._countedByPrototype = Prototype.emptyFunction;
- results.push(Element.extend(n));
- }
- return Selector.handlers.unmark(results);
- },
-
- // COMBINATOR FUNCTIONS
- descendant: function(nodes) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- h.concat(results, node.getElementsByTagName('*'));
- return results;
- },
-
- child: function(nodes) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- for (var j = 0, child; child = node.childNodes[j]; j++)
- if (child.nodeType == 1 && child.tagName != '!') results.push(child);
- }
- return results;
- },
-
- adjacent: function(nodes) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- var next = this.nextElementSibling(node);
- if (next) results.push(next);
- }
- return results;
- },
-
- laterSibling: function(nodes) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- h.concat(results, Element.nextSiblings(node));
- return results;
- },
-
- nextElementSibling: function(node) {
- while (node = node.nextSibling)
- if (node.nodeType == 1) return node;
- return null;
- },
-
- previousElementSibling: function(node) {
- while (node = node.previousSibling)
- if (node.nodeType == 1) return node;
- return null;
- },
-
- // TOKEN FUNCTIONS
- tagName: function(nodes, root, tagName, combinator) {
- var uTagName = tagName.toUpperCase();
- var results = [], h = Selector.handlers;
- if (nodes) {
- if (combinator) {
- // fastlane for ordinary descendant combinators
- if (combinator == "descendant") {
- for (var i = 0, node; node = nodes[i]; i++)
- h.concat(results, node.getElementsByTagName(tagName));
- return results;
- } else nodes = this[combinator](nodes);
- if (tagName == "*") return nodes;
- }
- for (var i = 0, node; node = nodes[i]; i++)
- if (node.tagName.toUpperCase() === uTagName) results.push(node);
- return results;
- } else return root.getElementsByTagName(tagName);
- },
-
- id: function(nodes, root, id, combinator) {
- var targetNode = $(id), h = Selector.handlers;
- if (!targetNode) return [];
- if (!nodes && root == document) return [targetNode];
- if (nodes) {
- if (combinator) {
- if (combinator == 'child') {
- for (var i = 0, node; node = nodes[i]; i++)
- if (targetNode.parentNode == node) return [targetNode];
- } else if (combinator == 'descendant') {
- for (var i = 0, node; node = nodes[i]; i++)
- if (Element.descendantOf(targetNode, node)) return [targetNode];
- } else if (combinator == 'adjacent') {
- for (var i = 0, node; node = nodes[i]; i++)
- if (Selector.handlers.previousElementSibling(targetNode) == node)
- return [targetNode];
- } else nodes = h[combinator](nodes);
- }
- for (var i = 0, node; node = nodes[i]; i++)
- if (node == targetNode) return [targetNode];
- return [];
- }
- return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : [];
- },
-
- className: function(nodes, root, className, combinator) {
- if (nodes && combinator) nodes = this[combinator](nodes);
- return Selector.handlers.byClassName(nodes, root, className);
- },
-
- byClassName: function(nodes, root, className) {
- if (!nodes) nodes = Selector.handlers.descendant([root]);
- var needle = ' ' + className + ' ';
- for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) {
- nodeClassName = node.className;
- if (nodeClassName.length == 0) continue;
- if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle))
- results.push(node);
- }
- return results;
- },
-
- attrPresence: function(nodes, root, attr, combinator) {
- if (!nodes) nodes = root.getElementsByTagName("*");
- if (nodes && combinator) nodes = this[combinator](nodes);
- var results = [];
- for (var i = 0, node; node = nodes[i]; i++)
- if (Element.hasAttribute(node, attr)) results.push(node);
- return results;
- },
-
- attr: function(nodes, root, attr, value, operator, combinator) {
- if (!nodes) nodes = root.getElementsByTagName("*");
- if (nodes && combinator) nodes = this[combinator](nodes);
- var handler = Selector.operators[operator], results = [];
- for (var i = 0, node; node = nodes[i]; i++) {
- var nodeValue = Element.readAttribute(node, attr);
- if (nodeValue === null) continue;
- if (handler(nodeValue, value)) results.push(node);
- }
- return results;
- },
-
- pseudo: function(nodes, name, value, root, combinator) {
- if (nodes && combinator) nodes = this[combinator](nodes);
- if (!nodes) nodes = root.getElementsByTagName("*");
- return Selector.pseudos[name](nodes, value, root);
- }
- },
-
- pseudos: {
- 'first-child': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- if (Selector.handlers.previousElementSibling(node)) continue;
- results.push(node);
- }
- return results;
- },
- 'last-child': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- if (Selector.handlers.nextElementSibling(node)) continue;
- results.push(node);
- }
- return results;
- },
- 'only-child': function(nodes, value, root) {
- var h = Selector.handlers;
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (!h.previousElementSibling(node) && !h.nextElementSibling(node))
- results.push(node);
- return results;
- },
- 'nth-child': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root);
- },
- 'nth-last-child': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root, true);
- },
- 'nth-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root, false, true);
- },
- 'nth-last-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, formula, root, true, true);
- },
- 'first-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, "1", root, false, true);
- },
- 'last-of-type': function(nodes, formula, root) {
- return Selector.pseudos.nth(nodes, "1", root, true, true);
- },
- 'only-of-type': function(nodes, formula, root) {
- var p = Selector.pseudos;
- return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root);
- },
-
- // handles the an+b logic
- getIndices: function(a, b, total) {
- if (a == 0) return b > 0 ? [b] : [];
- return $R(1, total).inject([], function(memo, i) {
- if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i);
- return memo;
- });
- },
-
- // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type
- nth: function(nodes, formula, root, reverse, ofType) {
- if (nodes.length == 0) return [];
- if (formula == 'even') formula = '2n+0';
- if (formula == 'odd') formula = '2n+1';
- var h = Selector.handlers, results = [], indexed = [], m;
- h.mark(nodes);
- for (var i = 0, node; node = nodes[i]; i++) {
- if (!node.parentNode._countedByPrototype) {
- h.index(node.parentNode, reverse, ofType);
- indexed.push(node.parentNode);
- }
- }
- if (formula.match(/^\d+$/)) { // just a number
- formula = Number(formula);
- for (var i = 0, node; node = nodes[i]; i++)
- if (node.nodeIndex == formula) results.push(node);
- } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b
- if (m[1] == "-") m[1] = -1;
- var a = m[1] ? Number(m[1]) : 1;
- var b = m[2] ? Number(m[2]) : 0;
- var indices = Selector.pseudos.getIndices(a, b, nodes.length);
- for (var i = 0, node, l = indices.length; node = nodes[i]; i++) {
- for (var j = 0; j < l; j++)
- if (node.nodeIndex == indices[j]) results.push(node);
- }
- }
- h.unmark(nodes);
- h.unmark(indexed);
- return results;
- },
-
- 'empty': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++) {
- // IE treats comments as element nodes
- if (node.tagName == '!' || node.firstChild) continue;
- results.push(node);
- }
- return results;
- },
-
- 'not': function(nodes, selector, root) {
- var h = Selector.handlers, selectorType, m;
- var exclusions = new Selector(selector).findElements(root);
- h.mark(exclusions);
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (!node._countedByPrototype) results.push(node);
- h.unmark(exclusions);
- return results;
- },
-
- 'enabled': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (!node.disabled && (!node.type || node.type !== 'hidden'))
- results.push(node);
- return results;
- },
-
- 'disabled': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (node.disabled) results.push(node);
- return results;
- },
-
- 'checked': function(nodes, value, root) {
- for (var i = 0, results = [], node; node = nodes[i]; i++)
- if (node.checked) results.push(node);
- return results;
- }
- },
-
- operators: {
- '=': function(nv, v) { return nv == v; },
- '!=': function(nv, v) { return nv != v; },
- '^=': function(nv, v) { return nv == v || nv && nv.startsWith(v); },
- '$=': function(nv, v) { return nv == v || nv && nv.endsWith(v); },
- '*=': function(nv, v) { return nv == v || nv && nv.include(v); },
- '$=': function(nv, v) { return nv.endsWith(v); },
- '*=': function(nv, v) { return nv.include(v); },
- '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); },
- '|=': function(nv, v) { return ('-' + (nv || "").toUpperCase() +
- '-').include('-' + (v || "").toUpperCase() + '-'); }
- },
-
- split: function(expression) {
- var expressions = [];
- expression.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) {
- expressions.push(m[1].strip());
- });
- return expressions;
- },
-
- matchElements: function(elements, expression) {
- var matches = $$(expression), h = Selector.handlers;
- h.mark(matches);
- for (var i = 0, results = [], element; element = elements[i]; i++)
- if (element._countedByPrototype) results.push(element);
- h.unmark(matches);
- return results;
- },
-
- findElement: function(elements, expression, index) {
- if (Object.isNumber(expression)) {
- index = expression; expression = false;
- }
- return Selector.matchElements(elements, expression || '*')[index || 0];
- },
-
- findChildElements: function(element, expressions) {
- expressions = Selector.split(expressions.join(','));
- var results = [], h = Selector.handlers;
- for (var i = 0, l = expressions.length, selector; i < l; i++) {
- selector = new Selector(expressions[i].strip());
- h.concat(results, selector.findElements(element));
- }
- return (l > 1) ? h.unique(results) : results;
- }
-});
-
-if (Prototype.Browser.IE) {
- Object.extend(Selector.handlers, {
- // IE returns comment nodes on getElementsByTagName("*").
- // Filter them out.
- concat: function(a, b) {
- for (var i = 0, node; node = b[i]; i++)
- if (node.tagName !== "!") a.push(node);
- return a;
- },
-
- // IE improperly serializes _countedByPrototype in (inner|outer)HTML.
- unmark: function(nodes) {
- for (var i = 0, node; node = nodes[i]; i++)
- node.removeAttribute('_countedByPrototype');
- return nodes;
- }
- });
-}
-
-function $$() {
- return Selector.findChildElements(document, $A(arguments));
-}
-var Form = {
- reset: function(form) {
- $(form).reset();
- return form;
- },
-
- serializeElements: function(elements, options) {
- if (typeof options != 'object') options = { hash: !!options };
- else if (Object.isUndefined(options.hash)) options.hash = true;
- var key, value, submitted = false, submit = options.submit;
-
- var data = elements.inject({ }, function(result, element) {
- if (!element.disabled && element.name) {
- key = element.name; value = $(element).getValue();
- if (value != null && element.type != 'file' && (element.type != 'submit' || (!submitted &&
- submit !== false && (!submit || key == submit) && (submitted = true)))) {
- if (key in result) {
- // a key is already present; construct an array of values
- if (!Object.isArray(result[key])) result[key] = [result[key]];
- result[key].push(value);
- }
- else result[key] = value;
- }
- }
- return result;
- });
-
- return options.hash ? data : Object.toQueryString(data);
- }
-};
-
-Form.Methods = {
- serialize: function(form, options) {
- return Form.serializeElements(Form.getElements(form), options);
- },
-
- getElements: function(form) {
- return $A($(form).getElementsByTagName('*')).inject([],
- function(elements, child) {
- if (Form.Element.Serializers[child.tagName.toLowerCase()])
- elements.push(Element.extend(child));
- return elements;
- }
- );
- },
-
- getInputs: function(form, typeName, name) {
- form = $(form);
- var inputs = form.getElementsByTagName('input');
-
- if (!typeName && !name) return $A(inputs).map(Element.extend);
-
- for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) {
- var input = inputs[i];
- if ((typeName && input.type != typeName) || (name && input.name != name))
- continue;
- matchingInputs.push(Element.extend(input));
- }
-
- return matchingInputs;
- },
-
- disable: function(form) {
- form = $(form);
- Form.getElements(form).invoke('disable');
- return form;
- },
-
- enable: function(form) {
- form = $(form);
- Form.getElements(form).invoke('enable');
- return form;
- },
-
- findFirstElement: function(form) {
- var elements = $(form).getElements().findAll(function(element) {
- return 'hidden' != element.type && !element.disabled;
- });
- var firstByIndex = elements.findAll(function(element) {
- return element.hasAttribute('tabIndex') && element.tabIndex >= 0;
- }).sortBy(function(element) { return element.tabIndex }).first();
-
- return firstByIndex ? firstByIndex : elements.find(function(element) {
- return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase());
- });
- },
-
- focusFirstElement: function(form) {
- form = $(form);
- form.findFirstElement().activate();
- return form;
- },
-
- request: function(form, options) {
- form = $(form), options = Object.clone(options || { });
-
- var params = options.parameters, action = form.readAttribute('action') || '';
- if (action.blank()) action = window.location.href;
- options.parameters = form.serialize(true);
-
- if (params) {
- if (Object.isString(params)) params = params.toQueryParams();
- Object.extend(options.parameters, params);
- }
-
- if (form.hasAttribute('method') && !options.method)
- options.method = form.method;
-
- return new Ajax.Request(action, options);
- }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element = {
- focus: function(element) {
- $(element).focus();
- return element;
- },
-
- select: function(element) {
- $(element).select();
- return element;
- }
-};
-
-Form.Element.Methods = {
- serialize: function(element) {
- element = $(element);
- if (!element.disabled && element.name) {
- var value = element.getValue();
- if (value != undefined) {
- var pair = { };
- pair[element.name] = value;
- return Object.toQueryString(pair);
- }
- }
- return '';
- },
-
- getValue: function(element) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- return Form.Element.Serializers[method](element);
- },
-
- setValue: function(element, value) {
- element = $(element);
- var method = element.tagName.toLowerCase();
- Form.Element.Serializers[method](element, value);
- return element;
- },
-
- clear: function(element) {
- $(element).value = '';
- return element;
- },
-
- present: function(element) {
- return $(element).value != '';
- },
-
- activate: function(element) {
- element = $(element);
- try {
- element.focus();
- if (element.select && (element.tagName.toLowerCase() != 'input' ||
- !['button', 'reset', 'submit'].include(element.type)))
- element.select();
- } catch (e) { }
- return element;
- },
-
- disable: function(element) {
- element = $(element);
- element.disabled = true;
- return element;
- },
-
- enable: function(element) {
- element = $(element);
- element.disabled = false;
- return element;
- }
-};
-
-/*--------------------------------------------------------------------------*/
-
-var Field = Form.Element;
-var $F = Form.Element.Methods.getValue;
-
-/*--------------------------------------------------------------------------*/
-
-Form.Element.Serializers = {
- input: function(element, value) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- return Form.Element.Serializers.inputSelector(element, value);
- default:
- return Form.Element.Serializers.textarea(element, value);
- }
- },
-
- inputSelector: function(element, value) {
- if (Object.isUndefined(value)) return element.checked ? element.value : null;
- else element.checked = !!value;
- },
-
- textarea: function(element, value) {
- if (Object.isUndefined(value)) return element.value;
- else element.value = value;
- },
-
- select: function(element, value) {
- if (Object.isUndefined(value))
- return this[element.type == 'select-one' ?
- 'selectOne' : 'selectMany'](element);
- else {
- var opt, currentValue, single = !Object.isArray(value);
- for (var i = 0, length = element.length; i < length; i++) {
- opt = element.options[i];
- currentValue = this.optionValue(opt);
- if (single) {
- if (currentValue == value) {
- opt.selected = true;
- return;
- }
- }
- else opt.selected = value.include(currentValue);
- }
- }
- },
-
- selectOne: function(element) {
- var index = element.selectedIndex;
- return index >= 0 ? this.optionValue(element.options[index]) : null;
- },
-
- selectMany: function(element) {
- var values, length = element.length;
- if (!length) return null;
-
- for (var i = 0, values = []; i < length; i++) {
- var opt = element.options[i];
- if (opt.selected) values.push(this.optionValue(opt));
- }
- return values;
- },
-
- optionValue: function(opt) {
- // extend element because hasAttribute may not be native
- return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text;
- }
-};
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.TimedObserver = Class.create(PeriodicalExecuter, {
- initialize: function($super, element, frequency, callback) {
- $super(callback, frequency);
- this.element = $(element);
- this.lastValue = this.getValue();
- },
-
- execute: function() {
- var value = this.getValue();
- if (Object.isString(this.lastValue) && Object.isString(value) ?
- this.lastValue != value : String(this.lastValue) != String(value)) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- }
-});
-
-Form.Element.Observer = Class.create(Abstract.TimedObserver, {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.Observer = Class.create(Abstract.TimedObserver, {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-
-/*--------------------------------------------------------------------------*/
-
-Abstract.EventObserver = Class.create({
- initialize: function(element, callback) {
- this.element = $(element);
- this.callback = callback;
-
- this.lastValue = this.getValue();
- if (this.element.tagName.toLowerCase() == 'form')
- this.registerFormCallbacks();
- else
- this.registerCallback(this.element);
- },
-
- onElementEvent: function() {
- var value = this.getValue();
- if (this.lastValue != value) {
- this.callback(this.element, value);
- this.lastValue = value;
- }
- },
-
- registerFormCallbacks: function() {
- Form.getElements(this.element).each(this.registerCallback, this);
- },
-
- registerCallback: function(element) {
- if (element.type) {
- switch (element.type.toLowerCase()) {
- case 'checkbox':
- case 'radio':
- Event.observe(element, 'click', this.onElementEvent.bind(this));
- break;
- default:
- Event.observe(element, 'change', this.onElementEvent.bind(this));
- break;
- }
- }
- }
-});
-
-Form.Element.EventObserver = Class.create(Abstract.EventObserver, {
- getValue: function() {
- return Form.Element.getValue(this.element);
- }
-});
-
-Form.EventObserver = Class.create(Abstract.EventObserver, {
- getValue: function() {
- return Form.serialize(this.element);
- }
-});
-if (!window.Event) var Event = { };
-
-Object.extend(Event, {
- KEY_BACKSPACE: 8,
- KEY_TAB: 9,
- KEY_RETURN: 13,
- KEY_ESC: 27,
- KEY_LEFT: 37,
- KEY_UP: 38,
- KEY_RIGHT: 39,
- KEY_DOWN: 40,
- KEY_DELETE: 46,
- KEY_HOME: 36,
- KEY_END: 35,
- KEY_PAGEUP: 33,
- KEY_PAGEDOWN: 34,
- KEY_INSERT: 45,
-
- cache: { },
-
- relatedTarget: function(event) {
- var element;
- switch(event.type) {
- case 'mouseover': element = event.fromElement; break;
- case 'mouseout': element = event.toElement; break;
- default: return null;
- }
- return Element.extend(element);
- }
-});
-
-Event.Methods = (function() {
- var isButton;
-
- if (Prototype.Browser.IE) {
- var buttonMap = { 0: 1, 1: 4, 2: 2 };
- isButton = function(event, code) {
- return event.button == buttonMap[code];
- };
-
- } else if (Prototype.Browser.WebKit) {
- isButton = function(event, code) {
- switch (code) {
- case 0: return event.which == 1 && !event.metaKey;
- case 1: return event.which == 1 && event.metaKey;
- default: return false;
- }
- };
-
- } else {
- isButton = function(event, code) {
- return event.which ? (event.which === code + 1) : (event.button === code);
- };
- }
-
- return {
- isLeftClick: function(event) { return isButton(event, 0) },
- isMiddleClick: function(event) { return isButton(event, 1) },
- isRightClick: function(event) { return isButton(event, 2) },
-
- element: function(event) {
- event = Event.extend(event);
-
- var node = event.target,
- type = event.type,
- currentTarget = event.currentTarget;
-
- if (currentTarget && currentTarget.tagName) {
- // Firefox screws up the "click" event when moving between radio buttons
- // via arrow keys. It also screws up the "load" and "error" events on images,
- // reporting the document as the target instead of the original image.
- if (type === 'load' || type === 'error' ||
- (type === 'click' && currentTarget.tagName.toLowerCase() === 'input'
- && currentTarget.type === 'radio'))
- node = currentTarget;
- }
- if (node.nodeType == Node.TEXT_NODE) node = node.parentNode;
- return Element.extend(node);
- },
-
- findElement: function(event, expression) {
- var element = Event.element(event);
- if (!expression) return element;
- var elements = [element].concat(element.ancestors());
- return Selector.findElement(elements, expression, 0);
- },
-
- pointer: function(event) {
- var docElement = document.documentElement,
- body = document.body || { scrollLeft: 0, scrollTop: 0 };
- return {
- x: event.pageX || (event.clientX +
- (docElement.scrollLeft || body.scrollLeft) -
- (docElement.clientLeft || 0)),
- y: event.pageY || (event.clientY +
- (docElement.scrollTop || body.scrollTop) -
- (docElement.clientTop || 0))
- };
- },
-
- pointerX: function(event) { return Event.pointer(event).x },
- pointerY: function(event) { return Event.pointer(event).y },
-
- stop: function(event) {
- Event.extend(event);
- event.preventDefault();
- event.stopPropagation();
- event.stopped = true;
- }
- };
-})();
-
-Event.extend = (function() {
- var methods = Object.keys(Event.Methods).inject({ }, function(m, name) {
- m[name] = Event.Methods[name].methodize();
- return m;
- });
-
- if (Prototype.Browser.IE) {
- Object.extend(methods, {
- stopPropagation: function() { this.cancelBubble = true },
- preventDefault: function() { this.returnValue = false },
- inspect: function() { return "[object Event]" }
- });
-
- return function(event) {
- if (!event) return false;
- if (event._extendedByPrototype) return event;
-
- event._extendedByPrototype = Prototype.emptyFunction;
- var pointer = Event.pointer(event);
- Object.extend(event, {
- target: event.srcElement,
- relatedTarget: Event.relatedTarget(event),
- pageX: pointer.x,
- pageY: pointer.y
- });
- return Object.extend(event, methods);
- };
-
- } else {
- Event.prototype = Event.prototype || document.createEvent("HTMLEvents")['__proto__'];
- Object.extend(Event.prototype, methods);
- return Prototype.K;
- }
-})();
-
-Object.extend(Event, (function() {
- var cache = Event.cache;
-
- function getEventID(element) {
- if (element._prototypeEventID) return element._prototypeEventID[0];
- arguments.callee.id = arguments.callee.id || 1;
- return element._prototypeEventID = [++arguments.callee.id];
- }
-
- function getDOMEventName(eventName) {
- if (eventName && eventName.include(':')) return "dataavailable";
- return eventName;
- }
-
- function getCacheForID(id) {
- return cache[id] = cache[id] || { };
- }
-
- function getWrappersForEventName(id, eventName) {
- var c = getCacheForID(id);
- return c[eventName] = c[eventName] || [];
- }
-
- function createWrapper(element, eventName, handler) {
- var id = getEventID(element);
- var c = getWrappersForEventName(id, eventName);
- if (c.pluck("handler").include(handler)) return false;
-
- var wrapper = function(event) {
- if (!Event || !Event.extend ||
- (event.eventName && event.eventName != eventName))
- return false;
-
- Event.extend(event);
- handler.call(element, event);
- };
-
- wrapper.handler = handler;
- c.push(wrapper);
- return wrapper;
- }
-
- function findWrapper(id, eventName, handler) {
- var c = getWrappersForEventName(id, eventName);
- return c.find(function(wrapper) { return wrapper.handler == handler });
- }
-
- function destroyWrapper(id, eventName, handler) {
- var c = getCacheForID(id);
- if (!c[eventName]) return false;
- c[eventName] = c[eventName].without(findWrapper(id, eventName, handler));
- }
-
- function destroyCache() {
- for (var id in cache)
- for (var eventName in cache[id])
- cache[id][eventName] = null;
- }
-
-
- // Internet Explorer needs to remove event handlers on page unload
- // in order to avoid memory leaks.
- if (window.attachEvent) {
- window.attachEvent("onunload", destroyCache);
- }
-
- // Safari has a dummy event handler on page unload so that it won't
- // use its bfcache. Safari <= 3.1 has an issue with restoring the "document"
- // object when page is returned to via the back button using its bfcache.
- if (Prototype.Browser.WebKit) {
- window.addEventListener('unload', Prototype.emptyFunction, false);
- }
-
- return {
- observe: function(element, eventName, handler) {
- element = $(element);
- var name = getDOMEventName(eventName);
-
- var wrapper = createWrapper(element, eventName, handler);
- if (!wrapper) return element;
-
- if (element.addEventListener) {
- element.addEventListener(name, wrapper, false);
- } else {
- element.attachEvent("on" + name, wrapper);
- }
-
- return element;
- },
-
- stopObserving: function(element, eventName, handler) {
- element = $(element);
- var id = getEventID(element), name = getDOMEventName(eventName);
-
- if (!handler && eventName) {
- getWrappersForEventName(id, eventName).each(function(wrapper) {
- element.stopObserving(eventName, wrapper.handler);
- });
- return element;
-
- } else if (!eventName) {
- Object.keys(getCacheForID(id)).each(function(eventName) {
- element.stopObserving(eventName);
- });
- return element;
- }
-
- var wrapper = findWrapper(id, eventName, handler);
- if (!wrapper) return element;
-
- if (element.removeEventListener) {
- element.removeEventListener(name, wrapper, false);
- } else {
- element.detachEvent("on" + name, wrapper);
- }
-
- destroyWrapper(id, eventName, handler);
-
- return element;
- },
-
- fire: function(element, eventName, memo) {
- element = $(element);
- if (element == document && document.createEvent && !element.dispatchEvent)
- element = document.documentElement;
-
- var event;
- if (document.createEvent) {
- event = document.createEvent("HTMLEvents");
- event.initEvent("dataavailable", true, true);
- } else {
- event = document.createEventObject();
- event.eventType = "ondataavailable";
- }
-
- event.eventName = eventName;
- event.memo = memo || { };
-
- if (document.createEvent) {
- element.dispatchEvent(event);
- } else {
- element.fireEvent(event.eventType, event);
- }
-
- return Event.extend(event);
- }
- };
-})());
-
-Object.extend(Event, Event.Methods);
-
-Element.addMethods({
- fire: Event.fire,
- observe: Event.observe,
- stopObserving: Event.stopObserving
-});
-
-Object.extend(document, {
- fire: Element.Methods.fire.methodize(),
- observe: Element.Methods.observe.methodize(),
- stopObserving: Element.Methods.stopObserving.methodize(),
- loaded: false
-});
-
-(function() {
- /* Support for the DOMContentLoaded event is based on work by Dan Webb,
- Matthias Miller, Dean Edwards and John Resig. */
-
- var timer;
-
- function fireContentLoadedEvent() {
- if (document.loaded) return;
- if (timer) window.clearInterval(timer);
- document.fire("dom:loaded");
- document.loaded = true;
- }
-
- if (document.addEventListener) {
- if (Prototype.Browser.WebKit) {
- timer = window.setInterval(function() {
- if (/loaded|complete/.test(document.readyState))
- fireContentLoadedEvent();
- }, 0);
-
- Event.observe(window, "load", fireContentLoadedEvent);
-
- } else {
- document.addEventListener("DOMContentLoaded",
- fireContentLoadedEvent, false);
- }
-
- } else {
- document.write("<script id=__onDOMContentLoaded defer src=//:><\/script>");
- $("__onDOMContentLoaded").onreadystatechange = function() {
- if (this.readyState == "complete") {
- this.onreadystatechange = null;
- fireContentLoadedEvent();
- }
- };
- }
-})();
-/*------------------------------- DEPRECATED -------------------------------*/
-
-Hash.toQueryString = Object.toQueryString;
-
-var Toggle = { display: Element.toggle };
-
-Element.Methods.childOf = Element.Methods.descendantOf;
-
-var Insertion = {
- Before: function(element, content) {
- return Element.insert(element, {before:content});
- },
-
- Top: function(element, content) {
- return Element.insert(element, {top:content});
- },
-
- Bottom: function(element, content) {
- return Element.insert(element, {bottom:content});
- },
-
- After: function(element, content) {
- return Element.insert(element, {after:content});
- }
-};
-
-var $continue = new Error('"throw $continue" is deprecated, use "return" instead');
-
-// This should be moved to script.aculo.us; notice the deprecated methods
-// further below, that map to the newer Element methods.
-var Position = {
- // set to true if needed, warning: firefox performance problems
- // NOT neeeded for page scrolling, only if draggable contained in
- // scrollable elements
- includeScrollOffsets: false,
-
- // must be called before calling withinIncludingScrolloffset, every time the
- // page is scrolled
- prepare: function() {
- this.deltaX = window.pageXOffset
- || document.documentElement.scrollLeft
- || document.body.scrollLeft
- || 0;
- this.deltaY = window.pageYOffset
- || document.documentElement.scrollTop
- || document.body.scrollTop
- || 0;
- },
-
- // caches x/y coordinate pair to use with overlap
- within: function(element, x, y) {
- if (this.includeScrollOffsets)
- return this.withinIncludingScrolloffsets(element, x, y);
- this.xcomp = x;
- this.ycomp = y;
- this.offset = Element.cumulativeOffset(element);
-
- return (y >= this.offset[1] &&
- y < this.offset[1] + element.offsetHeight &&
- x >= this.offset[0] &&
- x < this.offset[0] + element.offsetWidth);
- },
-
- withinIncludingScrolloffsets: function(element, x, y) {
- var offsetcache = Element.cumulativeScrollOffset(element);
-
- this.xcomp = x + offsetcache[0] - this.deltaX;
- this.ycomp = y + offsetcache[1] - this.deltaY;
- this.offset = Element.cumulativeOffset(element);
-
- return (this.ycomp >= this.offset[1] &&
- this.ycomp < this.offset[1] + element.offsetHeight &&
- this.xcomp >= this.offset[0] &&
- this.xcomp < this.offset[0] + element.offsetWidth);
- },
-
- // within must be called directly before
- overlap: function(mode, element) {
- if (!mode) return 0;
- if (mode == 'vertical')
- return ((this.offset[1] + element.offsetHeight) - this.ycomp) /
- element.offsetHeight;
- if (mode == 'horizontal')
- return ((this.offset[0] + element.offsetWidth) - this.xcomp) /
- element.offsetWidth;
- },
-
- // Deprecation layer -- use newer Element methods now (1.5.2).
-
- cumulativeOffset: Element.Methods.cumulativeOffset,
-
- positionedOffset: Element.Methods.positionedOffset,
-
- absolutize: function(element) {
- Position.prepare();
- return Element.absolutize(element);
- },
-
- relativize: function(element) {
- Position.prepare();
- return Element.relativize(element);
- },
-
- realOffset: Element.Methods.cumulativeScrollOffset,
-
- offsetParent: Element.Methods.getOffsetParent,
-
- page: Element.Methods.viewportOffset,
-
- clone: function(source, target, options) {
- options = options || { };
- return Element.clonePosition(target, source, options);
- }
-};
-
-/*--------------------------------------------------------------------------*/
-
-if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
- function iter(name) {
- return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + name + " ')]";
- }
-
- instanceMethods.getElementsByClassName = Prototype.BrowserFeatures.XPath ?
- function(element, className) {
- className = className.toString().strip();
- var cond = /\s/.test(className) ? $w(className).map(iter).join('') : iter(className);
- return cond ? document._getElementsByXPath('.//*' + cond, element) : [];
- } : function(element, className) {
- className = className.toString().strip();
- var elements = [], classNames = (/\s/.test(className) ? $w(className) : null);
- if (!classNames && !className) return elements;
-
- var nodes = $(element).getElementsByTagName('*');
- className = ' ' + className + ' ';
-
- for (var i = 0, child, cn; child = nodes[i]; i++) {
- if (child.className && (cn = ' ' + child.className + ' ') && (cn.include(className) ||
- (classNames && classNames.all(function(name) {
- return !name.toString().blank() && cn.include(' ' + name + ' ');
- }))))
- elements.push(Element.extend(child));
- }
- return elements;
- };
-
- return function(className, parentElement) {
- return $(parentElement || document.body).getElementsByClassName(className);
- };
-}(Element.Methods);
-
-/*--------------------------------------------------------------------------*/
-
-Element.ClassNames = Class.create();
-Element.ClassNames.prototype = {
- initialize: function(element) {
- this.element = $(element);
- },
-
- _each: function(iterator) {
- this.element.className.split(/\s+/).select(function(name) {
- return name.length > 0;
- })._each(iterator);
- },
-
- set: function(className) {
- this.element.className = className;
- },
-
- add: function(classNameToAdd) {
- if (this.include(classNameToAdd)) return;
- this.set($A(this).concat(classNameToAdd).join(' '));
- },
-
- remove: function(classNameToRemove) {
- if (!this.include(classNameToRemove)) return;
- this.set($A(this).without(classNameToRemove).join(' '));
- },
-
- toString: function() {
- return $A(this).join(' ');
- }
-};
-
-Object.extend(Element.ClassNames.prototype, Enumerable);
-
-/*--------------------------------------------------------------------------*/
-
-Element.addMethods(); \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/robots.txt b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/robots.txt
deleted file mode 100644
index 085187fa58b..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/html/robots.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-# See http://www.robotstxt.org/wc/norobots.html for documentation on how to use the robots.txt file
-#
-# To ban all spiders from the entire site uncomment the next two lines:
-# User-Agent: *
-# Disallow: /
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/code_statistics.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/code_statistics.rb
deleted file mode 100644
index 740d8a1767b..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/code_statistics.rb
+++ /dev/null
@@ -1,107 +0,0 @@
-class CodeStatistics #:nodoc:
-
- TEST_TYPES = %w(Units Functionals Unit\ tests Functional\ tests Integration\ tests)
-
- def initialize(*pairs)
- @pairs = pairs
- @statistics = calculate_statistics
- @total = calculate_total if pairs.length > 1
- end
-
- def to_s
- print_header
- @pairs.each { |pair| print_line(pair.first, @statistics[pair.first]) }
- print_splitter
-
- if @total
- print_line("Total", @total)
- print_splitter
- end
-
- print_code_test_stats
- end
-
- private
- def calculate_statistics
- @pairs.inject({}) { |stats, pair| stats[pair.first] = calculate_directory_statistics(pair.last); stats }
- end
-
- def calculate_directory_statistics(directory, pattern = /.*\.rb$/)
- stats = { "lines" => 0, "codelines" => 0, "classes" => 0, "methods" => 0 }
-
- Dir.foreach(directory) do |file_name|
- if File.stat(directory + "/" + file_name).directory? and (/^\./ !~ file_name)
- newstats = calculate_directory_statistics(directory + "/" + file_name, pattern)
- stats.each { |k, v| stats[k] += newstats[k] }
- end
-
- next unless file_name =~ pattern
-
- f = File.open(directory + "/" + file_name)
-
- while line = f.gets
- stats["lines"] += 1
- stats["classes"] += 1 if line =~ /class [A-Z]/
- stats["methods"] += 1 if line =~ /def [a-z]/
- stats["codelines"] += 1 unless line =~ /^\s*$/ || line =~ /^\s*#/
- end
- end
-
- stats
- end
-
- def calculate_total
- total = { "lines" => 0, "codelines" => 0, "classes" => 0, "methods" => 0 }
- @statistics.each_value { |pair| pair.each { |k, v| total[k] += v } }
- total
- end
-
- def calculate_code
- code_loc = 0
- @statistics.each { |k, v| code_loc += v['codelines'] unless TEST_TYPES.include? k }
- code_loc
- end
-
- def calculate_tests
- test_loc = 0
- @statistics.each { |k, v| test_loc += v['codelines'] if TEST_TYPES.include? k }
- test_loc
- end
-
- def print_header
- print_splitter
- puts "| Name | Lines | LOC | Classes | Methods | M/C | LOC/M |"
- print_splitter
- end
-
- def print_splitter
- puts "+----------------------+-------+-------+---------+---------+-----+-------+"
- end
-
- def print_line(name, statistics)
- m_over_c = (statistics["methods"] / statistics["classes"]) rescue m_over_c = 0
- loc_over_m = (statistics["codelines"] / statistics["methods"]) - 2 rescue loc_over_m = 0
-
- start = if TEST_TYPES.include? name
- "| #{name.ljust(20)} "
- else
- "| #{name.ljust(20)} "
- end
-
- puts start +
- "| #{statistics["lines"].to_s.rjust(5)} " +
- "| #{statistics["codelines"].to_s.rjust(5)} " +
- "| #{statistics["classes"].to_s.rjust(7)} " +
- "| #{statistics["methods"].to_s.rjust(7)} " +
- "| #{m_over_c.to_s.rjust(3)} " +
- "| #{loc_over_m.to_s.rjust(5)} |"
- end
-
- def print_code_test_stats
- code = calculate_code
- tests = calculate_tests
-
- puts " Code LOC: #{code} Test LOC: #{tests} Code to Test Ratio: 1:#{sprintf("%.1f", tests.to_f/code)}"
- puts ""
- end
- end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands.rb
deleted file mode 100644
index 841e98a0dc0..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands.rb
+++ /dev/null
@@ -1,17 +0,0 @@
-commands = Dir["#{File.dirname(__FILE__)}/commands/*.rb"].collect { |file_path| File.basename(file_path).split(".").first }
-
-if commands.include?(ARGV.first)
- require "#{File.dirname(__FILE__)}/commands/#{ARGV.shift}"
-else
- puts <<-USAGE
-The 'run' provides a unified access point for all the default Rails' commands.
-
-Usage: ./script/run <command> [OPTIONS]
-
-Examples:
- ./script/run generate controller Admin
- ./script/run process reaper
-
-USAGE
- puts "Choose: #{commands.join(", ")}"
-end \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/about.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/about.rb
deleted file mode 100644
index bc2cfcb948c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/about.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-require "#{RAILS_ROOT}/config/environment"
-require 'rails/info'
-puts Rails::Info
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/console.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/console.rb
deleted file mode 100644
index 63df8346396..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/console.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
-
-require 'optparse'
-
-options = { :sandbox => false, :irb => irb }
-OptionParser.new do |opt|
- opt.banner = "Usage: console [environment] [options]"
- opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
- opt.on("--irb=[#{irb}]", 'Invoke a different irb.') { |v| options[:irb] = v }
- opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
- opt.parse!(ARGV)
-end
-
-libs = " -r irb/completion"
-libs << %( -r "#{RAILS_ROOT}/config/environment")
-libs << " -r console_app"
-libs << " -r console_sandbox" if options[:sandbox]
-libs << " -r console_with_helpers"
-
-if options[:debugger]
- begin
- require 'ruby-debug'
- libs << " -r ruby-debug"
- puts "=> Debugger enabled"
- rescue Exception
- puts "You need to install ruby-debug to run the console in debugging mode. With gems, use 'gem install ruby-debug'"
- exit
- end
-end
-
-ENV['RAILS_ENV'] = case ARGV.first
- when "p"; "production"
- when "d"; "development"
- when "t"; "test"
- else
- ARGV.first || ENV['RAILS_ENV'] || 'development'
-end
-
-if options[:sandbox]
- puts "Loading #{ENV['RAILS_ENV']} environment in sandbox (Rails #{Rails.version})"
- puts "Any modifications you make will be rolled back on exit"
-else
- puts "Loading #{ENV['RAILS_ENV']} environment (Rails #{Rails.version})"
-end
-exec "#{options[:irb]} #{libs} --simple-prompt"
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/dbconsole.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/dbconsole.rb
deleted file mode 100644
index b4160494825..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/dbconsole.rb
+++ /dev/null
@@ -1,87 +0,0 @@
-require 'erb'
-require 'yaml'
-require 'optparse'
-
-include_password = false
-options = {}
-
-OptionParser.new do |opt|
- opt.banner = "Usage: dbconsole [options] [environment]"
- opt.on("-p", "--include-password", "Automatically provide the password from database.yml") do |v|
- include_password = true
- end
-
- opt.on("--mode [MODE]", ['html', 'list', 'line', 'column'],
- "Automatically put the sqlite3 database in the specified mode (html, list, line, column).") do |mode|
- options['mode'] = mode
- end
-
- opt.on("-h", "--header") do |h|
- options['header'] = h
- end
-
- opt.parse!(ARGV)
- abort opt.to_s unless (0..1).include?(ARGV.size)
-end
-
-env = ARGV.first || ENV['RAILS_ENV'] || 'development'
-unless config = YAML::load(ERB.new(IO.read(RAILS_ROOT + "/config/database.yml")).result)[env]
- abort "No database is configured for the environment '#{env}'"
-end
-
-
-def find_cmd(*commands)
- dirs_on_path = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
- commands += commands.map{|cmd| "#{cmd}.exe"} if RUBY_PLATFORM =~ /win32/
-
- full_path_command = nil
- found = commands.detect do |cmd|
- dir = dirs_on_path.detect do |path|
- full_path_command = File.join(path, cmd)
- File.executable? full_path_command
- end
- end
- found ? full_path_command : abort("Couldn't find database client: #{commands.join(', ')}. Check your $PATH and try again.")
-end
-
-case config["adapter"]
-when /^mysql/
- args = {
- 'host' => '--host',
- 'port' => '--port',
- 'socket' => '--socket',
- 'username' => '--user',
- 'encoding' => '--default-character-set'
- }.map { |opt, arg| "#{arg}=#{config[opt]}" if config[opt] }.compact
-
- if config['password'] && include_password
- args << "--password=#{config['password']}"
- elsif config['password'] && !config['password'].to_s.empty?
- args << "-p"
- end
-
- args << config['database']
-
- exec(find_cmd('mysql', 'mysql5'), *args)
-
-when "postgresql"
- ENV['PGUSER'] = config["username"] if config["username"]
- ENV['PGHOST'] = config["host"] if config["host"]
- ENV['PGPORT'] = config["port"].to_s if config["port"]
- ENV['PGPASSWORD'] = config["password"].to_s if config["password"] && include_password
- exec(find_cmd('psql'), config["database"])
-
-when "sqlite"
- exec(find_cmd('sqlite'), config["database"])
-
-when "sqlite3"
- args = []
-
- args << "-#{options['mode']}" if options['mode']
- args << "-header" if options['header']
- args << config['database']
-
- exec(find_cmd('sqlite3'), *args)
-else
- abort "Unknown command-line client for #{config['database']}. Submit a Rails patch to add support!"
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/destroy.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/destroy.rb
deleted file mode 100644
index f4b81d65117..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/destroy.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require "#{RAILS_ROOT}/config/environment"
-require 'rails_generator'
-require 'rails_generator/scripts/destroy'
-
-ARGV.shift if ['--help', '-h'].include?(ARGV[0])
-Rails::Generator::Scripts::Destroy.new.run(ARGV)
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/generate.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/generate.rb
deleted file mode 100755
index 3d3db3d8565..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/generate.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-require "#{RAILS_ROOT}/config/environment"
-require 'rails_generator'
-require 'rails_generator/scripts/generate'
-
-ARGV.shift if ['--help', '-h'].include?(ARGV[0])
-Rails::Generator::Scripts::Generate.new.run(ARGV)
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/listener b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/listener
deleted file mode 100755
index 7079ef78a6e..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/listener
+++ /dev/null
@@ -1,86 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'stringio'
-require 'fileutils'
-require 'fcgi_handler'
-
-def message(s)
- $stderr.puts "listener: #{s}" if ENV && ENV["DEBUG_GATEWAY"]
-end
-
-class RemoteCGI < CGI
- attr_accessor :stdinput, :stdoutput, :env_table
- def initialize(env_table, input = nil, output = nil)
- self.env_table = env_table
- self.stdinput = input || StringIO.new
- self.stdoutput = output || StringIO.new
- super()
- end
-
- def out(stream) # Ignore the requested output stream
- super(stdoutput)
- end
-end
-
-class Listener
- include DRbUndumped
-
- def initialize(timeout, socket_path)
- @socket = File.expand_path(socket_path)
- @mutex = Mutex.new
- @active = false
- @timeout = timeout
-
- @handler = RailsFCGIHandler.new
- @handler.extend DRbUndumped
-
- message 'opening socket'
- DRb.start_service("drbunix:#{@socket}", self)
-
- message 'entering process loop'
- @handler.process! self
- end
-
- def each_cgi(&cgi_block)
- @cgi_block = cgi_block
- message 'entering idle loop'
- loop do
- sleep @timeout rescue nil
- die! unless @active
- @active = false
- end
- end
-
- def process(env, input)
- message 'received request'
- @mutex.synchronize do
- @active = true
-
- message 'creating input stream'
- input_stream = StringIO.new(input)
- message 'building CGI instance'
- cgi = RemoteCGI.new(eval(env), input_stream)
-
- message 'yielding to fcgi handler'
- @cgi_block.call cgi
- message 'yield finished -- sending output'
-
- cgi.stdoutput.seek(0)
- output = cgi.stdoutput.read
-
- return output
- end
- end
-
- def die!
- message 'shutting down'
- DRb.stop_service
- FileUtils.rm_f @socket
- Kernel.exit 0
- end
-end
-
-socket_path = ARGV.shift
-timeout = (ARGV.shift || 90).to_i
-
-Listener.new(timeout, socket_path)
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/tracker b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/tracker
deleted file mode 100755
index 4ca12d779b6..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/ncgi/tracker
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/usr/bin/env ruby
-
-require 'drb'
-require 'thread'
-
-def message(s)
- $stderr.puts "tracker: #{s}" if ENV && ENV["DEBUG_GATEWAY"]
-end
-
-class Tracker
- include DRbUndumped
-
- def initialize(instances, socket_path)
- @instances = instances
- @socket = File.expand_path(socket_path)
- @active = false
-
- @listeners = []
- @instances.times { @listeners << Mutex.new }
-
- message "using #{@listeners.length} listeners"
- message "opening socket at #{@socket}"
-
- @service = DRb.start_service("drbunix://#{@socket}", self)
- end
-
- def with_listener
- message "listener requested"
-
- mutex = has_lock = index = nil
- 3.times do
- @listeners.each_with_index do |mutex, index|
- has_lock = mutex.try_lock
- break if has_lock
- end
- break if has_lock
- sleep 0.05
- end
-
- if has_lock
- message "obtained listener #{index}"
- @active = true
- begin yield index
- ensure
- mutex.unlock
- message "released listener #{index}"
- end
- else
- message "dropping request because no listeners are available!"
- end
- end
-
- def background(check_interval = nil)
- if check_interval
- loop do
- sleep check_interval
- message "Idle for #{check_interval}, shutting down" unless @active
- @active = false
- Kernel.exit 0
- end
- else DRb.thread.join
- end
- end
-end
-
-socket_path = ARGV.shift
-instances = ARGV.shift.to_i
-t = Tracker.new(instances, socket_path)
-t.background(ARGV.first ? ARGV.shift.to_i : 90)
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/benchmarker.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/benchmarker.rb
deleted file mode 100644
index e8804fe1bfd..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/benchmarker.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-if ARGV.empty?
- puts "Usage: ./script/performance/benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..."
- exit 1
-end
-
-begin
- N = Integer(ARGV.first)
- ARGV.shift
-rescue ArgumentError
- N = 1
-end
-
-require RAILS_ROOT + '/config/environment'
-require 'benchmark'
-include Benchmark
-
-# Don't include compilation in the benchmark
-ARGV.each { |expression| eval(expression) }
-
-bm(6) do |x|
- ARGV.each_with_index do |expression, idx|
- x.report("##{idx + 1}") { N.times { eval(expression) } }
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/profiler.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/profiler.rb
deleted file mode 100644
index 7df840f1974..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/performance/profiler.rb
+++ /dev/null
@@ -1,50 +0,0 @@
-if ARGV.empty?
- $stderr.puts "Usage: ./script/performance/profiler 'Person.expensive_method(10)' [times] [flat|graph|graph_html]"
- exit(1)
-end
-
-# Keep the expensive require out of the profile.
-$stderr.puts 'Loading Rails...'
-require RAILS_ROOT + '/config/environment'
-
-# Define a method to profile.
-if ARGV[1] and ARGV[1].to_i > 1
- eval "def profile_me() #{ARGV[1]}.times { #{ARGV[0]} } end"
-else
- eval "def profile_me() #{ARGV[0]} end"
-end
-
-# Use the ruby-prof extension if available. Fall back to stdlib profiler.
-begin
- begin
- require "ruby-prof"
- $stderr.puts 'Using the ruby-prof extension.'
- RubyProf.measure_mode = RubyProf::WALL_TIME
- RubyProf.start
- profile_me
- results = RubyProf.stop
- if ARGV[2]
- printer_class = RubyProf.const_get((ARGV[2] + "_printer").classify)
- else
- printer_class = RubyProf::FlatPrinter
- end
- printer = printer_class.new(results)
- printer.print($stderr)
- rescue LoadError
- require "prof"
- $stderr.puts 'Using the old ruby-prof extension.'
- Prof.clock_mode = Prof::GETTIMEOFDAY
- Prof.start
- profile_me
- results = Prof.stop
- require 'rubyprof_ext'
- Prof.print_profile(results, $stderr)
- end
-rescue LoadError
- require 'profiler'
- $stderr.puts 'Using the standard Ruby profiler.'
- Profiler__.start_profile
- profile_me
- Profiler__.stop_profile
- Profiler__.print_profile($stderr)
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/plugin.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/plugin.rb
deleted file mode 100644
index 9f99a8d5575..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/plugin.rb
+++ /dev/null
@@ -1,968 +0,0 @@
-# Rails Plugin Manager.
-#
-# Listing available plugins:
-#
-# $ ./script/plugin list
-# continuous_builder http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder
-# asset_timestamping http://svn.aviditybytes.com/rails/plugins/asset_timestamping
-# enumerations_mixin http://svn.protocool.com/rails/plugins/enumerations_mixin/trunk
-# calculations http://techno-weenie.net/svn/projects/calculations/
-# ...
-#
-# Installing plugins:
-#
-# $ ./script/plugin install continuous_builder asset_timestamping
-#
-# Finding Repositories:
-#
-# $ ./script/plugin discover
-#
-# Adding Repositories:
-#
-# $ ./script/plugin source http://svn.protocool.com/rails/plugins/
-#
-# How it works:
-#
-# * Maintains a list of subversion repositories that are assumed to have
-# a plugin directory structure. Manage them with the (source, unsource,
-# and sources commands)
-#
-# * The discover command scrapes the following page for things that
-# look like subversion repositories with plugins:
-# http://wiki.rubyonrails.org/rails/pages/Plugins
-#
-# * Unless you specify that you want to use svn, script/plugin uses plain old
-# HTTP for downloads. The following bullets are true if you specify
-# that you want to use svn.
-#
-# * If `vendor/plugins` is under subversion control, the script will
-# modify the svn:externals property and perform an update. You can
-# use normal subversion commands to keep the plugins up to date.
-#
-# * Or, if `vendor/plugins` is not under subversion control, the
-# plugin is pulled via `svn checkout` or `svn export` but looks
-# exactly the same.
-#
-# Specifying revisions:
-#
-# * Subversion revision is a single integer.
-#
-# * Git revision format:
-# - full - 'refs/tags/1.8.0' or 'refs/heads/experimental'
-# - short: 'experimental' (equivalent to 'refs/heads/experimental')
-# 'tag 1.8.0' (equivalent to 'refs/tags/1.8.0')
-#
-#
-# This is Free Software, copyright 2005 by Ryan Tomayko (rtomayko@gmail.com)
-# and is licensed MIT: (http://www.opensource.org/licenses/mit-license.php)
-
-$verbose = false
-
-
-require 'open-uri'
-require 'fileutils'
-require 'tempfile'
-
-include FileUtils
-
-class RailsEnvironment
- attr_reader :root
-
- def initialize(dir)
- @root = dir
- end
-
- def self.find(dir=nil)
- dir ||= pwd
- while dir.length > 1
- return new(dir) if File.exist?(File.join(dir, 'config', 'environment.rb'))
- dir = File.dirname(dir)
- end
- end
-
- def self.default
- @default ||= find
- end
-
- def self.default=(rails_env)
- @default = rails_env
- end
-
- def install(name_uri_or_plugin)
- if name_uri_or_plugin.is_a? String
- if name_uri_or_plugin =~ /:\/\//
- plugin = Plugin.new(name_uri_or_plugin)
- else
- plugin = Plugins[name_uri_or_plugin]
- end
- else
- plugin = name_uri_or_plugin
- end
- unless plugin.nil?
- plugin.install
- else
- puts "Plugin not found: #{name_uri_or_plugin}"
- end
- end
-
- def use_svn?
- require 'active_support/core_ext/kernel'
- silence_stderr {`svn --version` rescue nil}
- !$?.nil? && $?.success?
- end
-
- def use_externals?
- use_svn? && File.directory?("#{root}/vendor/plugins/.svn")
- end
-
- def use_checkout?
- # this is a bit of a guess. we assume that if the rails environment
- # is under subversion then they probably want the plugin checked out
- # instead of exported. This can be overridden on the command line
- File.directory?("#{root}/.svn")
- end
-
- def best_install_method
- return :http unless use_svn?
- case
- when use_externals? then :externals
- when use_checkout? then :checkout
- else :export
- end
- end
-
- def externals
- return [] unless use_externals?
- ext = `svn propget svn:externals "#{root}/vendor/plugins"`
- lines = ext.respond_to?(:lines) ? ext.lines : ext
- lines.reject{ |line| line.strip == '' }.map do |line|
- line.strip.split(/\s+/, 2)
- end
- end
-
- def externals=(items)
- unless items.is_a? String
- items = items.map{|name,uri| "#{name.ljust(29)} #{uri.chomp('/')}"}.join("\n")
- end
- Tempfile.open("svn-set-prop") do |file|
- file.write(items)
- file.flush
- system("svn propset -q svn:externals -F \"#{file.path}\" \"#{root}/vendor/plugins\"")
- end
- end
-
-end
-
-class Plugin
- attr_reader :name, :uri
-
- def initialize(uri, name=nil)
- @uri = uri
- guess_name(uri)
- end
-
- def self.find(name)
- name =~ /\// ? new(name) : Repositories.instance.find_plugin(name)
- end
-
- def to_s
- "#{@name.ljust(30)}#{@uri}"
- end
-
- def svn_url?
- @uri =~ /svn(?:\+ssh)?:\/\/*/
- end
-
- def git_url?
- @uri =~ /^git:\/\// || @uri =~ /\.git$/
- end
-
- def installed?
- File.directory?("#{rails_env.root}/vendor/plugins/#{name}") \
- or rails_env.externals.detect{ |name, repo| self.uri == repo }
- end
-
- def install(method=nil, options = {})
- method ||= rails_env.best_install_method?
- if :http == method
- method = :export if svn_url?
- method = :git if git_url?
- end
-
- uninstall if installed? and options[:force]
-
- unless installed?
- send("install_using_#{method}", options)
- run_install_hook
- else
- puts "already installed: #{name} (#{uri}). pass --force to reinstall"
- end
- end
-
- def uninstall
- path = "#{rails_env.root}/vendor/plugins/#{name}"
- if File.directory?(path)
- puts "Removing 'vendor/plugins/#{name}'" if $verbose
- run_uninstall_hook
- rm_r path
- else
- puts "Plugin doesn't exist: #{path}"
- end
- # clean up svn:externals
- externals = rails_env.externals
- externals.reject!{|n,u| name == n or name == u}
- rails_env.externals = externals
- end
-
- def info
- tmp = "#{rails_env.root}/_tmp_about.yml"
- if svn_url?
- cmd = "svn export #{@uri} \"#{rails_env.root}/#{tmp}\""
- puts cmd if $verbose
- system(cmd)
- end
- open(svn_url? ? tmp : File.join(@uri, 'about.yml')) do |stream|
- stream.read
- end rescue "No about.yml found in #{uri}"
- ensure
- FileUtils.rm_rf tmp if svn_url?
- end
-
- private
-
- def run_install_hook
- install_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/install.rb"
- load install_hook_file if File.exist? install_hook_file
- end
-
- def run_uninstall_hook
- uninstall_hook_file = "#{rails_env.root}/vendor/plugins/#{name}/uninstall.rb"
- load uninstall_hook_file if File.exist? uninstall_hook_file
- end
-
- def install_using_export(options = {})
- svn_command :export, options
- end
-
- def install_using_checkout(options = {})
- svn_command :checkout, options
- end
-
- def install_using_externals(options = {})
- externals = rails_env.externals
- externals.push([@name, uri])
- rails_env.externals = externals
- install_using_checkout(options)
- end
-
- def install_using_http(options = {})
- root = rails_env.root
- mkdir_p "#{root}/vendor/plugins/#{@name}"
- Dir.chdir "#{root}/vendor/plugins/#{@name}" do
- puts "fetching from '#{uri}'" if $verbose
- fetcher = RecursiveHTTPFetcher.new(uri, -1)
- fetcher.quiet = true if options[:quiet]
- fetcher.fetch
- end
- end
-
- def install_using_git(options = {})
- root = rails_env.root
- mkdir_p(install_path = "#{root}/vendor/plugins/#{name}")
- Dir.chdir install_path do
- init_cmd = "git init"
- init_cmd += " -q" if options[:quiet] and not $verbose
- puts init_cmd if $verbose
- system(init_cmd)
- base_cmd = "git pull --depth 1 #{uri}"
- base_cmd += " -q" if options[:quiet] and not $verbose
- base_cmd += " #{options[:revision]}" if options[:revision]
- puts base_cmd if $verbose
- if system(base_cmd)
- puts "removing: .git .gitignore" if $verbose
- rm_rf %w(.git .gitignore)
- else
- rm_rf install_path
- end
- end
- end
-
- def svn_command(cmd, options = {})
- root = rails_env.root
- mkdir_p "#{root}/vendor/plugins"
- base_cmd = "svn #{cmd} #{uri} \"#{root}/vendor/plugins/#{name}\""
- base_cmd += ' -q' if options[:quiet] and not $verbose
- base_cmd += " -r #{options[:revision]}" if options[:revision]
- puts base_cmd if $verbose
- system(base_cmd)
- end
-
- def guess_name(url)
- @name = File.basename(url)
- if @name == 'trunk' || @name.empty?
- @name = File.basename(File.dirname(url))
- end
- @name.gsub!(/\.git$/, '') if @name =~ /\.git$/
- end
-
- def rails_env
- @rails_env || RailsEnvironment.default
- end
-end
-
-class Repositories
- include Enumerable
-
- def initialize(cache_file = File.join(find_home, ".rails-plugin-sources"))
- @cache_file = File.expand_path(cache_file)
- load!
- end
-
- def each(&block)
- @repositories.each(&block)
- end
-
- def add(uri)
- unless find{|repo| repo.uri == uri }
- @repositories.push(Repository.new(uri)).last
- end
- end
-
- def remove(uri)
- @repositories.reject!{|repo| repo.uri == uri}
- end
-
- def exist?(uri)
- @repositories.detect{|repo| repo.uri == uri }
- end
-
- def all
- @repositories
- end
-
- def find_plugin(name)
- @repositories.each do |repo|
- repo.each do |plugin|
- return plugin if plugin.name == name
- end
- end
- return nil
- end
-
- def load!
- contents = File.exist?(@cache_file) ? File.read(@cache_file) : defaults
- contents = defaults if contents.empty?
- @repositories = contents.split(/\n/).reject do |line|
- line =~ /^\s*#/ or line =~ /^\s*$/
- end.map { |source| Repository.new(source.strip) }
- end
-
- def save
- File.open(@cache_file, 'w') do |f|
- each do |repo|
- f.write(repo.uri)
- f.write("\n")
- end
- end
- end
-
- def defaults
- <<-DEFAULTS
- http://dev.rubyonrails.com/svn/rails/plugins/
- DEFAULTS
- end
-
- def find_home
- ['HOME', 'USERPROFILE'].each do |homekey|
- return ENV[homekey] if ENV[homekey]
- end
- if ENV['HOMEDRIVE'] && ENV['HOMEPATH']
- return "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
- end
- begin
- File.expand_path("~")
- rescue StandardError => ex
- if File::ALT_SEPARATOR
- "C:/"
- else
- "/"
- end
- end
- end
-
- def self.instance
- @instance ||= Repositories.new
- end
-
- def self.each(&block)
- self.instance.each(&block)
- end
-end
-
-class Repository
- include Enumerable
- attr_reader :uri, :plugins
-
- def initialize(uri)
- @uri = uri.chomp('/') << "/"
- @plugins = nil
- end
-
- def plugins
- unless @plugins
- if $verbose
- puts "Discovering plugins in #{@uri}"
- puts index
- end
-
- @plugins = index.reject{ |line| line !~ /\/$/ }
- @plugins.map! { |name| Plugin.new(File.join(@uri, name), name) }
- end
-
- @plugins
- end
-
- def each(&block)
- plugins.each(&block)
- end
-
- private
- def index
- @index ||= RecursiveHTTPFetcher.new(@uri).ls
- end
-end
-
-
-# load default environment and parse arguments
-require 'optparse'
-module Commands
-
- class Plugin
- attr_reader :environment, :script_name, :sources
- def initialize
- @environment = RailsEnvironment.default
- @rails_root = RailsEnvironment.default.root
- @script_name = File.basename($0)
- @sources = []
- end
-
- def environment=(value)
- @environment = value
- RailsEnvironment.default = value
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@script_name} [OPTIONS] command"
- o.define_head "Rails plugin manager."
-
- o.separator ""
- o.separator "GENERAL OPTIONS"
-
- o.on("-r", "--root=DIR", String,
- "Set an explicit rails app directory.",
- "Default: #{@rails_root}") { |rails_root| @rails_root = rails_root; self.environment = RailsEnvironment.new(@rails_root) }
- o.on("-s", "--source=URL1,URL2", Array,
- "Use the specified plugin repositories instead of the defaults.") { |sources| @sources = sources}
-
- o.on("-v", "--verbose", "Turn on verbose output.") { |verbose| $verbose = verbose }
- o.on("-h", "--help", "Show this help message.") { puts o; exit }
-
- o.separator ""
- o.separator "COMMANDS"
-
- o.separator " discover Discover plugin repositories."
- o.separator " list List available plugins."
- o.separator " install Install plugin(s) from known repositories or URLs."
- o.separator " update Update installed plugins."
- o.separator " remove Uninstall plugins."
- o.separator " source Add a plugin source repository."
- o.separator " unsource Remove a plugin repository."
- o.separator " sources List currently configured plugin repositories."
-
- o.separator ""
- o.separator "EXAMPLES"
- o.separator " Install a plugin:"
- o.separator " #{@script_name} install continuous_builder\n"
- o.separator " Install a plugin from a subversion URL:"
- o.separator " #{@script_name} install http://dev.rubyonrails.com/svn/rails/plugins/continuous_builder\n"
- o.separator " Install a plugin from a git URL:"
- o.separator " #{@script_name} install git://github.com/SomeGuy/my_awesome_plugin.git\n"
- o.separator " Install a plugin and add a svn:externals entry to vendor/plugins"
- o.separator " #{@script_name} install -x continuous_builder\n"
- o.separator " List all available plugins:"
- o.separator " #{@script_name} list\n"
- o.separator " List plugins in the specified repository:"
- o.separator " #{@script_name} list --source=http://dev.rubyonrails.com/svn/rails/plugins/\n"
- o.separator " Discover and prompt to add new repositories:"
- o.separator " #{@script_name} discover\n"
- o.separator " Discover new repositories but just list them, don't add anything:"
- o.separator " #{@script_name} discover -l\n"
- o.separator " Add a new repository to the source list:"
- o.separator " #{@script_name} source http://dev.rubyonrails.com/svn/rails/plugins/\n"
- o.separator " Remove a repository from the source list:"
- o.separator " #{@script_name} unsource http://dev.rubyonrails.com/svn/rails/plugins/\n"
- o.separator " Show currently configured repositories:"
- o.separator " #{@script_name} sources\n"
- end
- end
-
- def parse!(args=ARGV)
- general, sub = split_args(args)
- options.parse!(general)
-
- command = general.shift
- if command =~ /^(list|discover|install|source|unsource|sources|remove|update|info)$/
- command = Commands.const_get(command.capitalize).new(self)
- command.parse!(sub)
- else
- puts "Unknown command: #{command}"
- puts options
- exit 1
- end
- end
-
- def split_args(args)
- left = []
- left << args.shift while args[0] and args[0] =~ /^-/
- left << args.shift if args[0]
- return [left, args]
- end
-
- def self.parse!(args=ARGV)
- Plugin.new.parse!(args)
- end
- end
-
-
- class List
- def initialize(base_command)
- @base_command = base_command
- @sources = []
- @local = false
- @remote = true
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} list [OPTIONS] [PATTERN]"
- o.define_head "List available plugins."
- o.separator ""
- o.separator "Options:"
- o.separator ""
- o.on( "-s", "--source=URL1,URL2", Array,
- "Use the specified plugin repositories.") {|sources| @sources = sources}
- o.on( "--local",
- "List locally installed plugins.") {|local| @local, @remote = local, false}
- o.on( "--remote",
- "List remotely available plugins. This is the default behavior",
- "unless --local is provided.") {|remote| @remote = remote}
- end
- end
-
- def parse!(args)
- options.order!(args)
- unless @sources.empty?
- @sources.map!{ |uri| Repository.new(uri) }
- else
- @sources = Repositories.instance.all
- end
- if @remote
- @sources.map{|r| r.plugins}.flatten.each do |plugin|
- if @local or !plugin.installed?
- puts plugin.to_s
- end
- end
- else
- cd "#{@base_command.environment.root}/vendor/plugins"
- Dir["*"].select{|p| File.directory?(p)}.each do |name|
- puts name
- end
- end
- end
- end
-
-
- class Sources
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} sources [OPTIONS] [PATTERN]"
- o.define_head "List configured plugin repositories."
- o.separator ""
- o.separator "Options:"
- o.separator ""
- o.on( "-c", "--check",
- "Report status of repository.") { |sources| @sources = sources}
- end
- end
-
- def parse!(args)
- options.parse!(args)
- Repositories.each do |repo|
- puts repo.uri
- end
- end
- end
-
-
- class Source
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} source REPOSITORY [REPOSITORY [REPOSITORY]...]"
- o.define_head "Add new repositories to the default search list."
- end
- end
-
- def parse!(args)
- options.parse!(args)
- count = 0
- args.each do |uri|
- if Repositories.instance.add(uri)
- puts "added: #{uri.ljust(50)}" if $verbose
- count += 1
- else
- puts "failed: #{uri.ljust(50)}"
- end
- end
- Repositories.instance.save
- puts "Added #{count} repositories."
- end
- end
-
-
- class Unsource
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} unsource URI [URI [URI]...]"
- o.define_head "Remove repositories from the default search list."
- o.separator ""
- o.on_tail("-h", "--help", "Show this help message.") { puts o; exit }
- end
- end
-
- def parse!(args)
- options.parse!(args)
- count = 0
- args.each do |uri|
- if Repositories.instance.remove(uri)
- count += 1
- puts "removed: #{uri.ljust(50)}"
- else
- puts "failed: #{uri.ljust(50)}"
- end
- end
- Repositories.instance.save
- puts "Removed #{count} repositories."
- end
- end
-
-
- class Discover
- def initialize(base_command)
- @base_command = base_command
- @list = false
- @prompt = true
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} discover URI [URI [URI]...]"
- o.define_head "Discover repositories referenced on a page."
- o.separator ""
- o.separator "Options:"
- o.separator ""
- o.on( "-l", "--list",
- "List but don't prompt or add discovered repositories.") { |list| @list, @prompt = list, !@list }
- o.on( "-n", "--no-prompt",
- "Add all new repositories without prompting.") { |v| @prompt = !v }
- end
- end
-
- def parse!(args)
- options.parse!(args)
- args = ['http://wiki.rubyonrails.org/rails/pages/Plugins'] if args.empty?
- args.each do |uri|
- scrape(uri) do |repo_uri|
- catch(:next_uri) do
- if @prompt
- begin
- $stdout.print "Add #{repo_uri}? [Y/n] "
- throw :next_uri if $stdin.gets !~ /^y?$/i
- rescue Interrupt
- $stdout.puts
- exit 1
- end
- elsif @list
- puts repo_uri
- throw :next_uri
- end
- Repositories.instance.add(repo_uri)
- puts "discovered: #{repo_uri}" if $verbose or !@prompt
- end
- end
- end
- Repositories.instance.save
- end
-
- def scrape(uri)
- require 'open-uri'
- puts "Scraping #{uri}" if $verbose
- dupes = []
- content = open(uri).each do |line|
- begin
- if line =~ /<a[^>]*href=['"]([^'"]*)['"]/ || line =~ /(svn:\/\/[^<|\n]*)/
- uri = $1
- if uri =~ /^\w+:\/\// && uri =~ /\/plugins\// && uri !~ /\/browser\// && uri !~ /^http:\/\/wiki\.rubyonrails/ && uri !~ /http:\/\/instiki/
- uri = extract_repository_uri(uri)
- yield uri unless dupes.include?(uri) || Repositories.instance.exist?(uri)
- dupes << uri
- end
- end
- rescue
- puts "Problems scraping '#{uri}': #{$!.to_s}"
- end
- end
- end
-
- def extract_repository_uri(uri)
- uri.match(/(svn|https?):.*\/plugins\//i)[0]
- end
- end
-
- class Install
- def initialize(base_command)
- @base_command = base_command
- @method = :http
- @options = { :quiet => false, :revision => nil, :force => false }
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} install PLUGIN [PLUGIN [PLUGIN] ...]"
- o.define_head "Install one or more plugins."
- o.separator ""
- o.separator "Options:"
- o.on( "-x", "--externals",
- "Use svn:externals to grab the plugin.",
- "Enables plugin updates and plugin versioning.") { |v| @method = :externals }
- o.on( "-o", "--checkout",
- "Use svn checkout to grab the plugin.",
- "Enables updating but does not add a svn:externals entry.") { |v| @method = :checkout }
- o.on( "-e", "--export",
- "Use svn export to grab the plugin.",
- "Exports the plugin, allowing you to check it into your local repository. Does not enable updates, or add an svn:externals entry.") { |v| @method = :export }
- o.on( "-q", "--quiet",
- "Suppresses the output from installation.",
- "Ignored if -v is passed (./script/plugin -v install ...)") { |v| @options[:quiet] = true }
- o.on( "-r REVISION", "--revision REVISION",
- "Checks out the given revision from subversion or git.",
- "Ignored if subversion/git is not used.") { |v| @options[:revision] = v }
- o.on( "-f", "--force",
- "Reinstalls a plugin if it's already installed.") { |v| @options[:force] = true }
- o.separator ""
- o.separator "You can specify plugin names as given in 'plugin list' output or absolute URLs to "
- o.separator "a plugin repository."
- end
- end
-
- def determine_install_method
- best = @base_command.environment.best_install_method
- @method = :http if best == :http and @method == :export
- case
- when (best == :http and @method != :http)
- msg = "Cannot install using subversion because `svn' cannot be found in your PATH"
- when (best == :export and (@method != :export and @method != :http))
- msg = "Cannot install using #{@method} because this project is not under subversion."
- when (best != :externals and @method == :externals)
- msg = "Cannot install using externals because vendor/plugins is not under subversion."
- end
- if msg
- puts msg
- exit 1
- end
- @method
- end
-
- def parse!(args)
- options.parse!(args)
- environment = @base_command.environment
- install_method = determine_install_method
- puts "Plugins will be installed using #{install_method}" if $verbose
- args.each do |name|
- ::Plugin.find(name).install(install_method, @options)
- end
- rescue StandardError => e
- puts "Plugin not found: #{args.inspect}"
- puts e.inspect if $verbose
- exit 1
- end
- end
-
- class Update
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} update [name [name]...]"
- o.on( "-r REVISION", "--revision REVISION",
- "Checks out the given revision from subversion.",
- "Ignored if subversion is not used.") { |v| @revision = v }
- o.define_head "Update plugins."
- end
- end
-
- def parse!(args)
- options.parse!(args)
- root = @base_command.environment.root
- cd root
- args = Dir["vendor/plugins/*"].map do |f|
- File.directory?("#{f}/.svn") ? File.basename(f) : nil
- end.compact if args.empty?
- cd "vendor/plugins"
- args.each do |name|
- if File.directory?(name)
- puts "Updating plugin: #{name}"
- system("svn #{$verbose ? '' : '-q'} up \"#{name}\" #{@revision ? "-r #{@revision}" : ''}")
- else
- puts "Plugin doesn't exist: #{name}"
- end
- end
- end
- end
-
- class Remove
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} remove name [name]..."
- o.define_head "Remove plugins."
- end
- end
-
- def parse!(args)
- options.parse!(args)
- root = @base_command.environment.root
- args.each do |name|
- ::Plugin.new(name).uninstall
- end
- end
- end
-
- class Info
- def initialize(base_command)
- @base_command = base_command
- end
-
- def options
- OptionParser.new do |o|
- o.set_summary_indent(' ')
- o.banner = "Usage: #{@base_command.script_name} info name [name]..."
- o.define_head "Shows plugin info at {url}/about.yml."
- end
- end
-
- def parse!(args)
- options.parse!(args)
- args.each do |name|
- puts ::Plugin.find(name).info
- puts
- end
- end
- end
-end
-
-class RecursiveHTTPFetcher
- attr_accessor :quiet
- def initialize(urls_to_fetch, level = 1, cwd = ".")
- @level = level
- @cwd = cwd
- @urls_to_fetch = RUBY_VERSION >= '1.9' ? urls_to_fetch.lines : urls_to_fetch.to_a
- @quiet = false
- end
-
- def ls
- @urls_to_fetch.collect do |url|
- if url =~ /^svn(\+ssh)?:\/\/.*/
- `svn ls #{url}`.split("\n").map {|entry| "/#{entry}"} rescue nil
- else
- open(url) do |stream|
- links("", stream.read)
- end rescue nil
- end
- end.flatten
- end
-
- def push_d(dir)
- @cwd = File.join(@cwd, dir)
- FileUtils.mkdir_p(@cwd)
- end
-
- def pop_d
- @cwd = File.dirname(@cwd)
- end
-
- def links(base_url, contents)
- links = []
- contents.scan(/href\s*=\s*\"*[^\">]*/i) do |link|
- link = link.sub(/href="/i, "")
- next if link =~ /svnindex.xsl$/
- next if link =~ /^(\w*:|)\/\// || link =~ /^\./
- links << File.join(base_url, link)
- end
- links
- end
-
- def download(link)
- puts "+ #{File.join(@cwd, File.basename(link))}" unless @quiet
- open(link) do |stream|
- File.open(File.join(@cwd, File.basename(link)), "wb") do |file|
- file.write(stream.read)
- end
- end
- end
-
- def fetch(links = @urls_to_fetch)
- links.each do |l|
- (l =~ /\/$/ || links == @urls_to_fetch) ? fetch_dir(l) : download(l)
- end
- end
-
- def fetch_dir(url)
- @level += 1
- push_d(File.basename(url)) if @level > 0
- open(url) do |stream|
- contents = stream.read
- fetch(links(url, contents))
- end
- pop_d if @level > 0
- @level -= 1
- end
-end
-
-Commands::Plugin.parse!
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/runner.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/runner.rb
deleted file mode 100644
index 5a4f244cd1c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/runner.rb
+++ /dev/null
@@ -1,54 +0,0 @@
-require 'optparse'
-
-options = { :environment => (ENV['RAILS_ENV'] || "development").dup }
-code_or_file = nil
-
-ARGV.clone.options do |opts|
- script_name = File.basename($0)
- opts.banner = "Usage: #{$0} [options] ('Some.ruby(code)' or a filename)"
-
- opts.separator ""
-
- opts.on("-e", "--environment=name", String,
- "Specifies the environment for the runner to operate under (test/development/production).",
- "Default: development") { |v| options[:environment] = v }
-
- opts.separator ""
-
- opts.on("-h", "--help",
- "Show this help message.") { $stderr.puts opts; exit }
-
- if RUBY_PLATFORM !~ /(:?mswin|mingw)/
- opts.separator ""
- opts.separator "You can also use runner as a shebang line for your scripts like this:"
- opts.separator "-------------------------------------------------------------"
- opts.separator "#!/usr/bin/env #{File.expand_path($0)}"
- opts.separator ""
- opts.separator "Product.find(:all).each { |p| p.price *= 2 ; p.save! }"
- opts.separator "-------------------------------------------------------------"
- end
-
- opts.order! { |o| code_or_file ||= o } rescue retry
-end
-
-ARGV.delete(code_or_file)
-
-ENV["RAILS_ENV"] = options[:environment]
-RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
-
-require RAILS_ROOT + '/config/environment'
-
-begin
- if code_or_file.nil?
- $stderr.puts "Run '#{$0} -h' for help."
- exit 1
- elsif File.exist?(code_or_file)
- eval(File.read(code_or_file), nil, code_or_file)
- else
- eval(code_or_file)
- end
-ensure
- if defined? Rails
- Rails.logger.flush if Rails.logger.respond_to?(:flush)
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/server.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/server.rb
deleted file mode 100644
index ebe34a42cdb..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/server.rb
+++ /dev/null
@@ -1,114 +0,0 @@
-require 'active_support'
-require 'action_controller'
-
-require 'fileutils'
-require 'optparse'
-
-# TODO: Push Thin adapter upstream so we don't need worry about requiring it
-begin
- require_library_or_gem 'thin'
-rescue Exception
- # Thin not available
-end
-
-options = {
- :Port => 3000,
- :Host => "0.0.0.0",
- :environment => (ENV['RAILS_ENV'] || "development").dup,
- :config => RAILS_ROOT + "/config.ru",
- :detach => false,
- :debugger => false,
- :path => nil
-}
-
-ARGV.clone.options do |opts|
- opts.on("-p", "--port=port", Integer,
- "Runs Rails on the specified port.", "Default: 3000") { |v| options[:Port] = v }
- opts.on("-b", "--binding=ip", String,
- "Binds Rails to the specified ip.", "Default: 0.0.0.0") { |v| options[:Host] = v }
- opts.on("-c", "--config=file", String,
- "Use custom rackup configuration file") { |v| options[:config] = v }
- opts.on("-d", "--daemon", "Make server run as a Daemon.") { options[:detach] = true }
- opts.on("-u", "--debugger", "Enable ruby-debugging for the server.") { options[:debugger] = true }
- opts.on("-e", "--environment=name", String,
- "Specifies the environment to run this server under (test/development/production).",
- "Default: development") { |v| options[:environment] = v }
- opts.on("-P", "--path=/path", String, "Runs Rails app mounted at a specific path.", "Default: /") { |v| options[:path] = v }
-
- opts.separator ""
-
- opts.on("-h", "--help", "Show this help message.") { puts opts; exit }
-
- opts.parse!
-end
-
-server = Rack::Handler.get(ARGV.first) rescue nil
-unless server
- begin
- server = Rack::Handler::Mongrel
- rescue LoadError => e
- server = Rack::Handler::WEBrick
- end
-end
-
-puts "=> Booting #{ActiveSupport::Inflector.demodulize(server)}"
-puts "=> Rails #{Rails.version} application starting on http://#{options[:Host]}:#{options[:Port]}#{options[:path]}"
-
-%w(cache pids sessions sockets).each do |dir_to_make|
- FileUtils.mkdir_p(File.join(RAILS_ROOT, 'tmp', dir_to_make))
-end
-
-if options[:detach]
- Process.daemon
- pid = "#{RAILS_ROOT}/tmp/pids/server.pid"
- File.open(pid, 'w'){ |f| f.write(Process.pid) }
- at_exit { File.delete(pid) if File.exist?(pid) }
-end
-
-ENV["RAILS_ENV"] = options[:environment]
-RAILS_ENV.replace(options[:environment]) if defined?(RAILS_ENV)
-
-if File.exist?(options[:config])
- config = options[:config]
- if config =~ /\.ru$/
- cfgfile = File.read(config)
- if cfgfile[/^#\\(.*)/]
- opts.parse!($1.split(/\s+/))
- end
- inner_app = eval("Rack::Builder.new {( " + cfgfile + "\n )}.to_app", nil, config)
- else
- require config
- inner_app = Object.const_get(File.basename(config, '.rb').capitalize)
- end
-else
- require RAILS_ROOT + "/config/environment"
- inner_app = ActionController::Dispatcher.new
-end
-
-if options[:path].nil?
- map_path = "/"
-else
- ActionController::Base.relative_url_root = options[:path]
- map_path = options[:path]
-end
-
-app = Rack::Builder.new {
- use Rails::Rack::LogTailer unless options[:detach]
- use Rails::Rack::Debugger if options[:debugger]
- map map_path do
- use Rails::Rack::Static
- run inner_app
- end
-}.to_app
-
-puts "=> Call with -d to detach"
-
-trap(:INT) { exit }
-
-puts "=> Ctrl-C to shutdown server"
-
-begin
- server.run(app, options.merge(:AccessLog => []))
-ensure
- puts 'Exiting'
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/update.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/update.rb
deleted file mode 100644
index 83ef833300a..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/commands/update.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require "#{RAILS_ROOT}/config/environment"
-require 'rails_generator'
-require 'rails_generator/scripts/update'
-Rails::Generator::Scripts::Update.new.run(ARGV)
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_app.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_app.rb
deleted file mode 100644
index d7d01d703fc..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_app.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-require 'active_support/test_case'
-require 'action_controller'
-
-# work around the at_exit hook in test/unit, which kills IRB
-Test::Unit.run = true if Test::Unit.respond_to?(:run=)
-
-# reference the global "app" instance, created on demand. To recreate the
-# instance, pass a non-false value as the parameter.
-def app(create=false)
- @app_integration_instance = nil if create
- @app_integration_instance ||= new_session do |sess|
- sess.host! "www.example.com"
- end
-end
-
-# create a new session. If a block is given, the new session will be yielded
-# to the block before being returned.
-def new_session
- session = ActionController::Integration::Session.new
- yield session if block_given?
- session
-end
-
-#reloads the environment
-def reload!
- puts "Reloading..."
- Dispatcher.cleanup_application
- Dispatcher.reload_application
- true
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_sandbox.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_sandbox.rb
deleted file mode 100644
index 65a3d686191..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_sandbox.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-ActiveRecord::Base.connection.increment_open_transactions
-ActiveRecord::Base.connection.begin_db_transaction
-at_exit do
- ActiveRecord::Base.connection.rollback_db_transaction
- ActiveRecord::Base.connection.decrement_open_transactions
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_with_helpers.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_with_helpers.rb
deleted file mode 100644
index 039db667c40..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/console_with_helpers.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-def helper
- @helper ||= ApplicationController.helpers
-end
-
-@controller = ApplicationController.new
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/performance_test_help.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/performance_test_help.rb
deleted file mode 100644
index 5148b4ab77c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/performance_test_help.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-require 'action_controller/performance_test'
-
-ActionController::Base.perform_caching = true
-ActiveSupport::Dependencies.mechanism = :require
-Rails.logger.level = ActiveSupport::BufferedLogger::INFO
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator.rb
deleted file mode 100644
index 264c6490620..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-#--
-# Copyright (c) 2004 Jeremy Kemper
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be
-# included in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#++
-
-railties = File.expand_path("..", __FILE__)
-$:.unshift(railties) unless $:.include?(railties)
-
-activesupport = File.expand_path("../../../activesupport/lib", __FILE__)
-$:.unshift(activesupport) unless $:.include?(activesupport)
-
-begin
- require 'active_support'
-rescue LoadError
- require 'rubygems'
- gem 'activesupport'
-end
-
-require 'rails_generator/base'
-require 'rails_generator/lookup'
-require 'rails_generator/commands'
-
-Rails::Generator::Base.send(:include, Rails::Generator::Lookup)
-Rails::Generator::Base.send(:include, Rails::Generator::Commands)
-
-# Set up a default logger for convenience.
-require 'rails_generator/simple_logger'
-Rails::Generator::Base.logger = Rails::Generator::SimpleLogger.new(STDOUT)
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/base.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/base.rb
deleted file mode 100644
index dd75f05c7bd..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/base.rb
+++ /dev/null
@@ -1,266 +0,0 @@
-require File.dirname(__FILE__) + '/options'
-require File.dirname(__FILE__) + '/manifest'
-require File.dirname(__FILE__) + '/spec'
-require File.dirname(__FILE__) + '/generated_attribute'
-
-module Rails
- # Rails::Generator is a code generation platform tailored for the Rails
- # web application framework. Generators are easily invoked within Rails
- # applications to add and remove components such as models and controllers.
- # New generators are easy to create and may be distributed as RubyGems,
- # tarballs, or Rails plugins for inclusion system-wide, per-user,
- # or per-application.
- #
- # For actual examples see the rails_generator/generators directory in the
- # Rails source (or the +railties+ directory if you have frozen the Rails
- # source in your application).
- #
- # Generators may subclass other generators to provide variations that
- # require little or no new logic but replace the template files.
- #
- # For a RubyGem, put your generator class and templates in the +lib+
- # directory. For a Rails plugin, make a +generators+ directory at the
- # root of your plugin.
- #
- # The layout of generator files can be seen in the built-in
- # +controller+ generator:
- #
- # generators/
- # components/
- # controller/
- # controller_generator.rb
- # templates/
- # controller.rb
- # functional_test.rb
- # helper.rb
- # view.html.erb
- #
- # The directory name (+controller+) matches the name of the generator file
- # (controller_generator.rb) and class (ControllerGenerator). The files
- # that will be copied or used as templates are stored in the +templates+
- # directory.
- #
- # The filenames of the templates don't matter, but choose something that
- # will be self-explanatory since you will be referencing these in the
- # +manifest+ method inside your generator subclass.
- #
- #
- module Generator
- class GeneratorError < StandardError; end
- class UsageError < GeneratorError; end
-
-
- # The base code generator is bare-bones. It sets up the source and
- # destination paths and tells the logger whether to keep its trap shut.
- #
- # It's useful for copying files such as stylesheets, images, or
- # javascripts.
- #
- # For more comprehensive template-based passive code generation with
- # arguments, you'll want Rails::Generator::NamedBase.
- #
- # Generators create a manifest of the actions they perform then hand
- # the manifest to a command which replays the actions to do the heavy
- # lifting (such as checking for existing files or creating directories
- # if needed). Create, destroy, and list commands are included. Since a
- # single manifest may be used by any command, creating new generators is
- # as simple as writing some code templates and declaring what you'd like
- # to do with them.
- #
- # The manifest method must be implemented by subclasses, returning a
- # Rails::Generator::Manifest. The +record+ method is provided as a
- # convenience for manifest creation. Example:
- #
- # class StylesheetGenerator < Rails::Generator::Base
- # def manifest
- # record do |m|
- # m.directory('public/stylesheets')
- # m.file('application.css', 'public/stylesheets/application.css')
- # end
- # end
- # end
- #
- # See Rails::Generator::Commands::Create for a list of methods available
- # to the manifest.
- class Base
- include Options
-
- # Declare default options for the generator. These options
- # are inherited to subclasses.
- default_options :collision => :ask, :quiet => false
-
- # A logger instance available everywhere in the generator.
- cattr_accessor :logger
-
- # Every generator that is dynamically looked up is tagged with a
- # Spec describing where it was found.
- class_inheritable_accessor :spec
-
- attr_reader :source_root, :destination_root, :args
-
- def initialize(runtime_args, runtime_options = {})
- @args = runtime_args
- parse!(@args, runtime_options)
-
- # Derive source and destination paths.
- @source_root = options[:source] || File.join(spec.path, 'templates')
- if options[:destination]
- @destination_root = options[:destination]
- elsif defined? ::RAILS_ROOT
- @destination_root = ::RAILS_ROOT
- end
-
- # Silence the logger if requested.
- logger.quiet = options[:quiet]
-
- # Raise usage error if help is requested.
- usage if options[:help]
- end
-
- # Generators must provide a manifest. Use the +record+ method to create
- # a new manifest and record your generator's actions.
- def manifest
- raise NotImplementedError, "No manifest for '#{spec.name}' generator."
- end
-
- # Return the full path from the source root for the given path.
- # Example for source_root = '/source':
- # source_path('some/path.rb') == '/source/some/path.rb'
- #
- # The given path may include a colon ':' character to indicate that
- # the file belongs to another generator. This notation allows any
- # generator to borrow files from another. Example:
- # source_path('model:fixture.yml') = '/model/source/path/fixture.yml'
- def source_path(relative_source)
- # Check whether we're referring to another generator's file.
- name, path = relative_source.split(':', 2)
-
- # If not, return the full path to our source file.
- if path.nil?
- File.join(source_root, name)
-
- # Otherwise, ask our referral for the file.
- else
- # FIXME: this is broken, though almost always true. Others'
- # source_root are not necessarily the templates dir.
- File.join(self.class.lookup(name).path, 'templates', path)
- end
- end
-
- # Return the full path from the destination root for the given path.
- # Example for destination_root = '/dest':
- # destination_path('some/path.rb') == '/dest/some/path.rb'
- def destination_path(relative_destination)
- File.join(destination_root, relative_destination)
- end
-
- def after_generate
- end
-
- protected
- # Convenience method for generator subclasses to record a manifest.
- def record
- Rails::Generator::Manifest.new(self) { |m| yield m }
- end
-
- # Override with your own usage banner.
- def banner
- "Usage: #{$0} #{spec.name} [options]"
- end
-
- # Read USAGE from file in generator base path.
- def usage_message
- File.read(File.join(spec.path, 'USAGE')) rescue ''
- end
- end
-
-
- # The base generator for named components: models, controllers, mailers,
- # etc. The target name is taken as the first argument and inflected to
- # singular, plural, class, file, and table forms for your convenience.
- # The remaining arguments are aliased to +actions+ as an array for
- # controller and mailer convenience.
- #
- # Several useful local variables and methods are populated in the
- # +initialize+ method. See below for a list of Attributes and
- # External Aliases available to both the manifest and to all templates.
- #
- # If no name is provided, the generator raises a usage error with content
- # optionally read from the USAGE file in the generator's base path.
- #
- # For example, the +controller+ generator takes the first argument as
- # the name of the class and subsequent arguments as the names of
- # actions to be generated:
- #
- # ./script/generate controller Article index new create
- #
- # See Rails::Generator::Base for a discussion of manifests,
- # Rails::Generator::Commands::Create for methods available to the manifest,
- # and Rails::Generator for a general discussion of generators.
- class NamedBase < Base
- attr_reader :name, :class_name, :singular_name, :plural_name, :table_name
- attr_reader :class_path, :file_path, :class_nesting, :class_nesting_depth
- alias_method :file_name, :singular_name
- alias_method :actions, :args
-
- def initialize(runtime_args, runtime_options = {})
- super
-
- # Name argument is required.
- usage if runtime_args.empty?
-
- @args = runtime_args.dup
- base_name = @args.shift
- assign_names!(base_name)
- end
-
- protected
- # Override with your own usage banner.
- def banner
- "Usage: #{$0} #{spec.name} #{spec.name.camelize}Name [options]"
- end
-
- def attributes
- @attributes ||= @args.collect do |attribute|
- Rails::Generator::GeneratedAttribute.new(*attribute.split(":"))
- end
- end
-
-
- private
- def assign_names!(name)
- @name = name
- base_name, @class_path, @file_path, @class_nesting, @class_nesting_depth = extract_modules(@name)
- @class_name_without_nesting, @singular_name, @plural_name = inflect_names(base_name)
- @table_name = (!defined?(ActiveRecord::Base) || ActiveRecord::Base.pluralize_table_names) ? plural_name : singular_name
- if @class_nesting.empty?
- @class_name = @class_name_without_nesting
- else
- @table_name = @class_nesting.underscore << "_" << @table_name
- @class_name = "#{@class_nesting}::#{@class_name_without_nesting}"
- end
- @table_name.gsub! '/', '_'
- end
-
- # Extract modules from filesystem-style or ruby-style path:
- # good/fun/stuff
- # Good::Fun::Stuff
- # produce the same results.
- def extract_modules(name)
- modules = name.include?('/') ? name.split('/') : name.split('::')
- name = modules.pop
- path = modules.map { |m| m.underscore }
- file_path = (path + [name.underscore]).join('/')
- nesting = modules.map { |m| m.camelize }.join('::')
- [name, path, file_path, nesting, modules.size]
- end
-
- def inflect_names(name)
- camel = name.camelize
- under = camel.underscore
- plural = under.pluralize
- [camel, under, plural]
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/commands.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/commands.rb
deleted file mode 100644
index b684dc92bed..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/commands.rb
+++ /dev/null
@@ -1,621 +0,0 @@
-require 'delegate'
-require 'optparse'
-require 'fileutils'
-require 'tempfile'
-require 'erb'
-
-module Rails
- module Generator
- module Commands
- # Here's a convenient way to get a handle on generator commands.
- # Command.instance('destroy', my_generator) instantiates a Destroy
- # delegate of my_generator ready to do your dirty work.
- def self.instance(command, generator)
- const_get(command.to_s.camelize).new(generator)
- end
-
- # Even more convenient access to commands. Include Commands in
- # the generator Base class to get a nice #command instance method
- # which returns a delegate for the requested command.
- def self.included(base)
- base.send(:define_method, :command) do |command|
- Commands.instance(command, self)
- end
- end
-
-
- # Generator commands delegate Rails::Generator::Base and implement
- # a standard set of actions. Their behavior is defined by the way
- # they respond to these actions: Create brings life; Destroy brings
- # death; List passively observes.
- #
- # Commands are invoked by replaying (or rewinding) the generator's
- # manifest of actions. See Rails::Generator::Manifest and
- # Rails::Generator::Base#manifest method that generator subclasses
- # are required to override.
- #
- # Commands allows generators to "plug in" invocation behavior, which
- # corresponds to the GoF Strategy pattern.
- class Base < DelegateClass(Rails::Generator::Base)
- # Replay action manifest. RewindBase subclass rewinds manifest.
- def invoke!
- manifest.replay(self)
- after_generate
- end
-
- def dependency(generator_name, args, runtime_options = {})
- logger.dependency(generator_name) do
- self.class.new(instance(generator_name, args, full_options(runtime_options))).invoke!
- end
- end
-
- # Does nothing for all commands except Create.
- def class_collisions(*class_names)
- end
-
- # Does nothing for all commands except Create.
- def readme(*args)
- end
-
- protected
- def current_migration_number
- Dir.glob("#{RAILS_ROOT}/#{@migration_directory}/[0-9]*_*.rb").inject(0) do |max, file_path|
- n = File.basename(file_path).split('_', 2).first.to_i
- if n > max then n else max end
- end
- end
-
- def next_migration_number
- current_migration_number + 1
- end
-
- def migration_directory(relative_path)
- directory(@migration_directory = relative_path)
- end
-
- def existing_migrations(file_name)
- Dir.glob("#{@migration_directory}/[0-9]*_*.rb").grep(/[0-9]+_#{file_name}.rb$/)
- end
-
- def migration_exists?(file_name)
- not existing_migrations(file_name).empty?
- end
-
- def next_migration_string(padding = 3)
- if ActiveRecord::Base.timestamped_migrations
- Time.now.utc.strftime("%Y%m%d%H%M%S")
- else
- "%.#{padding}d" % next_migration_number
- end
- end
-
- def gsub_file(relative_destination, regexp, *args, &block)
- path = destination_path(relative_destination)
- content = File.read(path).gsub(regexp, *args, &block)
- File.open(path, 'wb') { |file| file.write(content) }
- end
-
- private
- # Ask the user interactively whether to force collision.
- def force_file_collision?(destination, src, dst, file_options = {}, &block)
- $stdout.print "overwrite #{destination}? (enter \"h\" for help) [Ynaqdh] "
- case $stdin.gets.chomp
- when /\Ad\z/i
- Tempfile.open(File.basename(destination), File.dirname(dst)) do |temp|
- temp.write render_file(src, file_options, &block)
- temp.rewind
- $stdout.puts `#{diff_cmd} "#{dst}" "#{temp.path}"`
- end
- puts "retrying"
- raise 'retry diff'
- when /\Aa\z/i
- $stdout.puts "forcing #{spec.name}"
- options[:collision] = :force
- when /\Aq\z/i
- $stdout.puts "aborting #{spec.name}"
- raise SystemExit
- when /\An\z/i then :skip
- when /\Ay\z/i then :force
- else
- $stdout.puts <<-HELP
-Y - yes, overwrite
-n - no, do not overwrite
-a - all, overwrite this and all others
-q - quit, abort
-d - diff, show the differences between the old and the new
-h - help, show this help
-HELP
- raise 'retry'
- end
- rescue
- retry
- end
-
- def diff_cmd
- ENV['RAILS_DIFF'] || 'diff -u'
- end
-
- def render_template_part(template_options)
- # Getting Sandbox to evaluate part template in it
- part_binding = template_options[:sandbox].call.sandbox_binding
- part_rel_path = template_options[:insert]
- part_path = source_path(part_rel_path)
-
- # Render inner template within Sandbox binding
- rendered_part = ERB.new(File.readlines(part_path).join, nil, '-').result(part_binding)
- begin_mark = template_part_mark(template_options[:begin_mark], template_options[:mark_id])
- end_mark = template_part_mark(template_options[:end_mark], template_options[:mark_id])
- begin_mark + rendered_part + end_mark
- end
-
- def template_part_mark(name, id)
- "<!--[#{name}:#{id}]-->\n"
- end
- end
-
- # Base class for commands which handle generator actions in reverse, such as Destroy.
- class RewindBase < Base
- # Rewind action manifest.
- def invoke!
- manifest.rewind(self)
- end
- end
-
-
- # Create is the premier generator command. It copies files, creates
- # directories, renders templates, and more.
- class Create < Base
-
- # Check whether the given class names are already taken by
- # Ruby or Rails. In the future, expand to check other namespaces
- # such as the rest of the user's app.
- def class_collisions(*class_names)
- path = class_names.shift
- class_names.flatten.each do |class_name|
- # Convert to string to allow symbol arguments.
- class_name = class_name.to_s
-
- # Skip empty strings.
- next if class_name.strip.empty?
-
- # Split the class from its module nesting.
- nesting = class_name.split('::')
- name = nesting.pop
-
- # Hack to limit const_defined? to non-inherited on 1.9.
- extra = []
- extra << false unless Object.method(:const_defined?).arity == 1
-
- # Extract the last Module in the nesting.
- last = nesting.inject(Object) { |last, nest|
- break unless last.const_defined?(nest, *extra)
- last.const_get(nest)
- }
-
- # If the last Module exists, check whether the given
- # class exists and raise a collision if so.
- if last and last.const_defined?(name.camelize, *extra)
- raise_class_collision(class_name)
- end
- end
- end
-
- # Copy a file from source to destination with collision checking.
- #
- # The file_options hash accepts :chmod and :shebang and :collision options.
- # :chmod sets the permissions of the destination file:
- # file 'config/empty.log', 'log/test.log', :chmod => 0664
- # :shebang sets the #!/usr/bin/ruby line for scripts
- # file 'bin/generate.rb', 'script/generate', :chmod => 0755, :shebang => '/usr/bin/env ruby'
- # :collision sets the collision option only for the destination file:
- # file 'settings/server.yml', 'config/server.yml', :collision => :skip
- #
- # Collisions are handled by checking whether the destination file
- # exists and either skipping the file, forcing overwrite, or asking
- # the user what to do.
- def file(relative_source, relative_destination, file_options = {}, &block)
- # Determine full paths for source and destination files.
- source = source_path(relative_source)
- destination = destination_path(relative_destination)
- destination_exists = File.exist?(destination)
-
- # If source and destination are identical then we're done.
- if destination_exists and identical?(source, destination, &block)
- return logger.identical(relative_destination)
- end
-
- # Check for and resolve file collisions.
- if destination_exists
-
- # Make a choice whether to overwrite the file. :force and
- # :skip already have their mind made up, but give :ask a shot.
- choice = case (file_options[:collision] || options[:collision]).to_sym #|| :ask
- when :ask then force_file_collision?(relative_destination, source, destination, file_options, &block)
- when :force then :force
- when :skip then :skip
- else raise "Invalid collision option: #{options[:collision].inspect}"
- end
-
- # Take action based on our choice. Bail out if we chose to
- # skip the file; otherwise, log our transgression and continue.
- case choice
- when :force then logger.force(relative_destination)
- when :skip then return(logger.skip(relative_destination))
- else raise "Invalid collision choice: #{choice}.inspect"
- end
-
- # File doesn't exist so log its unbesmirched creation.
- else
- logger.create relative_destination
- end
-
- # If we're pretending, back off now.
- return if options[:pretend]
-
- # Write destination file with optional shebang. Yield for content
- # if block given so templaters may render the source file. If a
- # shebang is requested, replace the existing shebang or insert a
- # new one.
- File.open(destination, 'wb') do |dest|
- dest.write render_file(source, file_options, &block)
- end
-
- # Optionally change permissions.
- if file_options[:chmod]
- FileUtils.chmod(file_options[:chmod], destination)
- end
-
- # Optionally add file to subversion or git
- system("svn add #{destination}") if options[:svn]
- system("git add -v #{relative_destination}") if options[:git]
- end
-
- # Checks if the source and the destination file are identical. If
- # passed a block then the source file is a template that needs to first
- # be evaluated before being compared to the destination.
- def identical?(source, destination, &block)
- return false if File.directory? destination
- source = block_given? ? File.open(source) {|sf| yield(sf)} : IO.read(source)
- destination = IO.read(destination)
- source == destination
- end
-
- # Generate a file for a Rails application using an ERuby template.
- # Looks up and evaluates a template by name and writes the result.
- #
- # The ERB template uses explicit trim mode to best control the
- # proliferation of whitespace in generated code. <%- trims leading
- # whitespace; -%> trims trailing whitespace including one newline.
- #
- # A hash of template options may be passed as the last argument.
- # The options accepted by the file are accepted as well as :assigns,
- # a hash of variable bindings. Example:
- # template 'foo', 'bar', :assigns => { :action => 'view' }
- #
- # Template is implemented in terms of file. It calls file with a
- # block which takes a file handle and returns its rendered contents.
- def template(relative_source, relative_destination, template_options = {})
- file(relative_source, relative_destination, template_options) do |file|
- # Evaluate any assignments in a temporary, throwaway binding.
- vars = template_options[:assigns] || {}
- b = template_options[:binding] || binding
- vars.each { |k,v| eval "#{k} = vars[:#{k}] || vars['#{k}']", b }
-
- # Render the source file with the temporary binding.
- ERB.new(file.read, nil, '-').result(b)
- end
- end
-
- def complex_template(relative_source, relative_destination, template_options = {})
- options = template_options.dup
- options[:assigns] ||= {}
- options[:assigns]['template_for_inclusion'] = render_template_part(template_options)
- template(relative_source, relative_destination, options)
- end
-
- # Create a directory including any missing parent directories.
- # Always skips directories which exist.
- def directory(relative_path)
- path = destination_path(relative_path)
- if File.exist?(path)
- logger.exists relative_path
- else
- logger.create relative_path
- unless options[:pretend]
- FileUtils.mkdir_p(path)
- # git doesn't require adding the paths, adding the files later will
- # automatically do a path add.
-
- # Subversion doesn't do path adds, so we need to add
- # each directory individually.
- # So stack up the directory tree and add the paths to
- # subversion in order without recursion.
- if options[:svn]
- stack = [relative_path]
- until File.dirname(stack.last) == stack.last # dirname('.') == '.'
- stack.push File.dirname(stack.last)
- end
- stack.reverse_each do |rel_path|
- svn_path = destination_path(rel_path)
- system("svn add -N #{svn_path}") unless File.directory?(File.join(svn_path, '.svn'))
- end
- end
- end
- end
- end
-
- # Display a README.
- def readme(*relative_sources)
- relative_sources.flatten.each do |relative_source|
- logger.readme relative_source
- puts File.read(source_path(relative_source)) unless options[:pretend]
- end
- end
-
- # When creating a migration, it knows to find the first available file in db/migrate and use the migration.rb template.
- def migration_template(relative_source, relative_destination, template_options = {})
- migration_directory relative_destination
- migration_file_name = template_options[:migration_file_name] || file_name
- raise "Another migration is already named #{migration_file_name}: #{existing_migrations(migration_file_name).first}" if migration_exists?(migration_file_name)
- template(relative_source, "#{relative_destination}/#{next_migration_string}_#{migration_file_name}.rb", template_options)
- end
-
- def route_resources(*resources)
- resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
- sentinel = 'ActionController::Routing::Routes.draw do |map|'
-
- logger.route "map.resources #{resource_list}"
- unless options[:pretend]
- gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
- "#{match}\n map.resources #{resource_list}\n"
- end
- end
- end
-
- private
- def render_file(path, options = {})
- File.open(path, 'rb') do |file|
- if block_given?
- yield file
- else
- content = ''
- if shebang = options[:shebang]
- content << "#!#{shebang}\n"
- if line = file.gets
- content << "line\n" if line !~ /^#!/
- end
- end
- content << file.read
- end
- end
- end
-
- # Raise a usage error with an informative WordNet suggestion.
- # Thanks to Florian Gross (flgr).
- def raise_class_collision(class_name)
- message = <<end_message
- The name '#{class_name}' is either already used in your application or reserved by Ruby on Rails.
- Please choose an alternative and run this generator again.
-end_message
- if suggest = find_synonyms(class_name)
- if suggest.any?
- message << "\n Suggestions: \n\n"
- message << suggest.join("\n")
- end
- end
- raise UsageError, message
- end
-
- SYNONYM_LOOKUP_URI = "http://wordnet.princeton.edu/perl/webwn?s=%s"
-
- # Look up synonyms on WordNet. Thanks to Florian Gross (flgr).
- def find_synonyms(word)
- require 'open-uri'
- require 'timeout'
- timeout(5) do
- open(SYNONYM_LOOKUP_URI % word) do |stream|
- # Grab words linked to dictionary entries as possible synonyms
- data = stream.read.gsub("&nbsp;", " ").scan(/<a href="webwn.*?">([\w ]*?)<\/a>/s).uniq
- end
- end
- rescue Exception
- return nil
- end
- end
-
-
- # Undo the actions performed by a generator. Rewind the action
- # manifest and attempt to completely erase the results of each action.
- class Destroy < RewindBase
- # Remove a file if it exists and is a file.
- def file(relative_source, relative_destination, file_options = {})
- destination = destination_path(relative_destination)
- if File.exist?(destination)
- logger.rm relative_destination
- unless options[:pretend]
- if options[:svn]
- # If the file has been marked to be added
- # but has not yet been checked in, revert and delete
- if options[:svn][relative_destination]
- system("svn revert #{destination}")
- FileUtils.rm(destination)
- else
- # If the directory is not in the status list, it
- # has no modifications so we can simply remove it
- system("svn rm #{destination}")
- end
- elsif options[:git]
- if options[:git][:new][relative_destination]
- # file has been added, but not committed
- system("git reset HEAD #{relative_destination}")
- FileUtils.rm(destination)
- elsif options[:git][:modified][relative_destination]
- # file is committed and modified
- system("git rm -f #{relative_destination}")
- else
- # If the directory is not in the status list, it
- # has no modifications so we can simply remove it
- system("git rm #{relative_destination}")
- end
- else
- FileUtils.rm(destination)
- end
- end
- else
- logger.missing relative_destination
- return
- end
- end
-
- # Templates are deleted just like files and the actions take the
- # same parameters, so simply alias the file method.
- alias_method :template, :file
-
- # Remove each directory in the given path from right to left.
- # Remove each subdirectory if it exists and is a directory.
- def directory(relative_path)
- parts = relative_path.split('/')
- until parts.empty?
- partial = File.join(parts)
- path = destination_path(partial)
- if File.exist?(path)
- if Dir[File.join(path, '*')].empty?
- logger.rmdir partial
- unless options[:pretend]
- if options[:svn]
- # If the directory has been marked to be added
- # but has not yet been checked in, revert and delete
- if options[:svn][relative_path]
- system("svn revert #{path}")
- FileUtils.rmdir(path)
- else
- # If the directory is not in the status list, it
- # has no modifications so we can simply remove it
- system("svn rm #{path}")
- end
- # I don't think git needs to remove directories?..
- # or maybe they have special consideration...
- else
- FileUtils.rmdir(path)
- end
- end
- else
- logger.notempty partial
- end
- else
- logger.missing partial
- end
- parts.pop
- end
- end
-
- def complex_template(*args)
- # nothing should be done here
- end
-
- # When deleting a migration, it knows to delete every file named "[0-9]*_#{file_name}".
- def migration_template(relative_source, relative_destination, template_options = {})
- migration_directory relative_destination
-
- migration_file_name = template_options[:migration_file_name] || file_name
- unless migration_exists?(migration_file_name)
- puts "There is no migration named #{migration_file_name}"
- return
- end
-
-
- existing_migrations(migration_file_name).each do |file_path|
- file(relative_source, file_path, template_options)
- end
- end
-
- def route_resources(*resources)
- resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
- look_for = "\n map.resources #{resource_list}\n"
- logger.route "map.resources #{resource_list}"
- gsub_file 'config/routes.rb', /(#{look_for})/mi, ''
- end
- end
-
-
- # List a generator's action manifest.
- class List < Base
- def dependency(generator_name, args, options = {})
- logger.dependency "#{generator_name}(#{args.join(', ')}, #{options.inspect})"
- end
-
- def class_collisions(*class_names)
- logger.class_collisions class_names.join(', ')
- end
-
- def file(relative_source, relative_destination, options = {})
- logger.file relative_destination
- end
-
- def template(relative_source, relative_destination, options = {})
- logger.template relative_destination
- end
-
- def complex_template(relative_source, relative_destination, options = {})
- logger.template "#{options[:insert]} inside #{relative_destination}"
- end
-
- def directory(relative_path)
- logger.directory "#{destination_path(relative_path)}/"
- end
-
- def readme(*args)
- logger.readme args.join(', ')
- end
-
- def migration_template(relative_source, relative_destination, options = {})
- migration_directory relative_destination
- logger.migration_template file_name
- end
-
- def route_resources(*resources)
- resource_list = resources.map { |r| r.to_sym.inspect }.join(', ')
- logger.route "map.resources #{resource_list}"
- end
- end
-
- # Update generator's action manifest.
- class Update < Create
- def file(relative_source, relative_destination, options = {})
- # logger.file relative_destination
- end
-
- def template(relative_source, relative_destination, options = {})
- # logger.template relative_destination
- end
-
- def complex_template(relative_source, relative_destination, template_options = {})
-
- begin
- dest_file = destination_path(relative_destination)
- source_to_update = File.readlines(dest_file).join
- rescue Errno::ENOENT
- logger.missing relative_destination
- return
- end
-
- logger.refreshing "#{template_options[:insert].gsub(/\.erb/,'')} inside #{relative_destination}"
-
- begin_mark = Regexp.quote(template_part_mark(template_options[:begin_mark], template_options[:mark_id]))
- end_mark = Regexp.quote(template_part_mark(template_options[:end_mark], template_options[:mark_id]))
-
- # Refreshing inner part of the template with freshly rendered part.
- rendered_part = render_template_part(template_options)
- source_to_update.gsub!(/#{begin_mark}.*?#{end_mark}/m, rendered_part)
-
- File.open(dest_file, 'w') { |file| file.write(source_to_update) }
- end
-
- def directory(relative_path)
- # logger.directory "#{destination_path(relative_path)}/"
- end
- end
-
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generated_attribute.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generated_attribute.rb
deleted file mode 100644
index 81c3bfd2ebe..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generated_attribute.rb
+++ /dev/null
@@ -1,47 +0,0 @@
-require 'optparse'
-
-module Rails
- module Generator
- class GeneratedAttribute
- attr_accessor :name, :type, :column
-
- def initialize(name, type)
- @name, @type = name, type.to_sym
- @column = ActiveRecord::ConnectionAdapters::Column.new(name, nil, @type)
- end
-
- def field_type
- @field_type ||= case type
- when :integer, :float, :decimal then :text_field
- when :time then :time_select
- when :datetime, :timestamp then :datetime_select
- when :date then :date_select
- when :string then :text_field
- when :text then :text_area
- when :boolean then :check_box
- else
- :text_field
- end
- end
-
- def default
- @default ||= case type
- when :integer then 1
- when :float then 1.5
- when :decimal then "9.99"
- when :datetime, :timestamp, :time then Time.now.to_s(:db)
- when :date then Date.today.to_s(:db)
- when :string then "MyString"
- when :text then "MyText"
- when :boolean then false
- else
- ""
- end
- end
-
- def reference?
- [ :references, :belongs_to ].include?(self.type)
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/USAGE
deleted file mode 100644
index 36d6061a599..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/USAGE
+++ /dev/null
@@ -1,9 +0,0 @@
-Description:
- The 'rails' command creates a new Rails application with a default
- directory structure and configuration at the path you specify.
-
-Example:
- rails ~/Code/Ruby/weblog
-
- This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
- See the README in the newly created application to get going.
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb
deleted file mode 100644
index 0b67eef5a92..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/app_generator.rb
+++ /dev/null
@@ -1,266 +0,0 @@
-require 'rbconfig'
-require File.dirname(__FILE__) + '/template_runner'
-require 'digest/md5'
-require 'active_support/secure_random'
-
-class AppGenerator < Rails::Generator::Base
- DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])
-
- DATABASES = %w( mysql oracle postgresql sqlite2 sqlite3 frontbase ibm_db )
- DEFAULT_DATABASE = 'sqlite3'
-
- mandatory_options :source => "#{File.dirname(__FILE__)}/../../../../.."
- default_options :db => (ENV["RAILS_DEFAULT_DATABASE"] || DEFAULT_DATABASE),
- :shebang => DEFAULT_SHEBANG, :with_dispatchers => false, :freeze => false
-
-
- def initialize(runtime_args, runtime_options = {})
- super
-
- usage if args.empty?
- usage("Databases supported for preconfiguration are: #{DATABASES.join(", ")}") if (options[:db] && !DATABASES.include?(options[:db]))
-
- @destination_root = args.shift
- @app_name = File.basename(File.expand_path(@destination_root))
- end
-
- def manifest
- record do |m|
- create_directories(m)
- create_root_files(m)
- create_app_files(m)
- create_config_files(m)
- create_script_files(m)
- create_test_files(m)
- create_public_files(m)
- create_documentation_file(m)
- create_log_files(m)
- end
- end
-
- def after_generate
- if options[:template]
- Rails::TemplateRunner.new(options[:template], @destination_root)
- end
- end
-
- protected
- def banner
- "Usage: #{$0} /path/to/your/app [options]"
- end
-
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
- opt.on("-r", "--ruby=path", String,
- "Path to the Ruby binary of your choice (otherwise scripts use env, dispatchers current path).",
- "Default: #{DEFAULT_SHEBANG}") { |v| options[:shebang] = v }
-
- opt.on("-d", "--database=name", String,
- "Preconfigure for selected database (options: #{DATABASES.join('/')}).",
- "Default: #{DEFAULT_DATABASE}") { |v| options[:db] = v }
-
- opt.on("-D", "--with-dispatchers",
- "Add CGI/FastCGI/mod_ruby dispatches code to generated application skeleton",
- "Default: false") { |v| options[:with_dispatchers] = v }
-
- opt.on("-f", "--freeze",
- "Freeze Rails in vendor/rails from the gems generating the skeleton",
- "Default: false") { |v| options[:freeze] = v }
-
- opt.on("-m", "--template=path", String,
- "Use an application template that lives at path (can be a filesystem path or URL).",
- "Default: (none)") { |v| options[:template] = v }
-
- end
-
-
- private
- def create_directories(m)
- m.directory ''
-
- # Intermediate directories are automatically created so don't sweat their absence here.
- %w(
- app/controllers
- app/helpers
- app/models
- app/views/layouts
- config/environments
- config/initializers
- config/locales
- db
- doc
- lib
- lib/tasks
- log
- public/images
- public/javascripts
- public/stylesheets
- script/performance
- test/fixtures
- test/functional
- test/integration
- test/performance
- test/unit
- vendor
- vendor/plugins
- tmp/sessions
- tmp/sockets
- tmp/cache
- tmp/pids
- ).each { |path| m.directory(path) }
- end
-
- def create_root_files(m)
- m.file "fresh_rakefile", "Rakefile"
- m.file "README", "README"
- end
-
- def create_app_files(m)
- m.file "helpers/application_controller.rb", "app/controllers/application_controller.rb"
- m.file "helpers/application_helper.rb", "app/helpers/application_helper.rb"
- end
-
- def create_config_files(m)
- create_database_configuration_file(m)
- create_routes_file(m)
- create_locale_file(m)
- create_seeds_file(m)
- create_initializer_files(m)
- create_environment_files(m)
- end
-
- def create_documentation_file(m)
- m.file "doc/README_FOR_APP", "doc/README_FOR_APP"
- end
-
- def create_log_files(m)
- %w( server production development test ).each do |file|
- m.file "configs/empty.log", "log/#{file}.log", :chmod => 0666
- end
- end
-
- def create_public_files(m)
- create_dispatch_files(m)
- create_error_files(m)
- create_welcome_file(m)
- create_browser_convention_files(m)
- create_rails_image(m)
- create_javascript_files(m)
- end
-
- def create_script_files(m)
- %w(
- about console dbconsole destroy generate runner server plugin
- performance/benchmarker performance/profiler
- ).each do |file|
- m.file "bin/#{file}", "script/#{file}", {
- :chmod => 0755,
- :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang]
- }
- end
- end
-
- def create_test_files(m)
- m.file "helpers/test_helper.rb", "test/test_helper.rb"
- m.file "helpers/performance_test.rb", "test/performance/browsing_test.rb"
- end
-
-
- def create_database_configuration_file(m)
- m.template "configs/databases/#{options[:db]}.yml", "config/database.yml", :assigns => {
- :app_name => @app_name,
- :socket => options[:db] == "mysql" ? mysql_socket_location : nil }
- end
-
- def create_routes_file(m)
- m.file "configs/routes.rb", "config/routes.rb"
- end
-
- def create_seeds_file(m)
- m.file "configs/seeds.rb", "db/seeds.rb"
- end
-
- def create_initializer_files(m)
- %w(
- backtrace_silencers
- inflections
- mime_types
- new_rails_defaults
- ).each do |initializer|
- m.file "configs/initializers/#{initializer}.rb", "config/initializers/#{initializer}.rb"
- end
-
- m.template "configs/initializers/session_store.rb", "config/initializers/session_store.rb",
- :assigns => { :app_name => @app_name, :app_secret => ActiveSupport::SecureRandom.hex(64) }
-
- m.template "configs/initializers/cookie_verification_secret.rb", "config/initializers/cookie_verification_secret.rb",
- :assigns => { :app_secret => ActiveSupport::SecureRandom.hex(64) }
- end
-
- def create_locale_file(m)
- m.file "configs/locales/en.yml", "config/locales/en.yml"
- end
-
- def create_environment_files(m)
- m.template "environments/environment.rb", "config/environment.rb",
- :assigns => { :freeze => options[:freeze] }
-
- m.file "environments/boot.rb", "config/boot.rb"
- m.file "environments/production.rb", "config/environments/production.rb"
- m.file "environments/development.rb", "config/environments/development.rb"
- m.file "environments/test.rb", "config/environments/test.rb"
- end
-
-
- def create_dispatch_files(m)
- if options[:with_dispatchers]
- dispatcher_options = { :chmod => 0755, :shebang => options[:shebang] }
-
- m.file "dispatches/config.ru", "config.ru"
- m.file "dispatches/dispatch.rb", "public/dispatch.rb", dispatcher_options
- m.file "dispatches/dispatch.rb", "public/dispatch.cgi", dispatcher_options
- m.file "dispatches/dispatch.fcgi", "public/dispatch.fcgi", dispatcher_options
- end
- end
-
- def create_error_files(m)
- %w( 404 422 500 ).each do |file|
- m.file "html/#{file}.html", "public/#{file}.html"
- end
- end
-
- def create_welcome_file(m)
- m.file 'html/index.html', 'public/index.html'
- end
-
- def create_browser_convention_files(m)
- m.file "html/favicon.ico", "public/favicon.ico"
- m.file "html/robots.txt", "public/robots.txt"
- end
-
- def create_rails_image(m)
- m.file "html/images/rails.png", "public/images/rails.png"
- end
-
- def create_javascript_files(m)
- %w( prototype effects dragdrop controls application ).each do |javascript|
- m.file "html/javascripts/#{javascript}.js", "public/javascripts/#{javascript}.js"
- end
- end
-
-
- def mysql_socket_location
- [
- "/tmp/mysql.sock", # default
- "/var/run/mysqld/mysqld.sock", # debian/gentoo
- "/var/tmp/mysql.sock", # freebsd
- "/var/lib/mysql/mysql.sock", # fedora
- "/opt/local/lib/mysql/mysql.sock", # fedora
- "/opt/local/var/run/mysqld/mysqld.sock", # mac + darwinports + mysql
- "/opt/local/var/run/mysql4/mysqld.sock", # mac + darwinports + mysql4
- "/opt/local/var/run/mysql5/mysqld.sock", # mac + darwinports + mysql5
- "/opt/lampp/var/mysql/mysql.sock" # xampp for linux
- ].find { |f| File.exist?(f) } unless RUBY_PLATFORM =~ /(:?mswin|mingw)/
- end
-end \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/git.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/git.rb
deleted file mode 100644
index a53494de507..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/git.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-STDOUT.sync = true
-
-module Rails
- class Git < Scm
- def self.clone(repos, branch=nil)
- system "git clone #{repos}"
-
- if branch
- system "cd #{repos.split('/').last}/"
- system "git checkout #{branch}"
- end
- end
-
- def self.run(command)
- system "git #{command}"
- end
- end
-end \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/scm.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/scm.rb
deleted file mode 100644
index f6c08cad39c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/scm.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-module Rails
- class Scm
- private
- def self.hash_to_parameters(hash)
- hash.collect { |key, value| "--#{key} #{(value.kind_of?(String) ? value : "")}"}.join(" ")
- end
- end
-end \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/svn.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/svn.rb
deleted file mode 100644
index 22b5966d25a..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/scm/svn.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module Rails
- class Svn < Scm
- def self.checkout(repos, branch = nil)
- `svn checkout #{repos}/#{branch || "trunk"}`
- end
- end
-end \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/template_runner.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/template_runner.rb
deleted file mode 100644
index 40f21cc457c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/applications/app/template_runner.rb
+++ /dev/null
@@ -1,401 +0,0 @@
-require File.dirname(__FILE__) + '/scm/scm'
-require File.dirname(__FILE__) + '/scm/git'
-require File.dirname(__FILE__) + '/scm/svn'
-
-require 'open-uri'
-require 'fileutils'
-
-module Rails
- class TemplateRunner
- attr_reader :root
- attr_writer :logger
-
- def initialize(template, root = '') # :nodoc:
- @root = File.expand_path(File.directory?(root) ? root : File.join(Dir.pwd, root))
-
- log 'applying', "template: #{template}"
-
- load_template(template)
-
- log 'applied', "#{template}"
- end
-
- def load_template(template)
- begin
- code = open(template).read
- in_root { self.instance_eval(code) }
- rescue LoadError, Errno::ENOENT => e
- raise "The template [#{template}] could not be loaded. Error: #{e}"
- end
- end
-
- # Create a new file in the Rails project folder. Specify the
- # relative path from RAILS_ROOT. Data is the return value of a block
- # or a data string.
- #
- # ==== Examples
- #
- # file("lib/fun_party.rb") do
- # hostname = ask("What is the virtual hostname I should use?")
- # "vhost.name = #{hostname}"
- # end
- #
- # file("config/apach.conf", "your apache config")
- #
- def file(filename, data = nil, log_action = true, &block)
- log 'file', filename if log_action
- dir, file = [File.dirname(filename), File.basename(filename)]
-
- inside(dir) do
- File.open(file, "w") do |f|
- if block_given?
- f.write(block.call)
- else
- f.write(data)
- end
- end
- end
- end
-
- # Install a plugin. You must provide either a Subversion url or Git url.
- # For a Git-hosted plugin, you can specify if it should be added as a submodule instead of cloned.
- #
- # ==== Examples
- #
- # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git'
- # plugin 'restful-authentication', :git => 'git://github.com/technoweenie/restful-authentication.git', :submodule => true
- # plugin 'restful-authentication', :svn => 'svn://svnhub.com/technoweenie/restful-authentication/trunk'
- #
- def plugin(name, options)
- log 'plugin', name
-
- if options[:git] && options[:submodule]
- in_root do
- Git.run("submodule add #{options[:git]} vendor/plugins/#{name}")
- end
- elsif options[:git] || options[:svn]
- in_root do
- run_ruby_script("script/plugin install #{options[:svn] || options[:git]}", false)
- end
- else
- log "! no git or svn provided for #{name}. skipping..."
- end
- end
-
- # Adds an entry into config/environment.rb for the supplied gem :
- def gem(name, options = {})
- log 'gem', name
- env = options.delete(:env)
-
- gems_code = "config.gem '#{name}'"
-
- if options.any?
- opts = options.inject([]) {|result, h| result << [":#{h[0]} => #{h[1].inspect.gsub('"',"'")}"] }.sort.join(", ")
- gems_code << ", #{opts}"
- end
-
- environment gems_code, :env => env
- end
-
- # Adds a line inside the Initializer block for config/environment.rb. Used by #gem
- # If options :env is specified, the line is appended to the corresponding
- # file in config/environments/#{env}.rb
- def environment(data = nil, options = {}, &block)
- sentinel = 'Rails::Initializer.run do |config|'
-
- data = block.call if !data && block_given?
-
- in_root do
- if options[:env].nil?
- gsub_file 'config/environment.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
- "#{match}\n " << data
- end
- else
- Array.wrap(options[:env]).each do|env|
- append_file "config/environments/#{env}.rb", "\n#{data}"
- end
- end
- end
- end
-
- # Run a command in git.
- #
- # ==== Examples
- #
- # git :init
- # git :add => "this.file that.rb"
- # git :add => "onefile.rb", :rm => "badfile.cxx"
- #
- def git(command = {})
- in_root do
- if command.is_a?(Symbol)
- log 'running', "git #{command}"
- Git.run(command.to_s)
- else
- command.each do |command, options|
- log 'running', "git #{command} #{options}"
- Git.run("#{command} #{options}")
- end
- end
- end
- end
-
- # Create a new file in the vendor/ directory. Code can be specified
- # in a block or a data string can be given.
- #
- # ==== Examples
- #
- # vendor("sekrit.rb") do
- # sekrit_salt = "#{Time.now}--#{3.years.ago}--#{rand}--"
- # "salt = '#{sekrit_salt}'"
- # end
- #
- # vendor("foreign.rb", "# Foreign code is fun")
- #
- def vendor(filename, data = nil, &block)
- log 'vendoring', filename
- file("vendor/#{filename}", data, false, &block)
- end
-
- # Create a new file in the lib/ directory. Code can be specified
- # in a block or a data string can be given.
- #
- # ==== Examples
- #
- # lib("crypto.rb") do
- # "crypted_special_value = '#{rand}--#{Time.now}--#{rand(1337)}--'"
- # end
- #
- # lib("foreign.rb", "# Foreign code is fun")
- #
- def lib(filename, data = nil, &block)
- log 'lib', filename
- file("lib/#{filename}", data, false, &block)
- end
-
- # Create a new Rakefile with the provided code (either in a block or a string).
- #
- # ==== Examples
- #
- # rakefile("bootstrap.rake") do
- # project = ask("What is the UNIX name of your project?")
- #
- # <<-TASK
- # namespace :#{project} do
- # task :bootstrap do
- # puts "i like boots!"
- # end
- # end
- # TASK
- # end
- #
- # rakefile("seed.rake", "puts 'im plantin ur seedz'")
- #
- def rakefile(filename, data = nil, &block)
- log 'rakefile', filename
- file("lib/tasks/#{filename}", data, false, &block)
- end
-
- # Create a new initializer with the provided code (either in a block or a string).
- #
- # ==== Examples
- #
- # initializer("globals.rb") do
- # data = ""
- #
- # ['MY_WORK', 'ADMINS', 'BEST_COMPANY_EVAR'].each do
- # data << "#{const} = :entp"
- # end
- #
- # data
- # end
- #
- # initializer("api.rb", "API_KEY = '123456'")
- #
- def initializer(filename, data = nil, &block)
- log 'initializer', filename
- file("config/initializers/#{filename}", data, false, &block)
- end
-
- # Generate something using a generator from Rails or a plugin.
- # The second parameter is the argument string that is passed to
- # the generator or an Array that is joined.
- #
- # ==== Example
- #
- # generate(:authenticated, "user session")
- #
- def generate(what, *args)
- log 'generating', what
- argument = args.map(&:to_s).flatten.join(" ")
-
- in_root { run_ruby_script("script/generate #{what} #{argument}", false) }
- end
-
- # Executes a command
- #
- # ==== Example
- #
- # inside('vendor') do
- # run('ln -s ~/edge rails')
- # end
- #
- def run(command, log_action = true)
- log 'executing', "#{command} from #{Dir.pwd}" if log_action
- `#{command}`
- end
-
- # Executes a ruby script (taking into account WIN32 platform quirks)
- def run_ruby_script(command, log_action = true)
- ruby_command = RUBY_PLATFORM=~ /win32/ ? 'ruby ' : ''
- run("#{ruby_command}#{command}", log_action)
- end
-
- # Runs the supplied rake task
- #
- # ==== Example
- #
- # rake("db:migrate")
- # rake("db:migrate", :env => "production")
- # rake("gems:install", :sudo => true)
- #
- def rake(command, options = {})
- log 'rake', command
- env = options[:env] || 'development'
- sudo = options[:sudo] ? 'sudo ' : ''
- in_root { run("#{sudo}rake #{command} RAILS_ENV=#{env}", false) }
- end
-
- # Just run the capify command in root
- #
- # ==== Example
- #
- # capify!
- #
- def capify!
- log 'capifying'
- in_root { run('capify .', false) }
- end
-
- # Add Rails to /vendor/rails
- #
- # ==== Example
- #
- # freeze!
- #
- def freeze!(args = {})
- log 'vendor', 'rails edge'
- in_root { run('rake rails:freeze:edge', false) }
- end
-
- # Make an entry in Rails routing file conifg/routes.rb
- #
- # === Example
- #
- # route "map.root :controller => :welcome"
- #
- def route(routing_code)
- log 'route', routing_code
- sentinel = 'ActionController::Routing::Routes.draw do |map|'
-
- in_root do
- gsub_file 'config/routes.rb', /(#{Regexp.escape(sentinel)})/mi do |match|
- "#{match}\n #{routing_code}\n"
- end
- end
- end
-
- protected
-
- # Get a user's input
- #
- # ==== Example
- #
- # answer = ask("Should I freeze the latest Rails?")
- # freeze! if ask("Should I freeze the latest Rails?") == "yes"
- #
- def ask(string)
- log '', string
- STDIN.gets.strip
- end
-
- # Do something in the root of the Rails application or
- # a provided subfolder; the full path is yielded to the block you provide.
- # The path is set back to the previous path when the method exits.
- def inside(dir = '', &block)
- folder = File.join(root, dir)
- FileUtils.mkdir_p(folder) unless File.exist?(folder)
- FileUtils.cd(folder) { block.arity == 1 ? yield(folder) : yield }
- end
-
- def in_root
- FileUtils.cd(root) { yield }
- end
-
- # Helper to test if the user says yes(y)?
- #
- # ==== Example
- #
- # freeze! if yes?("Should I freeze the latest Rails?")
- #
- def yes?(question)
- answer = ask(question).downcase
- answer == "y" || answer == "yes"
- end
-
- # Helper to test if the user does NOT say yes(y)?
- #
- # ==== Example
- #
- # capify! if no?("Will you be using vlad to deploy your application?")
- #
- def no?(question)
- !yes?(question)
- end
-
- # Run a regular expression replacement on a file
- #
- # ==== Example
- #
- # gsub_file 'app/controllers/application_controller.rb', /#\s*(filter_parameter_logging :password)/, '\1'
- #
- def gsub_file(relative_destination, regexp, *args, &block)
- path = destination_path(relative_destination)
- content = File.read(path).gsub(regexp, *args, &block)
- File.open(path, 'wb') { |file| file.write(content) }
- end
-
- # Append text to a file
- #
- # ==== Example
- #
- # append_file 'config/environments/test.rb', 'config.gem "rspec"'
- #
- def append_file(relative_destination, data)
- path = destination_path(relative_destination)
- File.open(path, 'ab') { |file| file.write(data) }
- end
-
- def destination_path(relative_destination)
- File.join(root, relative_destination)
- end
-
- def log(action, message = '')
- logger.log(action, message)
- end
-
- def logger
- @logger ||= Rails::Generator::Base.logger
- end
-
- def logger
- @logger ||= if defined?(Rails::Generator::Base)
- Rails::Generator::Base.logger
- else
- require 'rails_generator/simple_logger'
- Rails::Generator::SimpleLogger.new(STDOUT)
- end
- end
-
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/USAGE
deleted file mode 100644
index 362872e84ab..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/USAGE
+++ /dev/null
@@ -1,30 +0,0 @@
-Description:
- Stubs out a new controller and its views. Pass the controller name, either
- CamelCased or under_scored, and a list of views as arguments.
-
- To create a controller within a module, specify the controller name as a
- path like 'parent_module/controller_name'.
-
- This generates a controller class in app/controllers, view templates in
- app/views/controller_name, a helper class in app/helpers, a functional
- test suite in test/functional and a helper test suite in test/unit/helpers.
-
-Example:
- `./script/generate controller CreditCard open debit credit close`
-
- Credit card controller with URLs like /credit_card/debit.
- Controller: app/controllers/credit_card_controller.rb
- Functional Test: test/functional/credit_card_controller_test.rb
- Views: app/views/credit_card/debit.html.erb [...]
- Helper: app/helpers/credit_card_helper.rb
- Helper Test: test/unit/helpers/credit_card_helper_test.rb
-
-Modules Example:
- `./script/generate controller 'admin/credit_card' suspend late_fee`
-
- Credit card admin controller with URLs /admin/credit_card/suspend.
- Controller: app/controllers/admin/credit_card_controller.rb
- Functional Test: test/functional/admin/credit_card_controller_test.rb
- Views: app/views/admin/credit_card/debit.html.erb [...]
- Helper: app/helpers/admin/credit_card_helper.rb
- Helper Test: test/unit/helpers/admin/credit_card_helper_test.rb
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/controller_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/controller_generator.rb
deleted file mode 100644
index dc126e8a989..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/controller_generator.rb
+++ /dev/null
@@ -1,43 +0,0 @@
-class ControllerGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions "#{class_name}Controller", "#{class_name}ControllerTest", "#{class_name}Helper", "#{class_name}HelperTest"
-
- # Controller, helper, views, and test directories.
- m.directory File.join('app/controllers', class_path)
- m.directory File.join('app/helpers', class_path)
- m.directory File.join('app/views', class_path, file_name)
- m.directory File.join('test/functional', class_path)
- m.directory File.join('test/unit/helpers', class_path)
-
- # Controller class, functional test, and helper class.
- m.template 'controller.rb',
- File.join('app/controllers',
- class_path,
- "#{file_name}_controller.rb")
-
- m.template 'functional_test.rb',
- File.join('test/functional',
- class_path,
- "#{file_name}_controller_test.rb")
-
- m.template 'helper.rb',
- File.join('app/helpers',
- class_path,
- "#{file_name}_helper.rb")
-
- m.template 'helper_test.rb',
- File.join('test/unit/helpers',
- class_path,
- "#{file_name}_helper_test.rb")
-
- # View template for each action.
- actions.each do |action|
- path = File.join('app/views', class_path, file_name, "#{action}.html.erb")
- m.template 'view.html.erb', path,
- :assigns => { :action => action, :path => path }
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/controller.rb
deleted file mode 100644
index cda2659e693..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/controller.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-class <%= class_name %>Controller < ApplicationController
-<% for action in actions -%>
- def <%= action %>
- end
-
-<% end -%>
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/functional_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/functional_test.rb
deleted file mode 100644
index 62fa5d86fdd..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/functional_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>ControllerTest < ActionController::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper.rb
deleted file mode 100644
index 3fe2ecdc74c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module <%= class_name %>Helper
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper_test.rb
deleted file mode 100644
index 591e40900e9..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>HelperTest < ActionView::TestCase
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/view.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/view.html.erb
deleted file mode 100644
index ad85431f986..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/controller/templates/view.html.erb
+++ /dev/null
@@ -1,2 +0,0 @@
-<h1><%= class_name %>#<%= action %></h1>
-<p>Find me in <%= path %></p>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/USAGE
deleted file mode 100644
index ef27ca617e5..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/USAGE
+++ /dev/null
@@ -1,24 +0,0 @@
-Description:
- Stubs out a new helper. Pass the helper name, either
- CamelCased or under_scored.
-
- To create a helper within a module, specify the helper name as a
- path like 'parent_module/helper_name'.
-
- This generates a helper class in app/helpers and a helper test
- suite in test/unit/helpers.
-
-Example:
- `./script/generate helper CreditCard`
-
- Credit card helper.
- Helper: app/helpers/credit_card_helper.rb
- Test: test/unit/helpers/credit_card_helper_test.rb
-
-Modules Example:
- `./script/generate helper 'admin/credit_card'`
-
- Credit card admin helper.
- Helper: app/helpers/admin/credit_card_helper.rb
- Test: test/unit/helpers/admin/credit_card_helper_test.rb
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/helper_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/helper_generator.rb
deleted file mode 100644
index f7831f7c7ab..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/helper_generator.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-class HelperGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions class_path, "#{class_name}Helper", "#{class_name}HelperTest"
-
- # Helper and helper test directories.
- m.directory File.join('app/helpers', class_path)
- m.directory File.join('test/unit/helpers', class_path)
-
- # Helper and helper test class.
-
- m.template 'helper.rb',
- File.join('app/helpers',
- class_path,
- "#{file_name}_helper.rb")
-
- m.template 'helper_test.rb',
- File.join('test/unit/helpers',
- class_path,
- "#{file_name}_helper_test.rb")
-
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper.rb
deleted file mode 100644
index 3fe2ecdc74c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module <%= class_name %>Helper
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper_test.rb
deleted file mode 100644
index 591e40900e9..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/helper/templates/helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>HelperTest < ActionView::TestCase
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/USAGE
deleted file mode 100644
index 09e2691f690..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/USAGE
+++ /dev/null
@@ -1,8 +0,0 @@
-Description:
- Stubs out a new integration test. Pass the name of the test, either
- CamelCased or under_scored, as an argument. The new test class is
- generated in test/integration/testname_test.rb
-
-Example:
- `./script/generate integration_test GeneralStories` creates a GeneralStories
- integration test in test/integration/general_stories_test.rb
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb
deleted file mode 100644
index 44323f28cac..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/integration_test_generator.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class IntegrationTestGenerator < Rails::Generator::NamedBase
- default_options :skip_migration => false
-
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions class_name, "#{class_name}Test"
-
- # integration test directory
- m.directory File.join('test/integration', class_path)
-
- # integration test stub
- m.template 'integration_test.rb', File.join('test/integration', class_path, "#{file_name}_test.rb")
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb
deleted file mode 100644
index 2c57158b1c4..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/integration_test/templates/integration_test.rb
+++ /dev/null
@@ -1,10 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>Test < ActionController::IntegrationTest
- fixtures :all
-
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/USAGE
deleted file mode 100644
index 61a649ed4d2..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/USAGE
+++ /dev/null
@@ -1,16 +0,0 @@
-Description:
- Stubs out a new mailer and its views. Pass the mailer name, either
- CamelCased or under_scored, and an optional list of emails as arguments.
-
- This generates a mailer class in app/models, view templates in
- app/views/mailer_name, a unit test in test/unit, and fixtures in
- test/fixtures.
-
-Example:
- `./script/generate mailer Notifications signup forgot_password invoice`
-
- creates a Notifications mailer class, views, test, and fixtures:
- Mailer: app/models/notifications.rb
- Views: app/views/notifications/signup.erb [...]
- Test: test/unit/test/unit/notifications_test.rb
- Fixtures: test/fixtures/notifications/signup [...]
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/mailer_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/mailer_generator.rb
deleted file mode 100644
index ba6d60cac61..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/mailer_generator.rb
+++ /dev/null
@@ -1,30 +0,0 @@
-class MailerGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions class_name, "#{class_name}Test"
-
- # Mailer, view, test, and fixture directories.
- m.directory File.join('app/models', class_path)
- m.directory File.join('app/views', file_path)
- m.directory File.join('test/unit', class_path)
- m.directory File.join('test/fixtures', file_path)
-
- # Mailer class and unit test.
- m.template "mailer.rb", File.join('app/models', class_path, "#{file_name}.rb")
- m.template "unit_test.rb", File.join('test/unit', class_path, "#{file_name}_test.rb")
-
- # View template and fixture for each action.
- actions.each do |action|
- relative_path = File.join(file_path, action)
- view_path = File.join('app/views', "#{relative_path}.erb")
- fixture_path = File.join('test/fixtures', relative_path)
-
- m.template "view.erb", view_path,
- :assigns => { :action => action, :path => view_path }
- m.template "fixture.erb", fixture_path,
- :assigns => { :action => action, :path => view_path }
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.erb
deleted file mode 100644
index 6899257ddcb..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= class_name %>#<%= action %>
-
-Find me in <%= path %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/fixture.rhtml
+++ /dev/null
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/mailer.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/mailer.rb
deleted file mode 100644
index ce15ae9de90..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/mailer.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class <%= class_name %> < ActionMailer::Base
-
-<% for action in actions -%>
-
- def <%= action %>(sent_at = Time.now)
- subject '<%= class_name %>#<%= action %>'
- recipients ''
- from ''
- sent_on sent_at
-
- body :greeting => 'Hi,'
- end
-<% end -%>
-
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/unit_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
deleted file mode 100644
index 4de94076e97..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/unit_test.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>Test < ActionMailer::TestCase
-<% for action in actions -%>
- test "<%= action %>" do
- @expected.subject = '<%= class_name %>#<%= action %>'
- @expected.body = read_fixture('<%= action %>')
- @expected.date = Time.now
-
- assert_equal @expected.encoded, <%= class_name %>.create_<%= action %>(@expected.date).encoded
- end
-
-<% end -%>
-<% if actions.blank? -%>
- # replace this with your real tests
- test "the truth" do
- assert true
- end
-<% end -%>
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.erb
deleted file mode 100644
index 6899257ddcb..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.erb
+++ /dev/null
@@ -1,3 +0,0 @@
-<%= class_name %>#<%= action %>
-
-Find me in <%= path %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.rhtml b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.rhtml
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/mailer/templates/view.rhtml
+++ /dev/null
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/USAGE
deleted file mode 100644
index 123ec6c03f3..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/USAGE
+++ /dev/null
@@ -1,8 +0,0 @@
-Description:
- Cast some metal!
-
-Examples:
- `./script/generate metal poller`
-
- This will create:
- Metal: app/metal/poller.rb
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/metal_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/metal_generator.rb
deleted file mode 100644
index 64f49d929d8..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/metal_generator.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class MetalGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- m.directory 'app/metal'
- m.template 'metal.rb', File.join('app/metal', "#{file_name}.rb")
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/templates/metal.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/templates/metal.rb
deleted file mode 100644
index e94982b69ac..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/metal/templates/metal.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-# Allow the metal piece to run in isolation
-require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
-
-class <%= class_name %>
- def self.call(env)
- if env["PATH_INFO"] =~ /^\/<%= file_name %>/
- [200, {"Content-Type" => "text/html"}, ["Hello, World!"]]
- else
- [404, {"Content-Type" => "text/html"}, ["Not Found"]]
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/USAGE
deleted file mode 100644
index b83c657963b..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/USAGE
+++ /dev/null
@@ -1,29 +0,0 @@
-Description:
- Stubs out a new database migration. Pass the migration name, either
- CamelCased or under_scored, and an optional list of attribute pairs as arguments.
-
- A migration class is generated in db/migrate prefixed by a timestamp of the current date and time.
-
- You can name your migration in either of these formats to generate add/remove
- column lines from supplied attributes: AddColumnsToTable or RemoveColumnsFromTable
-
-Example:
- `./script/generate migration AddSslFlag`
-
- If the current date is May 14, 2008 and the current time 09:09:12, this creates the AddSslFlag migration
- db/migrate/20080514090912_add_ssl_flag.rb
-
- `./script/generate migration AddTitleBodyToPost title:string body:text published:boolean`
-
- This will create the AddTitleBodyToPost in db/migrate/20080514090912_add_title_body_to_post.rb with
- this in the Up migration:
-
- add_column :posts, :title, :string
- add_column :posts, :body, :text
- add_column :posts, :published, :boolean
-
- And this in the Down migration:
-
- remove_column :posts, :published
- remove_column :posts, :body
- remove_column :posts, :title
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/migration_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/migration_generator.rb
deleted file mode 100644
index 9a40c5d3f1c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/migration_generator.rb
+++ /dev/null
@@ -1,20 +0,0 @@
-class MigrationGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- m.migration_template 'migration.rb', 'db/migrate', :assigns => get_local_assigns
- end
- end
-
-
- private
- def get_local_assigns
- {}.tap do |assigns|
- if class_name.underscore =~ /^(add|remove)_.*_(?:to|from)_(.*)/
- assigns[:migration_action] = $1
- assigns[:table_name] = $2.pluralize
- else
- assigns[:attributes] = []
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/templates/migration.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/templates/migration.rb
deleted file mode 100644
index ca35a432294..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/migration/templates/migration.rb
+++ /dev/null
@@ -1,11 +0,0 @@
-class <%= class_name.underscore.camelize %> < ActiveRecord::Migration
- def self.up<% attributes.each do |attribute| %>
- <%= migration_action %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'add' %>, :<%= attribute.type %><% end -%>
- <%- end %>
- end
-
- def self.down<% attributes.reverse.each do |attribute| %>
- <%= migration_action == 'add' ? 'remove' : 'add' %>_column :<%= table_name %>, :<%= attribute.name %><% if migration_action == 'remove' %>, :<%= attribute.type %><% end -%>
- <%- end %>
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/USAGE
deleted file mode 100644
index 24b03b4d4aa..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/USAGE
+++ /dev/null
@@ -1,27 +0,0 @@
-Description:
- Stubs out a new model. Pass the model name, either CamelCased or
- under_scored, and an optional list of attribute pairs as arguments.
-
- Attribute pairs are column_name:sql_type arguments specifying the
- model's attributes. Timestamps are added by default, so you don't have to
- specify them by hand as 'created_at:datetime updated_at:datetime'.
-
- You don't have to think up every attribute up front, but it helps to
- sketch out a few so you can start working with the model immediately.
-
- This generates a model class in app/models, a unit test in test/unit,
- a test fixture in test/fixtures/singular_name.yml, and a migration in
- db/migrate.
-
-Examples:
- `./script/generate model account`
-
- creates an Account model, test, fixture, and migration:
- Model: app/models/account.rb
- Test: test/unit/account_test.rb
- Fixtures: test/fixtures/accounts.yml
- Migration: db/migrate/XXX_add_accounts.rb
-
- `./script/generate model post title:string body:text published:boolean`
-
- creates a Post model with a string title, text body, and published flag.
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/model_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/model_generator.rb
deleted file mode 100644
index 1895d8a9c6e..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/model_generator.rb
+++ /dev/null
@@ -1,52 +0,0 @@
-class ModelGenerator < Rails::Generator::NamedBase
- default_options :skip_timestamps => false, :skip_migration => false, :skip_fixture => false
-
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions class_name, "#{class_name}Test"
-
- # Model, test, and fixture directories.
- m.directory File.join('app/models', class_path)
- m.directory File.join('test/unit', class_path)
- m.directory File.join('test/fixtures', class_path)
-
- # Model class, unit test, and fixtures.
- m.template 'model.rb', File.join('app/models', class_path, "#{file_name}.rb")
- m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_test.rb")
-
- unless options[:skip_fixture]
- m.template 'fixtures.yml', File.join('test/fixtures', "#{table_name}.yml")
- end
-
- migration_file_path = file_path.gsub(/\//, '_')
- migration_name = class_name
- if ActiveRecord::Base.pluralize_table_names
- migration_name = migration_name.pluralize
- migration_file_path = migration_file_path.pluralize
- end
-
- unless options[:skip_migration]
- m.migration_template 'migration.rb', 'db/migrate', :assigns => {
- :migration_name => "Create#{migration_name.gsub(/::/, '')}"
- }, :migration_file_name => "create_#{migration_file_path}"
- end
- end
- end
-
- protected
- def banner
- "Usage: #{$0} #{spec.name} ModelName [field:type, field:type]"
- end
-
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
- opt.on("--skip-timestamps",
- "Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
- opt.on("--skip-migration",
- "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
- opt.on("--skip-fixture",
- "Don't generation a fixture file for this model") { |v| options[:skip_fixture] = v}
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/fixtures.yml b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/fixtures.yml
deleted file mode 100644
index a30132bc996..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/fixtures.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
-
-<% unless attributes.empty? -%>
-one:
-<% for attribute in attributes -%>
- <%= attribute.name %>: <%= attribute.default %>
-<% end -%>
-
-two:
-<% for attribute in attributes -%>
- <%= attribute.name %>: <%= attribute.default %>
-<% end -%>
-<% else -%>
-# This model initially had no columns defined. If you add columns to the
-# model remove the '{}' from the fixture names and add the columns immediately
-# below each fixture, per the syntax in the comments below
-#
-one: {}
-# column: value
-#
-two: {}
-# column: value
-<% end -%> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/migration.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/migration.rb
deleted file mode 100644
index 382fd1156ee..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/migration.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class <%= migration_name %> < ActiveRecord::Migration
- def self.up
- create_table :<%= table_name %> do |t|
-<% for attribute in attributes -%>
- t.<%= attribute.type %> :<%= attribute.name %>
-<% end -%>
-<% unless options[:skip_timestamps] %>
- t.timestamps
-<% end -%>
- end
- end
-
- def self.down
- drop_table :<%= table_name %>
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/model.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/model.rb
deleted file mode 100644
index 6fcf393bdf1..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/model.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-class <%= class_name %> < ActiveRecord::Base
-<% attributes.select(&:reference?).each do |attribute| -%>
- belongs_to :<%= attribute.name %>
-<% end -%>
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/unit_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/unit_test.rb
deleted file mode 100644
index 3e0bc29d3ad..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/model/templates/unit_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>Test < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/USAGE
deleted file mode 100644
index a5d744a3c2a..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/USAGE
+++ /dev/null
@@ -1,13 +0,0 @@
-Description:
- Stubs out a new observer. Pass the observer name, either CamelCased or
- under_scored, as an argument.
-
- The generator creates an observer class in app/models and a unit test in
- test/unit.
-
-Example:
- `./script/generate observer Account`
-
- creates an Account observer and unit test:
- Observer: app/models/account_observer.rb
- Test: test/unit/account_observer_test.rb
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/observer_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/observer_generator.rb
deleted file mode 100644
index 3c4b330a801..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/observer_generator.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class ObserverGenerator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions "#{class_name}Observer", "#{class_name}ObserverTest"
-
- # Observer, and test directories.
- m.directory File.join('app/models', class_path)
- m.directory File.join('test/unit', class_path)
-
- # Observer class and unit test fixtures.
- m.template 'observer.rb', File.join('app/models', class_path, "#{file_name}_observer.rb")
- m.template 'unit_test.rb', File.join('test/unit', class_path, "#{file_name}_observer_test.rb")
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/observer.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/observer.rb
deleted file mode 100644
index b9a3004161a..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/observer.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class <%= class_name %>Observer < ActiveRecord::Observer
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/unit_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/unit_test.rb
deleted file mode 100644
index 03f6d5666e5..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/observer/templates/unit_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>ObserverTest < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/USAGE
deleted file mode 100644
index d84051eb02d..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/USAGE
+++ /dev/null
@@ -1,8 +0,0 @@
-Description:
- Stubs out a new performance test. Pass the name of the test, either
- CamelCased or under_scored, as an argument. The new test class is
- generated in test/performance/testname_test.rb
-
-Example:
- `./script/generate performance_test GeneralStories` creates a GeneralStories
- performance test in test/performance/general_stories_test.rb
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb
deleted file mode 100644
index 83ce8ac6740..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/performance_test_generator.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class PerformanceTestGenerator < Rails::Generator::NamedBase
- default_options :skip_migration => false
-
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions class_name, "#{class_name}Test"
-
- # performance test directory
- m.directory File.join('test/performance', class_path)
-
- # performance test stub
- m.template 'performance_test.rb', File.join('test/performance', class_path, "#{file_name}_test.rb")
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb
deleted file mode 100644
index 27c91b0fcac..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/performance_test/templates/performance_test.rb
+++ /dev/null
@@ -1,9 +0,0 @@
-require 'test_helper'
-require 'performance_test_help'
-
-class <%= class_name %>Test < ActionController::PerformanceTest
- # Replace this with your real tests.
- def test_homepage
- get '/'
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/USAGE
deleted file mode 100644
index d2ecfc2d59c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/USAGE
+++ /dev/null
@@ -1,25 +0,0 @@
-Description:
- Stubs out a new plugin. Pass the plugin name, either CamelCased or
- under_scored, as an argument. Pass --with-generator to add an example
- generator also.
-
- This creates a plugin in vendor/plugins including an init.rb and README
- as well as standard lib, task, and test directories.
-
-Example:
- `./script/generate plugin BrowserFilters`
-
- creates a standard browser_filters plugin:
- vendor/plugins/browser_filters/README
- vendor/plugins/browser_filters/init.rb
- vendor/plugins/browser_filters/install.rb
- vendor/plugins/browser_filters/lib/browser_filters.rb
- vendor/plugins/browser_filters/test/browser_filters_test.rb
- vendor/plugins/browser_filters/tasks/browser_filters_tasks.rake
-
- ./script/generate plugin BrowserFilters --with-generator
-
- creates a browser_filters generator also:
- vendor/plugins/browser_filters/generators/browser_filters/browser_filters_generator.rb
- vendor/plugins/browser_filters/generators/browser_filters/USAGE
- vendor/plugins/browser_filters/generators/browser_filters/templates/
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/plugin_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/plugin_generator.rb
deleted file mode 100644
index 34c10b510b4..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/plugin_generator.rb
+++ /dev/null
@@ -1,39 +0,0 @@
-class PluginGenerator < Rails::Generator::NamedBase
- attr_reader :plugin_path
-
- def initialize(runtime_args, runtime_options = {})
- @with_generator = runtime_args.delete("--with-generator")
- super
- @plugin_path = "vendor/plugins/#{file_name}"
- end
-
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions class_name
-
- m.directory "#{plugin_path}/lib"
- m.directory "#{plugin_path}/lib/tasks"
- m.directory "#{plugin_path}/test"
-
- m.template 'README', "#{plugin_path}/README"
- m.template 'MIT-LICENSE', "#{plugin_path}/MIT-LICENSE"
- m.template 'Rakefile', "#{plugin_path}/Rakefile"
- m.template 'init.rb', "#{plugin_path}/init.rb"
- m.template 'install.rb', "#{plugin_path}/install.rb"
- m.template 'uninstall.rb', "#{plugin_path}/uninstall.rb"
- m.template 'plugin.rb', "#{plugin_path}/lib/#{file_name}.rb"
- m.template 'tasks.rake', "#{plugin_path}/lib/tasks/#{file_name}.rake"
- m.template 'unit_test.rb', "#{plugin_path}/test/#{file_name}_test.rb"
- m.template 'test_helper.rb', "#{plugin_path}/test/test_helper.rb"
- if @with_generator
- m.directory "#{plugin_path}/generators"
- m.directory "#{plugin_path}/generators/#{file_name}"
- m.directory "#{plugin_path}/generators/#{file_name}/templates"
-
- m.template 'generator.rb', "#{plugin_path}/generators/#{file_name}/#{file_name}_generator.rb"
- m.template 'USAGE', "#{plugin_path}/generators/#{file_name}/USAGE"
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE
deleted file mode 100644
index 8717df053d3..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/MIT-LICENSE
+++ /dev/null
@@ -1,20 +0,0 @@
-Copyright (c) <%= Date.today.year %> [name of plugin creator]
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/README b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/README
deleted file mode 100644
index 702db07cb1e..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/README
+++ /dev/null
@@ -1,13 +0,0 @@
-<%= class_name %>
-<%= "=" * class_name.size %>
-
-Introduction goes here.
-
-
-Example
-=======
-
-Example goes here.
-
-
-Copyright (c) <%= Date.today.year %> [name of plugin creator], released under the MIT license
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/Rakefile b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/Rakefile
deleted file mode 100644
index c56ce94730f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/Rakefile
+++ /dev/null
@@ -1,23 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rdoc/task'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the <%= file_name %> plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.libs << 'test'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the <%= file_name %> plugin.'
-RDoc::Task.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = '<%= class_name %>'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/USAGE
deleted file mode 100644
index ea9f4f12cc6..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/USAGE
+++ /dev/null
@@ -1,8 +0,0 @@
-Description:
- Explain the generator
-
-Example:
- ./script/generate <%= file_name %> Thing
-
- This will create:
- what/will/it/create
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/generator.rb
deleted file mode 100644
index 3e800df6c5f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/generator.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-class <%= class_name %>Generator < Rails::Generator::NamedBase
- def manifest
- record do |m|
- # m.directory "lib"
- # m.template 'README', "README"
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/init.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/init.rb
deleted file mode 100644
index 3c19a743c9d..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/init.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Include hook code here
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/install.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/install.rb
deleted file mode 100644
index f7732d3796c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/install.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Install hook code here
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/plugin.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/plugin.rb
deleted file mode 100644
index d8d908a9591..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/plugin.rb
+++ /dev/null
@@ -1 +0,0 @@
-# <%= class_name %>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/tasks.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/tasks.rake
deleted file mode 100644
index 72920a9d3a3..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/tasks.rake
+++ /dev/null
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :<%= file_name %> do
-# # Task goes here
-# end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/test_helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/test_helper.rb
deleted file mode 100644
index 51093e14eb2..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/test_helper.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'rubygems'
-require 'test/unit'
-require 'active_support'
-require 'active_support/test_case'
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/uninstall.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/uninstall.rb
deleted file mode 100644
index 97383334634..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/uninstall.rb
+++ /dev/null
@@ -1 +0,0 @@
-# Uninstall hook code here
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/unit_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/unit_test.rb
deleted file mode 100644
index 3e0bc29d3ad..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/plugin/templates/unit_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class <%= class_name %>Test < ActiveSupport::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/USAGE
deleted file mode 100644
index e6043f1de19..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/USAGE
+++ /dev/null
@@ -1,23 +0,0 @@
-Description:
- Stubs out a new resource including an empty model and controller suitable
- for a restful, resource-oriented application. Pass the singular model name,
- either CamelCased or under_scored, as the first argument, and an optional
- list of attribute pairs.
-
- Attribute pairs are column_name:sql_type arguments specifying the
- model's attributes. Timestamps are added by default, so you don't have to
- specify them by hand as 'created_at:datetime updated_at:datetime'.
-
- You don't have to think up every attribute up front, but it helps to
- sketch out a few so you can start working with the resource immediately.
-
- This creates a model, controller, helper, tests and fixtures for all of them,
- and the corresponding map.resources declaration in config/routes.rb
-
- Unlike the scaffold generator, the resource generator does not create
- views or add any methods to the generated controller.
-
-Examples:
- `./script/generate resource post` # no attributes
- `./script/generate resource post title:string body:text published:boolean`
- `./script/generate resource purchase order_id:integer amount:decimal`
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/resource_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/resource_generator.rb
deleted file mode 100644
index 4ee2fbff638..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/resource_generator.rb
+++ /dev/null
@@ -1,76 +0,0 @@
-class ResourceGenerator < Rails::Generator::NamedBase
- default_options :skip_timestamps => false, :skip_migration => false
-
- attr_reader :controller_name,
- :controller_class_path,
- :controller_file_path,
- :controller_class_nesting,
- :controller_class_nesting_depth,
- :controller_class_name,
- :controller_singular_name,
- :controller_plural_name
- alias_method :controller_file_name, :controller_singular_name
- alias_method :controller_table_name, :controller_plural_name
-
- def initialize(runtime_args, runtime_options = {})
- super
-
- @controller_name = @name.pluralize
-
- base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
- @controller_class_name_without_nesting, @controller_singular_name, @controller_plural_name = inflect_names(base_name)
-
- if @controller_class_nesting.empty?
- @controller_class_name = @controller_class_name_without_nesting
- else
- @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
- end
- end
-
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions("#{controller_class_name}Controller", "#{controller_class_name}Helper")
- m.class_collisions(class_name)
-
- # Controller, helper, views, and test directories.
- m.directory(File.join('app/models', class_path))
- m.directory(File.join('app/controllers', controller_class_path))
- m.directory(File.join('app/helpers', controller_class_path))
- m.directory(File.join('app/views', controller_class_path, controller_file_name))
- m.directory(File.join('test/functional', controller_class_path))
- m.directory(File.join('test/unit', class_path))
- m.directory(File.join('test/unit/helpers', class_path))
-
- m.dependency 'model', [name] + @args, :collision => :skip
-
- m.template(
- 'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
- )
-
- m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
- m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
- m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
-
- m.route_resources controller_file_name
- end
- end
-
- protected
- def banner
- "Usage: #{$0} resource ModelName [field:type, field:type]"
- end
-
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
- opt.on("--skip-timestamps",
- "Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
- opt.on("--skip-migration",
- "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
- end
-
- def model_name
- class_name.demodulize
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/controller.rb
deleted file mode 100644
index 765a9426942..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/controller.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-class <%= controller_class_name %>Controller < ApplicationController
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/functional_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/functional_test.rb
deleted file mode 100644
index b1bb1dacbf9..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/functional_test.rb
+++ /dev/null
@@ -1,8 +0,0 @@
-require 'test_helper'
-
-class <%= controller_class_name %>ControllerTest < ActionController::TestCase
- # Replace this with your real tests.
- test "the truth" do
- assert true
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper.rb
deleted file mode 100644
index 9bd821b1b24..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module <%= controller_class_name %>Helper
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper_test.rb
deleted file mode 100644
index 061f64a5e35..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/resource/templates/helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class <%= controller_class_name %>HelperTest < ActionView::TestCase
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/USAGE
deleted file mode 100644
index 810aea16f14..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/USAGE
+++ /dev/null
@@ -1,29 +0,0 @@
-Description:
- Scaffolds an entire resource, from model and migration to controller and
- views, along with a full test suite. The resource is ready to use as a
- starting point for your RESTful, resource-oriented application.
-
- Pass the name of the model (in singular form), either CamelCased or
- under_scored, as the first argument, and an optional list of attribute
- pairs.
-
- Attribute pairs are column_name:sql_type arguments specifying the
- model's attributes. Timestamps are added by default, so you don't have to
- specify them by hand as 'created_at:datetime updated_at:datetime'.
-
- You don't have to think up every attribute up front, but it helps to
- sketch out a few so you can start working with the resource immediately.
-
- For example, 'scaffold post title:string body:text published:boolean'
- gives you a model with those three attributes, a controller that handles
- the create/show/update/destroy, forms to create and edit your posts, and
- an index that lists them all, as well as a map.resources :posts
- declaration in config/routes.rb.
-
- If you want to remove all the generated files, run
- 'script/destroy scaffold ModelName'.
-
-Examples:
- `./script/generate scaffold post`
- `./script/generate scaffold post title:string body:text published:boolean`
- `./script/generate scaffold purchase order_id:integer amount:decimal`
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb
deleted file mode 100644
index 88bc3252a06..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/scaffold_generator.rb
+++ /dev/null
@@ -1,103 +0,0 @@
-class ScaffoldGenerator < Rails::Generator::NamedBase
- default_options :skip_timestamps => false, :skip_migration => false, :force_plural => false
-
- attr_reader :controller_name,
- :controller_class_path,
- :controller_file_path,
- :controller_class_nesting,
- :controller_class_nesting_depth,
- :controller_class_name,
- :controller_underscore_name,
- :controller_singular_name,
- :controller_plural_name
- alias_method :controller_file_name, :controller_underscore_name
- alias_method :controller_table_name, :controller_plural_name
-
- def initialize(runtime_args, runtime_options = {})
- super
-
- if @name == @name.pluralize && !options[:force_plural]
- logger.warning "Plural version of the model detected, using singularized version. Override with --force-plural."
- @name = @name.singularize
- assign_names!(@name)
- end
-
- @controller_name = @name.pluralize
-
- base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
- @controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
- @controller_singular_name=base_name.singularize
- if @controller_class_nesting.empty?
- @controller_class_name = @controller_class_name_without_nesting
- else
- @controller_class_name = "#{@controller_class_nesting}::#{@controller_class_name_without_nesting}"
- end
- end
-
- def manifest
- record do |m|
- # Check for class naming collisions.
- m.class_collisions("#{controller_class_name}Controller", "#{controller_class_name}Helper")
- m.class_collisions(class_name)
-
- # Controller, helper, views, test and stylesheets directories.
- m.directory(File.join('app/models', class_path))
- m.directory(File.join('app/controllers', controller_class_path))
- m.directory(File.join('app/helpers', controller_class_path))
- m.directory(File.join('app/views', controller_class_path, controller_file_name))
- m.directory(File.join('app/views/layouts', controller_class_path))
- m.directory(File.join('test/functional', controller_class_path))
- m.directory(File.join('test/unit', class_path))
- m.directory(File.join('test/unit/helpers', class_path))
- m.directory(File.join('public/stylesheets', class_path))
-
- for action in scaffold_views
- m.template(
- "view_#{action}.html.erb",
- File.join('app/views', controller_class_path, controller_file_name, "#{action}.html.erb")
- )
- end
-
- # Layout and stylesheet.
- m.template('layout.html.erb', File.join('app/views/layouts', controller_class_path, "#{controller_file_name}.html.erb"))
- m.template('style.css', 'public/stylesheets/scaffold.css')
-
- m.template(
- 'controller.rb', File.join('app/controllers', controller_class_path, "#{controller_file_name}_controller.rb")
- )
-
- m.template('functional_test.rb', File.join('test/functional', controller_class_path, "#{controller_file_name}_controller_test.rb"))
- m.template('helper.rb', File.join('app/helpers', controller_class_path, "#{controller_file_name}_helper.rb"))
- m.template('helper_test.rb', File.join('test/unit/helpers', controller_class_path, "#{controller_file_name}_helper_test.rb"))
-
- m.route_resources controller_file_name
-
- m.dependency 'model', [name] + @args, :collision => :skip
- end
- end
-
- protected
- # Override with your own usage banner.
- def banner
- "Usage: #{$0} scaffold ModelName [field:type, field:type]"
- end
-
- def add_options!(opt)
- opt.separator ''
- opt.separator 'Options:'
- opt.on("--skip-timestamps",
- "Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
- opt.on("--skip-migration",
- "Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
- opt.on("--force-plural",
- "Forces the generation of a plural ModelName") { |v| options[:force_plural] = v }
- end
-
- def scaffold_views
- %w[ index show new edit ]
- end
-
- def model_name
- class_name.demodulize
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/controller.rb
deleted file mode 100644
index cef254cd896..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/controller.rb
+++ /dev/null
@@ -1,83 +0,0 @@
-class <%= controller_class_name %>Controller < ApplicationController
- # GET /<%= table_name %>
- # GET /<%= table_name %>.xml
- def index
- @<%= table_name %> = <%= class_name %>.all
-
- respond_to do |format|
- format.html # index.html.erb
- format.xml { render :xml => @<%= table_name %> }
- end
- end
-
- # GET /<%= table_name %>/1
- # GET /<%= table_name %>/1.xml
- def show
- @<%= file_name %> = <%= class_name %>.find(params[:id])
-
- respond_to do |format|
- format.html # show.html.erb
- format.xml { render :xml => @<%= file_name %> }
- end
- end
-
- # GET /<%= table_name %>/new
- # GET /<%= table_name %>/new.xml
- def new
- @<%= file_name %> = <%= class_name %>.new
-
- respond_to do |format|
- format.html # new.html.erb
- format.xml { render :xml => @<%= file_name %> }
- end
- end
-
- # GET /<%= table_name %>/1/edit
- def edit
- @<%= file_name %> = <%= class_name %>.find(params[:id])
- end
-
- # POST /<%= table_name %>
- # POST /<%= table_name %>.xml
- def create
- @<%= file_name %> = <%= class_name %>.new(params[:<%= file_name %>])
-
- respond_to do |format|
- if @<%= file_name %>.save
- format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully created.') }
- format.xml { render :xml => @<%= file_name %>, :status => :created, :location => @<%= file_name %> }
- else
- format.html { render :action => "new" }
- format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
- end
- end
- end
-
- # PUT /<%= table_name %>/1
- # PUT /<%= table_name %>/1.xml
- def update
- @<%= file_name %> = <%= class_name %>.find(params[:id])
-
- respond_to do |format|
- if @<%= file_name %>.update_attributes(params[:<%= file_name %>])
- format.html { redirect_to(@<%= file_name %>, :notice => '<%= class_name %> was successfully updated.') }
- format.xml { head :ok }
- else
- format.html { render :action => "edit" }
- format.xml { render :xml => @<%= file_name %>.errors, :status => :unprocessable_entity }
- end
- end
- end
-
- # DELETE /<%= table_name %>/1
- # DELETE /<%= table_name %>/1.xml
- def destroy
- @<%= file_name %> = <%= class_name %>.find(params[:id])
- @<%= file_name %>.destroy
-
- respond_to do |format|
- format.html { redirect_to(<%= table_name %>_url) }
- format.xml { head :ok }
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb
deleted file mode 100644
index cd2fc578bf0..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/functional_test.rb
+++ /dev/null
@@ -1,45 +0,0 @@
-require 'test_helper'
-
-class <%= controller_class_name %>ControllerTest < ActionController::TestCase
- test "should get index" do
- get :index
- assert_response :success
- assert_not_nil assigns(:<%= table_name %>)
- end
-
- test "should get new" do
- get :new
- assert_response :success
- end
-
- test "should create <%= file_name %>" do
- assert_difference('<%= class_name %>.count') do
- post :create, :<%= file_name %> => { }
- end
-
- assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
- end
-
- test "should show <%= file_name %>" do
- get :show, :id => <%= table_name %>(:one).to_param
- assert_response :success
- end
-
- test "should get edit" do
- get :edit, :id => <%= table_name %>(:one).to_param
- assert_response :success
- end
-
- test "should update <%= file_name %>" do
- put :update, :id => <%= table_name %>(:one).to_param, :<%= file_name %> => { }
- assert_redirected_to <%= file_name %>_path(assigns(:<%= file_name %>))
- end
-
- test "should destroy <%= file_name %>" do
- assert_difference('<%= class_name %>.count', -1) do
- delete :destroy, :id => <%= table_name %>(:one).to_param
- end
-
- assert_redirected_to <%= table_name %>_path
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper.rb
deleted file mode 100644
index 9bd821b1b24..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper.rb
+++ /dev/null
@@ -1,2 +0,0 @@
-module <%= controller_class_name %>Helper
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper_test.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper_test.rb
deleted file mode 100644
index 061f64a5e35..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/helper_test.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'test_helper'
-
-class <%= controller_class_name %>HelperTest < ActionView::TestCase
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb
deleted file mode 100644
index 1478ff68f01..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/layout.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
- <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
- <title><%= controller_class_name %>: <%%= controller.action_name %></title>
- <%%= stylesheet_link_tag 'scaffold' %>
-</head>
-<body>
-
-<p style="color: green"><%%= notice %></p>
-
-<%%= yield %>
-
-</body>
-</html>
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/style.css b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/style.css
deleted file mode 100644
index 093c20994d7..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/style.css
+++ /dev/null
@@ -1,54 +0,0 @@
-body { background-color: #fff; color: #333; }
-
-body, p, ol, ul, td {
- font-family: verdana, arial, helvetica, sans-serif;
- font-size: 13px;
- line-height: 18px;
-}
-
-pre {
- background-color: #eee;
- padding: 10px;
- font-size: 11px;
-}
-
-a { color: #000; }
-a:visited { color: #666; }
-a:hover { color: #fff; background-color:#000; }
-
-.fieldWithErrors {
- padding: 2px;
- background-color: red;
- display: table;
-}
-
-#errorExplanation {
- width: 400px;
- border: 2px solid red;
- padding: 7px;
- padding-bottom: 12px;
- margin-bottom: 20px;
- background-color: #f0f0f0;
-}
-
-#errorExplanation h2 {
- text-align: left;
- font-weight: bold;
- padding: 5px 5px 5px 15px;
- font-size: 12px;
- margin: -7px;
- background-color: #c00;
- color: #fff;
-}
-
-#errorExplanation p {
- color: #333;
- margin-bottom: 0;
- padding: 5px;
-}
-
-#errorExplanation ul li {
- font-size: 12px;
- list-style: square;
-}
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb
deleted file mode 100644
index cca1d61c687..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_edit.html.erb
+++ /dev/null
@@ -1,18 +0,0 @@
-<h1>Editing <%= singular_name %></h1>
-
-<%% form_for(@<%= singular_name %>) do |f| %>
- <%%= f.error_messages %>
-
-<% for attribute in attributes -%>
- <p>
- <%%= f.label :<%= attribute.name %> %><br />
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
- </p>
-<% end -%>
- <p>
- <%%= f.submit 'Update' %>
- </p>
-<%% end %>
-
-<%%= link_to 'Show', @<%= singular_name %> %> |
-<%%= link_to 'Back', <%= plural_name %>_path %> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb
deleted file mode 100644
index 2e603d5b4a3..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_index.html.erb
+++ /dev/null
@@ -1,24 +0,0 @@
-<h1>Listing <%= plural_name %></h1>
-
-<table>
- <tr>
-<% for attribute in attributes -%>
- <th><%= attribute.column.human_name %></th>
-<% end -%>
- </tr>
-
-<%% @<%= plural_name %>.each do |<%= singular_name %>| %>
- <tr>
-<% for attribute in attributes -%>
- <td><%%=h <%= singular_name %>.<%= attribute.name %> %></td>
-<% end -%>
- <td><%%= link_to 'Show', <%= singular_name %> %></td>
- <td><%%= link_to 'Edit', edit_<%= singular_name %>_path(<%= singular_name %>) %></td>
- <td><%%= link_to 'Destroy', <%= singular_name %>, :confirm => 'Are you sure?', :method => :delete %></td>
- </tr>
-<%% end %>
-</table>
-
-<br />
-
-<%%= link_to 'New <%= singular_name %>', new_<%= singular_name %>_path %> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb
deleted file mode 100644
index 96c89fc50ed..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_new.html.erb
+++ /dev/null
@@ -1,17 +0,0 @@
-<h1>New <%= singular_name %></h1>
-
-<%% form_for(@<%= singular_name %>) do |f| %>
- <%%= f.error_messages %>
-
-<% for attribute in attributes -%>
- <p>
- <%%= f.label :<%= attribute.name %> %><br />
- <%%= f.<%= attribute.field_type %> :<%= attribute.name %> %>
- </p>
-<% end -%>
- <p>
- <%%= f.submit 'Create' %>
- </p>
-<%% end %>
-
-<%%= link_to 'Back', <%= plural_name %>_path %> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb
deleted file mode 100644
index adecaf70c62..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/scaffold/templates/view_show.html.erb
+++ /dev/null
@@ -1,10 +0,0 @@
-<% for attribute in attributes -%>
-<p>
- <b><%= attribute.column.human_name %>:</b>
- <%%=h @<%= singular_name %>.<%= attribute.name %> %>
-</p>
-
-<% end -%>
-
-<%%= link_to 'Edit', edit_<%= singular_name %>_path(@<%= singular_name %>) %> |
-<%%= link_to 'Back', <%= plural_name %>_path %> \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/USAGE b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/USAGE
deleted file mode 100644
index 87117a3cb66..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/USAGE
+++ /dev/null
@@ -1,10 +0,0 @@
-Description:
- Creates a migration to add the sessions table used by the Active Record
- session store. Pass the migration name, either CamelCased or under_scored,
- as an argument.
-
-Example:
- `./script/generate session_migration CreateSessionTable`
-
- With 4 existing migrations, this creates the AddSessionTable migration
- in db/migrate/005_add_session_table.rb
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb
deleted file mode 100644
index 2e177033a18..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/session_migration_generator.rb
+++ /dev/null
@@ -1,18 +0,0 @@
-class SessionMigrationGenerator < Rails::Generator::NamedBase
- def initialize(runtime_args, runtime_options = {})
- runtime_args << 'add_session_table' if runtime_args.empty?
- super
- end
-
- def manifest
- record do |m|
- m.migration_template 'migration.rb', 'db/migrate',
- :assigns => { :session_table_name => default_session_table_name }
- end
- end
-
- protected
- def default_session_table_name
- ActiveRecord::Base.pluralize_table_names ? 'session'.pluralize : 'session'
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/templates/migration.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/templates/migration.rb
deleted file mode 100644
index ca220a5f233..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/generators/components/session_migration/templates/migration.rb
+++ /dev/null
@@ -1,16 +0,0 @@
-class <%= class_name %> < ActiveRecord::Migration
- def self.up
- create_table :<%= session_table_name %> do |t|
- t.string :session_id, :null => false
- t.text :data
- t.timestamps
- end
-
- add_index :<%= session_table_name %>, :session_id
- add_index :<%= session_table_name %>, :updated_at
- end
-
- def self.down
- drop_table :<%= session_table_name %>
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/lookup.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/lookup.rb
deleted file mode 100644
index a3525364a2f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/lookup.rb
+++ /dev/null
@@ -1,249 +0,0 @@
-require 'pathname'
-
-require File.dirname(__FILE__) + '/spec'
-
-class Object
- class << self
- # Lookup missing generators using const_missing. This allows any
- # generator to reference another without having to know its location:
- # RubyGems, ~/.rails/generators, and RAILS_ROOT/generators.
- def lookup_missing_generator(class_id)
- if md = /(.+)Generator$/.match(class_id.to_s)
- name = md.captures.first.demodulize.underscore
- Rails::Generator::Base.lookup(name).klass
- else
- const_missing_before_generators(class_id)
- end
- end
-
- unless respond_to?(:const_missing_before_generators)
- alias_method :const_missing_before_generators, :const_missing
- alias_method :const_missing, :lookup_missing_generator
- end
- end
-end
-
-# User home directory lookup adapted from RubyGems.
-def Dir.user_home
- if ENV['HOME']
- ENV['HOME']
- elsif ENV['USERPROFILE']
- ENV['USERPROFILE']
- elsif ENV['HOMEDRIVE'] and ENV['HOMEPATH']
- "#{ENV['HOMEDRIVE']}:#{ENV['HOMEPATH']}"
- else
- File.expand_path '~'
- end
-end
-
-
-module Rails
- module Generator
-
- # Generator lookup is managed by a list of sources which return specs
- # describing where to find and how to create generators. This module
- # provides class methods for manipulating the source list and looking up
- # generator specs, and an #instance wrapper for quickly instantiating
- # generators by name.
- #
- # A spec is not a generator: it's a description of where to find
- # the generator and how to create it. A source is anything that
- # yields generators from #each. PathSource and GemGeneratorSource are provided.
- module Lookup
- def self.included(base)
- base.extend(ClassMethods)
- base.use_component_sources!
- end
-
- # Convenience method to instantiate another generator.
- def instance(generator_name, args, runtime_options = {})
- self.class.instance(generator_name, args, runtime_options)
- end
-
- module ClassMethods
- # The list of sources where we look, in order, for generators.
- def sources
- read_inheritable_attribute(:sources) or use_component_sources!
- end
-
- # Add a source to the end of the list.
- def append_sources(*args)
- sources.concat(args.flatten)
- invalidate_cache!
- end
-
- # Add a source to the beginning of the list.
- def prepend_sources(*args)
- write_inheritable_array(:sources, args.flatten + sources)
- invalidate_cache!
- end
-
- # Reset the source list.
- def reset_sources
- write_inheritable_attribute(:sources, [])
- invalidate_cache!
- end
-
- # Use application generators (app, ?).
- def use_application_sources!
- reset_sources
- sources << PathSource.new(:builtin, "#{File.dirname(__FILE__)}/generators/applications")
- end
-
- # Use component generators (model, controller, etc).
- # 1. Rails application. If RAILS_ROOT is defined we know we're
- # generating in the context of a Rails application, so search
- # RAILS_ROOT/generators.
- # 2. Look in plugins, either for generators/ or rails_generators/
- # directories within each plugin
- # 3. User home directory. Search ~/.rails/generators.
- # 4. RubyGems. Search for gems named *_generator, and look for
- # generators within any RubyGem's
- # /rails_generators/<generator_name>_generator.rb file.
- # 5. Builtins. Model, controller, mailer, scaffold, and so on.
- def use_component_sources!
- reset_sources
- if defined? ::RAILS_ROOT
- sources << PathSource.new(:lib, "#{::RAILS_ROOT}/lib/generators")
- sources << PathSource.new(:vendor, "#{::RAILS_ROOT}/vendor/generators")
- Rails.configuration.plugin_paths.each do |path|
- relative_path = Pathname.new(File.expand_path(path)).relative_path_from(Pathname.new(::RAILS_ROOT))
- sources << PathSource.new(:"plugins (#{relative_path})", "#{path}/*/**/{,rails_}generators")
- end
- end
- sources << PathSource.new(:user, "#{Dir.user_home}/.rails/generators")
- if Object.const_defined?(:Gem)
- sources << GemGeneratorSource.new
- sources << GemPathSource.new
- end
- sources << PathSource.new(:builtin, "#{File.dirname(__FILE__)}/generators/components")
- end
-
- # Lookup knows how to find generators' Specs from a list of Sources.
- # Searches the sources, in order, for the first matching name.
- def lookup(generator_name)
- @found ||= {}
- generator_name = generator_name.to_s.downcase
- @found[generator_name] ||= cache.find { |spec| spec.name == generator_name }
- unless @found[generator_name]
- chars = generator_name.scan(/./).map{|c|"#{c}.*?"}
- rx = /^#{chars}$/
- gns = cache.select{|spec| spec.name =~ rx }
- @found[generator_name] ||= gns.first if gns.length == 1
- raise GeneratorError, "Pattern '#{generator_name}' matches more than one generator: #{gns.map{|sp|sp.name}.join(', ')}" if gns.length > 1
- end
- @found[generator_name] or raise GeneratorError, "Couldn't find '#{generator_name}' generator"
- end
-
- # Convenience method to lookup and instantiate a generator.
- def instance(generator_name, args = [], runtime_options = {})
- lookup(generator_name).klass.new(args, full_options(runtime_options))
- end
-
- private
- # Lookup and cache every generator from the source list.
- def cache
- @cache ||= sources.inject([]) { |cache, source| cache + source.to_a }
- end
-
- # Clear the cache whenever the source list changes.
- def invalidate_cache!
- @cache = nil
- end
- end
- end
-
- # Sources enumerate (yield from #each) generator specs which describe
- # where to find and how to create generators. Enumerable is mixed in so,
- # for example, source.collect will retrieve every generator.
- # Sources may be assigned a label to distinguish them.
- class Source
- include Enumerable
-
- attr_reader :label
- def initialize(label)
- @label = label
- end
-
- # The each method must be implemented in subclasses.
- # The base implementation raises an error.
- def each
- raise NotImplementedError
- end
-
- # Return a convenient sorted list of all generator names.
- def names
- map { |spec| spec.name }.sort
- end
- end
-
-
- # PathSource looks for generators in a filesystem directory.
- class PathSource < Source
- attr_reader :path
-
- def initialize(label, path)
- super label
- @path = path
- end
-
- # Yield each eligible subdirectory.
- def each
- Dir["#{path}/[a-z]*"].each do |dir|
- if File.directory?(dir)
- yield Spec.new(File.basename(dir), dir, label)
- end
- end
- end
- end
-
- class AbstractGemSource < Source
- def initialize
- super :RubyGems
- end
- end
-
- # GemGeneratorSource hits the mines to quarry for generators. The latest versions
- # of gems named *_generator are selected.
- class GemGeneratorSource < AbstractGemSource
- # Yield latest versions of generator gems.
- def each
- dependency = Gem::Dependency.new(/_generator$/, Gem::Requirement.default)
- Gem::cache.search(dependency).inject({}) { |latest, gem|
- hem = latest[gem.name]
- latest[gem.name] = gem if hem.nil? or gem.version > hem.version
- latest
- }.values.each { |gem|
- yield Spec.new(gem.name.sub(/_generator$/, ''), gem.full_gem_path, label)
- }
- end
- end
-
- # GemPathSource looks for generators within any RubyGem's /rails_generators/<generator_name>_generator.rb file.
- class GemPathSource < AbstractGemSource
- # Yield each generator within rails_generator subdirectories.
- def each
- generator_full_paths.each do |generator|
- yield Spec.new(File.basename(generator).sub(/_generator.rb$/, ''), File.dirname(generator), label)
- end
- end
-
- private
- def generator_full_paths
- @generator_full_paths ||=
- Gem::cache.inject({}) do |latest, name_gem|
- name, gem = name_gem
- hem = latest[gem.name]
- latest[gem.name] = gem if hem.nil? or gem.version > hem.version
- latest
- end.values.inject([]) do |mem, gem|
- Dir[gem.full_gem_path + '/{rails_,}generators/**/*_generator.rb'].each do |generator|
- mem << generator
- end
- mem
- end
- end
- end
-
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/manifest.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/manifest.rb
deleted file mode 100644
index 702effa76f5..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/manifest.rb
+++ /dev/null
@@ -1,53 +0,0 @@
-module Rails
- module Generator
-
- # Manifest captures the actions a generator performs. Instantiate
- # a manifest with an optional target object, hammer it with actions,
- # then replay or rewind on the object of your choice.
- #
- # Example:
- # manifest = Manifest.new { |m|
- # m.make_directory '/foo'
- # m.create_file '/foo/bar.txt'
- # }
- # manifest.replay(creator)
- # manifest.rewind(destroyer)
- class Manifest
- attr_reader :target
-
- # Take a default action target. Yield self if block given.
- def initialize(target = nil)
- @target, @actions = target, []
- yield self if block_given?
- end
-
- # Record an action.
- def method_missing(action, *args, &block)
- @actions << [action, args, block]
- end
-
- # Replay recorded actions.
- def replay(target = nil)
- send_actions(target || @target, @actions)
- end
-
- # Rewind recorded actions.
- def rewind(target = nil)
- send_actions(target || @target, @actions.reverse)
- end
-
- # Erase recorded actions.
- def erase
- @actions = []
- end
-
- private
- def send_actions(target, actions)
- actions.each do |method, args, block|
- target.send(method, *args, &block)
- end
- end
- end
-
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/options.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/options.rb
deleted file mode 100644
index 070f96b69b9..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/options.rb
+++ /dev/null
@@ -1,150 +0,0 @@
-require 'optparse'
-
-module Rails
- module Generator
- module Options
- def self.included(base)
- base.extend(ClassMethods)
- class << base
- if respond_to?(:inherited)
- alias_method :inherited_without_options, :inherited
- end
- alias_method :inherited, :inherited_with_options
- end
- end
-
- module ClassMethods
- def inherited_with_options(sub)
- inherited_without_options(sub) if respond_to?(:inherited_without_options)
- sub.extend(Rails::Generator::Options::ClassMethods)
- end
-
- def mandatory_options(options = nil)
- if options
- write_inheritable_attribute(:mandatory_options, options)
- else
- read_inheritable_attribute(:mandatory_options) or write_inheritable_attribute(:mandatory_options, {})
- end
- end
-
- def default_options(options = nil)
- if options
- write_inheritable_attribute(:default_options, options)
- else
- read_inheritable_attribute(:default_options) or write_inheritable_attribute(:default_options, {})
- end
- end
-
- # Merge together our class options. In increasing precedence:
- # default_options (class default options)
- # runtime_options (provided as argument)
- # mandatory_options (class mandatory options)
- def full_options(runtime_options = {})
- default_options.merge(runtime_options).merge(mandatory_options)
- end
-
- end
-
- # Each instance has an options hash that's populated by #parse.
- def options
- @options ||= {}
- end
- attr_writer :options
-
- protected
- # Convenient access to class mandatory options.
- def mandatory_options
- self.class.mandatory_options
- end
-
- # Convenient access to class default options.
- def default_options
- self.class.default_options
- end
-
- # Merge together our instance options. In increasing precedence:
- # default_options (class default options)
- # options (instance options)
- # runtime_options (provided as argument)
- # mandatory_options (class mandatory options)
- def full_options(runtime_options = {})
- self.class.full_options(options.merge(runtime_options))
- end
-
- # Parse arguments into the options hash. Classes may customize
- # parsing behavior by overriding these methods:
- # #banner Usage: ./script/generate [options]
- # #add_options! Options:
- # some options..
- # #add_general_options! General Options:
- # general options..
- def parse!(args, runtime_options = {})
- self.options = {}
-
- @option_parser = OptionParser.new do |opt|
- opt.banner = banner
- add_options!(opt)
- add_general_options!(opt)
- opt.parse!(args)
- end
-
- return args
- ensure
- self.options = full_options(runtime_options)
- end
-
- # Raise a usage error. Override usage_message to provide a blurb
- # after the option parser summary.
- def usage(message = usage_message)
- raise UsageError, "#{@option_parser}\n#{message}"
- end
-
- def usage_message
- ''
- end
-
- # Override with your own usage banner.
- def banner
- "Usage: #{$0} [options]"
- end
-
- # Override to add your options to the parser:
- # def add_options!(opt)
- # opt.on('-v', '--verbose') { |value| options[:verbose] = value }
- # end
- def add_options!(opt)
- end
-
- # Adds general options like -h and --quiet. Usually don't override.
- def add_general_options!(opt)
- opt.separator ''
- opt.separator 'Rails Info:'
- opt.on('-v', '--version', 'Show the Rails version number and quit.')
- opt.on('-h', '--help', 'Show this help message and quit.') { |v| options[:help] = v }
-
- opt.separator ''
- opt.separator 'General Options:'
-
- opt.on('-p', '--pretend', 'Run but do not make any changes.') { |v| options[:pretend] = v }
- opt.on('-f', '--force', 'Overwrite files that already exist.') { options[:collision] = :force }
- opt.on('-s', '--skip', 'Skip files that already exist.') { options[:collision] = :skip }
- opt.on('-q', '--quiet', 'Suppress normal output.') { |v| options[:quiet] = v }
- opt.on('-t', '--backtrace', 'Debugging: show backtrace on errors.') { |v| options[:backtrace] = v }
- opt.on('-c', '--svn', 'Modify files with subversion. (Note: svn must be in path)') do
- options[:svn] = {}
- `svn status`.each_line do |line|
- options[:svn][line.chomp[7..-1]] = true
- end
- end
- opt.on('-g', '--git', 'Modify files with git. (Note: git must be in path)') do
- options[:git] = {:new => {}, :modified => {}}
- `git status`.each_line do |line|
- options[:git][:new][line.chomp[14..-1]] = true if line =~ /new file:/
- options[:git][:modified][line.chomp[14..-1]] = true if line =~ /modified:/
- end
- end
- end
-
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts.rb
deleted file mode 100644
index 9b1a99838a6..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts.rb
+++ /dev/null
@@ -1,89 +0,0 @@
-require File.dirname(__FILE__) + '/options'
-
-module Rails
- module Generator
- module Scripts
-
- # Generator scripts handle command-line invocation. Each script
- # responds to an invoke! class method which handles option parsing
- # and generator invocation.
- class Base
- include Options
- default_options :collision => :ask, :quiet => false
-
- # Run the generator script. Takes an array of unparsed arguments
- # and a hash of parsed arguments, takes the generator as an option
- # or first remaining argument, and invokes the requested command.
- def run(args = [], runtime_options = {})
- begin
- parse!(args.dup, runtime_options)
- rescue OptionParser::InvalidOption => e
- # Don't cry, script. Generators want what you think is invalid.
- end
-
- # Generator name is the only required option.
- unless options[:generator]
- usage if args.empty?
- options[:generator] ||= args.shift
- end
-
- # Look up generator instance and invoke command on it.
- Rails::Generator::Base.instance(options[:generator], args, options).command(options[:command]).invoke!
- rescue => e
- puts e
- puts " #{e.backtrace.join("\n ")}\n" if options[:backtrace]
- raise SystemExit
- end
-
- protected
- # Override with your own script usage banner.
- def banner
- "Usage: #{$0} generator [options] [args]"
- end
-
- def usage_message
- usage = "\nInstalled Generators\n"
- Rails::Generator::Base.sources.inject([]) do |mem, source|
- # Using an association list instead of a hash to preserve order,
- # for aesthetic reasons more than anything else.
- label = source.label.to_s.capitalize
- pair = mem.assoc(label)
- mem << (pair = [label, []]) if pair.nil?
- pair[1] |= source.names
- mem
- end.each do |label, names|
- usage << " #{label}: #{names.join(', ')}\n" unless names.empty?
- end
-
- usage << <<end_blurb
-
-More are available at http://wiki.rubyonrails.org/rails/pages/AvailableGenerators
- 1. Download, for example, login_generator.zip
- 2. Unzip to directory #{Dir.user_home}/.rails/generators/login
- to use the generator with all your Rails apps
-end_blurb
-
- if Object.const_defined?(:RAILS_ROOT)
- usage << <<end_blurb
- or to #{File.expand_path(RAILS_ROOT)}/lib/generators/login
- to use with this app only.
-end_blurb
- end
-
- usage << <<end_blurb
- 3. Run generate with no arguments for usage information
- #{$0} login
-
-Generator gems are also available:
- 1. gem search -r generator
- 2. gem install login_generator
- 3. #{$0} login
-
-end_blurb
- return usage
- end
- end # Base
-
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/destroy.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/destroy.rb
deleted file mode 100644
index a7c2a147515..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/destroy.rb
+++ /dev/null
@@ -1,29 +0,0 @@
-require File.dirname(__FILE__) + '/../scripts'
-
-module Rails::Generator::Scripts
- class Destroy < Base
- mandatory_options :command => :destroy
-
- protected
- def usage_message
- usage = "\nInstalled Generators\n"
- Rails::Generator::Base.sources.each do |source|
- label = source.label.to_s.capitalize
- names = source.names
- usage << " #{label}: #{names.join(', ')}\n" unless names.empty?
- end
-
- usage << <<end_blurb
-
-script/generate command. For instance, 'script/destroy migration CreatePost'
-will delete the appropriate XXX_create_post.rb migration file in db/migrate,
-while 'script/destroy scaffold Post' will delete the posts controller and
-views, post model and migration, all associated tests, and the map.resources
-:posts line in config/routes.rb.
-
-For instructions on finding new generators, run script/generate.
-end_blurb
- return usage
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/generate.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/generate.rb
deleted file mode 100644
index 1fe2f54ab3e..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/generate.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-require File.dirname(__FILE__) + '/../scripts'
-
-module Rails::Generator::Scripts
- class Generate < Base
- mandatory_options :command => :create
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/update.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/update.rb
deleted file mode 100644
index 53a9faa3663..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/scripts/update.rb
+++ /dev/null
@@ -1,12 +0,0 @@
-require File.dirname(__FILE__) + '/../scripts'
-
-module Rails::Generator::Scripts
- class Update < Base
- mandatory_options :command => :update
-
- protected
- def banner
- "Usage: #{$0} [options] scaffold"
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/secret_key_generator.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/secret_key_generator.rb
deleted file mode 100644
index 7dd495a2f50..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/secret_key_generator.rb
+++ /dev/null
@@ -1,24 +0,0 @@
-require 'active_support/deprecation'
-
-module Rails
- # A class for creating random secret keys. This class will do its best to create a
- # random secret key that's as secure as possible, using whatever methods are
- # available on the current platform. For example:
- #
- # generator = Rails::SecretKeyGenerator("some unique identifier, such as the application name")
- # generator.generate_secret # => "f3f1be90053fa851... (some long string)"
- #
- # This class is *deprecated* in Rails 2.2 in favor of ActiveSupport::SecureRandom.
- # It is currently a wrapper around ActiveSupport::SecureRandom.
- class SecretKeyGenerator
- def initialize(identifier)
- end
-
- # Generate a random secret key with the best possible method available on
- # the current platform.
- def generate_secret
- ActiveSupport::SecureRandom.hex(64)
- end
- deprecate :generate_secret=>"You should use ActiveSupport::SecureRandom.hex(64)"
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/simple_logger.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/simple_logger.rb
deleted file mode 100644
index d750f07b84f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/simple_logger.rb
+++ /dev/null
@@ -1,46 +0,0 @@
-module Rails
- module Generator
- class SimpleLogger # :nodoc:
- attr_reader :out
- attr_accessor :quiet
-
- def initialize(out = $stdout)
- @out = out
- @quiet = false
- @level = 0
- end
-
- def log(status, message, &block)
- @out.print("%12s %s%s\n" % [status, ' ' * @level, message]) unless quiet
- indent(&block) if block_given?
- end
-
- def indent(&block)
- @level += 1
- if block_given?
- begin
- block.call
- ensure
- outdent
- end
- end
- end
-
- def outdent
- @level -= 1
- if block_given?
- begin
- block.call
- ensure
- indent
- end
- end
- end
-
- private
- def method_missing(method, *args, &block)
- log(method.to_s, args.first, &block)
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/spec.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/spec.rb
deleted file mode 100644
index 9d780b7ac5f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/rails_generator/spec.rb
+++ /dev/null
@@ -1,44 +0,0 @@
-module Rails
- module Generator
- # A spec knows where a generator was found and how to instantiate it.
- # Metadata include the generator's name, its base path, and the source
- # which yielded it (PathSource, GemPathSource, etc.)
- class Spec
- attr_reader :name, :path, :source
-
- def initialize(name, path, source)
- @name, @path, @source = name, path, source
- end
-
- # Look up the generator class. Require its class file, find the class
- # in ObjectSpace, tag it with this spec, and return.
- def klass
- unless @klass
- require class_file
- @klass = lookup_class
- @klass.spec = self
- end
- @klass
- end
-
- def class_file
- "#{path}/#{name}_generator.rb"
- end
-
- def class_name
- "#{name.camelize}Generator"
- end
-
- private
- # Search for the first Class descending from Rails::Generator::Base
- # whose name matches the requested class name.
- def lookup_class
- ObjectSpace.each_object(Class) do |obj|
- return obj if obj.ancestors.include?(Rails::Generator::Base) and
- obj.name.split('::').last == class_name
- end
- raise NameError, "Missing #{class_name} class in #{class_file}"
- end
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/annotations.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/annotations.rake
deleted file mode 100644
index 48ac40099a0..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/annotations.rake
+++ /dev/null
@@ -1,20 +0,0 @@
-require 'source_annotation_extractor'
-
-desc "Enumerate all annotations"
-task :notes do
- SourceAnnotationExtractor.enumerate "OPTIMIZE|FIXME|TODO", :tag => true
-end
-
-namespace :notes do
- ["OPTIMIZE", "FIXME", "TODO"].each do |annotation|
- desc "Enumerate all #{annotation} annotations"
- task annotation.downcase.intern do
- SourceAnnotationExtractor.enumerate annotation
- end
- end
-
- desc "Enumerate a custom annotation, specify with ANNOTATION=WTFHAX"
- task :custom do
- SourceAnnotationExtractor.enumerate ENV['ANNOTATION']
- end
-end \ No newline at end of file
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/databases.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/databases.rake
deleted file mode 100644
index 1cf24343a67..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/databases.rake
+++ /dev/null
@@ -1,436 +0,0 @@
-namespace :db do
- task :load_config => :rails_env do
- require 'active_record'
- ActiveRecord::Base.configurations = Rails::Configuration.new.database_configuration
- end
-
- namespace :create do
- desc 'Create all the local databases defined in config/database.yml'
- task :all => :load_config do
- ActiveRecord::Base.configurations.each_value do |config|
- # Skip entries that don't have a database key, such as the first entry here:
- #
- # defaults: &defaults
- # adapter: mysql
- # username: root
- # password:
- # host: localhost
- #
- # development:
- # database: blog_development
- # <<: *defaults
- next unless config['database']
- # Only connect to local databases
- local_database?(config) { create_database(config) }
- end
- end
- end
-
- desc 'Create the database defined in config/database.yml for the current RAILS_ENV'
- task :create => :load_config do
- create_database(ActiveRecord::Base.configurations[RAILS_ENV])
- end
-
- def create_database(config)
- begin
- if config['adapter'] =~ /sqlite/
- if File.exist?(config['database'])
- $stderr.puts "#{config['database']} already exists"
- else
- begin
- # Create the SQLite database
- ActiveRecord::Base.establish_connection(config)
- ActiveRecord::Base.connection
- rescue
- $stderr.puts $!, *($!.backtrace)
- $stderr.puts "Couldn't create database for #{config.inspect}"
- end
- end
- return # Skip the else clause of begin/rescue
- else
- ActiveRecord::Base.establish_connection(config)
- ActiveRecord::Base.connection
- end
- rescue
- case config['adapter']
- when /^mysql/
- @charset = ENV['CHARSET'] || 'utf8'
- @collation = ENV['COLLATION'] || 'utf8_unicode_ci'
- begin
- ActiveRecord::Base.establish_connection(config.merge('database' => nil))
- ActiveRecord::Base.connection.create_database(config['database'], :charset => (config['charset'] || @charset), :collation => (config['collation'] || @collation))
- ActiveRecord::Base.establish_connection(config)
- rescue
- $stderr.puts "Couldn't create database for #{config.inspect}, charset: #{config['charset'] || @charset}, collation: #{config['collation'] || @collation} (if you set the charset manually, make sure you have a matching collation)"
- end
- when 'postgresql'
- @encoding = config[:encoding] || ENV['CHARSET'] || 'utf8'
- begin
- ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
- ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding))
- ActiveRecord::Base.establish_connection(config)
- rescue
- $stderr.puts $!, *($!.backtrace)
- $stderr.puts "Couldn't create database for #{config.inspect}"
- end
- end
- else
- $stderr.puts "#{config['database']} already exists"
- end
- end
-
- namespace :drop do
- desc 'Drops all the local databases defined in config/database.yml'
- task :all => :load_config do
- ActiveRecord::Base.configurations.each_value do |config|
- # Skip entries that don't have a database key
- next unless config['database']
- # Only connect to local databases
- local_database?(config) { drop_database(config) }
- end
- end
- end
-
- desc 'Drops the database for the current RAILS_ENV'
- task :drop => :load_config do
- config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
- drop_database(config)
- end
-
- def local_database?(config, &block)
- if %w( 127.0.0.1 localhost ).include?(config['host']) || config['host'].blank?
- yield
- else
- puts "This task only modifies local databases. #{config['database']} is on a remote host."
- end
- end
-
-
- desc "Migrate the database through scripts in db/migrate and update db/schema.rb by invoking db:schema:dump. Target specific version with VERSION=x. Turn off output with VERBOSE=false."
- task :migrate => :environment do
- ActiveRecord::Migration.verbose = ENV["VERBOSE"] ? ENV["VERBOSE"] == "true" : true
- ActiveRecord::Migrator.migrate("db/migrate/", ENV["VERSION"] ? ENV["VERSION"].to_i : nil)
- Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
- end
-
- namespace :migrate do
- desc 'Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x. Target specific version with VERSION=x.'
- task :redo => :environment do
- if ENV["VERSION"]
- Rake::Task["db:migrate:down"].invoke
- Rake::Task["db:migrate:up"].invoke
- else
- Rake::Task["db:rollback"].invoke
- Rake::Task["db:migrate"].invoke
- end
- end
-
- desc 'Resets your database using your migrations for the current environment'
- task :reset => ["db:drop", "db:create", "db:migrate"]
-
- desc 'Runs the "up" for a given migration VERSION.'
- task :up => :environment do
- version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
- raise "VERSION is required" unless version
- ActiveRecord::Migrator.run(:up, "db/migrate/", version)
- Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
- end
-
- desc 'Runs the "down" for a given migration VERSION.'
- task :down => :environment do
- version = ENV["VERSION"] ? ENV["VERSION"].to_i : nil
- raise "VERSION is required" unless version
- ActiveRecord::Migrator.run(:down, "db/migrate/", version)
- Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
- end
- end
-
- desc 'Rolls the schema back to the previous version. Specify the number of steps with STEP=n'
- task :rollback => :environment do
- step = ENV['STEP'] ? ENV['STEP'].to_i : 1
- ActiveRecord::Migrator.rollback('db/migrate/', step)
- Rake::Task["db:schema:dump"].invoke if ActiveRecord::Base.schema_format == :ruby
- end
-
- desc 'Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.'
- task :reset => [ 'db:drop', 'db:setup' ]
-
- desc "Retrieves the charset for the current environment's database"
- task :charset => :environment do
- config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
- case config['adapter']
- when /^mysql/
- ActiveRecord::Base.establish_connection(config)
- puts ActiveRecord::Base.connection.charset
- when 'postgresql'
- ActiveRecord::Base.establish_connection(config)
- puts ActiveRecord::Base.connection.encoding
- else
- puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
- end
- end
-
- desc "Retrieves the collation for the current environment's database"
- task :collation => :environment do
- config = ActiveRecord::Base.configurations[RAILS_ENV || 'development']
- case config['adapter']
- when /^mysql/
- ActiveRecord::Base.establish_connection(config)
- puts ActiveRecord::Base.connection.collation
- else
- puts 'sorry, your database adapter is not supported yet, feel free to submit a patch'
- end
- end
-
- desc "Retrieves the current schema version number"
- task :version => :environment do
- puts "Current version: #{ActiveRecord::Migrator.current_version}"
- end
-
- desc "Raises an error if there are pending migrations"
- task :abort_if_pending_migrations => :environment do
- if defined? ActiveRecord
- pending_migrations = ActiveRecord::Migrator.new(:up, 'db/migrate').pending_migrations
-
- if pending_migrations.any?
- puts "You have #{pending_migrations.size} pending migrations:"
- pending_migrations.each do |pending_migration|
- puts ' %4d %s' % [pending_migration.version, pending_migration.name]
- end
- abort %{Run "rake db:migrate" to update your database then try again.}
- end
- end
- end
-
- desc 'Create the database, load the schema, and initialize with the seed data'
- task :setup => [ 'db:create', 'db:schema:load', 'db:seed' ]
-
- desc 'Load the seed data from db/seeds.rb'
- task :seed => :environment do
- seed_file = File.join(Rails.root, 'db', 'seeds.rb')
- load(seed_file) if File.exist?(seed_file)
- end
-
- namespace :fixtures do
- desc "Load fixtures into the current environment's database. Load specific fixtures using FIXTURES=x,y. Load from subdirectory in test/fixtures using FIXTURES_DIR=z. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
- task :load => :environment do
- require 'active_record/fixtures'
- ActiveRecord::Base.establish_connection(Rails.env)
- base_dir = ENV['FIXTURES_PATH'] ? File.join(Rails.root, ENV['FIXTURES_PATH']) : File.join(Rails.root, 'test', 'fixtures')
- fixtures_dir = ENV['FIXTURES_DIR'] ? File.join(base_dir, ENV['FIXTURES_DIR']) : base_dir
-
- (ENV['FIXTURES'] ? ENV['FIXTURES'].split(/,/).map {|f| File.join(fixtures_dir, f) } : Dir.glob(File.join(fixtures_dir, '*.{yml,csv}'))).each do |fixture_file|
- Fixtures.create_fixtures(File.dirname(fixture_file), File.basename(fixture_file, '.*'))
- end
- end
-
- desc "Search for a fixture given a LABEL or ID. Specify an alternative path (eg. spec/fixtures) using FIXTURES_PATH=spec/fixtures."
- task :identify => :environment do
- require "active_record/fixtures"
-
- label, id = ENV["LABEL"], ENV["ID"]
- raise "LABEL or ID required" if label.blank? && id.blank?
-
- puts %Q(The fixture ID for "#{label}" is #{Fixtures.identify(label)}.) if label
-
- base_dir = ENV['FIXTURES_PATH'] ? File.join(Rails.root, ENV['FIXTURES_PATH']) : File.join(Rails.root, 'test', 'fixtures')
- Dir["#{base_dir}/**/*.yml"].each do |file|
- if data = YAML::load(ERB.new(IO.read(file)).result)
- data.keys.each do |key|
- key_id = Fixtures.identify(key)
-
- if key == label || key_id == id.to_i
- puts "#{file}: #{key} (#{key_id})"
- end
- end
- end
- end
- end
- end
-
- namespace :schema do
- desc "Create a db/schema.rb file that can be portably used against any DB supported by AR"
- task :dump => :environment do
- require 'active_record/schema_dumper'
- File.open(ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb", "w") do |file|
- ActiveRecord::SchemaDumper.dump(ActiveRecord::Base.connection, file)
- end
- Rake::Task["db:schema:dump"].reenable
- end
-
- desc "Load a schema.rb file into the database"
- task :load => :environment do
- file = ENV['SCHEMA'] || "#{RAILS_ROOT}/db/schema.rb"
- if File.exists?(file)
- load(file)
- else
- abort %{#{file} doesn't exist yet. Run "rake db:migrate" to create it then try again. If you do not intend to use a database, you should instead alter #{RAILS_ROOT}/config/environment.rb to prevent active_record from loading: config.frameworks -= [ :active_record ]}
- end
- end
- end
-
- namespace :structure do
- desc "Dump the database structure to a SQL file"
- task :dump => :environment do
- abcs = ActiveRecord::Base.configurations
- case abcs[RAILS_ENV]["adapter"]
- when /^mysql/, "oci", "oracle"
- ActiveRecord::Base.establish_connection(abcs[RAILS_ENV])
- File.open("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql", "w+") { |f| f << ActiveRecord::Base.connection.structure_dump }
- when "postgresql"
- ENV['PGHOST'] = abcs[RAILS_ENV]["host"] if abcs[RAILS_ENV]["host"]
- ENV['PGPORT'] = abcs[RAILS_ENV]["port"].to_s if abcs[RAILS_ENV]["port"]
- ENV['PGPASSWORD'] = abcs[RAILS_ENV]["password"].to_s if abcs[RAILS_ENV]["password"]
- search_path = abcs[RAILS_ENV]["schema_search_path"]
- search_path = "--schema=#{search_path}" if search_path
- `pg_dump -i -U "#{abcs[RAILS_ENV]["username"]}" -s -x -O -f db/#{RAILS_ENV}_structure.sql #{search_path} #{abcs[RAILS_ENV]["database"]}`
- raise "Error dumping database" if $?.exitstatus == 1
- when "sqlite", "sqlite3"
- dbfile = abcs[RAILS_ENV]["database"] || abcs[RAILS_ENV]["dbfile"]
- `#{abcs[RAILS_ENV]["adapter"]} #{dbfile} .schema > db/#{RAILS_ENV}_structure.sql`
- when "sqlserver"
- `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /f db\\#{RAILS_ENV}_structure.sql /q /A /r`
- `scptxfr /s #{abcs[RAILS_ENV]["host"]} /d #{abcs[RAILS_ENV]["database"]} /I /F db\ /q /A /r`
- when "firebird"
- set_firebird_env(abcs[RAILS_ENV])
- db_string = firebird_db_string(abcs[RAILS_ENV])
- sh "isql -a #{db_string} > #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql"
- else
- raise "Task not supported by '#{abcs["test"]["adapter"]}'"
- end
-
- if ActiveRecord::Base.connection.supports_migrations?
- File.open("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql", "a") { |f| f << ActiveRecord::Base.connection.dump_schema_information }
- end
- end
- end
-
- namespace :test do
- desc "Recreate the test database from the current schema.rb"
- task :load => 'db:test:purge' do
- ActiveRecord::Base.establish_connection(ActiveRecord::Base.configurations['test'])
- ActiveRecord::Schema.verbose = false
- Rake::Task["db:schema:load"].invoke
- end
-
- desc "Recreate the test database from the current environment's database schema"
- task :clone => %w(db:schema:dump db:test:load)
-
- desc "Recreate the test databases from the development structure"
- task :clone_structure => [ "db:structure:dump", "db:test:purge" ] do
- abcs = ActiveRecord::Base.configurations
- case abcs["test"]["adapter"]
- when /^mysql/
- ActiveRecord::Base.establish_connection(:test)
- ActiveRecord::Base.connection.execute('SET foreign_key_checks = 0')
- IO.readlines("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql").join.split("\n\n").each do |table|
- ActiveRecord::Base.connection.execute(table)
- end
- when "postgresql"
- ENV['PGHOST'] = abcs["test"]["host"] if abcs["test"]["host"]
- ENV['PGPORT'] = abcs["test"]["port"].to_s if abcs["test"]["port"]
- ENV['PGPASSWORD'] = abcs["test"]["password"].to_s if abcs["test"]["password"]
- `psql -U "#{abcs["test"]["username"]}" -f #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql #{abcs["test"]["database"]}`
- when "sqlite", "sqlite3"
- dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
- `#{abcs["test"]["adapter"]} #{dbfile} < #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql`
- when "sqlserver"
- `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
- when "oci", "oracle"
- ActiveRecord::Base.establish_connection(:test)
- IO.readlines("#{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql").join.split(";\n\n").each do |ddl|
- ActiveRecord::Base.connection.execute(ddl)
- end
- when "firebird"
- set_firebird_env(abcs["test"])
- db_string = firebird_db_string(abcs["test"])
- sh "isql -i #{RAILS_ROOT}/db/#{RAILS_ENV}_structure.sql #{db_string}"
- else
- raise "Task not supported by '#{abcs["test"]["adapter"]}'"
- end
- end
-
- desc "Empty the test database"
- task :purge => :environment do
- abcs = ActiveRecord::Base.configurations
- case abcs["test"]["adapter"]
- when /^mysql/
- ActiveRecord::Base.establish_connection(:test)
- ActiveRecord::Base.connection.recreate_database(abcs["test"]["database"], abcs["test"])
- when "postgresql"
- ActiveRecord::Base.clear_active_connections!
- drop_database(abcs['test'])
- create_database(abcs['test'])
- when "sqlite", "sqlite3"
- dbfile = abcs["test"]["database"] || abcs["test"]["dbfile"]
- File.delete(dbfile) if File.exist?(dbfile)
- when "sqlserver"
- dropfkscript = "#{abcs["test"]["host"]}.#{abcs["test"]["database"]}.DP1".gsub(/\\/,'-')
- `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{dropfkscript}`
- `osql -E -S #{abcs["test"]["host"]} -d #{abcs["test"]["database"]} -i db\\#{RAILS_ENV}_structure.sql`
- when "oci", "oracle"
- ActiveRecord::Base.establish_connection(:test)
- ActiveRecord::Base.connection.structure_drop.split(";\n\n").each do |ddl|
- ActiveRecord::Base.connection.execute(ddl)
- end
- when "firebird"
- ActiveRecord::Base.establish_connection(:test)
- ActiveRecord::Base.connection.recreate_database!
- else
- raise "Task not supported by '#{abcs["test"]["adapter"]}'"
- end
- end
-
- desc 'Check for pending migrations and load the test schema'
- task :prepare => 'db:abort_if_pending_migrations' do
- if defined?(ActiveRecord) && !ActiveRecord::Base.configurations.blank?
- Rake::Task[{ :sql => "db:test:clone_structure", :ruby => "db:test:load" }[ActiveRecord::Base.schema_format]].invoke
- end
- end
- end
-
- namespace :sessions do
- desc "Creates a sessions migration for use with ActiveRecord::SessionStore"
- task :create => :environment do
- raise "Task unavailable to this database (no migration support)" unless ActiveRecord::Base.connection.supports_migrations?
- require 'rails_generator'
- require 'rails_generator/scripts/generate'
- Rails::Generator::Scripts::Generate.new.run(["session_migration", ENV["MIGRATION"] || "CreateSessions"])
- end
-
- desc "Clear the sessions table"
- task :clear => :environment do
- ActiveRecord::Base.connection.execute "DELETE FROM #{session_table_name}"
- end
- end
-end
-
-def drop_database(config)
- begin
- case config['adapter']
- when /^mysql/
- ActiveRecord::Base.establish_connection(config)
- ActiveRecord::Base.connection.drop_database config['database']
- when /^sqlite/
- FileUtils.rm(File.join(RAILS_ROOT, config['database']))
- when 'postgresql'
- ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
- ActiveRecord::Base.connection.drop_database config['database']
- end
- rescue Exception => e
- puts "Couldn't drop #{config['database']} : #{e.inspect}"
- end
-end
-
-def session_table_name
- ActiveRecord::Base.pluralize_table_names ? :sessions : :session
-end
-
-def set_firebird_env(config)
- ENV["ISC_USER"] = config["username"].to_s if config["username"]
- ENV["ISC_PASSWORD"] = config["password"].to_s if config["password"]
-end
-
-def firebird_db_string(config)
- FireRuby::Database.db_string_for(config.symbolize_keys)
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/documentation.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/documentation.rake
deleted file mode 100644
index b3111a5aeb3..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/documentation.rake
+++ /dev/null
@@ -1,93 +0,0 @@
-begin
- require 'rdoc/task'
-namespace :doc do
- desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\""
- RDoc::Task.new("app") { |rdoc|
- rdoc.rdoc_dir = 'doc/app'
- rdoc.template = ENV['template'] if ENV['template']
- rdoc.title = ENV['title'] || "Rails Application Documentation"
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.options << '--charset' << 'utf-8'
- rdoc.rdoc_files.include('doc/README_FOR_APP')
- rdoc.rdoc_files.include('app/**/*.rb')
- rdoc.rdoc_files.include('lib/**/*.rb')
- }
-
- desc "Generate documentation for the Rails framework"
- RDoc::Task.new("rails") { |rdoc|
- rdoc.rdoc_dir = 'doc/api'
- rdoc.template = "#{ENV['template']}.rb" if ENV['template']
- rdoc.title = "Rails Framework Documentation"
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('vendor/rails/railties/CHANGELOG')
- rdoc.rdoc_files.include('vendor/rails/railties/MIT-LICENSE')
- rdoc.rdoc_files.include('vendor/rails/railties/README')
- rdoc.rdoc_files.include('vendor/rails/railties/lib/{*.rb,commands/*.rb,rails_generator/*.rb}')
- rdoc.rdoc_files.include('vendor/rails/activerecord/README')
- rdoc.rdoc_files.include('vendor/rails/activerecord/CHANGELOG')
- rdoc.rdoc_files.include('vendor/rails/activerecord/lib/active_record/**/*.rb')
- rdoc.rdoc_files.exclude('vendor/rails/activerecord/lib/active_record/vendor/*')
- rdoc.rdoc_files.include('vendor/rails/activeresource/README')
- rdoc.rdoc_files.include('vendor/rails/activeresource/CHANGELOG')
- rdoc.rdoc_files.include('vendor/rails/activeresource/lib/active_resource.rb')
- rdoc.rdoc_files.include('vendor/rails/activeresource/lib/active_resource/*')
- rdoc.rdoc_files.include('vendor/rails/actionpack/README')
- rdoc.rdoc_files.include('vendor/rails/actionpack/CHANGELOG')
- rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_controller/**/*.rb')
- rdoc.rdoc_files.include('vendor/rails/actionpack/lib/action_view/**/*.rb')
- rdoc.rdoc_files.include('vendor/rails/actionmailer/README')
- rdoc.rdoc_files.include('vendor/rails/actionmailer/CHANGELOG')
- rdoc.rdoc_files.include('vendor/rails/actionmailer/lib/action_mailer/base.rb')
- rdoc.rdoc_files.include('vendor/rails/activesupport/README')
- rdoc.rdoc_files.include('vendor/rails/activesupport/CHANGELOG')
- rdoc.rdoc_files.include('vendor/rails/activesupport/lib/active_support/**/*.rb')
- }
-
- plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) }
-
- desc "Generate documentation for all installed plugins"
- task :plugins => plugins.collect { |plugin| "doc:plugins:#{plugin}" }
-
- desc "Remove plugin documentation"
- task :clobber_plugins do
- rm_rf 'doc/plugins' rescue nil
- end
-
- desc "Generate Rails guides"
- task :guides do
- require File.join(RAILTIES_PATH, "guides/rails_guides")
- RailsGuides::Generator.new(File.join(RAILS_ROOT, "doc/guides")).generate
- end
-
- namespace :plugins do
- # Define doc tasks for each plugin
- plugins.each do |plugin|
- desc "Generate documentation for the #{plugin} plugin"
- task(plugin => :environment) do
- plugin_base = "vendor/plugins/#{plugin}"
- options = []
- files = Rake::FileList.new
- options << "-o doc/plugins/#{plugin}"
- options << "--title '#{plugin.titlecase} Plugin Documentation'"
- options << '--line-numbers' << '--inline-source'
- options << '--charset' << 'utf-8'
- options << '-T html'
-
- files.include("#{plugin_base}/lib/**/*.rb")
- if File.exist?("#{plugin_base}/README")
- files.include("#{plugin_base}/README")
- options << "--main '#{plugin_base}/README'"
- end
- files.include("#{plugin_base}/CHANGELOG") if File.exist?("#{plugin_base}/CHANGELOG")
-
- options << files.to_s
-
- sh %(rdoc #{options * ' '})
- end
- end
- end
-end
-rescue LoadError
- $stderr.puts 'Please install RDoc 2.4.2+ to generate documentation.'
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/framework.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/framework.rake
deleted file mode 100644
index 76ee9affa12..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/framework.rake
+++ /dev/null
@@ -1,146 +0,0 @@
-namespace :rails do
- namespace :freeze do
- desc "Lock this application to the current gems (by unpacking them into vendor/rails)"
- task :gems do
- deps = %w(actionpack activerecord actionmailer activesupport activeresource)
- require 'rubygems'
- require 'rubygems/gem_runner'
-
- rails = (version = ENV['VERSION']) ?
- Gem.cache.find_name('rails', "= #{version}").first :
- Gem.cache.find_name('rails').sort_by { |g| g.version }.last
-
- version ||= rails.version
-
- unless rails
- puts "No rails gem #{version} is installed. Do 'gem list rails' to see what you have available."
- exit
- end
-
- puts "Freezing to the gems for Rails #{rails.version}"
- rm_rf "vendor/rails"
- mkdir_p "vendor/rails"
-
- begin
- chdir("vendor/rails") do
- rails.dependencies.select { |g| deps.include? g.name }.each do |g|
- Gem::GemRunner.new.run(["unpack", g.name, "--version", g.respond_to?(:requirement) ? g.requirement.to_s : g.version_requirements.to_s])
- mv(Dir.glob("#{g.name}*").first, g.name)
- end
-
- Gem::GemRunner.new.run(["unpack", "rails", "--version", "=#{version}"])
- FileUtils.mv(Dir.glob("rails*").first, "railties")
- end
- rescue Exception
- rm_rf "vendor/rails"
- raise
- end
- end
-
- desc 'Lock to latest Edge Rails, for a specific release use RELEASE=1.2.0'
- task :edge do
- require 'open-uri'
- version = ENV["RELEASE"] || "edge"
- target = "rails_#{version}.zip"
- commits = "http://github.com/api/v1/yaml/rails/rails/commits/master"
- url = "http://dev.rubyonrails.org/archives/#{target}"
-
- chdir 'vendor' do
- latest_revision = YAML.load(open(commits))["commits"].first["id"]
-
- puts "Downloading Rails from #{url}"
- File.open('rails.zip', 'wb') do |dst|
- open url do |src|
- while chunk = src.read(4096)
- dst << chunk
- end
- end
- end
-
- puts 'Unpacking Rails'
- rm_rf 'rails'
- `unzip rails.zip`
- %w(rails.zip rails/Rakefile rails/cleanlogs.sh rails/pushgems.rb rails/release.rb).each do |goner|
- rm_f goner
- end
-
- puts "Frozen to git revision #{latest_revision}"
- File.open('rails/REVISION', 'w') do |revision|
- revision.puts latest_revision
- end
- end
-
- puts 'Updating current scripts, javascripts, and configuration settings'
- Rake::Task['rails:update'].invoke
- end
- end
-
- desc "Unlock this application from freeze of gems or edge and return to a fluid use of system gems"
- task :unfreeze do
- rm_rf "vendor/rails"
- end
-
- desc "Update both configs, scripts and public/javascripts from Rails"
- task :update => [ "update:scripts", "update:javascripts", "update:configs", "update:application_controller" ]
-
- desc "Applies the template supplied by LOCATION=/path/to/template"
- task :template do
- require 'rails_generator/generators/applications/app/template_runner'
- Rails::TemplateRunner.new(ENV["LOCATION"])
- end
-
- namespace :update do
- desc "Add new scripts to the application script/ directory"
- task :scripts do
- local_base = "script"
- edge_base = "#{File.dirname(__FILE__)}/../../bin"
-
- local = Dir["#{local_base}/**/*"].reject { |path| File.directory?(path) }
- edge = Dir["#{edge_base}/**/*"].reject { |path| File.directory?(path) }
-
- edge.each do |script|
- base_name = script[(edge_base.length+1)..-1]
- next if base_name == "rails"
- next if local.detect { |path| base_name == path[(local_base.length+1)..-1] }
- if !File.directory?("#{local_base}/#{File.dirname(base_name)}")
- mkdir_p "#{local_base}/#{File.dirname(base_name)}"
- end
- install script, "#{local_base}/#{base_name}", :mode => 0755
- end
- end
-
- desc "Update your javascripts from your current rails install"
- task :javascripts do
- require 'railties_path'
- project_dir = RAILS_ROOT + '/public/javascripts/'
- scripts = Dir[RAILTIES_PATH + '/html/javascripts/*.js']
- scripts.reject!{|s| File.basename(s) == 'application.js'} if File.exist?(project_dir + 'application.js')
- FileUtils.cp(scripts, project_dir)
- end
-
- desc "Update config/boot.rb from your current rails install"
- task :configs do
- require 'railties_path'
- FileUtils.cp(RAILTIES_PATH + '/environments/boot.rb', RAILS_ROOT + '/config/boot.rb')
- end
-
- desc "Rename application.rb to application_controller.rb"
- task :application_controller do
- old_style = RAILS_ROOT + '/app/controllers/application.rb'
- new_style = RAILS_ROOT + '/app/controllers/application_controller.rb'
- if File.exists?(old_style) && !File.exists?(new_style)
- FileUtils.mv(old_style, new_style)
- puts "#{old_style} has been renamed to #{new_style}, update your SCM as necessary"
- end
- end
-
- desc "Generate dispatcher files in RAILS_ROOT/public"
- task :generate_dispatchers do
- require 'railties_path'
- FileUtils.cp(RAILTIES_PATH + '/dispatches/config.ru', RAILS_ROOT + '/config.ru')
- FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.fcgi', RAILS_ROOT + '/public/dispatch.fcgi')
- FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.rb', RAILS_ROOT + '/public/dispatch.rb')
- FileUtils.cp(RAILTIES_PATH + '/dispatches/dispatch.rb', RAILS_ROOT + '/public/dispatch.cgi')
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/gems.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/gems.rake
deleted file mode 100644
index f1c34c7ccaf..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/gems.rake
+++ /dev/null
@@ -1,78 +0,0 @@
-desc "List the gems that this rails application depends on"
-task :gems => 'gems:base' do
- Rails.configuration.gems.each do |gem|
- print_gem_status(gem)
- end
- puts
- puts "I = Installed"
- puts "F = Frozen"
- puts "R = Framework (loaded before rails starts)"
-end
-
-namespace :gems do
- task :base do
- $gems_rake_task = true
- require 'rubygems'
- require 'rubygems/gem_runner'
- Rake::Task[:environment].invoke
- end
-
- desc "Build any native extensions for unpacked gems"
- task :build do
- $gems_build_rake_task = true
- frozen_gems.each { |gem| gem.build }
- end
-
- namespace :build do
- desc "Force the build of all gems"
- task :force do
- $gems_build_rake_task = true
- frozen_gems.each { |gem| gem.build(:force => true) }
- end
- end
-
- desc "Installs all required gems."
- task :install => :base do
- current_gems.each { |gem| gem.install }
- end
-
- desc "Unpacks all required gems into vendor/gems."
- task :unpack => :install do
- current_gems.each { |gem| gem.unpack }
- end
-
- namespace :unpack do
- desc "Unpacks all required gems and their dependencies into vendor/gems."
- task :dependencies => :install do
- current_gems.each { |gem| gem.unpack(:recursive => true) }
- end
- end
-
- desc "Regenerate gem specifications in correct format."
- task :refresh_specs do
- frozen_gems(false).each { |gem| gem.refresh }
- end
-end
-
-def current_gems
- gems = Rails.configuration.gems
- gems = gems.select { |gem| gem.name == ENV['GEM'] } unless ENV['GEM'].blank?
- gems
-end
-
-def frozen_gems(load_specs=true)
- Dir[File.join(RAILS_ROOT, 'vendor', 'gems', '*-*')].map do |gem_dir|
- Rails::GemDependency.from_directory_name(gem_dir, load_specs)
- end
-end
-
-def print_gem_status(gem, indent=1)
- code = case
- when gem.framework_gem? then 'R'
- when gem.frozen? then 'F'
- when gem.installed? then 'I'
- else ' '
- end
- puts " "*(indent-1)+" - [#{code}] #{gem.name} #{gem.requirement.to_s}"
- gem.dependencies.each { |g| print_gem_status(g, indent+1) }
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/log.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/log.rake
deleted file mode 100644
index 6e1334692ee..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/log.rake
+++ /dev/null
@@ -1,9 +0,0 @@
-namespace :log do
- desc "Truncates all *.log files in log/ to zero bytes"
- task :clear do
- FileList["log/*.log"].each do |log_file|
- f = File.open(log_file, "w")
- f.close
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/middleware.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/middleware.rake
deleted file mode 100644
index 05f159184e2..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/middleware.rake
+++ /dev/null
@@ -1,7 +0,0 @@
-desc 'Prints out your Rack middleware stack'
-task :middleware => :environment do
- ActionController::Dispatcher.middleware.active.each do |middleware|
- puts "use #{middleware.inspect}"
- end
- puts "run ActionController::Dispatcher.new"
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/misc.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/misc.rake
deleted file mode 100644
index 9e6f96db5b0..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/misc.rake
+++ /dev/null
@@ -1,63 +0,0 @@
-task :default => :test
-task :environment do
- $rails_rake_task = true
- require(File.join(RAILS_ROOT, 'config', 'environment'))
-end
-
-task :rails_env do
- unless defined? RAILS_ENV
- RAILS_ENV = ENV['RAILS_ENV'] ||= 'development'
- end
-end
-
-desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions.'
-task :secret do
- puts ActiveSupport::SecureRandom.hex(64)
-end
-
-require 'active_support'
-namespace :time do
- namespace :zones do
- desc 'Displays names of all time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
- task :all do
- build_time_zone_list(:all)
- end
-
- desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6'
- task :us do
- build_time_zone_list(:us_zones)
- end
-
- desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time'
- task :local do
- jan_offset = Time.now.beginning_of_year.utc_offset
- jul_offset = Time.now.beginning_of_year.change(:month => 7).utc_offset
- offset = jan_offset < jul_offset ? jan_offset : jul_offset
- build_time_zone_list(:all, offset)
- end
-
- # to find UTC -06:00 zones, OFFSET can be set to either -6, -6:00 or 21600
- def build_time_zone_list(method, offset = ENV['OFFSET'])
- if offset
- offset = if offset.to_s.match(/(\+|-)?(\d+):(\d+)/)
- sign = $1 == '-' ? -1 : 1
- hours, minutes = $2.to_f, $3.to_f
- ((hours * 3600) + (minutes.to_f * 60)) * sign
- elsif offset.to_f.abs <= 13
- offset.to_f * 3600
- else
- offset.to_f
- end
- end
- previous_offset = nil
- ActiveSupport::TimeZone.__send__(method).each do |zone|
- if offset.nil? || offset == zone.utc_offset
- puts "\n* UTC #{zone.formatted_offset} *" unless zone.utc_offset == previous_offset
- puts zone.name
- previous_offset = zone.utc_offset
- end
- end
- puts "\n"
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/rails.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/rails.rb
deleted file mode 100644
index b9bc099f94c..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/rails.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-$VERBOSE = nil
-
-# Load Rails rakefile extensions
-Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext }
-
-# Load any custom rakefile extensions
-deprecated_paths = Dir["#{RAILS_ROOT}/vendor/plugins/*/tasks/**/*.rake"].sort
-if deprecated_paths.any?
- plugins = deprecated_paths.map { |p| $1 if p =~ %r((vendor/plugins/[^/]+/tasks)) }.compact
- ActiveSupport::Deprecation.warn "Rake tasks in #{plugins.to_sentence} are deprecated. Use lib/tasks instead."
- deprecated_paths.each { |ext| load ext }
-end
-Dir["#{RAILS_ROOT}/vendor/plugins/*/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
-Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/routes.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/routes.rake
deleted file mode 100644
index abbf3258c18..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/routes.rake
+++ /dev/null
@@ -1,18 +0,0 @@
-desc 'Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.'
-task :routes => :environment do
- all_routes = ENV['CONTROLLER'] ? ActionController::Routing::Routes.routes.select { |route| route.defaults[:controller] == ENV['CONTROLLER'] } : ActionController::Routing::Routes.routes
- routes = all_routes.collect do |route|
- name = ActionController::Routing::Routes.named_routes.routes.index(route).to_s
- verb = route.conditions[:method].to_s.upcase
- segs = route.segments.inject("") { |str,s| str << s.to_s }
- segs.chop! if segs.length > 1
- reqs = route.requirements.empty? ? "" : route.requirements.inspect
- {:name => name, :verb => verb, :segs => segs, :reqs => reqs}
- end
- name_width = routes.collect {|r| r[:name]}.collect {|n| n.length}.max
- verb_width = routes.collect {|r| r[:verb]}.collect {|v| v.length}.max
- segs_width = routes.collect {|r| r[:segs]}.collect {|s| s.length}.max
- routes.each do |r|
- puts "#{r[:name].rjust(name_width)} #{r[:verb].ljust(verb_width)} #{r[:segs].ljust(segs_width)} #{r[:reqs]}"
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/statistics.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/statistics.rake
deleted file mode 100644
index 5ab27a0f625..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/statistics.rake
+++ /dev/null
@@ -1,17 +0,0 @@
-STATS_DIRECTORIES = [
- %w(Controllers app/controllers),
- %w(Helpers app/helpers),
- %w(Models app/models),
- %w(Libraries lib/),
- %w(APIs app/apis),
- %w(Integration\ tests test/integration),
- %w(Functional\ tests test/functional),
- %w(Unit\ tests test/unit)
-
-].collect { |name, dir| [ name, "#{RAILS_ROOT}/#{dir}" ] }.select { |name, dir| File.directory?(dir) }
-
-desc "Report code statistics (KLOCs, etc) from the application"
-task :stats do
- require 'code_statistics'
- CodeStatistics.new(*STATS_DIRECTORIES).to_s
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/testing.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/testing.rake
deleted file mode 100644
index fd5e52a05bc..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/testing.rake
+++ /dev/null
@@ -1,139 +0,0 @@
-TEST_CHANGES_SINCE = Time.now - 600
-
-# Look up tests for recently modified sources.
-def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)
- FileList[source_pattern].map do |path|
- if File.mtime(path) > touched_since
- tests = []
- source_dir = File.dirname(path).split("/")
- source_file = File.basename(path, '.rb')
-
- # Support subdirs in app/models and app/controllers
- modified_test_path = source_dir.length > 2 ? "#{test_path}/" << source_dir[1..source_dir.length].join('/') : test_path
-
- # For modified files in app/ run the tests for it. ex. /test/functional/account_controller.rb
- test = "#{modified_test_path}/#{source_file}_test.rb"
- tests.push test if File.exist?(test)
-
- # For modified files in app, run tests in subdirs too. ex. /test/functional/account/*_test.rb
- test = "#{modified_test_path}/#{File.basename(path, '.rb').sub("_controller","")}"
- FileList["#{test}/*_test.rb"].each { |f| tests.push f } if File.exist?(test)
-
- return tests
-
- end
- end.flatten.compact
-end
-
-
-# Recreated here from ActiveSupport because :uncommitted needs it before Rails is available
-module Kernel
- def silence_stderr
- old_stderr = STDERR.dup
- STDERR.reopen(RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'NUL:' : '/dev/null')
- STDERR.sync = true
- yield
- ensure
- STDERR.reopen(old_stderr)
- end
-end
-
-desc 'Run all unit, functional and integration tests'
-task :test do
- errors = %w(test:units test:functionals test:integration).collect do |task|
- begin
- Rake::Task[task].invoke
- nil
- rescue => e
- task
- end
- end.compact
- abort "Errors running #{errors.to_sentence(:locale => :en)}!" if errors.any?
-end
-
-namespace :test do
- Rake::TestTask.new(:recent => "db:test:prepare") do |t|
- since = TEST_CHANGES_SINCE
- touched = FileList['test/**/*_test.rb'].select { |path| File.mtime(path) > since } +
- recent_tests('app/models/**/*.rb', 'test/unit', since) +
- recent_tests('app/controllers/**/*.rb', 'test/functional', since)
-
- t.libs << 'test'
- t.verbose = true
- t.test_files = touched.uniq
- end
- Rake::Task['test:recent'].comment = "Test recent changes"
-
- Rake::TestTask.new(:uncommitted => "db:test:prepare") do |t|
- def t.file_list
- if File.directory?(".svn")
- changed_since_checkin = silence_stderr { `svn status` }.map { |path| path.chomp[7 .. -1] }
- elsif File.directory?(".git")
- changed_since_checkin = silence_stderr { `git ls-files --modified --others` }.map { |path| path.chomp }
- else
- abort "Not a Subversion or Git checkout."
- end
-
- models = changed_since_checkin.select { |path| path =~ /app[\\\/]models[\\\/].*\.rb$/ }
- controllers = changed_since_checkin.select { |path| path =~ /app[\\\/]controllers[\\\/].*\.rb$/ }
-
- unit_tests = models.map { |model| "test/unit/#{File.basename(model, '.rb')}_test.rb" }
- functional_tests = controllers.map { |controller| "test/functional/#{File.basename(controller, '.rb')}_test.rb" }
-
- unit_tests.uniq + functional_tests.uniq
- end
-
- t.libs << 'test'
- t.verbose = true
- end
- Rake::Task['test:uncommitted'].comment = "Test changes since last checkin (only Subversion and Git)"
-
- Rake::TestTask.new(:units => "db:test:prepare") do |t|
- t.libs << "test"
- t.pattern = 'test/unit/**/*_test.rb'
- t.verbose = true
- end
- Rake::Task['test:units'].comment = "Run the unit tests in test/unit"
-
- Rake::TestTask.new(:functionals => "db:test:prepare") do |t|
- t.libs << "test"
- t.pattern = 'test/functional/**/*_test.rb'
- t.verbose = true
- end
- Rake::Task['test:functionals'].comment = "Run the functional tests in test/functional"
-
- Rake::TestTask.new(:integration => "db:test:prepare") do |t|
- t.libs << "test"
- t.pattern = 'test/integration/**/*_test.rb'
- t.verbose = true
- end
- Rake::Task['test:integration'].comment = "Run the integration tests in test/integration"
-
- Rake::TestTask.new(:benchmark => 'db:test:prepare') do |t|
- t.libs << 'test'
- t.pattern = 'test/performance/**/*_test.rb'
- t.verbose = true
- t.options = '-- --benchmark'
- end
- Rake::Task['test:benchmark'].comment = 'Benchmark the performance tests'
-
- Rake::TestTask.new(:profile => 'db:test:prepare') do |t|
- t.libs << 'test'
- t.pattern = 'test/performance/**/*_test.rb'
- t.verbose = true
- end
- Rake::Task['test:profile'].comment = 'Profile the performance tests'
-
- Rake::TestTask.new(:plugins => :environment) do |t|
- t.libs << "test"
-
- if ENV['PLUGIN']
- t.pattern = "vendor/plugins/#{ENV['PLUGIN']}/test/**/*_test.rb"
- else
- t.pattern = 'vendor/plugins/*/**/test/**/*_test.rb'
- end
-
- t.verbose = true
- end
- Rake::Task['test:plugins'].comment = "Run the plugin tests in vendor/plugins/*/**/test (or specify with PLUGIN=name)"
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/tmp.rake b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/tmp.rake
deleted file mode 100644
index fea15058bb8..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/tasks/tmp.rake
+++ /dev/null
@@ -1,37 +0,0 @@
-namespace :tmp do
- desc "Clear session, cache, and socket files from tmp/"
- task :clear => [ "tmp:sessions:clear", "tmp:cache:clear", "tmp:sockets:clear"]
-
- desc "Creates tmp directories for sessions, cache, sockets, and pids"
- task :create do
- FileUtils.mkdir_p(%w( tmp/sessions tmp/cache tmp/sockets tmp/pids ))
- end
-
- namespace :sessions do
- desc "Clears all files in tmp/sessions"
- task :clear do
- FileUtils.rm(Dir['tmp/sessions/[^.]*'])
- end
- end
-
- namespace :cache do
- desc "Clears all files and directories in tmp/cache"
- task :clear do
- FileUtils.rm_rf(Dir['tmp/cache/[^.]*'])
- end
- end
-
- namespace :sockets do
- desc "Clears all files in tmp/sockets"
- task :clear do
- FileUtils.rm(Dir['tmp/sockets/[^.]*'])
- end
- end
-
- namespace :pids do
- desc "Clears all files in tmp/pids"
- task :clear do
- FileUtils.rm(Dir['tmp/pids/[^.]*'])
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/webrick_server.rb b/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/webrick_server.rb
deleted file mode 100644
index 2f60151b222..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/gems/gems/rails-2.3.15/lib/webrick_server.rb
+++ /dev/null
@@ -1,156 +0,0 @@
-# Donated by Florian Gross
-
-require 'webrick'
-require 'cgi'
-require 'stringio'
-require 'dispatcher'
-
-include WEBrick
-
-class CGI #:nodoc:
- def stdinput
- @stdin || $stdin
- end
-
- def env_table
- @env_table || ENV
- end
-
- def initialize(type = "query", table = nil, stdin = nil)
- @env_table, @stdin = table, stdin
-
- if defined?(MOD_RUBY) && !ENV.key?("GATEWAY_INTERFACE")
- Apache.request.setup_cgi_env
- end
-
- extend QueryExtension
- @multipart = false
- if defined?(CGI_PARAMS)
- warn "do not use CGI_PARAMS and CGI_COOKIES"
- @params = CGI_PARAMS.dup
- @cookies = CGI_COOKIES.dup
- else
- initialize_query() # set @params, @cookies
- end
- @output_cookies = nil
- @output_hidden = nil
- end
-end
-
-# A custom dispatch servlet for use with WEBrick. It dispatches requests
-# (using the Rails Dispatcher) to the appropriate controller/action. By default,
-# it restricts WEBrick to a managing a single Rails request at a time, but you
-# can change this behavior by setting ActionController::Base.allow_concurrency
-# to true.
-class DispatchServlet < WEBrick::HTTPServlet::AbstractServlet
- # Start the WEBrick server with the given options, mounting the
- # DispatchServlet at <tt>/</tt>.
- def self.dispatch(options = {})
- Socket.do_not_reverse_lookup = true # patch for OS X
-
- params = { :Port => options[:port].to_i,
- :ServerType => options[:server_type],
- :BindAddress => options[:ip] }
- params[:MimeTypes] = options[:mime_types] if options[:mime_types]
-
- server = WEBrick::HTTPServer.new(params)
- server.mount('/', DispatchServlet, options)
-
- trap("INT") { server.shutdown }
- server.start
- end
-
- def initialize(server, options) #:nodoc:
- @server_options = options
- @file_handler = WEBrick::HTTPServlet::FileHandler.new(server, options[:server_root])
- # Change to the RAILS_ROOT, since Webrick::Daemon.start does a Dir::cwd("/")
- # OPTIONS['working_directory'] is an absolute path of the RAILS_ROOT, set in railties/lib/commands/servers/webrick.rb
- Dir.chdir(OPTIONS['working_directory']) if defined?(OPTIONS) && File.directory?(OPTIONS['working_directory'])
- super
- end
-
- def service(req, res) #:nodoc:
- unless handle_file(req, res)
- unless handle_dispatch(req, res)
- raise WEBrick::HTTPStatus::NotFound, "`#{req.path}' not found."
- end
- end
- end
-
- def handle_file(req, res) #:nodoc:
- begin
- req = req.dup
- path = req.path.dup
-
- # Add .html if the last path piece has no . in it
- path << '.html' if path != '/' && (%r{(^|/)[^./]+$} =~ path)
- path.gsub!('+', ' ') # Unescape + since FileHandler doesn't do so.
-
- req.instance_variable_set(:@path_info, path) # Set the modified path...
-
- @file_handler.send(:service, req, res)
- return true
- rescue HTTPStatus::PartialContent, HTTPStatus::NotModified => err
- res.set_error(err)
- return true
- rescue => err
- return false
- end
- end
-
- def handle_dispatch(req, res, origin = nil) #:nodoc:
- data = StringIO.new
- Dispatcher.dispatch(
- CGI.new("query", create_env_table(req, origin), StringIO.new(req.body || "")),
- ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS,
- data
- )
-
- header, body = extract_header_and_body(data)
-
- set_charset(header)
- assign_status(res, header)
- res.cookies.concat(header.delete('set-cookie') || [])
- header.each { |key, val| res[key] = val.join(", ") }
-
- res.body = body
- return true
- rescue => err
- p err, err.backtrace
- return false
- end
-
- private
- def create_env_table(req, origin)
- env = req.meta_vars.clone
- env.delete "SCRIPT_NAME"
- env["QUERY_STRING"] = req.request_uri.query
- env["REQUEST_URI"] = origin if origin
- return env
- end
-
- def extract_header_and_body(data)
- data.rewind
- data = data.read
-
- raw_header, body = *data.split(/^[\xd\xa]{2}/on, 2)
- header = WEBrick::HTTPUtils::parse_header(raw_header)
-
- return header, body
- end
-
- def set_charset(header)
- ct = header["content-type"]
- if ct.any? { |x| x =~ /^text\// } && ! ct.any? { |x| x =~ /charset=/ }
- ch = @server_options[:charset] || "UTF-8"
- ct.find { |x| x =~ /^text\// } << ("; charset=" + ch)
- end
- end
-
- def assign_status(res, header)
- if /^(\d+)/ =~ header['status'][0]
- res.status = $1.to_i
- header.delete('status')
- end
- end
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/acts_as_tree/Rakefile b/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/acts_as_tree/Rakefile
deleted file mode 100644
index da091d9dd92..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/acts_as_tree/Rakefile
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test acts_as_tree plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for acts_as_tree plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'acts_as_tree'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/Rakefile b/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/Rakefile
deleted file mode 100644
index c764e2be4c9..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/Rakefile
+++ /dev/null
@@ -1,22 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the http_accept_language plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the http_accept_language plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'HttpAcceptLanguage'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/tasks/http_accept_language_tasks.rake b/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/tasks/http_accept_language_tasks.rake
deleted file mode 100644
index cfa4476090f..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/http_accept_language/tasks/http_accept_language_tasks.rake
+++ /dev/null
@@ -1,4 +0,0 @@
-# desc "Explaining what the task does"
-# task :http_accept_language do
-# # Task goes here
-# end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/README.textile b/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/README.textile
deleted file mode 100644
index 162e182fb76..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/README.textile
+++ /dev/null
@@ -1,224 +0,0 @@
-h1. "Restful Authentication Generator":http://github.com/technoweenie/restful-authentication
-
-This widely-used plugin provides a foundation for securely managing user
-authentication:
-* Login / logout
-* Secure password handling
-* Account activation by validating email
-* Account approval / disabling by admin
-* Rudimentary hooks for authorization and access control.
-
-Several features were updated in May, 2008.
-* "Stable newer version":http://github.com/technoweenie/restful-authentication/tree/master
-* "'Classic' (backward-compatible) version":http://github.com/technoweenie/restful-authentication/tree/classic
-* "Experimental version":http://github.com/technoweenie/restful-authentication/tree/modular (Much more modular, needs testing & review)
-
- !! important: if you upgrade your site, existing user account !!
- !! passwords will stop working unless you use --old-passwords !!
-
-***************************************************************************
-
-h2. Issue Tracker
-
-Please submit any bugs or annoyances on the lighthouse tracker at
-* "http://rails_security.lighthouseapp.com/projects/15332-restful_authentication/overview":http://rails_security.lighthouseapp.com/projects/15332-restful_authentication/overview
-
-For anything simple enough, please github message both maintainers: Rick Olson
-("technoweenie":http://github.com/technoweenie) and Flip Kromer
-("mrflip":http://github.com/mrflip).
-
-***************************************************************************
-
-h2. Documentation
-
-This page has notes on
-* "Installation":#INSTALL
-* "New Features":#AWESOME
-* "After installing":#POST-INSTALL
-
-See the "wiki":http://github.com/technoweenie/restful-authentication/wikis/home
-(or the notes/ directory) if you want to learn more about:
-
-* "Extensions, Addons and Alternatives":addons such as HAML templates
-* "Security Design Patterns":security-patterns with "snazzy diagram":http://github.com/technoweenie/restful-authentication/tree/master/notes/SecurityFramework.png
-* [[Authentication]] -- Lets a visitor identify herself (and lay claim to her corresponding Roles and measure of Trust)
-* "Trust Metrics":Trustification -- Confidence we can rely on the outcomes of this visitor's actions.
-* [[Authorization]] and Policy -- Based on trust and identity, what actions may this visitor perform?
-* [[Access Control]] -- How the Authorization policy is actually enforced in your code (A: hopefully without turning it into a spaghetti of if thens)
-* [[Rails Plugins]] for Authentication, Trust, Authorization and Access Control
-* [[Tradeoffs]] -- for the paranoid or the curious, a rundown of tradeoffs made in the code
-* [[CHANGELOG]] -- Summary of changes to internals
-* [[TODO]] -- Ideas for how you can help
-
-These best version of the release notes are in the notes/ directory in the
-"source code":http://github.com/technoweenie/restful-authentication/tree/master
--- look there for the latest version. The wiki versions are taken (manually)
-from there.
-
-***************************************************************************
-
-<a id="AWESOME"/> </a>
-h2. Exciting new features
-
-h3. Stories
-
-There are now "Cucumber":http://wiki.github.com/aslakhellesoy/cucumber/home features that allow expressive, enjoyable tests for the
-authentication code. The flexible code for resource testing in stories was
-extended from "Ben Mabey's.":http://www.benmabey.com/2008/02/04/rspec-plain-text-stories-webrat-chunky-bacon/
-
-h3. Modularize to match security design patterns:
-
-* Authentication (currently: password, browser cookie token, HTTP basic)
-* Trust metric (email validation)
-* Authorization (stateful roles)
-* Leave a flexible framework that will play nicely with other access control / policy definition / trust metric plugins
-
-h3. Other
-
-* Added a few helper methods for linking to user pages
-* Uniform handling of logout, remember_token
-* Stricter email, login field validation
-* Minor security fixes -- see CHANGELOG
-
-***************************************************************************
-
-h2. Non-backwards compatible Changes
-
-Here are a few changes in the May 2008 release that increase "Defense in Depth"
-but may require changes to existing accounts
-
-* If you have an existing site, none of these changes are compelling enough to
- warrant migrating your userbase.
-* If you are generating for a new site, all of these changes are low-impact.
- You should apply them.
-
-h3. Passwords
-
-The new password encryption (using a site key salt and stretching) will break
-existing user accounts' passwords. We recommend you use the --old-passwords
-option or write a migration tool and submit it as a patch. See the
-[[Tradeoffs]] note for more information.
-
-h3. Validations
-
-By default, email and usernames are validated against a somewhat strict pattern; your users' values may be now illegal. Adjust to suit.
-
-***************************************************************************
-
-<a id="INSTALL"/> </a>
-h2. Installation
-
-This is a basic restful authentication generator for rails, taken from
-acts as authenticated. Currently it requires Rails 1.2.6 or above.
-
-**IMPORTANT FOR RAILS > 2.1 USERS** To avoid a @NameError@ exception ("lighthouse tracker ticket":http://rails_security.lighthouseapp.com/projects/15332-restful_authentication/tickets/2-not-a-valid-constant-name-errors#ticket-2-2), check out the code to have an _underscore_ and not _dash_ in its name:
-* either use <code>git clone git://github.com/technoweenie/restful-authentication.git restful_authentication</code>
-* or rename the plugin's directory to be <code>restful_authentication</code> after fetching it.
-
-To use the generator:
-
- ./script/generate authenticated user sessions \
- --include-activation \
- --stateful \
- --rspec \
- --skip-migration \
- --skip-routes \
- --old-passwords
-
-* The first parameter specifies the model that gets created in signup (typically
- a user or account model). A model with migration is created, as well as a
- basic controller with the create method. You probably want to say "User" here.
-
-* The second parameter specifies the session controller name. This is the
- controller that handles the actual login/logout function on the site.
- (probably: "Session").
-
-* --include-activation: Generates the code for a ActionMailer and its respective
- Activation Code through email.
-
-* --stateful: Builds in support for acts_as_state_machine and generates
- activation code. (@--stateful@ implies @--include-activation@). Based on the
- idea at [[http://www.vaporbase.com/postings/stateful_authentication]]. Passing
- @--skip-migration@ will skip the user migration, and @--skip-routes@ will skip
- resource generation -- both useful if you've already run this generator.
- (Needs the "acts_as_state_machine plugin":http://elitists.textdriven.com/svn/plugins/acts_as_state_machine/,
- but new installs should probably run with @--aasm@ instead.)
-
-* --aasm: Works the same as stateful but uses the "updated aasm gem":http://github.com/rubyist/aasm/tree/master
-
-* --rspec: Generate RSpec tests and Stories in place of standard rails tests.
- This requires the
- "RSpec and Rspec-on-rails plugins":http://rspec.info/
- (make sure you "./script/generate rspec" after installing RSpec.) The rspec
- and story suite are much more thorough than the rails tests, and changes are
- unlikely to be backported.
-
-* --old-passwords: Use the older password scheme (see [[#COMPATIBILITY]], above)
-
-* --skip-migration: Don't generate a migration file for this model
-
-* --skip-routes: Don't generate a resource line in @config/routes.rb@
-
-***************************************************************************
-<a id="POST-INSTALL"/> </a>
-h2. After installing
-
-The below assumes a Model named 'User' and a Controller named 'Session'; please
-alter to suit. There are additional security minutae in @notes/README-Tradeoffs@
--- only the paranoid or the curious need bother, though.
-
-* Add these familiar login URLs to your @config/routes.rb@ if you like:
-
- <pre><code>
- map.signup '/signup', :controller => 'users', :action => 'new'
- map.login '/login', :controller => 'session', :action => 'new'
- map.logout '/logout', :controller => 'session', :action => 'destroy'
- </code></pre>
-
-* With @--include-activation@, also add to your @config/routes.rb@:
-
- <pre><code>
- map.activate '/activate/:activation_code', :controller => 'users', :action => 'activate', :activation_code => nil
- </code></pre>
-
- and add an observer to @config/environment.rb@:
-
- <pre><code>
- config.active_record.observers = :user_observer
- </code></pre>
-
- Pay attention, may be this is not an issue for everybody, but if you should
- have problems, that the sent activation_code does match with that in the
- database stored, reload your user object before sending its data through email
- something like:
-
- <pre><code>
- class UserObserver < ActiveRecord::Observer
- def after_create(user)
- user.reload
- UserMailer.deliver_signup_notification(user)
- end
- def after_save(user)
- user.reload
- UserMailer.deliver_activation(user) if user.recently_activated?
- end
- end
- </code></pre>
-
-
-* With @--stateful@, add an observer to config/environment.rb:
-
- <pre><code>
- config.active_record.observers = :user_observer
- </code></pre>
-
- and modify the users resource line to read
-
- map.resources :users, :member => { :suspend => :put,
- :unsuspend => :put,
- :purge => :delete }
-
-* If you use a public repository for your code (such as github, rubyforge,
- gitorious, etc.) make sure to NOT post your site_keys.rb (add a line like
- '/config/initializers/site_keys.rb' to your .gitignore or do the svn ignore
- dance), but make sure you DO keep it backed up somewhere safe.
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/Rakefile b/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/Rakefile
deleted file mode 100644
index 8a87bffd7f0..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/Rakefile
+++ /dev/null
@@ -1,32 +0,0 @@
-require 'rake'
-require 'rake/testtask'
-require 'rake/rdoctask'
-require 'rake/gempackagetask'
-
-desc 'Default: run unit tests.'
-task :default => :test
-
-desc 'Test the restful_authentication plugin.'
-Rake::TestTask.new(:test) do |t|
- t.libs << 'lib'
- t.pattern = 'test/**/*_test.rb'
- t.verbose = true
-end
-
-desc 'Generate documentation for the restful_authentication plugin.'
-Rake::RDocTask.new(:rdoc) do |rdoc|
- rdoc.rdoc_dir = 'rdoc'
- rdoc.title = 'RestfulAuthentication'
- rdoc.options << '--line-numbers' << '--inline-source'
- rdoc.rdoc_files.include('README')
- rdoc.rdoc_files.include('lib/**/*.rb')
-end
-
-gemspec = eval(File.read("#{File.dirname(__FILE__)}/restful-authentication.gemspec"))
-PKG_NAME = gemspec.name
-PKG_VERSION = gemspec.version
-
-Rake::GemPackageTask.new(gemspec) do |pkg|
- pkg.need_zip = true
- pkg.need_tar = true
-end
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/TODO b/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/TODO
deleted file mode 100644
index 30968ada9cf..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/TODO
+++ /dev/null
@@ -1,15 +0,0 @@
-
-h3. Authentication security projects for a later date
-
-
-* Track 'failed logins this hour' and demand a captcha after say 5 failed logins
- ("RECAPTCHA plugin.":http://agilewebdevelopment.com/plugins/recaptcha)
- "De-proxy-ficate IP address": http://wiki.codemongers.com/NginxHttpRealIpModule
-
-* Make cookie spoofing a little harder: we set the user's cookie to
- (remember_token), but store digest(remember_token, request_IP). A CSRF cookie
- spoofer has to then at least also spoof the user's originating IP
- (see "Secure Programs HOWTO":http://www.dwheeler.com/secure-programs/Secure-Programs-HOWTO/web-authentication.html)
-
-* Log HTTP request on authentication / authorization failures
- http://palisade.plynt.com/issues/2004Jul/safe-auth-practices
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/tasks/auth.rake b/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/tasks/auth.rake
deleted file mode 100644
index 5fe72212095..00000000000
--- a/server/sonar-web/src/main/webapp/WEB-INF/vendor/plugins/restful_authentication/tasks/auth.rake
+++ /dev/null
@@ -1,33 +0,0 @@
-require 'digest/sha1'
-require 'erb'
-
-def site_keys_file
- File.join("config", "initializers", "site_keys.rb")
-end
-
-def secure_digest(*args)
- Digest::SHA1.hexdigest(args.flatten.join('--'))
-end
-
-def make_token
- secure_digest(Time.now, (1..10).map{ rand.to_s })
-end
-
-def make_site_keys_rb
- site_key = secure_digest(Time.now, (1..10).map{ rand.to_s })
- site_key_erb = <<-EOF
-# key of 40 chars length
-REST_AUTH_SITE_KEY = '#{site_key}'
-REST_AUTH_DIGEST_STRETCHES = 10
-EOF
-end
-
-namespace :auth do
- namespace :gen do
- desc "Generates config/initializers/site_keys.rb"
- task :site_key do
- file = ENV['file'] || site_keys_file
- File.open(file, "w"){|f| f.write(make_site_keys_rb)}
- end
- end
-end
diff --git a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java
index 144a34b292b..6c1992ac1e2 100644
--- a/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java
+++ b/sonar-batch-protocol/src/main/java/org/sonar/batch/protocol/input/ActiveRule.java
@@ -26,12 +26,13 @@ import java.util.Map;
public class ActiveRule {
private final String repositoryKey, ruleKey;
- private final String severity, internalKey, language;
+ private final String name, severity, internalKey, language;
private final Map<String, String> params = new HashMap<String, String>();
- public ActiveRule(String repositoryKey, String ruleKey, String severity, String internalKey, String language) {
+ public ActiveRule(String repositoryKey, String ruleKey, String name, String severity, String internalKey, String language) {
this.repositoryKey = repositoryKey;
this.ruleKey = ruleKey;
+ this.name = name;
this.severity = severity;
this.internalKey = internalKey;
this.language = language;
@@ -45,6 +46,10 @@ public class ActiveRule {
return ruleKey;
}
+ public String name() {
+ return name;
+ }
+
public String severity() {
return severity;
}
diff --git a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java
index 831f5e12cef..328939ca23d 100644
--- a/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java
+++ b/sonar-batch-protocol/src/test/java/org/sonar/batch/protocol/input/ProjectReferentialsTest.java
@@ -38,7 +38,7 @@ public class ProjectReferentialsTest {
ref.addQProfile(new QProfile("squid-java", "Java", "java", new SimpleDateFormat("dd/MM/yyyy").parse("14/03/1984")));
ref.addSettings("foo", new HashMap<String, String>());
ref.settings("foo").put("prop", "value");
- ref.addActiveRule(new ActiveRule("repo", "rule", "MAJOR", "rule", "java"));
+ ref.addActiveRule(new ActiveRule("repo", "rule", "Rule", "MAJOR", "rule", "java"));
ref.setTimestamp(10);
System.out.println(ref.toJson());
@@ -46,7 +46,7 @@ public class ProjectReferentialsTest {
.assertEquals(
"{timestamp:10,"
+ "qprofilesByLanguage:{java:{key:\"squid-java\",name:Java,language:java,rulesUpdatedAt:\"Mar 14, 1984 12:00:00 AM\"}},"
- + "activeRules:[{repositoryKey:repo,ruleKey:rule,severity:MAJOR,internalKey:rule,language:java,params:{}}],"
+ + "activeRules:[{repositoryKey:repo,ruleKey:rule,name:Rule,severity:MAJOR,internalKey:rule,language:java,params:{}}],"
+ "settingsByModule:{foo:{prop:value}}}",
ref.toJson(), true);
}
diff --git a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
index 3ca6ff97634..4405eb259e8 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/referential/DefaultProjectReferentialsLoader.java
@@ -96,7 +96,7 @@ public class DefaultProjectReferentialsLoader implements ProjectReferentialsLoad
} else {
internalKey = rule.getConfigKey();
}
- ActiveRule activeRule = new ActiveRule(rule.ruleKey().repository(), rule.ruleKey().rule(), activeDto.getSeverityString(), internalKey, rule.getLanguage());
+ ActiveRule activeRule = new ActiveRule(rule.ruleKey().repository(), rule.ruleKey().rule(), rule.getName(), activeDto.getSeverityString(), internalKey, rule.getLanguage());
// load parameter values
for (ActiveRuleParamDto paramDto : paramDtosByActiveRuleId.get(activeDto.getId())) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java b/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java
index 9b6b009d3df..a539b744073 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/rule/ActiveRulesProvider.java
@@ -48,6 +48,7 @@ public class ActiveRulesProvider extends ProviderAdapter {
ActiveRulesBuilder builder = new ActiveRulesBuilder();
for (ActiveRule activeRule : ref.activeRules()) {
NewActiveRule newActiveRule = builder.create(RuleKey.of(activeRule.repositoryKey(), activeRule.ruleKey()));
+ newActiveRule.setName(activeRule.name());
newActiveRule.setSeverity(activeRule.severity());
newActiveRule.setLanguage(activeRule.language());
newActiveRule.setInternalKey(activeRule.internalKey());
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultSensorContext.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultSensorContext.java
index c2119b18d02..6f4b2bdec70 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultSensorContext.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/DefaultSensorContext.java
@@ -24,9 +24,8 @@ import org.sonar.api.batch.bootstrap.ProjectDefinition;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.Metric;
-import org.sonar.api.batch.rule.ActiveRule;
import org.sonar.api.batch.rule.ActiveRules;
-import org.sonar.api.batch.rule.Rule;
+import org.sonar.api.batch.rule.internal.DefaultActiveRule;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.issue.Issue;
import org.sonar.api.batch.sensor.issue.IssueBuilder;
@@ -129,22 +128,16 @@ public class DefaultSensorContext implements SensorContext {
resourceKey = def.getKey();
}
RuleKey ruleKey = issue.ruleKey();
- // TODO we need a Rule referential on batch side
- Rule rule = null;
- // Rule rule = rules.find(ruleKey);
- // if (rule == null) {
- // throw MessageException.of(String.format("The rule '%s' does not exist.", ruleKey));
- // }
- ActiveRule activeRule = activeRules.find(ruleKey);
+ DefaultActiveRule activeRule = (DefaultActiveRule) activeRules.find(ruleKey);
if (activeRule == null) {
// rule does not exist or is not enabled -> ignore the issue
return false;
}
- if (/* Strings.isNullOrEmpty(rule.name()) && */Strings.isNullOrEmpty(issue.message())) {
+ if (Strings.isNullOrEmpty(activeRule.name()) && Strings.isNullOrEmpty(issue.message())) {
throw MessageException.of(String.format("The rule '%s' has no name and the related issue has no message.", ruleKey));
}
- updateIssue((DefaultIssue) issue, activeRule, rule);
+ updateIssue((DefaultIssue) issue, activeRule);
if (issueFilters.accept(SensorContextAdaptor.toDefaultIssue(def.getKey(), resourceKey, issue), null)) {
issueCache.put(def.getKey(), resourceKey, (DefaultIssue) issue);
@@ -154,9 +147,9 @@ public class DefaultSensorContext implements SensorContext {
return false;
}
- private void updateIssue(DefaultIssue issue, ActiveRule activeRule, Rule rule) {
+ private void updateIssue(DefaultIssue issue, DefaultActiveRule activeRule) {
if (Strings.isNullOrEmpty(issue.message())) {
- issue.setMessage(rule.name());
+ issue.setMessage(activeRule.name());
}
if (issue.severity() == null) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java
index edde874cdae..67e2a37908d 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanContainer.java
@@ -82,7 +82,6 @@ public class ModuleScanContainer extends ComponentContainer {
ModuleScanExecutor.class,
ModuleScanExecutor.getPhaseClasses(),
moduleDefinition.getContainerExtensions(),
- AnalyzersExecutor.class,
// file system
ModuleInputFileCache.class,
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java
index 0f96f195698..8611bd3b26a 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/ModuleScanExecutor.java
@@ -19,12 +19,10 @@
*/
package org.sonar.batch.scan2;
-import org.sonar.api.batch.sensor.SensorContext;
-
import com.google.common.collect.Lists;
import org.sonar.api.batch.bootstrap.ProjectDefinition;
+import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.batch.issue.ignore.scanner.IssueExclusionsLoader;
-import org.sonar.batch.phases.SensorsExecutor;
import org.sonar.batch.rule.QProfileVerifier;
import org.sonar.batch.scan.filesystem.DefaultModuleFileSystem;
import org.sonar.batch.scan.filesystem.FileSystemLogger;
@@ -33,7 +31,7 @@ import java.util.Collection;
public final class ModuleScanExecutor {
- private final AnalyzersExecutor analyzersExecutor;
+ private final SensorsExecutor analyzersExecutor;
private final SensorContext analyzerContext;
private final FileSystemLogger fsLogger;
private final DefaultModuleFileSystem fs;
@@ -42,7 +40,7 @@ public final class ModuleScanExecutor {
private AnalysisPublisher analyzisPublisher;
- public ModuleScanExecutor(AnalyzersExecutor analyzersExecutor,
+ public ModuleScanExecutor(SensorsExecutor analyzersExecutor,
SensorContext analyzerContext,
FileSystemLogger fsLogger, DefaultModuleFileSystem fs, QProfileVerifier profileVerifier,
IssueExclusionsLoader issueExclusionsLoader, AnalysisPublisher analyzisPublisher) {
diff --git a/sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzersExecutor.java b/sonar-batch/src/main/java/org/sonar/batch/scan2/SensorsExecutor.java
index 54e6b1397ac..14b6326b150 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/scan2/AnalyzersExecutor.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/scan2/SensorsExecutor.java
@@ -30,14 +30,14 @@ import org.sonar.batch.bootstrap.BatchExtensionDictionnary;
import java.util.Collection;
-public class AnalyzersExecutor implements BatchComponent {
+public class SensorsExecutor implements BatchComponent {
- private static final Logger LOG = LoggerFactory.getLogger(AnalyzersExecutor.class);
+ private static final Logger LOG = LoggerFactory.getLogger(SensorsExecutor.class);
private BatchExtensionDictionnary selector;
private AnalyzerOptimizer optimizer;
- public AnalyzersExecutor(BatchExtensionDictionnary selector, AnalyzerOptimizer optimizer) {
+ public SensorsExecutor(BatchExtensionDictionnary selector, AnalyzerOptimizer optimizer) {
this.selector = selector;
this.optimizer = optimizer;
}
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java
index ace6681869b..674f472d0b5 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/fs/FileSystemMediumTest.java
@@ -50,7 +50,7 @@ public class FileSystemMediumTest {
public BatchMediumTester tester = BatchMediumTester.builder()
.registerPlugin("xoo", new XooPlugin())
.addDefaultQProfile("xoo", "Sonar Way")
- .activateRule(new ActiveRule("xoo", "OneIssuePerLine", "MAJOR", "xoo", "xoo"))
+ .activateRule(new ActiveRule("xoo", "OneIssuePerLine", "One issue per line", "MAJOR", "xoo", "xoo"))
.bootstrapProperties(ImmutableMap.of("sonar.analysis.mode", "sensor"))
.build();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesMediumTest.java
index 3fec3ccb251..875e7e6d510 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesMediumTest.java
@@ -45,7 +45,7 @@ public class IssuesMediumTest {
public BatchMediumTester tester = BatchMediumTester.builder()
.registerPlugin("xoo", new XooPlugin())
.addDefaultQProfile("xoo", "Sonar Way")
- .activateRule(new ActiveRule("xoo", "OneIssuePerLine", "MAJOR", "OneIssuePerLine.internal", "xoo"))
+ .activateRule(new ActiveRule("xoo", "OneIssuePerLine", "One issue per line", "MAJOR", "OneIssuePerLine.internal", "xoo"))
.bootstrapProperties(ImmutableMap.of("sonar.analysis.mode", "sensor"))
.build();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesOnDirMediumTest.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesOnDirMediumTest.java
index bbd1aefd719..fdf6b15e857 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesOnDirMediumTest.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/issues/IssuesOnDirMediumTest.java
@@ -44,7 +44,7 @@ public class IssuesOnDirMediumTest {
public BatchMediumTester tester = BatchMediumTester.builder()
.registerPlugin("xoo", new XooPlugin())
.addDefaultQProfile("xoo", "Sonar Way")
- .activateRule(new ActiveRule("xoo", "OneIssueOnDirPerFile", "MINOR", "xoo", "xoo"))
+ .activateRule(new ActiveRule("xoo", "OneIssueOnDirPerFile", "One issue per line", "MINOR", "xoo", "xoo"))
.bootstrapProperties(ImmutableMap.of("sonar.analysis.mode", "sensor"))
.build();
diff --git a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java
index bd38dee8fbc..2a811068e54 100644
--- a/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java
+++ b/sonar-batch/src/test/java/org/sonar/batch/mediumtest/xoo/plugin/rule/OneIssuePerLineSensor.java
@@ -24,6 +24,7 @@ import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.sensor.Sensor;
import org.sonar.api.batch.sensor.SensorContext;
import org.sonar.api.batch.sensor.SensorDescriptor;
+import org.sonar.api.batch.sensor.issue.IssueBuilder;
import org.sonar.api.batch.sensor.measure.Measure;
import org.sonar.api.measures.CoreMetrics;
import org.sonar.api.rule.RuleKey;
@@ -58,8 +59,9 @@ public class OneIssuePerLineSensor implements Sensor {
if (linesMeasure == null) {
LoggerFactory.getLogger(getClass()).warn("Missing measure " + CoreMetrics.LINES_KEY + " on " + file);
} else {
+ IssueBuilder issueBuilder = context.issueBuilder();
for (int line = 1; line <= (Integer) linesMeasure.value(); line++) {
- context.addIssue(context.issueBuilder()
+ context.addIssue(issueBuilder
.ruleKey(ruleKey)
.onFile(file)
.atLine(line)
diff --git a/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java b/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java
index cb8c8dac1a0..9d74af46428 100644
--- a/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/component/db/ComponentMapper.java
@@ -19,8 +19,11 @@
*/
package org.sonar.core.component.db;
+import org.apache.ibatis.annotations.Param;
import org.sonar.core.component.ComponentDto;
+import java.util.List;
+
/**
* @since 4.3
*/
@@ -30,6 +33,8 @@ public interface ComponentMapper {
ComponentDto selectById(long id);
+ List<ComponentDto> findModulesByProject(@Param("projectKey") String projectKey);
+
long countById(long id);
void insert(ComponentDto rule);
diff --git a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java
index 756ed70d824..4357258a1b4 100644
--- a/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/properties/PropertiesDao.java
@@ -95,11 +95,14 @@ public class PropertiesDao implements BatchComponent, ServerComponent, DaoCompon
}
}
+ public List<PropertyDto> selectProjectProperties(String resourceKey, SqlSession session) {
+ return session.getMapper(PropertiesMapper.class).selectProjectProperties(resourceKey);
+ }
+
public List<PropertyDto> selectProjectProperties(String resourceKey) {
SqlSession session = mybatis.openSession(false);
- PropertiesMapper mapper = session.getMapper(PropertiesMapper.class);
try {
- return mapper.selectProjectProperties(resourceKey);
+ return selectProjectProperties(resourceKey, session);
} finally {
MyBatis.closeQuietly(session);
}
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
index 45189d64df9..01244ef1ae2 100644
--- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
+++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileDao.java
@@ -187,12 +187,17 @@ public class QualityProfileDao implements ServerComponent, DaoComponent {
public QualityProfileDto getByProjectAndLanguage(long projectId, String language, String key) {
DbSession session = mybatis.openSession(false);
try {
- return session.getMapper(QualityProfileMapper.class).selectByProjectAndLanguage(projectId, language, key);
+ return session.getMapper(QualityProfileMapper.class).selectByProjectIdAndLanguage(projectId, language, key);
} finally {
MyBatis.closeQuietly(session);
}
}
+ @CheckForNull
+ public QualityProfileDto getByProjectAndLanguage(String projectKey, String language, String propertyKeyPrefix, DbSession session) {
+ return session.getMapper(QualityProfileMapper.class).selectByProjectAndLanguage(projectKey, language, propertyKeyPrefix);
+ }
+
public List<QualityProfileDto> findByLanguage(String language) {
DbSession session = mybatis.openSession(false);
try {
diff --git a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java
index cef07f9a24a..3ba36880451 100644
--- a/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java
+++ b/sonar-core/src/main/java/org/sonar/core/qualityprofile/db/QualityProfileMapper.java
@@ -67,5 +67,7 @@ public interface QualityProfileMapper {
int countProjects(@Param("value") String propertyValue, @Param("key") String propertyKey);
- QualityProfileDto selectByProjectAndLanguage(@Param("projectId") Long projectId, @Param("language") String language, @Param("key") String propertyKeyPrefix);
+ QualityProfileDto selectByProjectIdAndLanguage(@Param("projectId") Long projectId, @Param("language") String language, @Param("key") String propertyKeyPrefix);
+
+ QualityProfileDto selectByProjectAndLanguage(@Param("projectKey") String projectKey, @Param("language") String language, @Param("propertyKey") String propertyKeyPrefix);
}
diff --git a/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml b/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml
index de9ad8a46b5..f0dc353a03a 100644
--- a/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/component/db/ComponentMapper.xml
@@ -18,21 +18,41 @@
<select id="selectByKey" parameterType="String" resultType="Component">
SELECT <include refid="componentColumns"/>
FROM projects p
- INNER JOIN snapshots s on s.project_id=p.id and s.islast=${_true}
- WHERE p.enabled=${_true} AND p.kee=#{key}
+ INNER JOIN snapshots s ON s.project_id=p.id AND s.islast=${_true}
+ <where>
+ AND p.enabled=${_true}
+ AND p.kee=#{key}
+ </where>
</select>
<select id="selectById" parameterType="long" resultType="Component">
SELECT <include refid="componentColumns"/>
FROM projects p
- INNER JOIN snapshots s on s.project_id=p.id and s.islast=${_true}
- WHERE p.enabled=${_true} AND p.id=#{id}
+ INNER JOIN snapshots s ON s.project_id=p.id AND s.islast=${_true}
+ <where>
+ AND p.enabled=${_true}
+ AND p.id=#{id}
+ </where>
</select>
<select id="countById" parameterType="long" resultType="long">
SELECT count(p.id)
FROM projects p
- WHERE p.enabled=${_true} AND p.id=#{id}
+ <where>
+ AND p.enabled=${_true}
+ AND p.id=#{id}
+ </where>
+ </select>
+
+ <select id="findModulesByProject" parameterType="String" resultType="Component">
+ SELECT <include refid="componentColumns"/>
+ FROM projects p
+ INNER JOIN projects root ON root.id=p.root_id AND root.enabled=${_true} AND root.kee=#{projectKey}
+ INNER JOIN snapshots s ON s.project_id=p.id AND s.islast=${_true}
+ <where>
+ AND p.enabled=${_true}
+ AND p.scope='PRJ'
+ </where>
</select>
<sql id="insertColumns">
diff --git a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
index 84c2ae5e101..b8a6ea50889 100644
--- a/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
+++ b/sonar-core/src/main/resources/org/sonar/core/qualityprofile/db/QualityProfileMapper.xml
@@ -114,7 +114,7 @@
</where>
</select>
- <select id="selectByProjectAndLanguage" parameterType="map" resultType="QualityProfile">
+ <select id="selectByProjectIdAndLanguage" parameterType="map" resultType="QualityProfile">
SELECT <include refid="profilesColumns"/>
FROM rules_profiles p
INNER JOIN properties prop ON prop.resource_id=#{projectId}
@@ -123,5 +123,17 @@
WHERE p.language=#{language}
</select>
+ <select id="selectByProjectAndLanguage" parameterType="map" resultType="QualityProfile">
+ SELECT <include refid="profilesColumns"/>
+ FROM rules_profiles p, projects project
+ INNER JOIN properties prop ON prop.resource_id=project.id
+ <where>
+ AND p.language=#{language}
+ AND prop.prop_key LIKE #{propertyKey}
+ AND prop.text_value LIKE p.name
+ AND project.kee=#{projectKey}
+ </where>
+ </select>
+
</mapper>
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 8d538ffb626..2d8b6615c1b 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -1716,6 +1716,8 @@ coding_rules.create_manual_rule=Create Manual Rule
coding_rules.custom_rule=Custom Rule
coding_rules.custom_rule.title=This rule has been created through customization of a rule template
coding_rules.custom_rules=Custom Rules
+coding_rules.delete.custom.confirm=Are you sure you want to delete custom rule "{0}"?
+coding_rules.delete.manual.confirm=Are you sure you want to delete manual rule "{0}"?
coding_rules.extend_description=Extend Description
coding_rules.deactivate_in=Deactivate In
coding_rules.deactivate=Deactivate
@@ -2651,7 +2653,7 @@ component_viewer.measure_section.issues=Issues
component_viewer.measure_section.sqale=SQALE
component_viewer.measure_section.unit_tests=Unit Tests
component_viewer.measure_section.tests=Tests
-component_viewer.measure_section.test_names=Test Names
+component_viewer.measure_section.test_cases=Test Cases
component_viewer.measure_section.integration_tests=Integration Tests
component_viewer.measure_section.overall=Overall
@@ -2673,9 +2675,9 @@ component_viewer.transition.coverage=Covered By
component_viewer.transition.covers=Covers
component_viewer.transition.duplication=Duplicated By
-component_viewer.tests.sort_by=Sort by
-component_viewer.tests.duration=Duration
-component_viewer.tests.test_name=Test Name
+component_viewer.tests.ordered_by=ordered by
+component_viewer.tests.duration=duration
+component_viewer.tests.test_name=name
component_viewer.x_lines_are_covered={0} lines are covered
component_viewer.details=Details
diff --git a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
index 1f1c8554acf..21386e7be70 100644
--- a/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
+++ b/sonar-core/src/test/java/org/sonar/core/qualityprofile/db/QualityProfileDaoTest.java
@@ -20,6 +20,7 @@
package org.sonar.core.qualityprofile.db;
+import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.sonar.api.utils.System2;
@@ -36,14 +37,21 @@ import static org.mockito.Mockito.when;
public class QualityProfileDaoTest extends AbstractDaoTestCase {
QualityProfileDao dao;
+ DbSession session;
System2 system = mock(System2.class);
@Before
public void createDao() {
+ this.session = getMyBatis().openSession(false);
dao = new QualityProfileDao(getMyBatis(), system);
when(system.now()).thenReturn(UtcDateUtils.parseDateTime("2014-01-20T12:00:00+0000").getTime());
}
+ @After
+ public void after() {
+ this.session.close();
+ }
+
@Test
public void insert() {
setupData("shared");
@@ -217,10 +225,21 @@ public class QualityProfileDaoTest extends AbstractDaoTestCase {
}
@Test
- public void select_by_project_and_language() {
+ public void select_by_project_id_and_language() {
setupData("projects");
QualityProfileDto dto = dao.getByProjectAndLanguage(1L, "java", "sonar.profile.java");
assertThat(dto.getId()).isEqualTo(1);
}
+
+ @Test
+ public void select_by_project_key_and_language() {
+ setupData("projects");
+
+ QualityProfileDto dto = dao.getByProjectAndLanguage("org.codehaus.sonar:sonar", "java", "sonar.profile.java", session);
+ assertThat(dto.getId()).isEqualTo(1);
+
+ assertThat(dao.getByProjectAndLanguage("org.codehaus.sonar:sonar", "unkown", "sonar.profile.java", session)).isNull();
+ assertThat(dao.getByProjectAndLanguage("unknown", "java", "sonar.profile.java", session)).isNull();
+ }
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java
index 3e3d18651e9..35447556df9 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/ActiveRule.java
@@ -22,6 +22,7 @@ package org.sonar.api.batch.rule;
import org.sonar.api.rule.RuleKey;
import javax.annotation.CheckForNull;
+
import java.util.Map;
/**
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRule.java
index 5eeea77687d..08d34525d69 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRule.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/DefaultActiveRule.java
@@ -24,16 +24,19 @@ import org.sonar.api.batch.rule.ActiveRule;
import org.sonar.api.rule.RuleKey;
import javax.annotation.concurrent.Immutable;
+
import java.util.Map;
@Immutable
-class DefaultActiveRule implements ActiveRule {
+public class DefaultActiveRule implements ActiveRule {
private final RuleKey ruleKey;
+ private final String name;
private final String severity, internalKey, language;
private final Map<String, String> params;
DefaultActiveRule(NewActiveRule newActiveRule) {
this.severity = newActiveRule.severity;
+ this.name = newActiveRule.name;
this.internalKey = newActiveRule.internalKey;
this.ruleKey = newActiveRule.ruleKey;
this.params = ImmutableMap.copyOf(newActiveRule.params);
@@ -45,6 +48,10 @@ class DefaultActiveRule implements ActiveRule {
return ruleKey;
}
+ public String name() {
+ return name;
+ }
+
@Override
public String severity() {
return severity;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java
index dd4b53d5953..3f20d89bf3f 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/rule/internal/NewActiveRule.java
@@ -33,6 +33,7 @@ import java.util.Map;
*/
public class NewActiveRule {
final RuleKey ruleKey;
+ String name;
String severity = Severity.defaultSeverity();
Map<String, String> params = new HashMap<String, String>();
String internalKey, language;
@@ -43,6 +44,11 @@ public class NewActiveRule {
this.ruleKey = ruleKey;
}
+ public NewActiveRule setName(String name) {
+ this.name = name;
+ return this;
+ }
+
public NewActiveRule setSeverity(@Nullable String severity) {
this.severity = StringUtils.defaultIfBlank(severity, Severity.defaultSeverity());
return this;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java
index 873fed63243..234b3865ca3 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/SensorContext.java
@@ -19,16 +19,15 @@
*/
package org.sonar.api.batch.sensor;
-import org.sonar.api.batch.sensor.issue.Issue;
-import org.sonar.api.batch.sensor.issue.IssueBuilder;
-import org.sonar.api.batch.sensor.measure.Measure;
-import org.sonar.api.batch.sensor.measure.MeasureBuilder;
-
import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.Metric;
import org.sonar.api.batch.rule.ActiveRules;
+import org.sonar.api.batch.sensor.issue.Issue;
+import org.sonar.api.batch.sensor.issue.IssueBuilder;
+import org.sonar.api.batch.sensor.measure.Measure;
+import org.sonar.api.batch.sensor.measure.MeasureBuilder;
import org.sonar.api.config.Settings;
import javax.annotation.CheckForNull;
@@ -101,7 +100,11 @@ public interface SensorContext {
/**
* Add an issue. Use {@link #issueBuilder()} to create the new issue.
- * @return true if the new issue is registered, false if the related rule does not exist or is disabled in the Quality profile.
+ * @return <code>true</code> if the new issue is registered, <code>false</code> if:
+ * <ul>
+ * <li>the rule does not exist</li>
+ * <li>the rule is disabled in the Quality profile</li>
+ * </ul>
*/
boolean addIssue(Issue issue);
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java
index c56e623056c..a8d2512542a 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/Issue.java
@@ -48,6 +48,7 @@ public interface Issue {
/**
* Message of the issue.
*/
+ @CheckForNull
String message();
/**
@@ -65,7 +66,7 @@ public interface Issue {
/**
* See constants in {@link org.sonar.api.rule.Severity}.
- * Can be null before issue is saved to tell to use severity configured in quality profile.
+ * Can be null before issue is saved. Means to use severity configured in quality profile.
*/
@CheckForNull
String severity();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueBuilder.java
index 5480103b1e7..f6b4fa85aaa 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueBuilder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/IssueBuilder.java
@@ -56,7 +56,8 @@ public interface IssueBuilder {
IssueBuilder onProject();
/**
- * Line of the issue. Only available for {@link #onFile(InputFile)} issues. If no line is specified then issue is supposed to be global to the file.
+ * Line of the issue. Only available for {@link #onFile(InputFile)} issues.
+ * If no line is specified it means that issue is global to the file.
*/
IssueBuilder atLine(int line);
@@ -77,7 +78,7 @@ public interface IssueBuilder {
IssueBuilder severity(@Nullable String severity);
/**
- * Build the issue.
+ * Build the issue. After call of this method the builder is cleaned and can be used to build another issue.
*/
Issue build();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java
index 9ca0fdd4f82..f3b56f73b6c 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssue.java
@@ -70,6 +70,7 @@ public class DefaultIssue implements Issue, Serializable {
return ruleKey;
}
+ @CheckForNull
@Override
public String message() {
return message;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueBuilder.java
index 62e89813f1c..fefbfb1e4c8 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueBuilder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/issue/internal/DefaultIssueBuilder.java
@@ -23,7 +23,6 @@ import com.google.common.base.Preconditions;
import org.sonar.api.batch.fs.InputDir;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.InputPath;
-import org.sonar.api.batch.sensor.issue.Issue;
import org.sonar.api.batch.sensor.issue.IssueBuilder;
import org.sonar.api.rule.RuleKey;
import org.sonar.api.rule.Severity;
@@ -108,8 +107,21 @@ public class DefaultIssueBuilder implements IssueBuilder {
}
@Override
- public Issue build() {
- return new DefaultIssue(this);
+ public DefaultIssue build() {
+ DefaultIssue result = new DefaultIssue(this);
+ reset();
+ return result;
+ }
+
+ private void reset() {
+ key = null;
+ onProject = false;
+ path = null;
+ ruleKey = null;
+ message = null;
+ line = null;
+ effortToFix = null;
+ severity = null;
}
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java
index ea606d45bd8..e7805affe65 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/Measure.java
@@ -19,13 +19,12 @@
*/
package org.sonar.api.batch.sensor.measure;
-import org.sonar.api.batch.sensor.Sensor;
-
import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.Metric;
+import org.sonar.api.batch.sensor.Sensor;
-import javax.annotation.Nullable;
+import javax.annotation.CheckForNull;
import java.io.Serializable;
@@ -39,7 +38,7 @@ public interface Measure<G extends Serializable> {
/**
* The {@link InputFile} this measure belongs to. Returns null if measure is global to the project.
*/
- @Nullable
+ @CheckForNull
InputFile inputFile();
Metric<G> metric();
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/MeasureBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/MeasureBuilder.java
index 05b16bee932..8dcfd9e37dd 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/MeasureBuilder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/MeasureBuilder.java
@@ -19,10 +19,9 @@
*/
package org.sonar.api.batch.sensor.measure;
-import org.sonar.api.batch.measure.Metric;
-
import com.google.common.annotations.Beta;
import org.sonar.api.batch.fs.InputFile;
+import org.sonar.api.batch.measure.Metric;
import java.io.Serializable;
@@ -54,7 +53,7 @@ public interface MeasureBuilder<G extends Serializable> {
MeasureBuilder<G> withValue(G value);
/**
- * Build the measure.
+ * Build the measure. After call of this method the builder is cleaned and can be used to build another measure.
*/
Measure<G> build();
}
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java
index 6664a055b8a..e51f548d529 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasure.java
@@ -19,8 +19,6 @@
*/
package org.sonar.api.batch.sensor.measure.internal;
-import org.sonar.api.batch.sensor.measure.Measure;
-
import com.google.common.base.Preconditions;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
@@ -28,8 +26,9 @@ import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.Metric;
+import org.sonar.api.batch.sensor.measure.Measure;
-import javax.annotation.Nullable;
+import javax.annotation.CheckForNull;
import java.io.Serializable;
@@ -48,7 +47,7 @@ public class DefaultMeasure<G extends Serializable> implements Measure<G>, Seria
this.value = builder.value;
}
- @Nullable
+ @CheckForNull
@Override
public InputFile inputFile() {
return inputFile;
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureBuilder.java b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureBuilder.java
index a1ef2e508d9..31fddee7652 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureBuilder.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureBuilder.java
@@ -19,41 +19,37 @@
*/
package org.sonar.api.batch.sensor.measure.internal;
-import org.sonar.api.batch.sensor.measure.MeasureBuilder;
-
import com.google.common.base.Preconditions;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.measure.Metric;
+import org.sonar.api.batch.sensor.measure.MeasureBuilder;
import java.io.Serializable;
public class DefaultMeasureBuilder<G extends Serializable> implements MeasureBuilder<G> {
- Boolean onProject = null;
+ boolean onProject = false;
InputFile file;
Metric<G> metric;
G value;
@Override
public DefaultMeasureBuilder<G> onFile(InputFile inputFile) {
- onProject(false);
- Preconditions.checkNotNull(inputFile, "inputFile should be non null");
+ Preconditions.checkState(!this.onProject, "onProject already called");
+ Preconditions.checkState(this.file == null, "onFile already called");
+ Preconditions.checkNotNull(inputFile, "InputFile should be non null");
this.file = inputFile;
return this;
}
@Override
public DefaultMeasureBuilder<G> onProject() {
- onProject(true);
- this.file = null;
+ Preconditions.checkState(!this.onProject, "onProject already called");
+ Preconditions.checkState(this.file == null, "onFile already called");
+ this.onProject = true;
return this;
}
- private void onProject(boolean isOnProject) {
- Preconditions.checkState(this.onProject == null, "onFile or onProject can be called only once");
- this.onProject = isOnProject;
- }
-
@Override
public DefaultMeasureBuilder<G> forMetric(Metric<G> metric) {
Preconditions.checkState(metric != null, "Metric already defined");
@@ -72,6 +68,15 @@ public class DefaultMeasureBuilder<G extends Serializable> implements MeasureBui
@Override
public DefaultMeasure<G> build() {
- return new DefaultMeasure<G>(this);
+ DefaultMeasure<G> result = new DefaultMeasure<G>(this);
+ reset();
+ return result;
+ }
+
+ private void reset() {
+ onProject = false;
+ file = null;
+ metric = null;
+ value = null;
}
}
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java
index 584b1ea7663..448880b9e4b 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/rule/internal/ActiveRulesBuilderTest.java
@@ -40,6 +40,7 @@ public class ActiveRulesBuilderTest {
public void build_rules() throws Exception {
ActiveRules activeRules = new ActiveRulesBuilder()
.create(RuleKey.of("squid", "S0001"))
+ .setName("My Rule")
.setSeverity(Severity.CRITICAL)
.setInternalKey("__S0001__")
.setParam("min", "20")
@@ -58,6 +59,7 @@ public class ActiveRulesBuilderTest {
ActiveRule squid1 = activeRules.find(RuleKey.of("squid", "S0001"));
assertThat(squid1.ruleKey().repository()).isEqualTo("squid");
assertThat(squid1.ruleKey().rule()).isEqualTo("S0001");
+ assertThat(((DefaultActiveRule) squid1).name()).isEqualTo("My Rule");
assertThat(squid1.severity()).isEqualTo(Severity.CRITICAL);
assertThat(squid1.internalKey()).isEqualTo("__S0001__");
assertThat(squid1.params()).hasSize(1);
diff --git a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureTest.java b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureTest.java
index c75a31679b2..b894ffec092 100644
--- a/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureTest.java
+++ b/sonar-plugin-api/src/test/java/org/sonar/api/batch/sensor/measure/internal/DefaultMeasureTest.java
@@ -19,14 +19,13 @@
*/
package org.sonar.api.batch.sensor.measure.internal;
-import org.sonar.api.batch.sensor.measure.Measure;
-import org.sonar.api.batch.sensor.measure.internal.DefaultMeasureBuilder;
-
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
+import org.sonar.api.batch.sensor.measure.Measure;
import org.sonar.api.measures.CoreMetrics;
+
import static org.fest.assertions.Assertions.assertThat;
public class DefaultMeasureTest {
@@ -63,7 +62,7 @@ public class DefaultMeasureTest {
@Test
public void not_allowed_to_call_onFile_and_onProject() {
thrown.expect(IllegalStateException.class);
- thrown.expectMessage("onFile or onProject can be called only once");
+ thrown.expectMessage("onProject already called");
new DefaultMeasureBuilder<Integer>()
.onProject()
.onFile(new DefaultInputFile("src/Foo.php"))