rhoconnect 3.0.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +208 -0
- data/CREDITS +38 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +97 -0
- data/LICENSE +75 -0
- data/README.md +10 -0
- data/Rakefile +82 -0
- data/bench/bench +7 -0
- data/bench/bench_runner.rb +112 -0
- data/bench/benchapp/Gemfile +21 -0
- data/bench/benchapp/Gemfile.lock +76 -0
- data/bench/benchapp/Rakefile +22 -0
- data/bench/benchapp/application.rb +39 -0
- data/bench/benchapp/config.ru +36 -0
- data/bench/benchapp/settings/license.key +1 -0
- data/bench/benchapp/settings/settings.yml +20 -0
- data/bench/benchapp/sources/mock_adapter.rb +55 -0
- data/bench/benchapp/sources/queue_mock_adapter.rb +2 -0
- data/bench/benchapp/spec/sources/mock_adapter_spec.rb +25 -0
- data/bench/benchapp/spec/sources/queue_mock_adapter_spec.rb +25 -0
- data/bench/benchapp/spec/spec_helper.rb +42 -0
- data/bench/blobapp/Gemfile +31 -0
- data/bench/blobapp/Gemfile.lock +103 -0
- data/bench/blobapp/Rakefile +25 -0
- data/bench/blobapp/application.rb +44 -0
- data/bench/blobapp/config.ru +36 -0
- data/bench/blobapp/settings/license.key +1 -0
- data/bench/blobapp/settings/settings.yml +16 -0
- data/bench/blobapp/sources/blob_adapter.rb +71 -0
- data/bench/blobapp/spec/sources/blob_adapter_spec.rb +25 -0
- data/bench/blobapp/spec/spec_helper.rb +42 -0
- data/bench/lib/bench/cli.rb +16 -0
- data/bench/lib/bench/logging.rb +13 -0
- data/bench/lib/bench/mock_client.rb +41 -0
- data/bench/lib/bench/result.rb +50 -0
- data/bench/lib/bench/runner.rb +107 -0
- data/bench/lib/bench/session.rb +67 -0
- data/bench/lib/bench/statistics.rb +56 -0
- data/bench/lib/bench/test_data.rb +98 -0
- data/bench/lib/bench/timer.rb +10 -0
- data/bench/lib/bench/utils.rb +49 -0
- data/bench/lib/bench.rb +129 -0
- data/bench/lib/testdata/100-data.txt +148 -0
- data/bench/lib/testdata/5-data.txt +9 -0
- data/bench/lib/testdata/images/icon.ico +0 -0
- data/bench/lib/testdata/images/icon.png +0 -0
- data/bench/lib/testdata/images/loading-Landscape.png +0 -0
- data/bench/lib/testdata/images/loading-LandscapeLeft.png +0 -0
- data/bench/lib/testdata/images/loading-LandscapeRight.png +0 -0
- data/bench/lib/testdata/images/loading-Portrait.png +0 -0
- data/bench/lib/testdata/images/loading-PortraitUpsideDown.png +0 -0
- data/bench/lib/testdata/images/loading.png +0 -0
- data/bench/lib/testdata/images/loading@2x.png +0 -0
- data/bench/run_bench.sh +42 -0
- data/bench/run_blob_script.sh +3 -0
- data/bench/run_cud_script.sh +3 -0
- data/bench/run_query_md_script.sh +3 -0
- data/bench/run_query_only_script.sh +3 -0
- data/bench/run_query_script.sh +3 -0
- data/bench/scripts/blob_cud_script.rb +98 -0
- data/bench/scripts/cud_script.rb +92 -0
- data/bench/scripts/helpers.rb +101 -0
- data/bench/scripts/query_md_script.rb +45 -0
- data/bench/scripts/query_only_script.rb +51 -0
- data/bench/scripts/query_script.rb +45 -0
- data/bench/spec/bench_spec_helper.rb +33 -0
- data/bench/spec/logging_spec.rb +15 -0
- data/bench/spec/mock_adapter_spec.rb +61 -0
- data/bench/spec/mock_client_spec.rb +65 -0
- data/bench/spec/result_spec.rb +61 -0
- data/bench/spec/utils_spec.rb +36 -0
- data/bin/rhoconnect +34 -0
- data/bin/rhoconnect-setup +84 -0
- data/doc/async-jobs.txt +69 -0
- data/doc/authentication.txt +76 -0
- data/doc/benchmarks.txt +168 -0
- data/doc/blob-sync.txt +130 -0
- data/doc/bulk-sync.txt +102 -0
- data/doc/client.txt +432 -0
- data/doc/command-line.txt +210 -0
- data/doc/contributing.txt +60 -0
- data/doc/deploying.txt +82 -0
- data/doc/install.txt +28 -0
- data/doc/introduction.txt +20 -0
- data/doc/licensing.txt +18 -0
- data/doc/metadata.txt +458 -0
- data/doc/migration.txt +182 -0
- data/doc/public/css/print.css +29 -0
- data/doc/public/css/screen.css +257 -0
- data/doc/public/css/style.css +20 -0
- data/doc/push.txt +135 -0
- data/doc/release.txt +41 -0
- data/doc/rest-api.txt +367 -0
- data/doc/source-adapters.txt +325 -0
- data/doc/stats-middleware.txt +69 -0
- data/doc/testing.txt +222 -0
- data/doc/tutorial.txt +315 -0
- data/doc/web-console.txt +35 -0
- data/examples/simple/Rakefile +14 -0
- data/examples/simple/application.rb +27 -0
- data/examples/simple/config.ru +49 -0
- data/examples/simple/settings/license.key +1 -0
- data/examples/simple/settings/settings.yml +23 -0
- data/examples/simple/sources/sample_adapter.rb +5 -0
- data/examples/simple/sources/simple_adapter.rb +5 -0
- data/generators/rhoconnect.rb +119 -0
- data/generators/templates/application/Gemfile +21 -0
- data/generators/templates/application/Rakefile +22 -0
- data/generators/templates/application/application.rb +39 -0
- data/generators/templates/application/config.ru +36 -0
- data/generators/templates/application/settings/license.key +1 -0
- data/generators/templates/application/settings/settings.yml +14 -0
- data/generators/templates/application/spec/spec_helper.rb +42 -0
- data/generators/templates/source/source_adapter.rb +47 -0
- data/generators/templates/source/source_spec.rb +25 -0
- data/install.sh +408 -0
- data/installer/unix-like/rho_connect_install_checkers.rb +140 -0
- data/installer/unix-like/rho_connect_install_constants.rb +51 -0
- data/installer/unix-like/rho_connect_install_debian.rb +63 -0
- data/installer/unix-like/rho_connect_install_dnd.rb +58 -0
- data/installer/unix-like/rho_connect_install_get_params.rb +30 -0
- data/installer/unix-like/rho_connect_install_installers.rb +142 -0
- data/installer/unix-like/rho_connect_install_utilities.rb +85 -0
- data/installer/unix-like/rho_connect_install_yum.rb +63 -0
- data/installer/unix-like/rhoinstaller.rb +89 -0
- data/installer/utils/create_texts.rb +366 -0
- data/installer/utils/install_test.rb +140 -0
- data/installer/windows/EnvVarUpdate.nsh +328 -0
- data/installer/windows/ServiceLib.nsh +369 -0
- data/installer/windows/configUi.ini +44 -0
- data/installer/windows/icon.ico +0 -0
- data/installer/windows/rhosync.nsi +418 -0
- data/installer/windows/uninstall.bat +7 -0
- data/lib/rhoconnect/api/admin/get_api_token.rb +14 -0
- data/lib/rhoconnect/api/admin/get_license_info.rb +8 -0
- data/lib/rhoconnect/api/admin/login.rb +6 -0
- data/lib/rhoconnect/api/admin/reset.rb +10 -0
- data/lib/rhoconnect/api/admin/stats.rb +21 -0
- data/lib/rhoconnect/api/application/bulk_data.rb +7 -0
- data/lib/rhoconnect/api/application/clientcreate.rb +8 -0
- data/lib/rhoconnect/api/application/clientlogin.rb +6 -0
- data/lib/rhoconnect/api/application/clientregister.rb +6 -0
- data/lib/rhoconnect/api/application/clientreset.rb +6 -0
- data/lib/rhoconnect/api/application/query.rb +7 -0
- data/lib/rhoconnect/api/application/queue_updates.rb +6 -0
- data/lib/rhoconnect/api/application/search.rb +6 -0
- data/lib/rhoconnect/api/client/create_client.rb +3 -0
- data/lib/rhoconnect/api/client/delete_client.rb +5 -0
- data/lib/rhoconnect/api/client/get_client_params.rb +3 -0
- data/lib/rhoconnect/api/client/list_client_docs.rb +12 -0
- data/lib/rhoconnect/api/client/list_clients.rb +3 -0
- data/lib/rhoconnect/api/client/ping.rb +7 -0
- data/lib/rhoconnect/api/source/get_adapter.rb +3 -0
- data/lib/rhoconnect/api/source/get_db_doc.rb +7 -0
- data/lib/rhoconnect/api/source/get_source_params.rb +3 -0
- data/lib/rhoconnect/api/source/list_source_docs.rb +10 -0
- data/lib/rhoconnect/api/source/list_sources.rb +15 -0
- data/lib/rhoconnect/api/source/push_deletes.rb +8 -0
- data/lib/rhoconnect/api/source/push_objects.rb +8 -0
- data/lib/rhoconnect/api/source/save_adapter.rb +3 -0
- data/lib/rhoconnect/api/source/set_db_doc.rb +8 -0
- data/lib/rhoconnect/api/source/set_refresh_time.rb +8 -0
- data/lib/rhoconnect/api/source/upload_file.rb +4 -0
- data/lib/rhoconnect/api/user/create_user.rb +7 -0
- data/lib/rhoconnect/api/user/delete_user.rb +9 -0
- data/lib/rhoconnect/api/user/list_users.rb +3 -0
- data/lib/rhoconnect/api/user/update_user.rb +4 -0
- data/lib/rhoconnect/api_token.rb +19 -0
- data/lib/rhoconnect/app.rb +76 -0
- data/lib/rhoconnect/bulk_data/bulk_data.rb +88 -0
- data/lib/rhoconnect/bulk_data/syncdb.index.schema +4 -0
- data/lib/rhoconnect/bulk_data/syncdb.schema +41 -0
- data/lib/rhoconnect/bulk_data.rb +2 -0
- data/lib/rhoconnect/client.rb +96 -0
- data/lib/rhoconnect/client_sync.rb +412 -0
- data/lib/rhoconnect/console/app/helpers/auth_helper.rb +22 -0
- data/lib/rhoconnect/console/app/helpers/extensions.rb +19 -0
- data/lib/rhoconnect/console/app/helpers/helpers.rb +57 -0
- data/lib/rhoconnect/console/app/public/ThickBox.css +649 -0
- data/lib/rhoconnect/console/app/public/home.css +438 -0
- data/lib/rhoconnect/console/app/public/images/foot_logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/header_halo.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/land_separator.gif +0 -0
- data/lib/rhoconnect/console/app/public/images/landing_header.jpg +0 -0
- data/lib/rhoconnect/console/app/public/images/logo_rhoconnect.png +0 -0
- data/lib/rhoconnect/console/app/public/images/rhomobile_rhohub_logo.png +0 -0
- data/lib/rhoconnect/console/app/public/images/tabs_separator.png +0 -0
- data/lib/rhoconnect/console/app/public/jqplot/excanvas.min.js +35 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.barRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisLabelRenderer.js +187 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasAxisTickRenderer.js +226 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.canvasTextRenderer.js +408 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.categoryAxisRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.cursor.js +952 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.js +313 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.dateAxisRenderer.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jqplot.pointLabels.min.js +34 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery-1.4.2.min.js +154 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.css +1 -0
- data/lib/rhoconnect/console/app/public/jqplot/jquery.jqplot.min.js +34 -0
- data/lib/rhoconnect/console/app/public/main.css +7 -0
- data/lib/rhoconnect/console/app/public/reset.css +76 -0
- data/lib/rhoconnect/console/app/public/style.css +2201 -0
- data/lib/rhoconnect/console/app/public/text.txt +0 -0
- data/lib/rhoconnect/console/app/routes/adapter.rb +28 -0
- data/lib/rhoconnect/console/app/routes/auth.rb +29 -0
- data/lib/rhoconnect/console/app/routes/client.rb +31 -0
- data/lib/rhoconnect/console/app/routes/docs.rb +145 -0
- data/lib/rhoconnect/console/app/routes/heroku.rb +19 -0
- data/lib/rhoconnect/console/app/routes/home.rb +63 -0
- data/lib/rhoconnect/console/app/routes/timing.rb +242 -0
- data/lib/rhoconnect/console/app/routes/user.rb +117 -0
- data/lib/rhoconnect/console/app/views/adapter.erb +16 -0
- data/lib/rhoconnect/console/app/views/client.erb +30 -0
- data/lib/rhoconnect/console/app/views/content.erb +14 -0
- data/lib/rhoconnect/console/app/views/doc.erb +8 -0
- data/lib/rhoconnect/console/app/views/docdata.erb +28 -0
- data/lib/rhoconnect/console/app/views/docs.erb +30 -0
- data/lib/rhoconnect/console/app/views/edituser.erb +13 -0
- data/lib/rhoconnect/console/app/views/headermenu.erb +40 -0
- data/lib/rhoconnect/console/app/views/home.erb +24 -0
- data/lib/rhoconnect/console/app/views/index.erb +58 -0
- data/lib/rhoconnect/console/app/views/jqplot.erb +52 -0
- data/lib/rhoconnect/console/app/views/layout.erb +165 -0
- data/lib/rhoconnect/console/app/views/login.erb +26 -0
- data/lib/rhoconnect/console/app/views/newuser.erb +17 -0
- data/lib/rhoconnect/console/app/views/ping.erb +28 -0
- data/lib/rhoconnect/console/app/views/result.erb +11 -0
- data/lib/rhoconnect/console/app/views/rightboxlinks.erb +15 -0
- data/lib/rhoconnect/console/app/views/select_doc.erb +17 -0
- data/lib/rhoconnect/console/app/views/upload_doc.erb +23 -0
- data/lib/rhoconnect/console/app/views/user.erb +29 -0
- data/lib/rhoconnect/console/app/views/users.erb +12 -0
- data/lib/rhoconnect/console/rhoconnect_api.rb +245 -0
- data/lib/rhoconnect/console/server.rb +32 -0
- data/lib/rhoconnect/console.rb +3 -0
- data/lib/rhoconnect/cors.rb +229 -0
- data/lib/rhoconnect/credential.rb +9 -0
- data/lib/rhoconnect/db_adapter.rb +46 -0
- data/lib/rhoconnect/document.rb +49 -0
- data/lib/rhoconnect/dynamic_adapter.rb +91 -0
- data/lib/rhoconnect/generator.rb +1 -0
- data/lib/rhoconnect/jobs/bulk_data_job.rb +203 -0
- data/lib/rhoconnect/jobs/ping_job.rb +46 -0
- data/lib/rhoconnect/jobs/source_job.rb +16 -0
- data/lib/rhoconnect/license.rb +86 -0
- data/lib/rhoconnect/lock_ops.rb +11 -0
- data/lib/rhoconnect/model.rb +414 -0
- data/lib/rhoconnect/ping/android.rb +56 -0
- data/lib/rhoconnect/ping/apple.rb +52 -0
- data/lib/rhoconnect/ping/blackberry.rb +56 -0
- data/lib/rhoconnect/ping.rb +3 -0
- data/lib/rhoconnect/read_state.rb +31 -0
- data/lib/rhoconnect/rho_indifferent_access.rb +88 -0
- data/lib/rhoconnect/server/views/index.erb +13 -0
- data/lib/rhoconnect/server.rb +286 -0
- data/lib/rhoconnect/source.rb +289 -0
- data/lib/rhoconnect/source_adapter.rb +123 -0
- data/lib/rhoconnect/source_sync.rb +302 -0
- data/lib/rhoconnect/stats/middleware.rb +20 -0
- data/lib/rhoconnect/stats/record.rb +108 -0
- data/lib/rhoconnect/store.rb +232 -0
- data/lib/rhoconnect/tasks.rb +350 -0
- data/lib/rhoconnect/test_methods.rb +220 -0
- data/lib/rhoconnect/user.rb +95 -0
- data/lib/rhoconnect/version.rb +3 -0
- data/lib/rhoconnect/x_domain_session_wrapper.rb +53 -0
- data/lib/rhoconnect.rb +285 -0
- data/rhoconnect.gemspec +67 -0
- data/spec/api/admin/api_token_spec.rb +14 -0
- data/spec/api/admin/get_api_token_spec.rb +36 -0
- data/spec/api/admin/get_license_info_spec.rb +38 -0
- data/spec/api/admin/reset_spec.rb +22 -0
- data/spec/api/admin/stats_spec.rb +66 -0
- data/spec/api/api_helper.rb +21 -0
- data/spec/api/application/rhoconnect_api_spec.rb +548 -0
- data/spec/api/client/create_client_spec.rb +13 -0
- data/spec/api/client/delete_client_spec.rb +13 -0
- data/spec/api/client/get_client_params_spec.rb +18 -0
- data/spec/api/client/list_client_docs_spec.rb +32 -0
- data/spec/api/client/list_clients_spec.rb +22 -0
- data/spec/api/client/ping_spec.rb +23 -0
- data/spec/api/rhosync_api_spec.rb.orig +606 -0
- data/spec/api/source/adapter_spec.rb +29 -0
- data/spec/api/source/get_db_doc_spec.rb +21 -0
- data/spec/api/source/get_source_params_spec.rb +32 -0
- data/spec/api/source/list_source_docs_spec.rb +25 -0
- data/spec/api/source/list_sources_spec.rb +26 -0
- data/spec/api/source/push_deletes_spec.rb +18 -0
- data/spec/api/source/push_objects_spec.rb +27 -0
- data/spec/api/source/set_db_doc_spec.rb +19 -0
- data/spec/api/source/set_refresh_time_spec.rb +43 -0
- data/spec/api/source/upload_file_spec.rb +26 -0
- data/spec/api/user/create_user_spec.rb +16 -0
- data/spec/api/user/delete_user_spec.rb +36 -0
- data/spec/api/user/list_users_spec.rb +30 -0
- data/spec/api/user/update_user_spec.rb +31 -0
- data/spec/api_token_spec.rb +14 -0
- data/spec/app_spec.rb +18 -0
- data/spec/apps/emptyapp/application.rb +27 -0
- data/spec/apps/emptyapp/settings/license.key +1 -0
- data/spec/apps/emptyapp/settings/settings.yml +14 -0
- data/spec/apps/rhotestapp/Rakefile +1 -0
- data/spec/apps/rhotestapp/application.rb +19 -0
- data/spec/apps/rhotestapp/config.ru +1 -0
- data/spec/apps/rhotestapp/settings/apple_fake_cert.pem +1 -0
- data/spec/apps/rhotestapp/settings/license.key +1 -0
- data/spec/apps/rhotestapp/settings/settings.yml +36 -0
- data/spec/apps/rhotestapp/sources/base_adapter.rb +9 -0
- data/spec/apps/rhotestapp/sources/fixed_schema_adapter.rb +28 -0
- data/spec/apps/rhotestapp/sources/sample_adapter.rb +71 -0
- data/spec/apps/rhotestapp/sources/simple_adapter.rb +41 -0
- data/spec/apps/rhotestapp/sources/sub_adapter.rb +7 -0
- data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem/mygem.rb +8 -0
- data/spec/apps/rhotestapp/vendor/mygem-0.1.0/lib/mygem.rb +1 -0
- data/spec/bulk_data/bulk_data_spec.rb +97 -0
- data/spec/client_spec.rb +124 -0
- data/spec/client_sync_spec.rb +774 -0
- data/spec/doc/base.html +72 -0
- data/spec/doc/doc_spec.rb +376 -0
- data/spec/doc/footer.html +4 -0
- data/spec/doc/header.html +30 -0
- data/spec/document_spec.rb +31 -0
- data/spec/dynamic_adapter_spec.rb +43 -0
- data/spec/factories/factories.rb +17 -0
- data/spec/generator/generator_spec.rb +58 -0
- data/spec/generator/generator_spec_helper.rb +9 -0
- data/spec/jobs/bulk_data_job_spec.rb +125 -0
- data/spec/jobs/ping_job_spec.rb +102 -0
- data/spec/jobs/source_job_spec.rb +29 -0
- data/spec/license_spec.rb +66 -0
- data/spec/model_spec.rb +273 -0
- data/spec/perf/bulk_data_perf_spec.rb +32 -0
- data/spec/perf/perf_spec_helper.rb +50 -0
- data/spec/perf/store_perf_spec.rb +27 -0
- data/spec/ping/android_spec.rb +91 -0
- data/spec/ping/apple_spec.rb +70 -0
- data/spec/ping/blackberry_spec.rb +62 -0
- data/spec/read_state_spec.rb +35 -0
- data/spec/rhosync_spec.rb +75 -0
- data/spec/server/cors_spec.rb +287 -0
- data/spec/server/server_spec.rb +470 -0
- data/spec/server/x_domain_session_wrapper_spec.rb +150 -0
- data/spec/source_adapter_spec.rb +125 -0
- data/spec/source_spec.rb +114 -0
- data/spec/source_sync_spec.rb +328 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_helper.rb +231 -0
- data/spec/stats/middleware_spec.rb +53 -0
- data/spec/stats/record_spec.rb +92 -0
- data/spec/store_spec.rb +251 -0
- data/spec/support/shared_examples.rb +168 -0
- data/spec/sync_states_spec.rb +72 -0
- data/spec/test_methods_spec.rb +134 -0
- data/spec/testdata/1000-data.txt +1414 -0
- data/spec/testdata/compressed/compress-data.txt +1 -0
- data/spec/testdata/upload1.txt +1 -0
- data/spec/testdata/upload2.txt +1 -0
- data/spec/user_spec.rb +139 -0
- data/tasks/redis.rake +206 -0
- metadata +706 -0
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rho_connect_install_constants'
|
2
|
+
|
3
|
+
module DownloadAndDocompress
|
4
|
+
extend self
|
5
|
+
|
6
|
+
# download_and_decompress
|
7
|
+
# Delegates the download and decompression duties
|
8
|
+
def download_and_decompress(prefix)
|
9
|
+
print_header "Downloading and Decompressing"
|
10
|
+
downloads = 0
|
11
|
+
Constants::URLS.each do |url|
|
12
|
+
if !File.exists?("#{ get_tarball_name url }") ||
|
13
|
+
!File.exists?("#{ get_version url }")
|
14
|
+
wget_download prefix, url
|
15
|
+
decompress prefix, url
|
16
|
+
downloads += 1
|
17
|
+
end #if
|
18
|
+
end #do
|
19
|
+
if downloads == 0
|
20
|
+
log_print "Nothing additional to download"
|
21
|
+
end #if
|
22
|
+
end #download_and_decompress
|
23
|
+
|
24
|
+
# wget_download
|
25
|
+
# Takes a URL and the name of a tarball and issues a wget command on said
|
26
|
+
# URL unless the tarball or directory already exists
|
27
|
+
def wget_download(prefix, url)
|
28
|
+
if !File.exists?("#{ prefix }#{ get_tarball_name url }") &&
|
29
|
+
!File.directory?("#{ prefix }#{ get_version url }")
|
30
|
+
cmd "wget -P #{ prefix } #{ url }"
|
31
|
+
end #if
|
32
|
+
end #wget_download
|
33
|
+
|
34
|
+
# decompress
|
35
|
+
# Decompress downloaded files unless already decompressed directory
|
36
|
+
# exists
|
37
|
+
def decompress(prefix, url)
|
38
|
+
tarball = get_tarball_name(url)
|
39
|
+
dir = get_version(url)
|
40
|
+
cmd "tar -xzf #{ prefix }#{ tarball } -C #{ prefix }" unless
|
41
|
+
File.directory? "#{ prefix }#{ dir }"
|
42
|
+
end #decompress
|
43
|
+
|
44
|
+
# get_version
|
45
|
+
# This method extracts the untarballed name of files retrieved via wget
|
46
|
+
# from their URL
|
47
|
+
def get_version(url)
|
48
|
+
url =~ /.*\/(.*)\.t.*\Z/
|
49
|
+
$1
|
50
|
+
end #get_version
|
51
|
+
|
52
|
+
# get_tarball_name
|
53
|
+
# This method extracts the name of files retrieved via wget from their URL
|
54
|
+
def get_tarball_name(url)
|
55
|
+
url =~ /.*\/(.*\.t.*)/
|
56
|
+
$1
|
57
|
+
end #get_tarball_name
|
58
|
+
end #DownloadAndDocompress
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rho_connect_install_constants'
|
2
|
+
require 'rho_connect_install_debian'
|
3
|
+
require 'rho_connect_install_yum'
|
4
|
+
|
5
|
+
module GetParams
|
6
|
+
extend self
|
7
|
+
|
8
|
+
# get_flavor
|
9
|
+
# determine whether running on a debian system or a yum system
|
10
|
+
def get_flavor(options)
|
11
|
+
get_cmd = ''
|
12
|
+
Constants::SUPPORTED_PKG_MGRS.each do |mgr|
|
13
|
+
if `which #{ mgr }` != ""
|
14
|
+
get_cmd = mgr
|
15
|
+
end #if
|
16
|
+
end #do
|
17
|
+
|
18
|
+
case get_cmd
|
19
|
+
when 'apt-get'
|
20
|
+
flavor = Debian.new(options)
|
21
|
+
when 'yum'
|
22
|
+
flavor = Yum.new(options)
|
23
|
+
else
|
24
|
+
log_print "Supported package manager not found"
|
25
|
+
exit(3)
|
26
|
+
end #case
|
27
|
+
|
28
|
+
flavor
|
29
|
+
end #get_flavor
|
30
|
+
end #GetParams
|
@@ -0,0 +1,142 @@
|
|
1
|
+
require 'rho_connect_install_constants'
|
2
|
+
require 'rho_connect_install_checkers'
|
3
|
+
|
4
|
+
include Checkers
|
5
|
+
|
6
|
+
module Installers
|
7
|
+
extend self
|
8
|
+
@options=''
|
9
|
+
|
10
|
+
# configure_passenger
|
11
|
+
# This method installs items that were retrieved via wget as well as
|
12
|
+
# passenger
|
13
|
+
def configure_passenger(options)
|
14
|
+
@options=options
|
15
|
+
installs = 0
|
16
|
+
print_header "Configuring Passenger"
|
17
|
+
if @options[:web_server] && !check_web_server_running
|
18
|
+
if @options[:web_server] == "apache2"
|
19
|
+
print_header "Configuring Apache2 to work with Passenger"
|
20
|
+
elsif @options[:web_server] == "nginx"
|
21
|
+
print_header "Configuring Nginx to work with Passenger"
|
22
|
+
else
|
23
|
+
log_print "That web server is not yet supported. Sorry..."
|
24
|
+
end #if
|
25
|
+
end #if
|
26
|
+
cmd "yes | #{@options[:prefix]}bin/passenger-install-#{ @options[:web_server] }-module"
|
27
|
+
|
28
|
+
if $? != 0
|
29
|
+
log_print "Some dependencies are not installed.\nPlease install them and re-run this script..."
|
30
|
+
exit
|
31
|
+
else
|
32
|
+
cmd "echo passenger >> #{@options[:prefix]}installchecklist"
|
33
|
+
end #if
|
34
|
+
end #configure_passenger
|
35
|
+
|
36
|
+
# install_all_packages
|
37
|
+
# This method installs all packages listed in the PACKAGES list defined
|
38
|
+
# in the Constants file.
|
39
|
+
def install_all_packages(pkg_mgr)
|
40
|
+
print_header "Installing packages"
|
41
|
+
Constants::PACKAGES.each do |pkg|
|
42
|
+
install_package pkg, pkg_mgr unless check_package pkg == true
|
43
|
+
end #do
|
44
|
+
packages_not_found = check_all_packages
|
45
|
+
if packages_not_found && !packages_not_found.empty?
|
46
|
+
log_print packages_not_found
|
47
|
+
else
|
48
|
+
log_print "All packages installed correctly"
|
49
|
+
end #if
|
50
|
+
end #install_all_packages
|
51
|
+
|
52
|
+
# install_package
|
53
|
+
# This method installs the package passed with the determined get_cmd
|
54
|
+
def install_package(pkg, pkg_mgr)
|
55
|
+
cmd "#{ pkg_mgr } install #{ pkg }" unless check_package pkg
|
56
|
+
end #install_package
|
57
|
+
|
58
|
+
# install_all_gems
|
59
|
+
# This method installs all gems specified in the GEMS list defined in the
|
60
|
+
# Constants file
|
61
|
+
def install_all_gems
|
62
|
+
gem_path = "#{@options[:prefix]}bin/gem"
|
63
|
+
Constants::GEMS.each do |gem|
|
64
|
+
install_gem gem, gem_path
|
65
|
+
end #do
|
66
|
+
end #install_all_gems
|
67
|
+
|
68
|
+
# install_gem
|
69
|
+
# This method installs the given gem unless it is already installed
|
70
|
+
def install_gem(gem, gem_path)
|
71
|
+
if gem =~ /sqlite3/ && @options[:pkg_mgr] =~ /yum/ # CentOS
|
72
|
+
sqlite3_cmd= "export LD_LIBRARY_PATH=#{@options[:prefix]}lib; #{@options[:prefix]}bin/gem install sqlite3 --no-ri --no-rdoc -- --with-sqlite3-include=#{@options[:prefix]}include"
|
73
|
+
cmd sqlite3_cmd
|
74
|
+
else
|
75
|
+
cmd "#{@gem_path} install #{ gem } --no-ri --no-rdoc" unless check_gem gem, @gem_path
|
76
|
+
end
|
77
|
+
end #install_gem
|
78
|
+
|
79
|
+
# install_rubygems
|
80
|
+
# This method installs rubygems which was downloaded and untarred earlier
|
81
|
+
def install_rubygems
|
82
|
+
print_header "Installing Rubygems"
|
83
|
+
Dir.chdir("#{@options[:prefix]}#{Constants::RUBYGEMS}")
|
84
|
+
cmd "#{@options[:prefix]}bin/ruby setup.rb --prefix=#{@options[:prefix]}#{Constants::RUBYGEMS}"
|
85
|
+
@gem_path = "#{@options[:prefix]}bin/gem"
|
86
|
+
cmd "sed -n '1 c\#!/opt/rhoconnect/bin/ruby' #{@options[:prefix]}bin/gem"
|
87
|
+
@gem="#{@options[:prefix]}bin/gem"
|
88
|
+
cmd "echo rubygems >> #{@options[:prefix]}installchecklist"
|
89
|
+
end #install_rubygems
|
90
|
+
|
91
|
+
# install_redis
|
92
|
+
# This method installs redis
|
93
|
+
def install_redis
|
94
|
+
Dir.chdir("#{@options[:prefix]}#{Constants::REDIS}/src")
|
95
|
+
cmd "make; make PREFIX=#{@options[:prefix]} install"
|
96
|
+
cmd "mkdir #{@options[:prefix]}etc" unless File.exist? "#{@options[:prefix]}etc"
|
97
|
+
|
98
|
+
#cmd "cp ../redis.conf #{@options[:prefix]}etc"
|
99
|
+
redis_conf_file = File.new("#{@options[:prefix]}etc/redis.conf", 'w')
|
100
|
+
File.foreach("../redis.conf") do |line|
|
101
|
+
# daemonize no --> daemonize yes
|
102
|
+
# logfile stdout --> logfile /var/log/redis.log
|
103
|
+
if line =~ /^daemonize/
|
104
|
+
redis_conf_file << "daemonize yes" << "\n"
|
105
|
+
elsif line =~ /^logfile/
|
106
|
+
redis_conf_file << "logfile /var/log/redis.log" << "\n"
|
107
|
+
else
|
108
|
+
redis_conf_file << line
|
109
|
+
end
|
110
|
+
end
|
111
|
+
redis_conf_file.close
|
112
|
+
|
113
|
+
cmd "echo redis >> #{@options[:prefix]}installchecklist"
|
114
|
+
end #install_redis
|
115
|
+
|
116
|
+
# install_sqlite
|
117
|
+
# This method instaqll sqlite
|
118
|
+
def install_sqlite
|
119
|
+
Dir.chdir("#{@options[:prefix]}#{Constants::SQLITE3}")
|
120
|
+
cmd "./configure --prefix=#{@options[:prefix]}"
|
121
|
+
cmd "make; make install"
|
122
|
+
cmd "echo sqlite >> #{@options[:prefix]}installchecklist"
|
123
|
+
end #install_sqlite
|
124
|
+
|
125
|
+
# install_rhoconnect
|
126
|
+
# This method installs rhoconnect
|
127
|
+
def install_rhoconnect
|
128
|
+
# start installations
|
129
|
+
# store current gem_path
|
130
|
+
orig_gem_path = `which gem`
|
131
|
+
print_header "Installing Rhoconnect"
|
132
|
+
Dir.chdir(@options[:start_dir])
|
133
|
+
cmd "#{@options[:prefix]}bin/bundle config build.sqlite3" +
|
134
|
+
" --with-sqlite3-include=#{@options[:prefix]}include" +
|
135
|
+
" --with-sqlite3-lib=#{@options[:prefix]}lib"
|
136
|
+
cmd "#{@options[:prefix]}bin/bundle install" +
|
137
|
+
" --without=test development" +
|
138
|
+
" --path=#{@options[:prefix]}"
|
139
|
+
cmd "export PATH=#{@options[:prefix]}bin:$PATH; rake install"
|
140
|
+
cmd "echo rhoconnect >> #{@options[:prefix]}installchecklist"
|
141
|
+
end #install_rhoconnect
|
142
|
+
end #Installers
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'readline'
|
2
|
+
require 'net/http'
|
3
|
+
require 'net/https'
|
4
|
+
require 'rho_connect_install_constants'
|
5
|
+
require 'rho_connect_install_installers'
|
6
|
+
require 'rho_connect_install_checkers'
|
7
|
+
require 'rho_connect_install_dnd'
|
8
|
+
|
9
|
+
include Installers
|
10
|
+
include Checkers
|
11
|
+
include DownloadAndDocompress
|
12
|
+
|
13
|
+
module Utilities
|
14
|
+
extend self
|
15
|
+
|
16
|
+
# get_elapsed_time
|
17
|
+
# This method returns the time since the given initial_time
|
18
|
+
def get_elapsed_time(initial_time)
|
19
|
+
#get time difference
|
20
|
+
elapsed_time = Time.now - initial_time
|
21
|
+
#determine if time is displayed in hours, minutes, or seconds
|
22
|
+
if elapsed_time >= 3600
|
23
|
+
elapsed_time /= 60
|
24
|
+
time_units = "hours"
|
25
|
+
elsif elapsed_time >= 60 && elapsed_time < 3600
|
26
|
+
elapsed_time /= 60
|
27
|
+
time_units = "minutes"
|
28
|
+
else
|
29
|
+
time_units = "seconds"
|
30
|
+
end #if
|
31
|
+
|
32
|
+
#round elapsed_time to 3 decimal values
|
33
|
+
elapsed_time = (elapsed_time * 10**3).round.to_f / 10**3
|
34
|
+
elapsed_time.to_s << " " + time_units
|
35
|
+
end #get_elapsed_time
|
36
|
+
|
37
|
+
# log_print
|
38
|
+
# This method displays, in minutes, how long the installation process took
|
39
|
+
def log_print(string)
|
40
|
+
puts string
|
41
|
+
@log.info {string} unless @log == nil
|
42
|
+
end #log_print
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
# cmd
|
47
|
+
# This method issues the given system command and calls log_print for output
|
48
|
+
def cmd(cmd)
|
49
|
+
log_print cmd
|
50
|
+
log_print `#{ cmd }`
|
51
|
+
end #cmd
|
52
|
+
|
53
|
+
#set_log_file
|
54
|
+
def set_log_file(log)
|
55
|
+
@log = log
|
56
|
+
end #set_log_file
|
57
|
+
|
58
|
+
# print_header
|
59
|
+
# This method displays a header surrounded by '=' characters consisting of
|
60
|
+
# the given string
|
61
|
+
def print_header(string)
|
62
|
+
header = "\n"
|
63
|
+
border = "===="
|
64
|
+
string.each_char { border << "=" }
|
65
|
+
header << border + "\n"
|
66
|
+
header << "= " + string + " =\n"
|
67
|
+
header << border +"\n"
|
68
|
+
log_print header
|
69
|
+
end #print_header
|
70
|
+
|
71
|
+
# cleanup
|
72
|
+
# This method moves all compressed files from the installation directory
|
73
|
+
# that were downloaded by this installation process
|
74
|
+
def cleanup(prefix, options)
|
75
|
+
print_header "Cleaning up"
|
76
|
+
Dir.mkdir("#{prefix}downloads") unless File.directory?("#{prefix}downloads")
|
77
|
+
Constants::URLS.each do |url|
|
78
|
+
file = get_version url
|
79
|
+
if File.exists?("#{prefix}#{file}")
|
80
|
+
cmd "rm -rf #{prefix}downloads/#{file}"
|
81
|
+
cmd "mv #{prefix}#{file}* #{prefix}downloads"
|
82
|
+
end #if
|
83
|
+
end # do
|
84
|
+
end #cleanup
|
85
|
+
end #Utilities
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rho_connect_install_utilities'
|
2
|
+
require 'rho_connect_install_constants'
|
3
|
+
|
4
|
+
include Utilities
|
5
|
+
|
6
|
+
class Yum
|
7
|
+
attr_accessor :options
|
8
|
+
|
9
|
+
def initialize(options)
|
10
|
+
@@flavor = "Yum"
|
11
|
+
@options = options
|
12
|
+
@options[:pkg_mgr] = 'yes | yum'
|
13
|
+
@options[:pkg_chkr] = 'rpm -qa'
|
14
|
+
end #initialize
|
15
|
+
|
16
|
+
# check_for_installed_software_only
|
17
|
+
# This method runs checks against the software that must be installed.
|
18
|
+
def check_for_installed_software_only
|
19
|
+
check_all_installed @options
|
20
|
+
end #check_for_installed_software_only
|
21
|
+
|
22
|
+
# execute_installation
|
23
|
+
# This method orchestrates the actual installation process
|
24
|
+
def execute_installation
|
25
|
+
#start logging
|
26
|
+
set_log_file @options[:log]
|
27
|
+
|
28
|
+
#gather necessary files
|
29
|
+
download_and_decompress @options[:prefix]
|
30
|
+
|
31
|
+
#install ruby gems
|
32
|
+
install_rubygems
|
33
|
+
install_redis if @options[:redis]
|
34
|
+
install_sqlite
|
35
|
+
|
36
|
+
#start installing
|
37
|
+
install_all_gems
|
38
|
+
configure_passenger @options
|
39
|
+
|
40
|
+
#install rhoconnect
|
41
|
+
install_rhoconnect
|
42
|
+
|
43
|
+
#remove downloaded tarballs
|
44
|
+
cleanup options[:prefix], @options
|
45
|
+
end #execute_installation
|
46
|
+
|
47
|
+
# to_s
|
48
|
+
# This method overrides the default to_s method
|
49
|
+
def to_s
|
50
|
+
string = "Debian Installation Parameters:\n"
|
51
|
+
string << "\tPackage Manager\n"
|
52
|
+
string << "\t\tapt-get\n"
|
53
|
+
Constants::DEFAULTS.each do |key, val|
|
54
|
+
string << "\t" + key + "\n"
|
55
|
+
val.each do |field|
|
56
|
+
string << "\t\t" + field + "\n"
|
57
|
+
end #do
|
58
|
+
end #do
|
59
|
+
|
60
|
+
string
|
61
|
+
end #to_s
|
62
|
+
|
63
|
+
end #Yum
|
@@ -0,0 +1,89 @@
|
|
1
|
+
$:.unshift File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
require 'logger'
|
5
|
+
require 'time'
|
6
|
+
require 'rho_connect_install_get_params'
|
7
|
+
require 'rho_connect_install_constants'
|
8
|
+
require 'rho_connect_install_utilities'
|
9
|
+
|
10
|
+
include GetParams
|
11
|
+
include Utilities
|
12
|
+
|
13
|
+
# Simplify logger output format: [timestamp] message
|
14
|
+
class Logger
|
15
|
+
class Formatter
|
16
|
+
#Format = "[%s] %s\n"
|
17
|
+
def call(severity, time, progname, msg)
|
18
|
+
"[%s] %s\n" % [format_datetime(time), msg]
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
#make sure script is only run by root users
|
24
|
+
user = `whoami`.strip
|
25
|
+
if user != "root"
|
26
|
+
puts "This installation must be performed by the root user"
|
27
|
+
exit(2)
|
28
|
+
end #if
|
29
|
+
|
30
|
+
options = {}
|
31
|
+
|
32
|
+
optparse = OptionParser.new do|opts|
|
33
|
+
options[:redis] = true
|
34
|
+
opts.on( '--no-redis', '', 'Skip installing the redis server.') do
|
35
|
+
options[:redis] = false
|
36
|
+
end #do
|
37
|
+
|
38
|
+
options[:offline] = false
|
39
|
+
opts.on( '-o', '--offline', 'Check that all necessary files are installed in /opt/rhoconnect if no prefix is specified.' ) do
|
40
|
+
options[:offline] = true
|
41
|
+
end #do
|
42
|
+
|
43
|
+
options[:prefix] = Constants::DEFAULT_INSTALL_DIR
|
44
|
+
opts.on( '-p', '--prefix PREFIX', 'Specify PREFIX as the installation directory. Defalut is /opt/rhoconnect.' ) do |file|
|
45
|
+
options[:prefix] = file
|
46
|
+
end #do
|
47
|
+
|
48
|
+
options[:ruby_version] = "rubyee"
|
49
|
+
opts.on( '-r', '--ruby-version VERSION', 'Specify version of ruby to be installed. Default is Ruby Enterprise.' ) do |ver|
|
50
|
+
options[:ruby_version] = ver
|
51
|
+
end #do
|
52
|
+
|
53
|
+
options[:silent] = false
|
54
|
+
opts.on( '-s', '--silent', 'Perform installation with minimal output' ) do
|
55
|
+
options[:silent] = true
|
56
|
+
end #do
|
57
|
+
|
58
|
+
options[:web_server] = "apache2"
|
59
|
+
opts.on( '-w', '--web-server SERVER', 'Specify apache2 or nginx. Default is Apache2.' ) do |server|
|
60
|
+
options[:web_server] = server
|
61
|
+
end #do
|
62
|
+
|
63
|
+
opts.on( '-h', '--help', 'Display this screen.' ) do
|
64
|
+
puts opts
|
65
|
+
exit
|
66
|
+
end #do
|
67
|
+
end #do
|
68
|
+
|
69
|
+
options[:start_dir] = `pwd`.strip
|
70
|
+
|
71
|
+
optparse.parse!
|
72
|
+
log = Logger.new(IO.readlines("#{options[:prefix]}info.dat").last.strip)
|
73
|
+
log.datetime_format = "%Y-%m-%d %H:%M:%S" # simplify time output
|
74
|
+
options[:log] = log
|
75
|
+
|
76
|
+
#downcase all options hash string values
|
77
|
+
options.each do |key, val|
|
78
|
+
options[key] = val.downcase if val.class == String
|
79
|
+
end #do
|
80
|
+
|
81
|
+
#Start installation process
|
82
|
+
#determine into what directory things will be installed
|
83
|
+
rho = GetParams.get_flavor(options)
|
84
|
+
|
85
|
+
if options[:offline]
|
86
|
+
rho.check_for_installed_software_only
|
87
|
+
else
|
88
|
+
rho.execute_installation
|
89
|
+
end #if
|