gfdnavi 1.3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,20 @@
|
|
1
|
+
class AddOpenIdAuthenticationTables < ActiveRecord::Migration
|
2
|
+
def self.up
|
3
|
+
create_table :open_id_authentication_associations, :force => true do |t|
|
4
|
+
t.integer :issued, :lifetime
|
5
|
+
t.string :handle, :assoc_type
|
6
|
+
t.binary :server_url, :secret
|
7
|
+
end
|
8
|
+
|
9
|
+
create_table :open_id_authentication_nonces, :force => true do |t|
|
10
|
+
t.integer :timestamp, :null => false
|
11
|
+
t.string :server_url, :null => true
|
12
|
+
t.string :salt, :null => false
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.down
|
17
|
+
drop_table :open_id_authentication_associations
|
18
|
+
drop_table :open_id_authentication_nonces
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,760 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
RAILS_ENV = 'production' if ARGV.delete('-p') or ARGV.delete('--production')
|
4
|
+
|
5
|
+
require File.dirname(__FILE__)+"/../config/environment"
|
6
|
+
require "kconv"
|
7
|
+
require 'opendapdir'
|
8
|
+
require 'localdir'
|
9
|
+
require "optparse"
|
10
|
+
|
11
|
+
# === �Q�Ɛ�̃m�[�h�����ۑ��̏ꍇ�A��ŎQ�Ɛ�̃m�[�h���ۑ����ꂽ�ꍇ��
|
12
|
+
# �Q�Ƃ�K��DB�ɐݒ肷�邽�߂̃��\�b�h
|
13
|
+
# register_image, register_knowledge�̍Ō�ɂ�����Ă�
|
14
|
+
ToDo = Hash.new # path => proc
|
15
|
+
def after_save(obj)
|
16
|
+
if proc = ToDo[obj.path]
|
17
|
+
proc.call(obj.node)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
class OptionParser
|
22
|
+
# Changed to raise error. (Originally, invalid options
|
23
|
+
# are just warned, which is easily overlooked.)
|
24
|
+
def warn(mesg = $!)
|
25
|
+
raise mesg
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
#################################################
|
31
|
+
module NumRu
|
32
|
+
|
33
|
+
# == To be merged into the original GPhys distribution
|
34
|
+
# Geospatio-temporal coordinate handing
|
35
|
+
class GPhys
|
36
|
+
|
37
|
+
def lon_lat_t_ranges
|
38
|
+
geocoords = lon_lat_t_coords
|
39
|
+
georanges = Hash.new
|
40
|
+
geocoords.each do |nm,crd|
|
41
|
+
georanges[nm] = [crd.max, crd.min]
|
42
|
+
end
|
43
|
+
georanges
|
44
|
+
end
|
45
|
+
|
46
|
+
def lon_lat_t_coords
|
47
|
+
geocoords = Hash.new # will ba Hash of :lon, :lat, and :time
|
48
|
+
|
49
|
+
#< from the coordinate variables >
|
50
|
+
for dim in 0...self.rank
|
51
|
+
crd = add_lon_lat_t_coords(self.coord(dim), geocoords)
|
52
|
+
end
|
53
|
+
|
54
|
+
#< from the "coordinates" attributes (CF convenction) >
|
55
|
+
if geocoords.length!=3 and data.respond_to?(:file) and \
|
56
|
+
(nms = self.get_att("coordinates"))
|
57
|
+
nms.split.each do |nm|
|
58
|
+
if data.file.var(nm)
|
59
|
+
crd = GPhys::IO.open(data.file, nm).data
|
60
|
+
geocoords = add_lon_lat_t_coords(crd, geocoords)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
#< from scalar variables >
|
66
|
+
if geocoords.length!=3 && data.respond_to?(:file)
|
67
|
+
data.file.var_names.each do |nm|
|
68
|
+
if /(lon|lat|time)/i =~ nm
|
69
|
+
crd = GPhys::IO.open(data.file, nm).data
|
70
|
+
if crd.length==1
|
71
|
+
geocoords = add_lon_lat_t_coords(crd, geocoords)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
geocoords.each do |nm,crd|
|
78
|
+
if nm==:lon or nm==:lat
|
79
|
+
un = crd.units
|
80
|
+
if un and /(^degree|^\s*$)/i !~ un.to_s
|
81
|
+
geocoords[nm] = un.convert2(crd,Units['degrees'])
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
geocoords
|
87
|
+
end
|
88
|
+
|
89
|
+
########################
|
90
|
+
private
|
91
|
+
def add_lon_lat_t_coords(coord, geocoords)
|
92
|
+
unt = coord.units.to_s
|
93
|
+
if !geocoords[:lon] && /^degrees?_east$/i =~ unt
|
94
|
+
geocoords[:lon] = coord
|
95
|
+
elsif !geocoords[:lat] && /^degrees?_north$/i =~ unt
|
96
|
+
geocoords[:lat] = coord
|
97
|
+
elsif !geocoords[:time] && /since/ =~ unt
|
98
|
+
geocoords[:time] = coord
|
99
|
+
end
|
100
|
+
nm = coord.name
|
101
|
+
if !geocoords[:lon] && /^lon(gitude)?$/i =~ nm
|
102
|
+
geocoords[:lon] = coord
|
103
|
+
elsif !geocoords[:lat] && /^lat(itude)?$/i =~ nm
|
104
|
+
geocoords[:lat] = coord
|
105
|
+
end
|
106
|
+
geocoords
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
# == To be merged into the original GPhys distribution
|
112
|
+
# for unumeric.rb
|
113
|
+
class UNumeric
|
114
|
+
def to_datetime
|
115
|
+
if /(.*) *since *(.*)/ =~ units.to_s
|
116
|
+
stun = $1
|
117
|
+
since = DateTime.parse($2)
|
118
|
+
tun = Units[stun]
|
119
|
+
sec = tun.convert( val, Units['seconds'] ).round + 1e-1
|
120
|
+
# ^ take "round" to avoid round error in sec
|
121
|
+
# (Note that %S below takes floor of seconds).
|
122
|
+
datetime = since + (sec/86400.0)
|
123
|
+
else
|
124
|
+
nil
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
end
|
129
|
+
##################################################
|
130
|
+
|
131
|
+
# Hash with String / Regexp keys
|
132
|
+
class RegHash < Hash
|
133
|
+
def []=(key,val)
|
134
|
+
if key.is_a?(String) && /[\*%\?]/ =~ key # wild cards
|
135
|
+
key = Regexp.new( '^' + key.gsub(/[\*%]/,'.*').gsub(/\?/,'.') + '$' )
|
136
|
+
end
|
137
|
+
super(key,val)
|
138
|
+
end
|
139
|
+
def [](key)
|
140
|
+
(v=super(key)) && (return(v))
|
141
|
+
keys.each do |k|
|
142
|
+
if key.is_a?(String) && k.is_a?(Regexp) && k =~ key
|
143
|
+
return(super(k))
|
144
|
+
else
|
145
|
+
nil
|
146
|
+
end
|
147
|
+
end
|
148
|
+
nil
|
149
|
+
end
|
150
|
+
def delete(key)
|
151
|
+
(v=super(key)) && (return(v))
|
152
|
+
keys.each do |k|
|
153
|
+
if key.is_a?(String) && k.is_a?(Regexp) && k =~ key
|
154
|
+
return(super(k))
|
155
|
+
else
|
156
|
+
nil
|
157
|
+
end
|
158
|
+
end
|
159
|
+
nil
|
160
|
+
end
|
161
|
+
end
|
162
|
+
|
163
|
+
module MSG
|
164
|
+
module_function
|
165
|
+
@@verbose_level = 1 # normal
|
166
|
+
def to_quiet; @@verbose_level = 0; end
|
167
|
+
def to_normal; @@verbose_level = 1; end
|
168
|
+
def to_verbose; @@verbose_level = 2; end
|
169
|
+
def verbose(msg, altmsg=nil)
|
170
|
+
if @@verbose_level == 2
|
171
|
+
print(msg)
|
172
|
+
elsif altmsg
|
173
|
+
print(altmsg)
|
174
|
+
end
|
175
|
+
STDOUT.flush
|
176
|
+
end
|
177
|
+
def normal(msg, altmsg=nil)
|
178
|
+
if @@verbose_level >= 1
|
179
|
+
print(msg)
|
180
|
+
elsif altmsg
|
181
|
+
print(altmsg)
|
182
|
+
end
|
183
|
+
STDOUT.flush
|
184
|
+
end
|
185
|
+
end
|
186
|
+
|
187
|
+
##################################################
|
188
|
+
include NumRu
|
189
|
+
|
190
|
+
Var_Meta_To_Register = RegHash.new
|
191
|
+
|
192
|
+
def open_dir(path)
|
193
|
+
case path
|
194
|
+
when /^http.*(\/dap\/|\/nph-dods\/)/
|
195
|
+
dir = OPeNDAPDir.open(path)
|
196
|
+
when /^\//, /^[a-zA-Z]:/
|
197
|
+
dir = LocalDir.open(path)
|
198
|
+
else
|
199
|
+
raise ArgumentError, "Unsupported kind of path: #{path}"
|
200
|
+
end
|
201
|
+
dir
|
202
|
+
end
|
203
|
+
|
204
|
+
GFDNAVI_IGNORED_DIRS_PAT = Regexp.union( *GFDNAVI_IGNORED_DIRS.collect{|igd|
|
205
|
+
igd.is_a?(String) ? Regexp.new('^'+igd+'$') : igd} )
|
206
|
+
IMAGE_PAT = /(\.png$|\.jpg$|\.jpeg$|\.gif$|\.tiff$)/i
|
207
|
+
KNOWLEDGE_PAT = /\.knlge$/i
|
208
|
+
|
209
|
+
def parse_dir(dir, parent=nil, mtime=nil)
|
210
|
+
#plain_file_paths = dir.plain_file_paths # for yaml, png files etc
|
211
|
+
|
212
|
+
rdir,flag = register_dir(dir.path, parent, mtime)
|
213
|
+
|
214
|
+
if rdir \
|
215
|
+
&& rdir.name != "functions" && rdir.name != "draw_methods" # [�J��MEMO] �����͏�����悤�ɂ����� (�x�V��)
|
216
|
+
d_chnames = dir.entries.collect{|e| e.sub(/\.yml$/,'')}
|
217
|
+
r_childs = rdir.node.children
|
218
|
+
#r_chnames = r_childs.collect{|c| c.name} # [�J��MEMO] �ق�Ƃ͂���ł�������
|
219
|
+
r_chnames = r_childs.collect{|c| File.basename(c.path)}
|
220
|
+
no_exist = r_chnames - d_chnames
|
221
|
+
no_exist.delete("usr") if rdir.path=="/" # [�J��MEMO] �����͏�����悤�ɂ����� (�x�V��)
|
222
|
+
no_exist.each do |name|
|
223
|
+
r_childs.each do |c|
|
224
|
+
if c.name==name
|
225
|
+
c.destroy
|
226
|
+
end
|
227
|
+
end
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
dir.each_gphys_file do |path, mtime, size, klass|
|
232
|
+
Directory.transaction do
|
233
|
+
rd,flag = register_dir(path, rdir, mtime, size, true)
|
234
|
+
if flag
|
235
|
+
begin
|
236
|
+
file = klass.open(path)
|
237
|
+
begin
|
238
|
+
GPhys::IO.var_names_except_coordinates(file).each do |vname|
|
239
|
+
register_var(file,vname,rd,mtime)
|
240
|
+
end
|
241
|
+
rescue
|
242
|
+
if dir.is_a?( NumRu::OPeNDAPDir )
|
243
|
+
# just to warn, because one cannot correct the problem in general
|
244
|
+
warn "*** Error occured while processing remote file #{file.path} : #{$!.to_s}"
|
245
|
+
else
|
246
|
+
raise $!
|
247
|
+
end
|
248
|
+
ensure
|
249
|
+
file.close
|
250
|
+
end
|
251
|
+
rescue
|
252
|
+
if !OPTS[:ignore_errors]
|
253
|
+
raise $!
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
|
261
|
+
Var_Meta_To_Register.clear
|
262
|
+
|
263
|
+
dir.each_file(IMAGE_PAT) do |path, mtime, size|
|
264
|
+
if File.exist?( yml = path+'.yml' )
|
265
|
+
meta = YAML.load( File.read(yml) )
|
266
|
+
else
|
267
|
+
meta = nil
|
268
|
+
end
|
269
|
+
register_image(path,meta,mtime,size)
|
270
|
+
end
|
271
|
+
|
272
|
+
# knowledge
|
273
|
+
dir.each_file(KNOWLEDGE_PAT) do |path, mtime, size|
|
274
|
+
unless /\.\d\.knlge$/ =~ path
|
275
|
+
if File.exist?(path)
|
276
|
+
meta = YAML.load( File.read(path) )
|
277
|
+
else
|
278
|
+
meta = nil
|
279
|
+
end
|
280
|
+
register_knowledge(path,meta,mtime,size)
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
unless /nus$/ =~ dir.path
|
285
|
+
dir.each_dir do |subdir, mtime|
|
286
|
+
if GFDNAVI_IGNORED_DIRS_PAT !~ subdir.name
|
287
|
+
parse_dir(subdir, rdir, mtime)
|
288
|
+
end
|
289
|
+
end
|
290
|
+
end
|
291
|
+
|
292
|
+
rdir
|
293
|
+
end
|
294
|
+
|
295
|
+
def register_var(file,vname,parent,mtime)
|
296
|
+
## print " registering #{vname}\n"
|
297
|
+
|
298
|
+
if String === file
|
299
|
+
file = Dir[File.join(GFDNAVI_DATA_PATH,file)].sort
|
300
|
+
rpath_var = vname
|
301
|
+
vname = File.basename(vname)
|
302
|
+
else
|
303
|
+
rpath = file.path.sub(GFDNAVI_DATA_PATH,"")
|
304
|
+
rpath_var = File.join(rpath,vname)
|
305
|
+
rpath_dir = rpath
|
306
|
+
vname.split("/")[0..-2].each{|dname|
|
307
|
+
rpath_dir = File.join(rpath_dir,dname)
|
308
|
+
parent, = register_dir(rpath_dir, parent, mtime)
|
309
|
+
}
|
310
|
+
end
|
311
|
+
|
312
|
+
unless var = Variable.find(:first, :conditions=>["path=?",rpath_var])
|
313
|
+
var = Variable.new
|
314
|
+
end
|
315
|
+
|
316
|
+
if Array === file
|
317
|
+
file.each{|f|
|
318
|
+
var.actual_files.push ActualFile.new(:path=>f.sub(GFDNAVI_DATA_PATH,""))
|
319
|
+
}
|
320
|
+
else
|
321
|
+
var.file = rpath
|
322
|
+
end
|
323
|
+
|
324
|
+
var.name = File.basename(vname)
|
325
|
+
var.mtime = mtime
|
326
|
+
var.path = rpath_var
|
327
|
+
var.parent = parent.node
|
328
|
+
gphys = NumRu::GPhys::IO.open(file,vname)
|
329
|
+
var.size = gphys.length
|
330
|
+
node = var.node
|
331
|
+
gphys.att_names.each{|aname|
|
332
|
+
register_kattr(aname, gphys.get_att(aname), node)
|
333
|
+
}
|
334
|
+
if (meta = Var_Meta_To_Register[rpath_var]) # substitution, not ==
|
335
|
+
register_meta(meta, node)
|
336
|
+
end
|
337
|
+
if !node.remote? or OPTS[:stremote] # too slow for remote
|
338
|
+
georanges = gphys.lon_lat_t_ranges
|
339
|
+
if georanges.length > 0
|
340
|
+
sta = SpatialAndTimeAttribute.new
|
341
|
+
sta.node = node
|
342
|
+
if r=georanges[:lon]
|
343
|
+
sta.longitude_lb, sta.longitude_rt = r.collect{|un| un.val}
|
344
|
+
end
|
345
|
+
if r=georanges[:lat]
|
346
|
+
sta.latitude_lb, sta.latitude_rt = r.collect{|un| un.val}
|
347
|
+
end
|
348
|
+
if r=georanges[:time]
|
349
|
+
sta.starttime,sta.endtime = r.collect{|un| un.to_datetime}
|
350
|
+
end
|
351
|
+
node.spatial_and_time_attributes.push(sta)
|
352
|
+
end
|
353
|
+
end
|
354
|
+
unless var.save
|
355
|
+
warn "failed to register variable: #{rpath}"
|
356
|
+
warn " #{var.errors.full_messages}"
|
357
|
+
end
|
358
|
+
MSG.verbose("registrated variable: #{rpath}\n")
|
359
|
+
end
|
360
|
+
|
361
|
+
def register_image(path,meta,mtime,size)
|
362
|
+
rpath = path.sub(GFDNAVI_DATA_PATH,"").sub(File.dirname(GFDNAVI_USER_PATH),"")
|
363
|
+
rpath = '/' if rpath == '' # local root directory
|
364
|
+
node = Node.find(:first, :conditions=>["path=?",rpath])
|
365
|
+
if node
|
366
|
+
if OPTS[:force] or t_comp(mtime, node.mtime) or !node.image?
|
367
|
+
node.destroy # for test
|
368
|
+
node = nil # for test
|
369
|
+
else
|
370
|
+
MSG.normal(".",".")
|
371
|
+
return nil
|
372
|
+
end
|
373
|
+
end
|
374
|
+
unless node
|
375
|
+
img = Image.new
|
376
|
+
img.name = File.basename(rpath)
|
377
|
+
img.path = rpath
|
378
|
+
img.mtime = mtime
|
379
|
+
img.size = size
|
380
|
+
register_meta(meta, img.node) if meta
|
381
|
+
unless img.save
|
382
|
+
warn "failed to register an image file (#{rpath})"
|
383
|
+
warn " #{img.errors.full_messages}"
|
384
|
+
end
|
385
|
+
MSG.verbose("\nregister image: #{rpath}")
|
386
|
+
end
|
387
|
+
after_save(img)
|
388
|
+
nil
|
389
|
+
end
|
390
|
+
|
391
|
+
def register_knowledge(path, meta, mtime, size)
|
392
|
+
rpath = path.sub(GFDNAVI_DATA_PATH,"").sub(File.dirname(GFDNAVI_USER_PATH),"")
|
393
|
+
rpath = '/' if rpath == '' # local root directory
|
394
|
+
node = Node.find(:first, :conditions=>["path=?",rpath])
|
395
|
+
if node
|
396
|
+
if OPTS[:force] or t_comp(mtime, node.mtime) or !node.knowledge?
|
397
|
+
node.destroy # for test
|
398
|
+
node = nil # for test
|
399
|
+
else
|
400
|
+
MSG.normal(".",".")
|
401
|
+
return nil
|
402
|
+
end
|
403
|
+
end
|
404
|
+
unless node
|
405
|
+
knowledge = Knowledge.new
|
406
|
+
knowledge.name = File.basename(rpath)
|
407
|
+
knowledge.path = rpath
|
408
|
+
knowledge.mtime = mtime
|
409
|
+
knowledge.size = size
|
410
|
+
register_meta(meta, knowledge.node) if meta
|
411
|
+
unless knowledge.save
|
412
|
+
warn "failed to register a knowledge file (#{rpath})"
|
413
|
+
warn " #{knowledge.errors.full_messages}"
|
414
|
+
end
|
415
|
+
MSG.verbose("\nregister knowledge: #{rpath}")
|
416
|
+
end
|
417
|
+
after_save(knowledge)
|
418
|
+
nil
|
419
|
+
end
|
420
|
+
|
421
|
+
def t_comp(a,b)
|
422
|
+
return(nil) if a.nil? or b.nil?
|
423
|
+
if a.class == b.class
|
424
|
+
a > b
|
425
|
+
end
|
426
|
+
end
|
427
|
+
|
428
|
+
def register_dir(path, parent, mtime, size=nil, plain_file=false, kas=nil)
|
429
|
+
rpath = path.sub(GFDNAVI_DATA_PATH,"").sub(File.dirname(GFDNAVI_USER_PATH),"")
|
430
|
+
rpath = '/' if rpath == '' # local root directory
|
431
|
+
dir = Directory.find(:first, :conditions=>["path=?",rpath], :user=>:all)
|
432
|
+
if dir
|
433
|
+
if OPTS[:force] or t_comp(mtime, dir.mtime)
|
434
|
+
# dir.destroy # for test
|
435
|
+
# dir = nil # for test
|
436
|
+
elsif OPTS[:attr]
|
437
|
+
parse_meta(path, dir.node)
|
438
|
+
dir.save
|
439
|
+
MSG.normal(".",".")
|
440
|
+
return [dir, false]
|
441
|
+
else
|
442
|
+
MSG.normal(".",".")
|
443
|
+
return [dir, false]
|
444
|
+
end
|
445
|
+
MSG.normal("\nupdating #{rpath}",".")
|
446
|
+
else
|
447
|
+
MSG.normal("\nregistering #{rpath}",".")
|
448
|
+
end
|
449
|
+
KeywordAttribute.transaction do
|
450
|
+
dir ||= Directory.new
|
451
|
+
if parent
|
452
|
+
dir.name = File.basename(rpath)
|
453
|
+
else
|
454
|
+
dir.name = rpath
|
455
|
+
end
|
456
|
+
dir.path = rpath
|
457
|
+
dir.mtime = mtime
|
458
|
+
dir.size = size if size
|
459
|
+
dir.plain_file = plain_file
|
460
|
+
if parent
|
461
|
+
dir.parent = Node===parent ? parent : parent.node
|
462
|
+
dir.owner = parent.owner
|
463
|
+
else
|
464
|
+
dir.owner = ROOT
|
465
|
+
end
|
466
|
+
parse_meta(path, dir.node)
|
467
|
+
kas.each{|k,v| register_kattr(k, v, dir.node)} if kas
|
468
|
+
unless dir.save
|
469
|
+
warn "failed to register directory(#{rpath})"
|
470
|
+
warn " #{dir.errors.full_messages}"
|
471
|
+
end
|
472
|
+
MSG.verbose("\nregister directory: #{rpath}")
|
473
|
+
end
|
474
|
+
return [dir, true]
|
475
|
+
end
|
476
|
+
|
477
|
+
def parse_meta(path,node)
|
478
|
+
fname = path + ".yml"
|
479
|
+
if File.exist?(fname)
|
480
|
+
hash = YAML.load( File.read(fname) )
|
481
|
+
if Hash === hash
|
482
|
+
register_meta(hash,node)
|
483
|
+
else
|
484
|
+
warn "yaml file must have hash data"
|
485
|
+
end
|
486
|
+
end
|
487
|
+
|
488
|
+
fname = path + ".SIGEN"
|
489
|
+
if File.exist?(fname)
|
490
|
+
File.foreach(fname){|line|
|
491
|
+
k, v = line.chop.split(":")
|
492
|
+
register_kattr(k, v.strip, node) if v
|
493
|
+
|
494
|
+
}
|
495
|
+
end
|
496
|
+
end
|
497
|
+
|
498
|
+
def register_meta(meta,node)
|
499
|
+
meta.sort.each{|k,v| # sort to registe 'contains' firstly
|
500
|
+
case k
|
501
|
+
when "gfdnavi", "gfdnavi_knowledge"
|
502
|
+
register_gfdnavi_params(v, node)
|
503
|
+
when "contains"
|
504
|
+
v.each{ |name,meta|
|
505
|
+
case name
|
506
|
+
when /^[^\/]*$/ # variables directory under node
|
507
|
+
Var_Meta_To_Register[File.join(node.path,name)] = meta
|
508
|
+
end
|
509
|
+
}
|
510
|
+
else
|
511
|
+
register_kattr(k, v, node)
|
512
|
+
end
|
513
|
+
}
|
514
|
+
end
|
515
|
+
|
516
|
+
def register_kattr(name, value, node)
|
517
|
+
return if value.nil?
|
518
|
+
value=NArray[value] if value.is_a?(Numeric) # to rescue a inapropriate yaml
|
519
|
+
ka = nil
|
520
|
+
node.keyword_attributes.each{ |nka| # node unsaved, so find explicitly
|
521
|
+
if nka.name == name
|
522
|
+
ka = nka
|
523
|
+
break
|
524
|
+
end
|
525
|
+
}
|
526
|
+
unless ka
|
527
|
+
ka = KeywordAttribute.new
|
528
|
+
ka.name = Kconv.kconv(name, @charset)
|
529
|
+
ka.node = Node === node ? node : node.node
|
530
|
+
end
|
531
|
+
ka.value = String===value ? Kconv.kconv(value, @charset) : value
|
532
|
+
node.keyword_attributes.push(ka) # --> ka will be automtcly saved with node
|
533
|
+
end
|
534
|
+
|
535
|
+
def register_gfdnavi_params(hash, node)
|
536
|
+
node = node.node unless Node === node
|
537
|
+
hash.each do |key, val|
|
538
|
+
case key
|
539
|
+
when 'aggregate'
|
540
|
+
raise('aggregate must have Hash') unless Hash === val
|
541
|
+
val.each{|name, ha|
|
542
|
+
dname = File.dirname(name)
|
543
|
+
vname = File.basename(name)
|
544
|
+
fname = File.join(node.path, dname)
|
545
|
+
if ha && ali = ha['alias']
|
546
|
+
path = File.expand_path(File.join(node.path, ali))
|
547
|
+
path.sub!(/^[a-zA-Z]:/,"")
|
548
|
+
parent = Node.find(:first, :conditions=>["path=?",File.dirname(path)])
|
549
|
+
parent
|
550
|
+
raise("alias is invalid") unless parent
|
551
|
+
else
|
552
|
+
path = fname
|
553
|
+
parent = node
|
554
|
+
end
|
555
|
+
ka = {'remark' => 'This is a vertual united file'}
|
556
|
+
parent, flag = register_dir(path, parent, nil, nil, false, ka)
|
557
|
+
register_var(fname, File.join(path,vname), parent, nil) if flag
|
558
|
+
}
|
559
|
+
when 'owner','user' # 'user' is for backward compatibility
|
560
|
+
user = User.find_by_login(val)
|
561
|
+
if user
|
562
|
+
node.owner = user
|
563
|
+
end
|
564
|
+
when 'other_mode'
|
565
|
+
node.other_mode = val == 4 ? 4 : 0
|
566
|
+
when 'rgroups'
|
567
|
+
raise("Array expected") if !val.is_a?(Array)
|
568
|
+
node.set_rgroups(*val)
|
569
|
+
when 'wgroups'
|
570
|
+
raise("Array expected") if !val.is_a?(Array)
|
571
|
+
node.set_wgroups(*val)
|
572
|
+
when 'downloadable'
|
573
|
+
if node.directory?
|
574
|
+
node.entity.downloadable = val==true
|
575
|
+
end
|
576
|
+
when 'draw_parameters'
|
577
|
+
val.each{|dpk, dpv|
|
578
|
+
dp = DrawParameter.new
|
579
|
+
dp.node = node
|
580
|
+
dp.name = dpk
|
581
|
+
dp.value = dpv
|
582
|
+
node.draw_parameters.push(dp)
|
583
|
+
}
|
584
|
+
when 'vizshot'
|
585
|
+
if node.image?
|
586
|
+
node.entity.vizshot = val
|
587
|
+
else
|
588
|
+
raise "gfdinavi attribute of 'vizshot' is only for Image"
|
589
|
+
end
|
590
|
+
when "references"
|
591
|
+
if Array === val
|
592
|
+
val.each{|hash|
|
593
|
+
if Hash === hash
|
594
|
+
@references.push [hash["name"], hash["path"], node.path]
|
595
|
+
else
|
596
|
+
raise "gfdnavi attribute of references must be Array of Hash('name' and 'path')"
|
597
|
+
end
|
598
|
+
}
|
599
|
+
else
|
600
|
+
raise "gfdnavi attribute of references must be Array of Hash('name' and 'path')"
|
601
|
+
end
|
602
|
+
when 'category'
|
603
|
+
node.entity.category = val
|
604
|
+
register_kattr("category", val, node)
|
605
|
+
when 'title'
|
606
|
+
node.entity.title = val
|
607
|
+
register_kattr("title", val, node)
|
608
|
+
when 'creator'
|
609
|
+
node.entity.creator = val
|
610
|
+
register_kattr("creator", val, node)
|
611
|
+
when 'textbody'
|
612
|
+
node.entity.textbody = val
|
613
|
+
register_kattr("textbody", val, node)
|
614
|
+
when 'description'
|
615
|
+
node.entity.description = val
|
616
|
+
register_kattr("description", val, node)
|
617
|
+
when 'horizontal_figures'
|
618
|
+
node.entity.horizontal_figures = val
|
619
|
+
when 'default_layout'
|
620
|
+
node.entity.default_layout = val
|
621
|
+
when 'figures_size_status'
|
622
|
+
node.entity.figures_size_status = val
|
623
|
+
when 'figures_size_number'
|
624
|
+
node.entity.figures_size_number = val
|
625
|
+
when 'comment_on'
|
626
|
+
if knowledge = Knowledge.find(:first, :conditions => ["path=?", val])
|
627
|
+
node.entity.comment_on = knowledge.node_id
|
628
|
+
else
|
629
|
+
ToDo[val] = Proc.new {|node|
|
630
|
+
knowledge.comment_on = Knowledge.find(node.id).id
|
631
|
+
knowledge.save
|
632
|
+
}
|
633
|
+
end
|
634
|
+
when 'comment_number'
|
635
|
+
node.entity.comment_number = val
|
636
|
+
when 'knowledge_figures'
|
637
|
+
knowledge_figures = Array.new
|
638
|
+
val.each do |v|
|
639
|
+
kf = KnowledgeFigure.new
|
640
|
+
kf.caption = v["caption"]
|
641
|
+
if image = Image.find(:first, :conditions => ["path=?", v["image_path"]])
|
642
|
+
kf.image = image
|
643
|
+
else # �����ɓ����ׂ��G�����o�^�Ȃ�AToDo���X�g�ɓ���Č��
|
644
|
+
ToDo[v["image_path"]] = Proc.new {|node|
|
645
|
+
image = Image.find(:first, :conditions => ["node_id=?", node.id])
|
646
|
+
kf.image = image
|
647
|
+
kf.save
|
648
|
+
}
|
649
|
+
end
|
650
|
+
knowledge_figures.push(kf)
|
651
|
+
end
|
652
|
+
node.entity.knowledge_figures = knowledge_figures
|
653
|
+
end
|
654
|
+
end
|
655
|
+
end
|
656
|
+
|
657
|
+
##########################################
|
658
|
+
###### main part #######
|
659
|
+
##########################################
|
660
|
+
|
661
|
+
@charset = Kconv::UTF8
|
662
|
+
|
663
|
+
#< interpret options >
|
664
|
+
|
665
|
+
opt = OptionParser.new
|
666
|
+
OPTS = {}
|
667
|
+
ARGV.options{|opt|
|
668
|
+
opt.on( '-q', '--quiet', "Quiet mode" ){|v| OPTS[:quiet] = v}
|
669
|
+
opt.on( '-v', '--verbose', "Verbose mode" ){|v| OPTS[:verbose] = v}
|
670
|
+
opt.on( '-l', '--local-only', "Update only for local data"
|
671
|
+
){|v| OPTS[:localonly] = v}
|
672
|
+
opt.on( '-d=DIR', '--dir=DIR', "Process only under the directory"
|
673
|
+
){|v| OPTS[:dir] = v.sub(/^=/, '')}
|
674
|
+
opt.on( '-f', '--force', "Force to (re-)register" ){|v| OPTS[:force] = v}
|
675
|
+
opt.on( '-a', '--update-attributes', "Update attributes from YAML and SIGEN file" ){|v| OPTS[:attr] = v}
|
676
|
+
opt.on( '--ignore-errors', "Ignore errors while opning files"){|v| OPTS[:ignore_errors] = v}
|
677
|
+
opt.on( '--clear-tree', "Remove all nodes from DB. (Only to clear. No registering.)" ){|v| OPTS[:cleartree] = v}
|
678
|
+
opt.on( '--st-remote', "Register space-time attributes of remote data as well as local data (Very slow with opendap. Be patient.)" ){|v| OPTS[:stremote] = v}
|
679
|
+
##See the top of this file## opt.on( '-p', '--production', "Production DB" ){|v| OPTS[:production]=v}
|
680
|
+
|
681
|
+
opt.on_tail('-h', '--help', "Show this help message"){|v| OPTS[:help] = v}
|
682
|
+
opt.parse!
|
683
|
+
}
|
684
|
+
|
685
|
+
if OPTS[:help]
|
686
|
+
print <<-"EOS"
|
687
|
+
|
688
|
+
USAGE: ruby #{File.basename($0.to_s)} [options]
|
689
|
+
|
690
|
+
OPTIONS: \n#{opt.to_a[1..-1].join("")}
|
691
|
+
EOS
|
692
|
+
exit
|
693
|
+
end
|
694
|
+
|
695
|
+
if OPTS[:quiet]
|
696
|
+
MSG.to_quiet
|
697
|
+
elsif OPTS[:verbose]
|
698
|
+
MSG.to_verbose
|
699
|
+
end
|
700
|
+
|
701
|
+
#< optional : remove all nodes from DB >
|
702
|
+
|
703
|
+
if OPTS[:cleartree]
|
704
|
+
# Remove all root dirs. Children will be deleted automatically.
|
705
|
+
rootdirs = Node.find(:all, :user=>:all,
|
706
|
+
:conditions=>'parent_id is NULL AND node_type = 0')
|
707
|
+
print "Removing\n"
|
708
|
+
rootdirs.each{|n| print(" ",n.path,"\n"); n.destroy}
|
709
|
+
exit
|
710
|
+
end
|
711
|
+
|
712
|
+
#< register local data >
|
713
|
+
|
714
|
+
ROOT = User.find_by_login("root")
|
715
|
+
raise("Cannot find the user 'root'. Need to create it first.") if ROOT.nil?
|
716
|
+
|
717
|
+
begin
|
718
|
+
|
719
|
+
@references = Array.new
|
720
|
+
|
721
|
+
if !OPTS[:dir]
|
722
|
+
|
723
|
+
rootdir = parse_dir(open_dir(GFDNAVI_DATA_PATH), nil,
|
724
|
+
File.mtime(GFDNAVI_DATA_PATH))
|
725
|
+
|
726
|
+
parse_dir(open_dir(GFDNAVI_USER_PATH), rootdir, File.mtime(GFDNAVI_USER_PATH))
|
727
|
+
|
728
|
+
#< register remote data >
|
729
|
+
|
730
|
+
if !OPTS[:localonly] && GFDNAVI_REMOTE_DATA_PATHS
|
731
|
+
GFDNAVI_REMOTE_DATA_PATHS.each do |path|
|
732
|
+
opddir = open_dir(path)
|
733
|
+
parse_dir(opddir)
|
734
|
+
end
|
735
|
+
end
|
736
|
+
|
737
|
+
else
|
738
|
+
|
739
|
+
dirname = OPTS[:dir]
|
740
|
+
dir = Node.find_by_path(dirname) or raise("#{dirname} is not in DB")
|
741
|
+
parent = dir.parent or raise("parent of #{dirname} is not in DB")
|
742
|
+
parse_dir( open_dir(dir.fname), parent, File.mtime(dir.fname) )
|
743
|
+
|
744
|
+
end
|
745
|
+
|
746
|
+
print "\nregistering node relations\n"
|
747
|
+
@references.each{|ref|
|
748
|
+
nr = NodeRelation.new
|
749
|
+
nr.name = ref[0]
|
750
|
+
nr.reference = Node.find(:first,:conditions=>["path=?",ref[1]], :user=>:all)
|
751
|
+
nr.referenced_by = Node.find(:first,:conditions=>["path=?",ref[2]], :user=>:all)
|
752
|
+
nr.save!
|
753
|
+
}
|
754
|
+
|
755
|
+
rescue
|
756
|
+
print "\n"
|
757
|
+
raise $!
|
758
|
+
end
|
759
|
+
|
760
|
+
print "\n"
|