gfdnavi 1.3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +10949 -0
- data/LICENCE.txt +57 -0
- data/Makefile +18 -0
- data/TODO +132 -0
- data/app/controllers/analysis_controller.rb +700 -0
- data/app/controllers/application.rb +41 -0
- data/app/controllers/draw_method_controller.rb +172 -0
- data/app/controllers/explorer_controller.rb +197 -0
- data/app/controllers/finder_controller.rb +331 -0
- data/app/controllers/function_controller.rb +204 -0
- data/app/controllers/group_controller.rb +115 -0
- data/app/controllers/keyword_attributes_controller.rb +52 -0
- data/app/controllers/knowledge_controller.rb +928 -0
- data/app/controllers/nodes_controller.rb +515 -0
- data/app/controllers/search_controller.rb +341 -0
- data/app/controllers/user_controller.rb +337 -0
- data/app/helpers/analysis_helper.rb +2 -0
- data/app/helpers/application_helper.rb +105 -0
- data/app/helpers/description_helper.rb +2 -0
- data/app/helpers/function_helper.rb +2 -0
- data/app/helpers/group_helper.rb +2 -0
- data/app/helpers/search_helper.rb +3 -0
- data/app/helpers/user_helper.rb +2 -0
- data/app/helpers/work_flow_helper.rb +92 -0
- data/app/models/actual_file.rb +3 -0
- data/app/models/analysis.rb +715 -0
- data/app/models/analysis_history.rb +42 -0
- data/app/models/cross_array.rb +22 -0
- data/app/models/cross_result.rb +254 -0
- data/app/models/derived_spatial_attribute.rb +3 -0
- data/app/models/diagram_cache.rb +16 -0
- data/app/models/diagram_cache_datum.rb +4 -0
- data/app/models/diagram_cache_session.rb +8 -0
- data/app/models/directory.rb +21 -0
- data/app/models/draw_method.rb +48 -0
- data/app/models/draw_method_attribute.rb +8 -0
- data/app/models/draw_parameter.rb +12 -0
- data/app/models/explorer_query.rb +354 -0
- data/app/models/explorer_result.rb +312 -0
- data/app/models/function.rb +75 -0
- data/app/models/function_argument.rb +6 -0
- data/app/models/function_output.rb +4 -0
- data/app/models/group.rb +153 -0
- data/app/models/image.rb +20 -0
- data/app/models/keyword_attribute.rb +179 -0
- data/app/models/knowledge.rb +94 -0
- data/app/models/knowledge_backup.rb +32 -0
- data/app/models/knowledge_figure.rb +16 -0
- data/app/models/knowledge_figure_backup.rb +16 -0
- data/app/models/knowledge_parser.rb +392 -0
- data/app/models/node.rb +605 -0
- data/app/models/node_entity_abstract.rb +112 -0
- data/app/models/node_lineage.rb +6 -0
- data/app/models/node_relation.rb +4 -0
- data/app/models/path_node.rb +60 -0
- data/app/models/query.rb +193 -0
- data/app/models/query_history.rb +12 -0
- data/app/models/results.rb +48 -0
- data/app/models/sign_up_user.rb +25 -0
- data/app/models/spatial_and_time_attribute.rb +11 -0
- data/app/models/user.rb +115 -0
- data/app/models/user_mailer.rb +48 -0
- data/app/models/value_type.rb +3 -0
- data/app/models/variable.rb +70 -0
- data/app/models/virtual_node.rb +457 -0
- data/app/views/analysis/__help_analysis_tab.en.html +57 -0
- data/app/views/analysis/__help_draw_share.en.html +12 -0
- data/app/views/analysis/__help_draw_tab.en.html +6 -0
- data/app/views/analysis/_analysis_function_settings.rhtml +61 -0
- data/app/views/analysis/_analysis_settings.rhtml +28 -0
- data/app/views/analysis/_diagram.rhtml +70 -0
- data/app/views/analysis/_dimension_option.rhtml +59 -0
- data/app/views/analysis/_draw_general_settings.rhtml +217 -0
- data/app/views/analysis/_draw_settings.rhtml +73 -0
- data/app/views/analysis/_history.rhtml +19 -0
- data/app/views/analysis/_popular_diagrams.rhtml +42 -0
- data/app/views/analysis/_save_form.rhtml +44 -0
- data/app/views/analysis/_variables.rhtml +66 -0
- data/app/views/analysis/_variables_order.rhtml +56 -0
- data/app/views/analysis/index.rhtml +195 -0
- data/app/views/analysis/preview.rhtml +3 -0
- data/app/views/analysis/save.rhtml +73 -0
- data/app/views/analysis/show_diagram.rhtml +42 -0
- data/app/views/cross/_display_map.rhtml +201 -0
- data/app/views/cross/_result.rhtml +205 -0
- data/app/views/cross/_show_result_tree.rhtml +40 -0
- data/app/views/cross/_show_results.rhtml +80 -0
- data/app/views/cross/_style.rhtml +21 -0
- data/app/views/cross/index.rhtml +271 -0
- data/app/views/draw_method/_edit_form.rhtml +110 -0
- data/app/views/draw_method/create.rhtml +8 -0
- data/app/views/draw_method/details.rhtml +113 -0
- data/app/views/draw_method/edit.rhtml +8 -0
- data/app/views/draw_method/list.rhtml +80 -0
- data/app/views/explorer/_display_map.rhtml +199 -0
- data/app/views/explorer/_show_result_tree.rhtml +40 -0
- data/app/views/explorer/_show_results.rhtml +101 -0
- data/app/views/explorer/_style.rhtml +21 -0
- data/app/views/explorer/index.rhtml +214 -0
- data/app/views/finder/_children.html.erb +84 -0
- data/app/views/finder/_children_details.html.erb +74 -0
- data/app/views/finder/_children_details_tr.html.erb +196 -0
- data/app/views/finder/create_tree.html.erb +15 -0
- data/app/views/finder/flex.html.erb +52 -0
- data/app/views/finder/index.html.erb +47 -0
- data/app/views/finder/show_details.html.erb +3 -0
- data/app/views/finder/show_images.html.erb +3 -0
- data/app/views/function/_edit_form.rhtml +106 -0
- data/app/views/function/create.rhtml +8 -0
- data/app/views/function/details.rhtml +96 -0
- data/app/views/function/edit.rhtml +8 -0
- data/app/views/function/list.rhtml +80 -0
- data/app/views/group/add_member.rhtml +13 -0
- data/app/views/group/change_owner.rhtml +15 -0
- data/app/views/group/create.rhtml +11 -0
- data/app/views/group/delete_member.rhtml +14 -0
- data/app/views/group/list.rhtml +63 -0
- data/app/views/knowledge/_backup.rhtml +135 -0
- data/app/views/knowledge/_category.rhtml +58 -0
- data/app/views/knowledge/_category_list.rhtml +34 -0
- data/app/views/knowledge/_category_table.rhtml +23 -0
- data/app/views/knowledge/_comment.rhtml +64 -0
- data/app/views/knowledge/_comment_input_form.rhtml +19 -0
- data/app/views/knowledge/_comments.rhtml +84 -0
- data/app/views/knowledge/_form.rhtml +139 -0
- data/app/views/knowledge/_group_figure_form.rhtml +187 -0
- data/app/views/knowledge/_layout_figure.rhtml +61 -0
- data/app/views/knowledge/_layout_figures_in_a_row_above_text.rhtml +42 -0
- data/app/views/knowledge/_layout_figures_under_text.rhtml +45 -0
- data/app/views/knowledge/_layout_one_figure_above_text.rhtml +28 -0
- data/app/views/knowledge/_summary.rhtml +21 -0
- data/app/views/knowledge/edit.rhtml +37 -0
- data/app/views/knowledge/list.rhtml +287 -0
- data/app/views/knowledge/new.rhtml +23 -0
- data/app/views/knowledge/new_from_analysis.rhtml +21 -0
- data/app/views/knowledge/show.rhtml +196 -0
- data/app/views/layouts/gfdnavi.rhtml +105 -0
- data/app/views/nodes/_ancestors.html.erb +89 -0
- data/app/views/nodes/_description_methods_table.html.erb +75 -0
- data/app/views/nodes/_mode.html.erb +16 -0
- data/app/views/nodes/description.html.erb +181 -0
- data/app/views/nodes/description_methods.html.erb +1 -0
- data/app/views/nodes/edit.html.erb +73 -0
- data/app/views/nodes/index.html.erb +25 -0
- data/app/views/nodes/show.html.erb +20 -0
- data/app/views/search/_children_details_mapsearch.rhtml +68 -0
- data/app/views/search/_children_details_tr.rhtml +205 -0
- data/app/views/search/_show_grouplist.rhtml +74 -0
- data/app/views/search/_show_results.rhtml +43 -0
- data/app/views/search/_show_results_global.rhtml +36 -0
- data/app/views/search/_show_results_partial.rhtml +39 -0
- data/app/views/search/_show_results_partial_groupbyfile.rhtml +50 -0
- data/app/views/search/_show_variablelist.rhtml +28 -0
- data/app/views/search/mapsearch.rhtml +176 -0
- data/app/views/search/remapsearch.rjs +18 -0
- data/app/views/search/show_details.rhtml +3 -0
- data/app/views/user/add_user.rhtml +30 -0
- data/app/views/user/change_password.rhtml +25 -0
- data/app/views/user/edit.html.erb +50 -0
- data/app/views/user/index.rhtml +162 -0
- data/app/views/user/login.rhtml +41 -0
- data/app/views/user/logout.rhtml +4 -0
- data/app/views/user/signup.rhtml +36 -0
- data/app/views/user/signup_succeeded.rhtml +36 -0
- data/app/views/user_mailer/authorization_inform.rhtml +15 -0
- data/app/views/user_mailer/signup_accepted.rhtml +12 -0
- data/app/views/user_mailer/signup_confirm.rhtml +14 -0
- data/app/views/user_mailer/signup_inform.rhtml +13 -0
- data/app/views/user_mailer/signup_rejected.rhtml +11 -0
- data/app/views/work_flow/_push_wsdls.rhtml +55 -0
- data/app/views/work_flow/index.rhtml +46 -0
- data/config/database.yml.example +35 -0
- data/config/environment.rb +68 -0
- data/config/gfdnavi.yml.example +95 -0
- data/config/load_config.rb +151 -0
- data/config/routes.rb +35 -0
- data/consistency_checker.rb +129 -0
- data/data/gfdnavi_docs/how_to_draw_multiple_images.knlge +68 -0
- data/data/gfdnavi_docs/how_to_knowledge.knlge +138 -0
- data/data/gfdnavi_docs/how_to_write_document_about_Gfdnavi.knlge +30 -0
- data/data/samples/jmadata.SIGEN +8 -0
- data/data/samples/jmadata.yml +6 -0
- data/data/samples/jmadata/MSM-P/2006.nc.yml +2 -0
- data/data/samples/jmadata/MSM-P/2006.yml +17 -0
- data/data/samples/jmadata/MSM-P/2006/0101.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0101.nc.yml +13 -0
- data/data/samples/jmadata/MSM-P/2006/0102.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0103.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0104.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0105.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/010[1-3].nc.yml +2 -0
- data/data/samples/jmadata/MSM-P/2006/skip_data.rb +96 -0
- data/data/samples/jmadata/MSM-P/2006/skip_data.sh +6 -0
- data/data/samples/reanalysis.SIGEN +8 -0
- data/data/samples/reanalysis/era40.SIGEN +8 -0
- data/data/samples/reanalysis/era40.yml +2 -0
- data/data/samples/reanalysis/era40/t.jan.nc +0 -0
- data/data/samples/reanalysis/era40/t.jan.nc.yml +1 -0
- data/data/samples/reanalysis/ncep.SIGEN +9 -0
- data/data/samples/reanalysis/ncep/T.jan.100hPa.png +0 -0
- data/data/samples/reanalysis/ncep/T.jan.100hPa.png.yml +43 -0
- data/data/samples/reanalysis/ncep/T.jan.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc.yml +8 -0
- data/data/samples/reanalysis/ncep/T.jan_only_root.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan_only_root.nc.yml +4 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc +0 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc.yml +10 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc.yml.ja +11 -0
- data/data/samples/sonde_operational.yml +5 -0
- data/data/samples/sonde_operational/std_plev.yml +12 -0
- data/data/samples/sonde_operational/std_plev/41256.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/42410.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/43333.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/43346.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/48698.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/61641.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/63741.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/67083.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/72261.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/76805.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/82193.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91165.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91610.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91948.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/94294.spl.nc +0 -0
- data/db/NetCDFparser.rb +406 -0
- data/db/create_derived_spatial_attributes.sql +12 -0
- data/db/draw_methods/line.yml +6 -0
- data/db/draw_methods/scatter.yml +38 -0
- data/db/draw_methods/tone.yml +64 -0
- data/db/draw_methods/vector.yml +19 -0
- data/db/dump_db.rb +43 -0
- data/db/functions/additions.yml +10 -0
- data/db/functions/cut.yml +10 -0
- data/db/functions/division.yml +10 -0
- data/db/functions/mean.yml +28 -0
- data/db/functions/multiplication.yml +10 -0
- data/db/functions/stddev.yml +28 -0
- data/db/functions/subtraction.yml +10 -0
- data/db/migrate/001_initial_scheme.rb +289 -0
- data/db/migrate/002_add_open_id_authentication_tables.rb +20 -0
- data/db/register_directory_tree.rb +760 -0
- data/db/restore_db.rb +60 -0
- data/gfdnavi-install +828 -0
- data/install.rb +828 -0
- data/lib/activerecord_gfdnavi.rb +31 -0
- data/lib/basic_authorization.rb +50 -0
- data/lib/create_activeresources.rb +108 -0
- data/lib/execute_analysis.rb +472 -0
- data/lib/file_gfdnavi.rb +38 -0
- data/lib/gphys_gfdnavi.rb +81 -0
- data/lib/localdir.rb +110 -0
- data/lib/login_system.rb +110 -0
- data/lib/multibytes.rb +20 -0
- data/lib/narray_yaml.rb +58 -0
- data/lib/no_rdb_base.rb +40 -0
- data/lib/opendapdir.rb +171 -0
- data/lib/tar.rb +127 -0
- data/lib/tasks/clean.rake +65 -0
- data/lib/tasks/setup.rake +316 -0
- data/lib/tasks/update.rake +62 -0
- data/lib/vizshot_gfdnavi.rb +224 -0
- data/public/crossdomain.xml +4 -0
- data/public/flex/NodeTreeDescriptor.as +55 -0
- data/public/flex/TreeNode.as +253 -0
- data/public/flex/finder.mxml +304 -0
- data/public/flex/finder.swf +0 -0
- data/public/flex/gfdnavi.mxml +52 -0
- data/public/flex/gfdnavi.swf +0 -0
- data/public/images/Help_S-shots/dir_tree_with_add.jpg +0 -0
- data/public/images/analyze.gif +0 -0
- data/public/images/circle.gif +0 -0
- data/public/images/create_from_analysis_button.png +0 -0
- data/public/images/delete.png +0 -0
- data/public/images/down.png +0 -0
- data/public/images/drawbutton.gif +0 -0
- data/public/images/gfdnavi_home_logo.png +0 -0
- data/public/images/gfdnavi_logo_big.png +0 -0
- data/public/images/gfdnavi_logo_med.png +0 -0
- data/public/images/gfdnavi_logo_mini.png +0 -0
- data/public/images/gfdnavi_logo_nobg_big.png +0 -0
- data/public/images/gfdnavi_logo_nobg_med.png +0 -0
- data/public/images/gfdnavi_logo_nobg_small.png +0 -0
- data/public/images/gfdnavi_logo_small.png +0 -0
- data/public/images/gfdnavi_logo_xsmall.png +0 -0
- data/public/images/hbar.png +0 -0
- data/public/images/helpmark16.png +0 -0
- data/public/images/helpmark18.png +0 -0
- data/public/images/kikyu_g.gif +0 -0
- data/public/images/kikyu_r.gif +0 -0
- data/public/images/map_icon_g.gif +0 -0
- data/public/images/map_icon_r.gif +0 -0
- data/public/images/new_knowledge.png +0 -0
- data/public/images/openid.png +0 -0
- data/public/images/read_in_the_form.png +0 -0
- data/public/images/slider_f.gif +0 -0
- data/public/images/slider_f_red.gif +0 -0
- data/public/images/star1.gif +0 -0
- data/public/images/star2.gif +0 -0
- data/public/images/startanim.gif +0 -0
- data/public/images/stopanim.gif +0 -0
- data/public/images/tree/DL.png +0 -0
- data/public/images/tree/anal_viz.png +0 -0
- data/public/images/tree/analyze_visualize_checked_items.png +0 -0
- data/public/images/tree/binary.png +0 -0
- data/public/images/tree/details.png +0 -0
- data/public/images/tree/download_checked_items.png +0 -0
- data/public/images/tree/folder.png +0 -0
- data/public/images/tree/folder_close.gif +0 -0
- data/public/images/tree/image2.png +0 -0
- data/public/images/tree/knowledge.png +0 -0
- data/public/images/tree/knowledges.png +0 -0
- data/public/images/tree/last.gif +0 -0
- data/public/images/tree/last.png +0 -0
- data/public/images/tree/minus.gif +0 -0
- data/public/images/tree/minus_simple.gif +0 -0
- data/public/images/tree/none.gif +0 -0
- data/public/images/tree/none.png +0 -0
- data/public/images/tree/plus.gif +0 -0
- data/public/images/tree/plus_simple.gif +0 -0
- data/public/images/tree/show.png +0 -0
- data/public/images/tree/show_checked_items.png +0 -0
- data/public/images/tree/t.gif +0 -0
- data/public/images/tree/t.png +0 -0
- data/public/images/tree/tate.gif +0 -0
- data/public/images/tree/tate.png +0 -0
- data/public/images/up.png +0 -0
- data/public/images/vbar.png +0 -0
- data/public/images/white.bmp +0 -0
- data/public/images/x.gif +0 -0
- data/public/index.html +100 -0
- data/public/javascripts/AC_OETags.js +269 -0
- data/public/javascripts/analysis.js +751 -0
- data/public/javascripts/application.js +29 -0
- data/public/javascripts/directory_tree.js +102 -0
- data/public/javascripts/draw_method.js +83 -0
- data/public/javascripts/excanvas.js +704 -0
- data/public/javascripts/function.js +107 -0
- data/public/javascripts/gfdnavi.js +175 -0
- data/public/javascripts/knowledge.js +384 -0
- data/public/javascripts/mapsearch.js +313 -0
- data/public/javascripts/progress.js +42 -0
- data/public/javascripts/resizable_box.js +164 -0
- data/public/javascripts/slider.js +260 -0
- data/public/javascripts/tab.js +17 -0
- data/public/javascripts/work_flow.js +452 -0
- data/public/stylesheets/analysis.css +111 -0
- data/public/stylesheets/description.css +71 -0
- data/public/stylesheets/gfdnavi.css +141 -0
- data/public/stylesheets/knowledge.css +218 -0
- data/public/stylesheets/search.css +184 -0
- data/public/stylesheets/tree.css +45 -0
- data/public/stylesheets/tree_for_ie.css +3 -0
- data/public/stylesheets/work_flow.css +78 -0
- data/script/cleaner +11 -0
- data/script/server_ssl +131 -0
- data/test/fixtures/diagram_cache_data.yml +5 -0
- data/test/fixtures/diagram_cache_sessions.yml +6 -0
- data/test/fixtures/diagram_caches.yml +6 -0
- data/test/fixtures/directories.yml +57 -0
- data/test/fixtures/draw_parameters.yml +6 -0
- data/test/fixtures/function_arguments.yml +15 -0
- data/test/fixtures/function_outputs.yml +15 -0
- data/test/fixtures/functions.yml +29 -0
- data/test/fixtures/group_members.yml +33 -0
- data/test/fixtures/groups.yml +25 -0
- data/test/fixtures/images.yml +12 -0
- data/test/fixtures/keyword_attributes.yml +73 -0
- data/test/fixtures/knowledges.yml +10 -0
- data/test/fixtures/node_relations.yml +11 -0
- data/test/fixtures/nodes.yml +298 -0
- data/test/fixtures/sign_up_users.yml +8 -0
- data/test/fixtures/spatial_and_time_attributes.yml +29 -0
- data/test/fixtures/user_mailer/authorization_inform +11 -0
- data/test/fixtures/user_mailer/signup_accepted +10 -0
- data/test/fixtures/user_mailer/signup_confirm +17 -0
- data/test/fixtures/user_mailer/signup_inform +10 -0
- data/test/fixtures/user_mailer/signup_rejected +9 -0
- data/test/fixtures/users.yml +31 -0
- data/test/fixtures/value_types.yml +10 -0
- data/test/fixtures/variables.yml +17 -0
- data/test/functional/analysis_controller_test.rb +169 -0
- data/test/functional/description_controller_test.rb +18 -0
- data/test/functional/function_controller_test.rb +18 -0
- data/test/functional/group_controller_test.rb +18 -0
- data/test/functional/search_controller_test.rb +83 -0
- data/test/functional/user_controller_test.rb +77 -0
- data/test/functional/webservice_analysis_api_test.rb +12 -0
- data/test/functional/work_flow_controller_test.rb +18 -0
- data/test/test_helper.rb +28 -0
- data/test/unit/diagram_cache_datum_test.rb +10 -0
- data/test/unit/diagram_cache_session_test.rb +10 -0
- data/test/unit/diagram_cache_test.rb +10 -0
- data/test/unit/directory_test.rb +49 -0
- data/test/unit/draw_parameter_test.rb +10 -0
- data/test/unit/function_argument_test.rb +10 -0
- data/test/unit/function_output_test.rb +10 -0
- data/test/unit/function_test.rb +10 -0
- data/test/unit/group_test.rb +48 -0
- data/test/unit/image_test.rb +13 -0
- data/test/unit/keyword_attribute_test.rb +33 -0
- data/test/unit/knowledge_test.rb +13 -0
- data/test/unit/node_relation_test.rb +20 -0
- data/test/unit/node_test.rb +85 -0
- data/test/unit/sign_up_user_test.rb +20 -0
- data/test/unit/spatial_and_time_attribute_test.rb +29 -0
- data/test/unit/user_mailer_test.rb +101 -0
- data/test/unit/user_test.rb +134 -0
- data/test/unit/value_type_test.rb +10 -0
- data/test/unit/variable_test.rb +35 -0
- data/vendor/plugins/acts_as_list/README +23 -0
- data/vendor/plugins/acts_as_list/init.rb +3 -0
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/vendor/plugins/acts_as_tree/README +26 -0
- data/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/vendor/plugins/will_paginate/CHANGELOG +92 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +131 -0
- data/vendor/plugins/will_paginate/Rakefile +62 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +86 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +145 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +247 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +132 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +39 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +373 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +21 -0
- metadata +586 -0
data/install.rb
ADDED
|
@@ -0,0 +1,828 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
require "fileutils"
|
|
3
|
+
require "yaml"
|
|
4
|
+
|
|
5
|
+
RDBMS = %w(MySQL SQLite3)
|
|
6
|
+
@src_top = File.dirname( File.expand_path(__FILE__) )
|
|
7
|
+
|
|
8
|
+
# SET RAILS-COMMAND
|
|
9
|
+
if RUBY_PLATFORM =~ /mswin|mingw|bccwin/
|
|
10
|
+
# FOR WINDOWS
|
|
11
|
+
$rails_bin = "ruby " + File.join(ENV['RBPATH'],"rails")
|
|
12
|
+
$dev_null = "null"
|
|
13
|
+
else
|
|
14
|
+
# FOR UNIX-LIKE SYSTEMS
|
|
15
|
+
$rails_bin = "rails"
|
|
16
|
+
$dev_null = "/dev/null"
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# PLUGINS TO BE INSTALLED AFTER RAILS-COMMAND
|
|
20
|
+
$gfdnavi_plugins = [] # NOW IT'S EMPTY
|
|
21
|
+
|
|
22
|
+
=begin
|
|
23
|
+
rails_version = nil
|
|
24
|
+
# CHECK RAILS VERSION
|
|
25
|
+
IO.popen("#{$rails_bin} --version"){|io| rails_version = io.read.split[1].split(".")}
|
|
26
|
+
if (rails_version[0].to_i >= 2) and (rails_version[1].to_i >= 1)
|
|
27
|
+
if system("git --version > #{$dev_null}")
|
|
28
|
+
$gfdnavi_plugins.push("git://github.com/mislav/will_paginate.git")
|
|
29
|
+
else
|
|
30
|
+
raise "please install \"git\"!!!"
|
|
31
|
+
end
|
|
32
|
+
else
|
|
33
|
+
$gfdnavi_plugins.push("svn://errtheblog.com/svn/plugins/will_paginate")
|
|
34
|
+
end
|
|
35
|
+
=end
|
|
36
|
+
|
|
37
|
+
SERVER_TYPE_NAMES = ["1. private/group server",
|
|
38
|
+
"2. open-access server (enable user accounts)",
|
|
39
|
+
"3. open-access server (disable user accounts)"]
|
|
40
|
+
|
|
41
|
+
def setup_destination
|
|
42
|
+
print <<"EOF"
|
|
43
|
+
Set destination directory name and copy files.
|
|
44
|
+
gfdnavi will be installed to "/path_you_input/gfdnavi"
|
|
45
|
+
EOF
|
|
46
|
+
dest_path = @params[:dest_top] ? File.dirname(@params[:dest_top]) : ENV["HOME"]
|
|
47
|
+
# Win32 ##
|
|
48
|
+
unless dest_path == ""
|
|
49
|
+
if RUBY_PLATFORM =~ /mswin|mingw|bccwin/
|
|
50
|
+
dest_path = File.join(ENV['RBPATH'],"..","..")
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
print "Please input destination path (default: #{dest_path}): "
|
|
54
|
+
res = $stdin.gets.chomp!
|
|
55
|
+
unless res == ""
|
|
56
|
+
dest_path = res.sub(/\/$/,"")
|
|
57
|
+
end
|
|
58
|
+
##########
|
|
59
|
+
@params[:dest_top] = File.join(dest_path,"gfdnavi")
|
|
60
|
+
|
|
61
|
+
@params[:skip_rdb] = false
|
|
62
|
+
if File.exists?( File.join(dest_path, "gfdnavi", "config", "database.yml") )
|
|
63
|
+
print "There already exists #{dest_path}/gfdnavi/config/database.yml.\n"
|
|
64
|
+
print "Do you want to keep the settings? (yes/no, default:yes): "
|
|
65
|
+
while true
|
|
66
|
+
case $stdin.gets.chomp!
|
|
67
|
+
when "", "yes"
|
|
68
|
+
if !$load_inst_params
|
|
69
|
+
install_params_file = File.join(dest_path,"gfdnavi","install_params.yml")
|
|
70
|
+
if File.exists?( install_params_file )
|
|
71
|
+
@params = YAML.load(File.read(install_params_file))
|
|
72
|
+
$load_inst_params = true
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
@params[:skip_rdb] = true
|
|
76
|
+
break
|
|
77
|
+
when "no"
|
|
78
|
+
break
|
|
79
|
+
else
|
|
80
|
+
print "Do you want to keep the settings? (yes/no, default:yes): "
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def setup_email
|
|
87
|
+
print "Set admin's email address\n"
|
|
88
|
+
while true
|
|
89
|
+
print "Input email address"
|
|
90
|
+
print "(default: #{@params[:email]})" if @params[:email]
|
|
91
|
+
print ": "
|
|
92
|
+
email = $stdin.gets.chomp!
|
|
93
|
+
email = @params[:email] if email == ""
|
|
94
|
+
unless /^(\w|-)+@(\w|-)+\.(\w|-)+/ =~ email
|
|
95
|
+
print "Invalid email address is input.\n"
|
|
96
|
+
else
|
|
97
|
+
break
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
@params[:email] = email
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def setup_parameter
|
|
104
|
+
if @params[:skip_rdb]
|
|
105
|
+
print "skipped setting for database configurations\n"
|
|
106
|
+
else
|
|
107
|
+
print <<"EOF"
|
|
108
|
+
|
|
109
|
+
***
|
|
110
|
+
The database settings you will specify in the following will
|
|
111
|
+
be written in the file:
|
|
112
|
+
|
|
113
|
+
#{@params[:dest_top]}/config/database.yml
|
|
114
|
+
|
|
115
|
+
YOU CAN MANUALLY EDIT IT LATER IF YOU LIKE.
|
|
116
|
+
EOF
|
|
117
|
+
print <<"EOF"
|
|
118
|
+
***
|
|
119
|
+
Please specify the RDBMS you want to use.
|
|
120
|
+
EOF
|
|
121
|
+
RDBMS.each_with_index{|name,i| print "#{i+1}. #{name}\n"}
|
|
122
|
+
print "(Sorry, other RDBMSs are not supported in this installation script.)\n"
|
|
123
|
+
while true
|
|
124
|
+
rdb_type = @params[:rdb_type] || 2
|
|
125
|
+
print "Select the RDBMS (default:#{rdb_type}): "
|
|
126
|
+
type = $stdin.gets.chomp!
|
|
127
|
+
rdb_type = type=="" ? rdb_type : type.to_i
|
|
128
|
+
unless rdb_type >= 1 && rdb_type <= RDBMS.length
|
|
129
|
+
print "Invalid number was input.\n"
|
|
130
|
+
else
|
|
131
|
+
break
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
@params[:rdb_type] = rdb_type
|
|
135
|
+
if RDBMS[rdb_type-1] == "MySQL"
|
|
136
|
+
# CYGWIN PATCH BEGIN
|
|
137
|
+
if /cygwin/ =~ RUBY_PLATFORM
|
|
138
|
+
print <<"EOF"
|
|
139
|
+
1. windows native MySQL
|
|
140
|
+
2. MySQL compiled on cygwin
|
|
141
|
+
EOF
|
|
142
|
+
while true
|
|
143
|
+
rdb_plf = @params[:rdb_plf] || 1
|
|
144
|
+
print "Select the RDBMS platform (default:#{rdb_plf}): "
|
|
145
|
+
type = $stdin.gets.chomp!
|
|
146
|
+
rdb_plf = type=="" ? rdb_plf : type.to_i
|
|
147
|
+
unless [1,2].include?(rdb_plf)
|
|
148
|
+
print "Invalid number\n"
|
|
149
|
+
else
|
|
150
|
+
break
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
@params[:rdb_plf] = rdb_plf
|
|
154
|
+
end
|
|
155
|
+
# CYGWIN PATCH END
|
|
156
|
+
print "Input the RDB user name for gfdnavi_* databases "
|
|
157
|
+
print "(default: #{@params[:rdb_user]})" if @params[:rdb_user]
|
|
158
|
+
print ": "
|
|
159
|
+
rdb_user = $stdin.gets.chomp!
|
|
160
|
+
@params[:rdb_user] = rdb_user unless rdb_user == ""
|
|
161
|
+
print "Input the password for the databases: "
|
|
162
|
+
@params[:rdb_password] = $stdin.gets.chomp!
|
|
163
|
+
end
|
|
164
|
+
###
|
|
165
|
+
# MySQL SETTINGS
|
|
166
|
+
if RDBMS[rdb_type-1] == "MySQL"
|
|
167
|
+
print <<"EOF"
|
|
168
|
+
You must finish settings of RDBMS before installing gfdnavi.
|
|
169
|
+
If you have not, use another terminal now to set up
|
|
170
|
+
an RDBMS. If you would like to use mysql, I can show you how to do that.
|
|
171
|
+
EOF
|
|
172
|
+
print "Would you like read the how-to for mysql? (yes/no, default:yes): "
|
|
173
|
+
|
|
174
|
+
unless $stdin.gets.chomp! == "no"
|
|
175
|
+
print <<"EOF"
|
|
176
|
+
***
|
|
177
|
+
>>>>> doc for mysql >>>>>
|
|
178
|
+
You can set mysql database as follows:
|
|
179
|
+
|
|
180
|
+
% mysql -u root -p
|
|
181
|
+
Enter password:
|
|
182
|
+
-- type in password of root.
|
|
183
|
+
(the user name specified with the -u option does not need to be root,
|
|
184
|
+
but it must be a privileged one in order to create new databases.)
|
|
185
|
+
mysql> create database gfdnavi_development;
|
|
186
|
+
mysql> create database gfdnavi_test;
|
|
187
|
+
mysql> create database gfdnavi_production;
|
|
188
|
+
mysql> grant all on gfdnavi_development.* to 'davis'@'localhost' identified by 'hogehero';
|
|
189
|
+
mysql> grant all on gfdnavi_test.* to 'davis'@'localhost' identified by 'hogehero';
|
|
190
|
+
mysql> grant all on gfdnavi_production.* to 'davis'@'localhost' identified by 'hogehero';
|
|
191
|
+
|
|
192
|
+
Here, DO NOT forget to use your own password. DO NOT use 'hogehero'.
|
|
193
|
+
Note that the password will appear in the database.yml file
|
|
194
|
+
WITHOUT ENCRYPTION. So DO NOT USE YOUR LOGIN PASSWORD of any computer
|
|
195
|
+
system either.
|
|
196
|
+
<<<<< doc for mysql <<<<<
|
|
197
|
+
|
|
198
|
+
EOF
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
###
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
print "\n***\nGfdanvi configuration\n\n"
|
|
205
|
+
@params[:skip_configure] = false
|
|
206
|
+
if File.exists?( File.join(@params[:dest_top], "config", "gfdnavi.yml") )
|
|
207
|
+
print "There already exists #{@params[:dest_top]}/config/gfdnavi.yml.\n"
|
|
208
|
+
print "Do you want to keep the settings? (yes/no, default:yes): "
|
|
209
|
+
unless $stdin.gets.chomp! == "no"
|
|
210
|
+
@params[:skip_configure] = true
|
|
211
|
+
end
|
|
212
|
+
end
|
|
213
|
+
if @params[:skip_configure]
|
|
214
|
+
print "skipped setting for gfdnavi configurations\n"
|
|
215
|
+
else
|
|
216
|
+
print <<"EOF"
|
|
217
|
+
|
|
218
|
+
***
|
|
219
|
+
The gfdnavi settings you will specify in the following will
|
|
220
|
+
be written in the file:
|
|
221
|
+
|
|
222
|
+
#{@params[:dest_top]}/config/gfdnavi.yml
|
|
223
|
+
|
|
224
|
+
YOU CAN MANUALLY EDIT IT LATER IF YOU LIKE.
|
|
225
|
+
|
|
226
|
+
EOF
|
|
227
|
+
|
|
228
|
+
print "Set salt for encryption\n"
|
|
229
|
+
while true
|
|
230
|
+
print "input phrase (at least 5 characters): "
|
|
231
|
+
salt = $stdin.gets.chomp!
|
|
232
|
+
if salt.length < 5
|
|
233
|
+
print "The phrase which you input is too short.\n"
|
|
234
|
+
else
|
|
235
|
+
break
|
|
236
|
+
end
|
|
237
|
+
end
|
|
238
|
+
@params[:salt] = salt
|
|
239
|
+
|
|
240
|
+
# SET E-MAIL ADDRESS
|
|
241
|
+
setup_email
|
|
242
|
+
|
|
243
|
+
print <<"EOF"
|
|
244
|
+
Select server type to set default configuration parameters
|
|
245
|
+
The configurations in "config/gfdnavi.yml" will be set according to your choice of server type.
|
|
246
|
+
#{SERVER_TYPE_NAMES[0]}
|
|
247
|
+
#{SERVER_TYPE_NAMES[1]}
|
|
248
|
+
#{SERVER_TYPE_NAMES[2]}
|
|
249
|
+
EOF
|
|
250
|
+
while true
|
|
251
|
+
print "Select the server type (default:1): "
|
|
252
|
+
server_type = $stdin.gets.chomp!
|
|
253
|
+
server_type = server_type=="" ? 1 : server_type.to_i
|
|
254
|
+
unless [1,2,3].include?(server_type)
|
|
255
|
+
print "Invalid number was input.\n"
|
|
256
|
+
else
|
|
257
|
+
break
|
|
258
|
+
end
|
|
259
|
+
end
|
|
260
|
+
@params[:server_type] = server_type
|
|
261
|
+
|
|
262
|
+
if server_type == 1 # when private server is selected, unlimit soft limit of array.
|
|
263
|
+
@params[:unlimit_array_soft] = true
|
|
264
|
+
end
|
|
265
|
+
|
|
266
|
+
print <<"EOF"
|
|
267
|
+
Select Rails environment.
|
|
268
|
+
When you use Gfdnavi as an open-access server, production environment is strongly recommended.
|
|
269
|
+
If you are unsure, you should select development environment.
|
|
270
|
+
1. development
|
|
271
|
+
2. production
|
|
272
|
+
EOF
|
|
273
|
+
while true
|
|
274
|
+
print "Select environment (default:1): "
|
|
275
|
+
rails_env = $stdin.gets.chomp!
|
|
276
|
+
rails_env = rails_env=="" ? 1 : rails_env.to_i
|
|
277
|
+
unless [1,2].include?(rails_env)
|
|
278
|
+
print "Invalid number was input.\n"
|
|
279
|
+
else
|
|
280
|
+
break
|
|
281
|
+
end
|
|
282
|
+
end
|
|
283
|
+
case rails_env
|
|
284
|
+
when 1
|
|
285
|
+
@params[:rails_env] = "development"
|
|
286
|
+
when 2
|
|
287
|
+
@params[:rails_env] = "production"
|
|
288
|
+
end
|
|
289
|
+
end
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
DIRS_TO_EXCLUDE = /#{@src_top}\/data\/samples\/.+|#{@src_top}\/tmp\/.+|#{@src_top}\/public\/diagrams\/.+/
|
|
293
|
+
DIRS_OBSOLETE = /#{@src_top}\/public\/data\/.+/
|
|
294
|
+
|
|
295
|
+
def copy_files_in_dir(src, dest, sampledata=false)
|
|
296
|
+
Dir.foreach(src) do |name|
|
|
297
|
+
next if name == "." || name == ".."
|
|
298
|
+
next if name == "install.rb"
|
|
299
|
+
next if /~$/ =~ name
|
|
300
|
+
dest_name = File.join(dest,name)
|
|
301
|
+
src_name = File.join(src,name)
|
|
302
|
+
if File.directory?(src_name) && !File.symlink?(src_name)
|
|
303
|
+
next if DIRS_OBSOLETE =~ src_name
|
|
304
|
+
next if !sampledata and (DIRS_TO_EXCLUDE =~ src_name)
|
|
305
|
+
FileUtils.mkdir(dest_name) unless File.exist?(dest_name)
|
|
306
|
+
copy_files_in_dir( src_name, dest_name, sampledata)
|
|
307
|
+
else
|
|
308
|
+
FileUtils.copy( src_name, dest_name, {:preserve => true} ) if File.file?(src_name)
|
|
309
|
+
end
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
def copy_files(src, dest, sampledata=false)
|
|
314
|
+
copy_files_in_dir(src, dest, sampledata)
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
def install_files
|
|
318
|
+
dest_top = @params[:dest_top]
|
|
319
|
+
if File.exists?( dest_top )
|
|
320
|
+
unless File.directory?(dest_top)
|
|
321
|
+
abort "#{dest_top} is not a directory."
|
|
322
|
+
end
|
|
323
|
+
# IF TARGET DIRECTORY ALREADY EXISTS
|
|
324
|
+
if @src_top != dest_top
|
|
325
|
+
# IF TARGET != SRC
|
|
326
|
+
print "#{dest_top} already exists.\n"
|
|
327
|
+
unless $noquestions
|
|
328
|
+
while true
|
|
329
|
+
print "Can I overwrite it? (yes/no): "
|
|
330
|
+
case $stdin.gets.chomp!
|
|
331
|
+
when "yes"
|
|
332
|
+
# OVERWRITE
|
|
333
|
+
print "#{dest_top} will be overwritten.\n"
|
|
334
|
+
break
|
|
335
|
+
when "no"
|
|
336
|
+
# KEEP CURRENT FILES
|
|
337
|
+
print <<"EOF"
|
|
338
|
+
#{dest_top} will be kept as is.
|
|
339
|
+
Install process may fail
|
|
340
|
+
if you have not installed gfdnavi to the directory.
|
|
341
|
+
EOF
|
|
342
|
+
return
|
|
343
|
+
end
|
|
344
|
+
end
|
|
345
|
+
end
|
|
346
|
+
else
|
|
347
|
+
# IF TARGET == SRC
|
|
348
|
+
print "You are going to use current directory as the target.\n"
|
|
349
|
+
end
|
|
350
|
+
dest_existed = true
|
|
351
|
+
else
|
|
352
|
+
# CREATE TARGET DIRECTORY
|
|
353
|
+
unless $noquestions
|
|
354
|
+
print "#{dest_top} does not exist.\n"
|
|
355
|
+
print "Can I create the directories? (yes/no, default:yes): "
|
|
356
|
+
make_dest_top = $stdin.gets.chomp!
|
|
357
|
+
else
|
|
358
|
+
make_dest_top = "yes"
|
|
359
|
+
end
|
|
360
|
+
unless make_dest_top == "no"
|
|
361
|
+
FileUtils.makedirs(dest_top)
|
|
362
|
+
else
|
|
363
|
+
# CANCEL
|
|
364
|
+
abort "operation was canceled."
|
|
365
|
+
end
|
|
366
|
+
dest_existed = false
|
|
367
|
+
end
|
|
368
|
+
Dir.chdir( File.join(@params[:dest_top],"..") )
|
|
369
|
+
# CHECK IF RAILS-COMMAND WILL BE EXECUTED
|
|
370
|
+
execute_rails = false
|
|
371
|
+
if dest_existed && File.exists?( File.join(dest_top,'script/about') ) && (!$noquestions)
|
|
372
|
+
print "Do you want execute \"rails\" command? (you seem to have already executed, but it's no problem to repeat it.)(no/yes, default:no): "
|
|
373
|
+
if $stdin.gets.chomp! == "yes"
|
|
374
|
+
execute_rails = true
|
|
375
|
+
end
|
|
376
|
+
else
|
|
377
|
+
execute_rails = true
|
|
378
|
+
end
|
|
379
|
+
unless execute_rails
|
|
380
|
+
# IF NOT EXECUTING RAILS-COMMAND
|
|
381
|
+
print <<"EOF"
|
|
382
|
+
Warning: You selected no.
|
|
383
|
+
Make sure that you have already executed rails command,
|
|
384
|
+
or execute rails later.
|
|
385
|
+
EOF
|
|
386
|
+
else
|
|
387
|
+
if @params[:skip_rdb] || (@src_top == dest_top)
|
|
388
|
+
rails_option = "--skip"
|
|
389
|
+
else
|
|
390
|
+
rails_option = "--force"
|
|
391
|
+
end
|
|
392
|
+
# EXECUTE RAILS-COMMAND
|
|
393
|
+
railscommand = "#{$rails_bin} gfdnavi #{rails_option} -d #{RDBMS[@params[:rdb_type]-1].downcase} > #{$dev_null}"
|
|
394
|
+
unless system(railscommand)
|
|
395
|
+
abort "failed to execute \n #{railscommand}\nat #{Dir.pwd}"
|
|
396
|
+
end
|
|
397
|
+
|
|
398
|
+
if $gfdnavi_plugins.length > 0
|
|
399
|
+
# INSTALL PLUGINS IF RAILS >= 2.0
|
|
400
|
+
require "rubygems"
|
|
401
|
+
begin
|
|
402
|
+
if (gem "rails", ">=2.0")
|
|
403
|
+
Dir.chdir("gfdnavi")
|
|
404
|
+
# REMOTE PLUGINS
|
|
405
|
+
skip_remote_plugin = false
|
|
406
|
+
|
|
407
|
+
#plugincommand = "ruby script/plugin install --force"
|
|
408
|
+
plugincommand = "script/plugin"
|
|
409
|
+
|
|
410
|
+
# $gfdnavi_plugins.each{|plgin| plugincommand << " " << plgin}
|
|
411
|
+
# CHECK PROXY
|
|
412
|
+
proxycommand = ""
|
|
413
|
+
if http_proxy = (ENV["http_proxy"] || ENV["HTTP_PROXY"])
|
|
414
|
+
print "use proxy for http connection\n"
|
|
415
|
+
print "http_proxy = #{ENV["http_proxy"]}\n" if ENV["http_proxy"]
|
|
416
|
+
print "HTTP_PROXY = #{ENV["HTTP_PROXY"]}\n" if ENV["HTTP_PROXY"]
|
|
417
|
+
else
|
|
418
|
+
unless $noquestions
|
|
419
|
+
print <<"EOF"
|
|
420
|
+
|
|
421
|
+
You need http connection to install remote plugins.
|
|
422
|
+
If you are not connected to internet,
|
|
423
|
+
please \"skip\" and try later.
|
|
424
|
+
Which do you choose? (direct / proxy / skip, default:direct):
|
|
425
|
+
EOF
|
|
426
|
+
case $stdin.gets.chomp!
|
|
427
|
+
when "proxy"
|
|
428
|
+
# SET HTTP PROXY
|
|
429
|
+
print "enter proxy (http://your-proxy-sever:port):\n"
|
|
430
|
+
http_proxy = $stdin.gets.chomp!
|
|
431
|
+
ENV["http_proxy"] = http_proxy
|
|
432
|
+
when "skip"
|
|
433
|
+
# SKIP REMOTE PLUGINS
|
|
434
|
+
print <<"EOF"
|
|
435
|
+
You need to execute following command at #{Dir.pwd} later.
|
|
436
|
+
#{plugincommand}
|
|
437
|
+
EOF
|
|
438
|
+
skip_remote_plugin = true
|
|
439
|
+
end
|
|
440
|
+
else
|
|
441
|
+
print "connecting without proxy\n"
|
|
442
|
+
end
|
|
443
|
+
end
|
|
444
|
+
unless skip_remote_plugin
|
|
445
|
+
# INSTALL REMOTE PLUGINS
|
|
446
|
+
# TRY DEFAULT SOURCES
|
|
447
|
+
print "install remote plugins...\n"
|
|
448
|
+
$gfdnavi_plugins.each{|plgin|
|
|
449
|
+
print "install " + plgin + "\n"
|
|
450
|
+
#unless system(plugincommand + " " + plgin)
|
|
451
|
+
unless system(plugincommand + " install " + plgin)
|
|
452
|
+
print <<"EOF"
|
|
453
|
+
failed to execute
|
|
454
|
+
#{plugincommand}
|
|
455
|
+
with http_proxy = #{http_proxy}
|
|
456
|
+
at #{Dir.pwd}
|
|
457
|
+
Before you start the service, please try again.
|
|
458
|
+
EOF
|
|
459
|
+
#end
|
|
460
|
+
end
|
|
461
|
+
}
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
rescue Gem::LoadError
|
|
465
|
+
# NO NEED TO INSTALL PLUGINS IF RAILS 1.x
|
|
466
|
+
end
|
|
467
|
+
end
|
|
468
|
+
end
|
|
469
|
+
|
|
470
|
+
# COPY (OVERWRITE) ORIGINAL FILES TO THE DESTINATION
|
|
471
|
+
if @src_top != dest_top
|
|
472
|
+
copy_files( @src_top, dest_top )
|
|
473
|
+
unless $noquestions
|
|
474
|
+
print "Do you want to install sample data? (yes/no, default:yes): "
|
|
475
|
+
inst_sample = $stdin.gets.chomp!
|
|
476
|
+
else
|
|
477
|
+
inst_sample = "yes"
|
|
478
|
+
end
|
|
479
|
+
unless inst_sample == "no"
|
|
480
|
+
dest_sample_dir = File.join(dest_top,"data","samples")
|
|
481
|
+
FileUtils.mkdir( dest_sample_dir ) unless File.exists?( dest_sample_dir )
|
|
482
|
+
copy_files( File.join(@src_top,"data","samples"), dest_sample_dir , sampledata=true)
|
|
483
|
+
end
|
|
484
|
+
else
|
|
485
|
+
printf("src == dest. no need to copy files.\n")
|
|
486
|
+
end
|
|
487
|
+
end
|
|
488
|
+
|
|
489
|
+
|
|
490
|
+
|
|
491
|
+
def set_configure_files
|
|
492
|
+
Dir.chdir( @params[:dest_top] )
|
|
493
|
+
unless @params[:skip_rdb]
|
|
494
|
+
database_file = File.join("config","database.yml")
|
|
495
|
+
# RAILS COMMAND CREATES database.yml
|
|
496
|
+
# THUS IT EXIST ALL THE TIME
|
|
497
|
+
if File.exists?( database_file )
|
|
498
|
+
FileUtils.move( database_file, database_file + ".bak" )
|
|
499
|
+
end
|
|
500
|
+
rdb_type = @params[:rdb_type]
|
|
501
|
+
rdb_plf = @params[:rdb_plf]
|
|
502
|
+
name = %w(mysql sqlite3)[rdb_type-1]
|
|
503
|
+
File.open(database_file,"w"){|file|
|
|
504
|
+
File.foreach( database_file + ".example" ){|line|
|
|
505
|
+
if RDBMS[rdb_type-1] == "MySQL"
|
|
506
|
+
if /^(\s*username:)/ =~ line
|
|
507
|
+
line = "#$1 #{@params[:rdb_user]}\n"
|
|
508
|
+
elsif /^(\s*password:)/ =~ line
|
|
509
|
+
line = "#$1 #{@params[:rdb_password]}\n"
|
|
510
|
+
end
|
|
511
|
+
if RUBY_PLATFORM =~ /mswin|mingw|bccwin/
|
|
512
|
+
# FOR WINDOWS
|
|
513
|
+
else
|
|
514
|
+
# FOR UNIX-LIKE PLATFORMS
|
|
515
|
+
if rdb_plf == 1
|
|
516
|
+
# FOR WINDOWS NATIVE MySQL WITH Cygwin Ruby
|
|
517
|
+
if /^(\s*host:)/ =~ line
|
|
518
|
+
# not Unix Socket but TCP/IP port
|
|
519
|
+
line = "#$1 127.0.0.1\n"
|
|
520
|
+
elsif /^(\s*socket:)/ =~ line
|
|
521
|
+
# do nothing
|
|
522
|
+
end
|
|
523
|
+
else
|
|
524
|
+
if /^(\s*socket:)/ =~ line
|
|
525
|
+
# configuration for MySQL Unix Socket
|
|
526
|
+
# search for MySQL Socket
|
|
527
|
+
sockets = ["/tmp/mysql.sock", # default
|
|
528
|
+
"/var/lib/mysql/mysql.sock", # fedora, vine
|
|
529
|
+
"/var/run/mysqld/mysqld.sock" # debian
|
|
530
|
+
]
|
|
531
|
+
tmp_sockets = []
|
|
532
|
+
sockets.each{|s|
|
|
533
|
+
tmp_sockets.push(s) if File.exist?(s)
|
|
534
|
+
}
|
|
535
|
+
if tmp_sockets > 1
|
|
536
|
+
raise "More than 1 MySQL sockets found!!!"
|
|
537
|
+
elsif tmp_sockets == 1
|
|
538
|
+
line = "#$1 #{tmp_sockets[0]}"
|
|
539
|
+
else
|
|
540
|
+
raise "MySQL socket not found!!!"
|
|
541
|
+
end
|
|
542
|
+
end
|
|
543
|
+
end
|
|
544
|
+
end
|
|
545
|
+
elsif RDBMS[rdb_type-1] == "SQLite3"
|
|
546
|
+
if /^(\s*adapter:)/ =~ line
|
|
547
|
+
# CHANGE ADAPTER TO SQLite3
|
|
548
|
+
line = " adapter: sqlite3\n"
|
|
549
|
+
elsif /^(\s*database:.*development)/ =~ line
|
|
550
|
+
line = " database: db/development.sqlite3"
|
|
551
|
+
elsif /^(\s*database:.*test)/ =~ line
|
|
552
|
+
line = " database: db/test.sqlite3"
|
|
553
|
+
elsif /^(\s*database:.*production)/ =~ line
|
|
554
|
+
line = " database: db/production.sqlite3"
|
|
555
|
+
elsif /^(\s*username:)/ =~ line
|
|
556
|
+
line = ""
|
|
557
|
+
elsif /^(\s*password:)/ =~ line
|
|
558
|
+
line = ""
|
|
559
|
+
elsif /^(\s*host:)/ =~ line
|
|
560
|
+
line = ""
|
|
561
|
+
end
|
|
562
|
+
end
|
|
563
|
+
file.write line
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
unless @params[:skip_configure]
|
|
569
|
+
config_file = File.join("config","gfdnavi.yml")
|
|
570
|
+
if File.exists?( config_file )
|
|
571
|
+
FileUtils.move( config_file, config_file + ".bak" )
|
|
572
|
+
end
|
|
573
|
+
File.open(config_file,"w") do |file|
|
|
574
|
+
server_type = @params[:server_type]
|
|
575
|
+
salt = @params[:salt]
|
|
576
|
+
email = @params[:email]
|
|
577
|
+
rails_env = @params[:rails_env]
|
|
578
|
+
File.foreach( config_file + ".example" ){|line|
|
|
579
|
+
if /^(passphrase:)/ =~ line
|
|
580
|
+
line = "#$1 #{salt}\n"
|
|
581
|
+
elsif /^(\s*email:) root@example\.org/ =~ line
|
|
582
|
+
line = "#$1 #{email}\n"
|
|
583
|
+
end
|
|
584
|
+
if server_type == 1 # private
|
|
585
|
+
elsif server_type > 1 # open
|
|
586
|
+
if /^(disable_user:)/ =~ line
|
|
587
|
+
if server_type == 3 # disable user accounts
|
|
588
|
+
line = "#$1 true\n"
|
|
589
|
+
end
|
|
590
|
+
elsif /^(enable_email:)/ =~ line
|
|
591
|
+
line = "#$1 true\n"
|
|
592
|
+
elsif /^(:domain:) example\.org/ =~ line
|
|
593
|
+
key = $1
|
|
594
|
+
/[\w|-]*@(.+)/ =~ @email
|
|
595
|
+
line = "#{key} #$1\n"
|
|
596
|
+
end
|
|
597
|
+
end
|
|
598
|
+
if rails_env == "development"
|
|
599
|
+
elsif rails_env == "production"
|
|
600
|
+
if /^#(\s*RAILS_ENV:)/ =~ line
|
|
601
|
+
line = "#$1 #{rails_env}\n"
|
|
602
|
+
end
|
|
603
|
+
end
|
|
604
|
+
#p ["@params[:unlimit_array_soft]",@params[:unlimit_array_soft]]
|
|
605
|
+
if @params[:unlimit_array_soft]
|
|
606
|
+
#hoge
|
|
607
|
+
if /^soft_limit_array_size: 2000000/ =~ line
|
|
608
|
+
line = "#" + line
|
|
609
|
+
end
|
|
610
|
+
end
|
|
611
|
+
file.write line
|
|
612
|
+
}
|
|
613
|
+
end
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
end
|
|
617
|
+
|
|
618
|
+
def execute_setup
|
|
619
|
+
Dir.chdir(@params[:dest_top])
|
|
620
|
+
begin
|
|
621
|
+
if Variable.table_exists?
|
|
622
|
+
print <<"EOF"
|
|
623
|
+
If you already have data in the gfdnavi database, skip this step,
|
|
624
|
+
and execute "rake update" manually if it is necessary.
|
|
625
|
+
EOF
|
|
626
|
+
unless $noquestions
|
|
627
|
+
print "Do you skip? (no/yes, default:no): "
|
|
628
|
+
if $stdin.gets.chomp! == "yes"
|
|
629
|
+
print "skiped\n"
|
|
630
|
+
return
|
|
631
|
+
end
|
|
632
|
+
end
|
|
633
|
+
end
|
|
634
|
+
rescue
|
|
635
|
+
#puts $!
|
|
636
|
+
end
|
|
637
|
+
# WHILE EXECUTION OF RAKE SETUP, WE NEED TO REPLY TO QUESTIONS
|
|
638
|
+
# DO NOT OUTPUT TO /dev/null
|
|
639
|
+
unless $noquestions_rake
|
|
640
|
+
rake_task = "setup"
|
|
641
|
+
else
|
|
642
|
+
rake_task = "setup_noquestions"
|
|
643
|
+
end
|
|
644
|
+
if RUBY_PLATFORM =~ /mswin|mingw|bccwin/
|
|
645
|
+
rakecommand = "rake.bat #{rake_task}"
|
|
646
|
+
else
|
|
647
|
+
rakecommand = "rake #{rake_task}"
|
|
648
|
+
end
|
|
649
|
+
unless system(rakecommand)
|
|
650
|
+
abort "failed to execute \"rake #{rake_task}\" at #{Dir.pwd}\n"
|
|
651
|
+
end
|
|
652
|
+
end
|
|
653
|
+
|
|
654
|
+
def print_parameters
|
|
655
|
+
# SALT FOR ENCRYPTION:
|
|
656
|
+
# DISPLAY "randomly generated" IF NOT MODIFIED BY HAND
|
|
657
|
+
|
|
658
|
+
# E-MAIL:
|
|
659
|
+
# DO NOT SHOW E-MAIL ADDRESS IF PRIVATE SERVER IS SELECTED
|
|
660
|
+
|
|
661
|
+
print <<"EOF"
|
|
662
|
+
Gfdnavi will be installed to the following directory:
|
|
663
|
+
#{@params[:dest_top]}
|
|
664
|
+
|
|
665
|
+
with following settings:
|
|
666
|
+
RDBMS: #{RDBMS[@params[:rdb_type] - 1]} #{if @params[:rdb_type]==1;if @params[:rdb_plf]==1;'on Windows';else;'on Cygwin';end;end}
|
|
667
|
+
salt for encryption#{" (randomly generated)" if @inst_mode.to_i < 3}: #{@params[:salt]}
|
|
668
|
+
email: #{@params[:server_type]==2 ? @params[:email] : "dummy (you can set later)"}
|
|
669
|
+
EOF
|
|
670
|
+
print <<"EOF"
|
|
671
|
+
server type: #{SERVER_TYPE_NAMES[@params[:server_type]-1]}
|
|
672
|
+
unlimit array size (soft limit): #{@params[:unlimit_array_soft] ? "true" : "false"}
|
|
673
|
+
rails env: #{@params[:rails_env]}
|
|
674
|
+
EOF
|
|
675
|
+
end
|
|
676
|
+
|
|
677
|
+
####################
|
|
678
|
+
### MAIN PROGRAM ###
|
|
679
|
+
####################
|
|
680
|
+
|
|
681
|
+
if (ARGV.delete("--help") || ARGV.delete("-h"))
|
|
682
|
+
print <<"EOF"
|
|
683
|
+
This is Gfdnavi installer.
|
|
684
|
+
Options:
|
|
685
|
+
--noquestions : Install with default settings
|
|
686
|
+
--clean : Discard previous settings
|
|
687
|
+
-h, --help : Print this message
|
|
688
|
+
EOF
|
|
689
|
+
exit 0
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
if ARGV.delete("--noquestions")
|
|
693
|
+
$noquestions = true
|
|
694
|
+
$noquestions_rake = true
|
|
695
|
+
end
|
|
696
|
+
|
|
697
|
+
$load_inst_params = false
|
|
698
|
+
install_params_file = File.join(@src_top,"install_params.yml")
|
|
699
|
+
if File.exists?( install_params_file )
|
|
700
|
+
unless ARGV.delete("--clean")
|
|
701
|
+
@params = YAML.load(File.read(install_params_file))
|
|
702
|
+
$load_inst_params = true
|
|
703
|
+
end
|
|
704
|
+
end
|
|
705
|
+
@params = Hash.new unless Hash === @params
|
|
706
|
+
# DEFAULT SETTINGS
|
|
707
|
+
|
|
708
|
+
if @params[:dest_top]
|
|
709
|
+
dest_path = File.dirname(@params[:dest_top])
|
|
710
|
+
else
|
|
711
|
+
if RUBY_PLATFORM =~ /mswin|mingw|bccwin/
|
|
712
|
+
dest_path = File.join(ENV['RBPATH'],"..","..")
|
|
713
|
+
else
|
|
714
|
+
dest_path = ENV["HOME"]
|
|
715
|
+
@params[:dest_top] = File.join(dest_path,"gfdnavi")
|
|
716
|
+
end
|
|
717
|
+
end
|
|
718
|
+
# SQLite3
|
|
719
|
+
@params[:rdb_type] = 2 if !(@params[:rdb_type])
|
|
720
|
+
@params[:rails_env] = "production" if !(@params[:rails_env])
|
|
721
|
+
# Windows native MySQL if MySQL with cygwin
|
|
722
|
+
@params[:rdb_plf] = 1 if !(@params[:rdb_plf])
|
|
723
|
+
@params[:salt] = [rand(64),rand(64),rand(64),rand(64),rand(64)].pack("C*").tr("\x00-\x3f","A-Za-z0-9./")
|
|
724
|
+
@params[:email] = "mail@hoge.com" if !(@params[:email])
|
|
725
|
+
@params[:server_type] = 1 if !(@params[:server_type])
|
|
726
|
+
@params[:rails_env] = "production" if !(@params[:rails_env])
|
|
727
|
+
@params[:skip_rdb] = false
|
|
728
|
+
@params[:skip_configure] = false
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
print <<"EOF"
|
|
732
|
+
Welcome to Gfdnavi.
|
|
733
|
+
In order to install Gfdnavi,
|
|
734
|
+
there are the following steps.
|
|
735
|
+
Step 1: Setup parameters
|
|
736
|
+
Step 2: Execute rails and copy files"
|
|
737
|
+
Step 3: Create "database.yml" and "gfdnavi.yml"
|
|
738
|
+
Step 4: Execute "rake setup"
|
|
739
|
+
Step 5: Set root's password
|
|
740
|
+
press any key to continue
|
|
741
|
+
EOF
|
|
742
|
+
|
|
743
|
+
unless $noquestions
|
|
744
|
+
$stdin.gets
|
|
745
|
+
end
|
|
746
|
+
|
|
747
|
+
unless $noquestions
|
|
748
|
+
mode_confirm = false
|
|
749
|
+
begin
|
|
750
|
+
print <<"EOF"
|
|
751
|
+
Select install mode:
|
|
752
|
+
1. install private server with default settings
|
|
753
|
+
2. install public server with default settings
|
|
754
|
+
3. configure details
|
|
755
|
+
EOF
|
|
756
|
+
while true
|
|
757
|
+
case @inst_mode = $stdin.gets.chomp!
|
|
758
|
+
when "1"
|
|
759
|
+
@params[:server_type] = 1
|
|
760
|
+
@params[:unlimit_array_soft] = true
|
|
761
|
+
$noquestions = true
|
|
762
|
+
setup_destination
|
|
763
|
+
print_parameters
|
|
764
|
+
print <<"EOF"
|
|
765
|
+
Do you agree?
|
|
766
|
+
(You can manually change the settings later
|
|
767
|
+
by editing config/gfdnavi.yml)
|
|
768
|
+
EOF
|
|
769
|
+
print "(yes/no, default:yes):"
|
|
770
|
+
mode_confirm = true unless ($stdin.gets.chomp!)=="no"
|
|
771
|
+
break
|
|
772
|
+
when "2"
|
|
773
|
+
@params[:server_type] = 2
|
|
774
|
+
$noquestions = true
|
|
775
|
+
setup_destination
|
|
776
|
+
setup_email
|
|
777
|
+
print_parameters
|
|
778
|
+
print <<"EOF"
|
|
779
|
+
Do you agree?
|
|
780
|
+
(You can manually change the settings later
|
|
781
|
+
by editing config/gfdnavi.yml)
|
|
782
|
+
EOF
|
|
783
|
+
print "(yes/no, default:yes):"
|
|
784
|
+
mode_confirm = true unless ($stdin.gets.chomp!)=="no"
|
|
785
|
+
break
|
|
786
|
+
when "3"
|
|
787
|
+
mode_confirm = true
|
|
788
|
+
setup_destination
|
|
789
|
+
break
|
|
790
|
+
else
|
|
791
|
+
print "invalid number!\n"
|
|
792
|
+
end
|
|
793
|
+
end
|
|
794
|
+
end until mode_confirm
|
|
795
|
+
end
|
|
796
|
+
|
|
797
|
+
print "***************************************\nStep 1: Setup parameters\n"
|
|
798
|
+
unless $noquestions
|
|
799
|
+
setup_parameter
|
|
800
|
+
para = @params.dup
|
|
801
|
+
para.delete(:salt)
|
|
802
|
+
para.delete(:rdb_password)
|
|
803
|
+
File.open(install_params_file,"w"){|file|
|
|
804
|
+
file.write para.to_yaml
|
|
805
|
+
}
|
|
806
|
+
else
|
|
807
|
+
print "Skip\n"
|
|
808
|
+
end
|
|
809
|
+
|
|
810
|
+
print "***************************************\nStep 2: Execute rails and copy files\n"
|
|
811
|
+
install_files
|
|
812
|
+
|
|
813
|
+
print "***************************************\nStep 3: Create \"database.yml\" and \"gfdnavi.yml\"\n"
|
|
814
|
+
set_configure_files
|
|
815
|
+
|
|
816
|
+
print "***************************************\nStep 4: Execute rake setup\n"
|
|
817
|
+
require File.join(Dir.pwd, "config", "environment")
|
|
818
|
+
execute_setup
|
|
819
|
+
|
|
820
|
+
print <<"EOF"
|
|
821
|
+
Congraturations!
|
|
822
|
+
You sucessed to install gfdnavi to #{@params[:dest_top]}.
|
|
823
|
+
Before you start gfdnavi,
|
|
824
|
+
change the following configurations
|
|
825
|
+
1. "config/database.yml"
|
|
826
|
+
2. "config/gfdnavi.yml"
|
|
827
|
+
and check file permission mode of their files (only webserver can read the files).
|
|
828
|
+
EOF
|