galaaz 0.5.0 → 2.1.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +46 -0
- data/LICENSE +0 -0
- data/README.md +1416 -667
- data/Rakefile +68 -41
- data/bin/galaaz-bootstrap +137 -0
- data/bin/galaaz-jruby +11 -0
- data/bin/galaaz-ruby +16 -0
- data/bin/galaaz_jruby_env.inc.sh +6 -0
- data/bin/galaaz_ruby_env.inc.sh +36 -0
- data/bin/gbookdown +63 -0
- data/bin/gknit +83 -13
- data/bin/gknit-draft.rb +0 -0
- data/bin/gstudio +5 -3
- data/bin/gstudio_irb.rb +0 -0
- data/bin/gstudio_pry.rb +0 -0
- data/bin/install-tinytex +6 -0
- data/bin/run_all_rspec +44 -0
- data/bin/run_example +17 -0
- data/bin/run_old_rspec +20 -0
- data/bin/run_rspec +24 -0
- data/bin/run_rspec_subset +38 -0
- data/bin/run_slow_rspec +20 -0
- data/blogs/R-on-Rails-Planning-Document.md +940 -0
- data/blogs/README.md +100 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +38 -66
- data/blogs/galaaz_ggplot/galaaz_ggplot.log +754 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot.md +115 -155
- data/blogs/galaaz_ggplot/galaaz_ggplot.tex +607 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-gfm/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-gfm/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-html/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/midwest_rb.png +0 -0
- data/blogs/galaaz_ggplot/galaaz_ggplot_files/figure-markdown_github/scatter_plot_rb.png +0 -0
- data/blogs/galaaz_ggplot/midwest.Rmd +3 -3
- data/blogs/galaaz_ggplot/midwest_external_png +0 -0
- data/blogs/gknit/gknit.Rmd +47 -52
- data/blogs/gknit/gknit.md +1430 -0
- data/blogs/gknit/gknit_files/figure-gfm/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-gfm/diverging_bar.png +0 -0
- data/blogs/gknit/gknit_files/figure-html/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-html/diverging_bar.png +0 -0
- data/blogs/gknit/lst.rds +0 -0
- data/blogs/gknit/model.rb +1 -1
- data/blogs/gknit/stats.bib +0 -0
- data/blogs/manual/include_model_local_repro.Rmd +14 -0
- data/blogs/manual/include_model_local_repro.md +75 -0
- data/blogs/manual/lst.rds +0 -0
- data/blogs/manual/manual.Rmd +855 -239
- data/blogs/manual/manual.log +1786 -0
- data/blogs/manual/manual.md +1416 -667
- data/blogs/manual/manual.tex +1883 -1161
- data/blogs/manual/manual_files/figure-html/bubble-1.png +0 -0
- data/blogs/manual/manual_files/figure-html/diverging_bar.png +0 -0
- data/blogs/manual/manual_files/figure-latex/bubble-1.png +0 -0
- data/blogs/manual/model.rb +1 -1
- data/blogs/nse_dplyr/nse_dplyr.Rmd +84 -111
- data/blogs/nse_dplyr/nse_dplyr.log +928 -0
- data/blogs/nse_dplyr/nse_dplyr.md +198 -229
- data/blogs/oh_my/not_so.rb +0 -0
- data/blogs/oh_my/oh_my.Rmd +1234 -25
- data/blogs/oh_my/oh_my.log +804 -0
- data/blogs/oh_my/oh_my.md +1663 -86
- data/blogs/oh_my/oh_my.tex +821 -0
- data/blogs/oh_my/old.Rmd +15 -14
- data/blogs/ruby_plot/ruby_plot.Rmd +58 -82
- data/blogs/ruby_plot/ruby_plot.log +885 -0
- data/blogs/ruby_plot/ruby_plot.md +71 -102
- data/blogs/ruby_plot/ruby_plot.tex +940 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-gfm/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-html/violin_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/dose_len.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_delivery.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facet_by_dose.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_by_delivery_color2.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_decorations.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_jitter.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/facets_with_points.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_box_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/final_violin_plot.png +0 -0
- data/blogs/ruby_plot/ruby_plot_files/figure-latex/violin_with_jitter.png +0 -0
- data/blogs/test/test.Rmd +14 -0
- data/blogs/test/test.md +10 -0
- data/examples/50Plots_MasterList/Images/midwest-scatterplot.PNG +0 -0
- data/examples/50Plots_MasterList/ScatterPlot.rb +2 -1
- data/examples/50Plots_MasterList/scatter_plot.rb +1 -0
- data/examples/Bibliography/master.bib +0 -0
- data/examples/Bibliography/stats.bib +0 -0
- data/examples/R/calc.R +0 -0
- data/examples/R/java_interop.R +0 -0
- data/examples/bioconductor_deseq2_airway/Documentation/DESeq2-airway-walkthrough.md +56 -0
- data/examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb +54 -0
- data/examples/bioconductor_deseq2_airway/bench_r_three_same_process.R +34 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb +34 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz_optimized.rb +35 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_minimal.R +30 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_pipeline_for_bench.R +36 -0
- data/examples/islr/all.rb +14 -0
- data/examples/islr/ch2.spec.rb +38 -7
- data/examples/islr/ch3.spec.rb +12 -2
- data/examples/islr/ch3_boston.rb +28 -0
- data/examples/islr/ch3_multiple_regression.rb +1 -0
- data/examples/islr/ch6.spec.rb +25 -1
- data/examples/islr/x_y_rnorm.jpg +0 -0
- data/examples/latex_templates/Test-acm_article/acm_proc_article-sp.cls +0 -0
- data/examples/latex_templates/Test-acm_article/sigproc.bib +0 -0
- data/examples/latex_templates/Test-acs_article/acs-Test-acs_article.bib +0 -0
- data/examples/latex_templates/Test-acs_article/acs-my_output.bib +0 -0
- data/examples/latex_templates/Test-aea_article/BibFile.bib +0 -0
- data/examples/latex_templates/Test-aea_article/Test-aea_article.Rmd +0 -0
- data/examples/latex_templates/Test-aea_article/references.bib +0 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.Rmd +0 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.pdfsync +0 -0
- data/examples/latex_templates/Test-ieee_article/IEEEtran.bst +0 -0
- data/examples/latex_templates/Test-ieee_article/mybibfile.bib +0 -0
- data/examples/latex_templates/Test-rjournal_article/RJournal.sty +0 -0
- data/examples/latex_templates/Test-rjournal_article/RJreferences.bib +0 -0
- data/examples/latex_templates/Test-rjournal_article/Test-rjournal_article.Rmd +0 -0
- data/examples/misc/baseball.csv +0 -0
- data/examples/misc/ggplot.rb +5 -3
- data/examples/misc/moneyball.rb +1 -0
- data/examples/misc/subsetting.rb +1 -0
- data/examples/multithread_shards_to_r/shards_to_r.rb +68 -0
- data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.Rmd +0 -0
- data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.Rmd +0 -0
- data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.Rmd +0 -0
- data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.Rmd +0 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/attend-grade-relationships.csv +0 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.Rmd +0 -0
- data/examples/rmarkdown/svm-xaringan-example/svm-xaringan-example.Rmd +0 -0
- data/examples/sthda_ggplot/README.md +0 -0
- data/examples/sthda_ggplot/RUN.md +41 -0
- data/examples/sthda_ggplot/all.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/density_gg.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_area.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_density.rb +3 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_dotplot.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_freqpoly.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/geom_histogram.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/histogram_density.rb +1 -0
- data/examples/sthda_ggplot/one_variable_continuous/stat.rb +1 -0
- data/examples/sthda_ggplot/one_variable_discrete/bar.rb +1 -0
- data/examples/sthda_ggplot/qplots/box_violin_dot.rb +1 -0
- data/examples/sthda_ggplot/qplots/scatter_plots.rb +1 -0
- data/examples/sthda_ggplot/scatter_gg.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_bin2d.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_density2d.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_bivariate/geom_hex.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_point.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/geom_smooth.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_cont/misc.rb +1 -0
- data/examples/sthda_ggplot/two_variables_cont_function/geom_area.rb +5 -3
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_bar.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_boxplot.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_dotplot.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_jitter.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_line.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_cont/geom_violin.rb +1 -0
- data/examples/sthda_ggplot/two_variables_disc_disc/geom_jitter.rb +1 -0
- data/examples/sthda_ggplot/two_variables_error/geom_crossbar.rb +1 -0
- data/ext/new_bridge/Makefile +46 -0
- data/ext/new_bridge/galaaz_gatekeeper_phase0.cpp +12 -0
- data/ext/new_bridge/galaaz_gatekeeper_phase1.cpp +1639 -0
- data/lib/R_interface/galaaz_device.R +20 -0
- data/lib/R_interface/include_engine.R +109 -0
- data/lib/R_interface/new_bridge_adapter.rb +824 -0
- data/lib/R_interface/r.rb +177 -25
- data/lib/R_interface/r_arrow.rb +113 -0
- data/lib/R_interface/r_libs.R +3 -3
- data/lib/R_interface/r_methods.rb +13 -126
- data/lib/R_interface/r_module_s.rb +0 -0
- data/lib/R_interface/rbinary_operators.rb +20 -2
- data/lib/R_interface/rclosure.rb +5 -1
- data/lib/R_interface/rdata_frame.rb +34 -70
- data/lib/R_interface/rdevice.rb +125 -0
- data/lib/R_interface/rdevices.R +0 -0
- data/lib/R_interface/renvironment.rb +10 -4
- data/lib/R_interface/rexpression.rb +5 -1
- data/lib/R_interface/rindexed_object.rb +41 -13
- data/lib/R_interface/rlanguage.rb +20 -62
- data/lib/R_interface/rlist.rb +115 -25
- data/lib/R_interface/rlogical_operators.rb +0 -0
- data/lib/R_interface/rmatrix.rb +2 -11
- data/lib/R_interface/rmd_indexed_object.rb +5 -1
- data/lib/R_interface/robject.rb +348 -290
- data/lib/R_interface/rpkg.rb +0 -0
- data/lib/R_interface/rsupport.rb +609 -328
- data/lib/R_interface/rsupport_scope.rb +2 -1
- data/lib/R_interface/rsymbol.rb +50 -0
- data/lib/R_interface/ruby_callback.rb +2 -3
- data/lib/R_interface/ruby_extensions.rb +225 -175
- data/lib/R_interface/runary_operators.rb +0 -0
- data/lib/R_interface/rvector.rb +162 -31
- data/lib/galaaz.rb +0 -0
- data/lib/galaaz_jruby.rb +22 -0
- data/lib/galaaz_ruby.rb +34 -0
- data/lib/gknit/diagnostics.rb +50 -0
- data/lib/gknit/draft.rb +23 -17
- data/lib/gknit/include_engine.rb +15 -7
- data/lib/gknit/knitr_engine.rb +223 -74
- data/lib/gknit/rb_engine.rb +3 -3
- data/lib/gknit/ruby_engine.rb +0 -0
- data/lib/gknit.rb +1 -0
- data/lib/new_bridge/bootstrap/windows_bootstrap.rb +285 -0
- data/lib/new_bridge/envelope.rb +51 -0
- data/lib/new_bridge/eval_result.rb +26 -0
- data/lib/new_bridge/framing.rb +39 -0
- data/lib/new_bridge/instance_pool_client.rb +38 -0
- data/lib/new_bridge/r_instance_manager.rb +404 -0
- data/lib/new_bridge/session_client.rb +530 -0
- data/lib/new_bridge/tcp_framed.rb +44 -0
- data/lib/new_bridge.rb +9 -0
- data/lib/util/exec_ruby.rb +95 -20
- data/lib/util/inline_file.rb +35 -30
- data/new_bridge_specs/benchmark_phase5_5_unboxing_spec.rb +96 -0
- data/new_bridge_specs/eval_r_async_spec.rb +113 -0
- data/new_bridge_specs/integration_phase5_1_concurrent_spec.rb +50 -0
- data/new_bridge_specs/integration_phase5_1_eval_spec.rb +16 -0
- data/new_bridge_specs/integration_phase5_1_r_api_spec.rb +25 -0
- data/new_bridge_specs/integration_phase5_1_smoke_spec.rb +31 -0
- data/new_bridge_specs/integration_phase5_2_dataframe_unboxing_spec.rb +19 -0
- data/new_bridge_specs/integration_phase5_2_handle_eval_unboxing_spec.rb +25 -0
- data/new_bridge_specs/integration_phase5_3_callback_args_spec.rb +28 -0
- data/new_bridge_specs/integration_phase5_3_callback_error_spec.rb +22 -0
- data/new_bridge_specs/integration_phase5_3_callback_timeout_spec.rb +28 -0
- data/new_bridge_specs/integration_phase5_3_callbacks_smoke_spec.rb +22 -0
- data/new_bridge_specs/integration_phase5_3_edge_cases_spec.rb +52 -0
- data/new_bridge_specs/integration_phase5_3_nested_spec.rb +30 -0
- data/new_bridge_specs/integration_phase5_4_concurrent_sessions_spec.rb +53 -0
- data/new_bridge_specs/integration_phase5_4_nested_session_callbacks_spec.rb +49 -0
- data/new_bridge_specs/integration_phase5_4_session_routing_spec.rb +38 -0
- data/new_bridge_specs/integration_phase5_5_stress_concurrency_spec.rb +52 -0
- data/new_bridge_specs/integration_phase5_5_unbox_walk_spec.rb +46 -0
- data/new_bridge_specs/phase0_protocol_spec.rb +96 -0
- data/new_bridge_specs/phase1_req_ret_spec.rb +66 -0
- data/new_bridge_specs/phase2_multi_instance_spec.rb +67 -0
- data/new_bridge_specs/phase3_callbacks_spec.rb +71 -0
- data/new_bridge_specs/phase4_2_hardening_spec.rb +252 -0
- data/new_bridge_specs/phase4_3_r_instance_manager_spec.rb +85 -0
- data/new_bridge_specs/phase4_nested_callbacks_spec.rb +123 -0
- data/r_requires/ggplot.rb +0 -0
- data/r_requires/knitr.rb +0 -0
- data/specs/all.rb +15 -11
- data/specs/arrow_from_ruby_batches_spec.rb +50 -0
- data/specs/arrow_semantics_spec.rb +64 -0
- data/specs/bridge_concurrent_spec.rb +46 -0
- data/specs/bridge_nested_spec.rb +25 -0
- data/specs/dataframe_semantics_spec.rb +122 -0
- data/specs/dataframe_single_index_logical_filter_spec.rb +21 -0
- data/specs/dispatch_probe_cache_spec.rb +38 -0
- data/specs/dispatch_probe_error_class_fallback_spec.rb +20 -0
- data/specs/dispatch_probe_fallback_spec.rb +18 -0
- data/specs/environment_semantics_spec.rb +89 -0
- data/specs/field_access_spec.rb +31 -0
- data/specs/figures/bg.jpeg +0 -0
- data/specs/figures/bg.png +0 -0
- data/specs/figures/bg.svg +168 -57
- data/specs/figures/dose_len.png +0 -0
- data/specs/figures/no_args.jpeg +0 -0
- data/specs/figures/no_args.png +0 -0
- data/specs/figures/no_args.svg +168 -57
- data/specs/figures/width_height.jpeg +0 -0
- data/specs/figures/width_height.png +0 -0
- data/specs/figures/width_height_units1.jpeg +0 -0
- data/specs/figures/width_height_units1.png +0 -0
- data/specs/figures/width_height_units2.jpeg +0 -0
- data/specs/figures/width_height_units2.png +0 -0
- data/specs/formula_semantics_spec.rb +81 -0
- data/specs/galaaz_util_exec_ruby_spec.rb +85 -0
- data/specs/galaaz_util_inline_file_spec.rb +54 -0
- data/specs/gknit_cli_option_permutation_spec.rb +24 -0
- data/specs/gknit_include_engine_spec.rb +72 -0
- data/specs/gknit_install_timeout_report_spec.rb +69 -0
- data/specs/gknit_internal_error_report_spec.rb +57 -0
- data/specs/gknit_vector_map_output_spec.rb +59 -0
- data/specs/globalenv_guardrail_spec.rb +52 -0
- data/specs/language_expression_semantics_spec.rb +145 -0
- data/specs/list_semantics_spec.rb +111 -0
- data/specs/new_bridge_bulk_dataframe_transfer_spec.rb +44 -0
- data/specs/new_bridge_bulk_vector_transfer_spec.rb +73 -0
- data/specs/new_bridge_callback_timeout_spec.rb +69 -0
- data/specs/new_bridge_eval_r_fallback_spec.rb +55 -0
- data/specs/nil_null_spec.rb +42 -0
- data/specs/object_build_phase2_spec.rb +53 -0
- data/specs/phase1_callback_bridge_spec.rb +84 -0
- data/specs/phase2_gknit_generic_rendering_guardrail_spec.rb +46 -0
- data/specs/phase2_gknit_no_raw_code_leakage_spec.rb +43 -0
- data/specs/phase3_gknit_generic_graphics_capture_spec.rb +71 -0
- data/specs/plot_device_semantics_spec.rb +28 -0
- data/specs/plot_snapshot_semantics_spec.rb +58 -0
- data/specs/protocol_result_spec.rb +236 -0
- data/specs/r_batch_fail_fast_spec.rb +47 -0
- data/specs/r_bridge_bootstrap_spec.rb +11 -0
- data/specs/r_devices.spec.rb +1 -1
- data/specs/r_eval.spec.rb +16 -18
- data/specs/r_function.spec.rb +1 -1
- data/specs/r_instance_manager_spec.rb +285 -0
- data/specs/r_list_apply.spec.rb +15 -15
- data/specs/r_matrix.spec.rb +0 -0
- data/specs/r_nse.spec.rb +5 -5
- data/specs/r_object_send_dispatch_spec.rb +13 -0
- data/specs/r_vector_comparator_spec.rb +8 -0
- data/specs/r_vector_creation.spec.rb +0 -0
- data/specs/r_vector_functions.spec.rb +0 -0
- data/specs/r_vector_object.spec.rb +0 -0
- data/specs/r_vector_operators.spec.rb +0 -0
- data/specs/r_vector_structured_scalar_reads_spec.rb +35 -0
- data/specs/r_vector_subsetting.spec.rb +0 -0
- data/specs/range_helper_spec.rb +21 -0
- data/specs/rsupport_scope_spec.rb +28 -0
- data/specs/rsupport_var_name_thread_safety_spec.rb +24 -0
- data/specs/scalar_character_spec.rb +44 -0
- data/specs/scoped_symbol_dsl_refinement_spec.rb +40 -0
- data/specs/session_env_bridge_spec.rb +25 -0
- data/specs/simplecov_bootstrap_spec.rb +10 -0
- data/specs/spec_helper.rb +10 -0
- data/specs/tmp.rb +0 -0
- data/specs/unboxing_recursion_regression_spec.rb +30 -0
- data/specs/unboxing_spec.rb +49 -0
- data/specs/verify_callbacks.rb +42 -0
- data/sty/galaaz.sty +0 -0
- data/version.rb +1 -1
- metadata +219 -63
- data/blogs/galaaz_ggplot/galaaz_ggplot.html +0 -520
- data/blogs/galaaz_ggplot/galaaz_ggplot.pdf +0 -0
- data/blogs/galaaz_ggplot/midwest.html +0 -188
- data/blogs/gknit/gknit.html +0 -2266
- data/blogs/gknit/gknit.pdf +0 -0
- data/blogs/manual/manual.html +0 -4638
- data/blogs/manual/manual.pdf +0 -0
- data/blogs/manual/manual_files/figure-latex/diverging_bar.pdf +0 -0
- data/blogs/nse_dplyr/nse_dplyr.html +0 -878
- data/blogs/nse_dplyr/nse_dplyr.pdf +0 -0
- data/blogs/oh_my/oh_my.html +0 -568
- data/blogs/ruby_plot/ruby_plot.html +0 -544
- data/blogs/ruby_plot/ruby_plot.pdf +0 -0
- data/examples/latex_templates/Test-acs_article/Test-acs_article.pdf +0 -0
- data/examples/latex_templates/Test-aea_article/Test-aea_article.pdf +0 -0
- data/examples/latex_templates/Test-amq_article/Test-amq_article.pdf +0 -0
- data/examples/latex_templates/Test-amq_article/pics/Figure2.pdf +0 -0
- data/examples/latex_templates/Test-asa_article/Test-asa_article.pdf +0 -0
- data/examples/latex_templates/Test-ieee_article/Test-ieee_article.pdf +0 -0
- data/examples/latex_templates/Test-rjournal_article/RJwrapper.pdf +0 -0
- data/examples/latex_templates/Test-springer_article/Test-springer_article.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-anon-ms-example/svm-rmarkdown-anon-ms-example.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-article-example/svm-rmarkdown-article-example.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-beamer-example/svm-rmarkdown-beamer-example.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-cv/svm-rmarkdown-cv.pdf +0 -0
- data/examples/rmarkdown/svm-rmarkdown-syllabus-example/svm-rmarkdown-syllabus-example.pdf +0 -0
- data/specs/r_dataframe.spec.rb +0 -379
- data/specs/r_environment.spec.rb +0 -140
- data/specs/r_formula.spec.rb +0 -232
- data/specs/r_language.spec.rb +0 -112
- data/specs/r_list.spec.rb +0 -293
- data/specs/r_plots.spec.rb +0 -72
- data/specs/ruby_expression.spec.rb +0 -316
data/Rakefile
CHANGED
|
@@ -23,8 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
require 'rake/tasklib'
|
|
25
25
|
require 'rake/testtask'
|
|
26
|
+
require 'shellwords'
|
|
26
27
|
|
|
27
28
|
require_relative 'version'
|
|
29
|
+
require_relative 'lib/galaaz_ruby'
|
|
28
30
|
|
|
29
31
|
#----------------------------------------------------------------------------------------
|
|
30
32
|
#
|
|
@@ -32,12 +34,16 @@ require_relative 'version'
|
|
|
32
34
|
|
|
33
35
|
class MakeTask < Rake::TaskLib
|
|
34
36
|
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
# Ruby prefix for running Galaaz. Uses `ruby` on PATH unless GALAAZ_RUBY is set.
|
|
38
|
+
# JVM flags only when the selected interpreter is JRuby (see lib/galaaz_ruby.rb).
|
|
39
|
+
def self.galaaz_ruby_invocation
|
|
40
|
+
GalaazRuby.shell_invocation('lib')
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Alias kept for existing call sites; same as galaaz_ruby_invocation.
|
|
44
|
+
def self.galaaz_jruby_invocation
|
|
45
|
+
galaaz_ruby_invocation
|
|
46
|
+
end
|
|
41
47
|
|
|
42
48
|
#----------------------------------------------------------------------------------------
|
|
43
49
|
#
|
|
@@ -56,13 +62,16 @@ class MakeTask < Rake::TaskLib
|
|
|
56
62
|
end
|
|
57
63
|
|
|
58
64
|
#----------------------------------------------------------------------------------------
|
|
59
|
-
#
|
|
65
|
+
# Run example or spec with Galaaz Ruby (ruby on PATH; GALAAZ_RUBY overrides)
|
|
60
66
|
#----------------------------------------------------------------------------------------
|
|
61
67
|
|
|
62
68
|
def make_task
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
69
|
+
inv = MakeTask.galaaz_ruby_invocation
|
|
70
|
+
if @rspec
|
|
71
|
+
sh %{ #{inv} -S bundle exec rspec #{@filepath}.rb -f documentation }
|
|
72
|
+
else
|
|
73
|
+
sh %{ #{inv} -S bundle exec ruby #{@filepath}.rb }
|
|
74
|
+
end
|
|
66
75
|
end
|
|
67
76
|
|
|
68
77
|
#----------------------------------------------------------------------------------------
|
|
@@ -77,8 +86,11 @@ class MakeTask < Rake::TaskLib
|
|
|
77
86
|
|
|
78
87
|
end
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
89
|
+
# Run each .rb file in a directory (for groups that don't have an all.rb)
|
|
90
|
+
def run_each_file(file_list)
|
|
91
|
+
inv = MakeTask.galaaz_ruby_invocation
|
|
92
|
+
file_list.each { |f| sh "#{inv} -S bundle exec ruby #{f}" }
|
|
93
|
+
end
|
|
82
94
|
|
|
83
95
|
geoms = FileList['examples/sthda_ggplot/**/*.rb']
|
|
84
96
|
specs = FileList['specs/**/*.rb']
|
|
@@ -165,6 +177,35 @@ bugs.each do |f|
|
|
|
165
177
|
Desc
|
|
166
178
|
end
|
|
167
179
|
|
|
180
|
+
#===========================================================================================
|
|
181
|
+
# Aggregate "all" tasks for groups that have multiple files (no single all.rb)
|
|
182
|
+
# sthda:all and islr:all already exist from MakeTask (they run all.rb in that dir)
|
|
183
|
+
#===========================================================================================
|
|
184
|
+
|
|
185
|
+
desc "Run all misc examples"
|
|
186
|
+
task "misc:all" do
|
|
187
|
+
run_each_file(misc.to_a)
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
desc "Run all 50Plots_MasterList examples"
|
|
191
|
+
task "master_list:all" do
|
|
192
|
+
run_each_file(master_list.to_a)
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
desc "Run all bug examples"
|
|
196
|
+
task "bugs:all" do
|
|
197
|
+
run_each_file(bugs.to_a)
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
#===========================================================================================
|
|
201
|
+
# Run all example groups (sthda_ggplot, misc, 50Plots_MasterList, islr, bugs)
|
|
202
|
+
#===========================================================================================
|
|
203
|
+
|
|
204
|
+
desc "Run all examples (sthda_ggplot, misc, 50Plots_MasterList, islr, bugs)"
|
|
205
|
+
task "examples:all" => ["sthda:all", "misc:all", "master_list:all", "islr:all", "bugs:all"]
|
|
206
|
+
|
|
207
|
+
task :default => "examples:all"
|
|
208
|
+
|
|
168
209
|
#===========================================================================================
|
|
169
210
|
# Creates task for running gknit
|
|
170
211
|
#===========================================================================================
|
|
@@ -179,15 +220,6 @@ blogs.each do |dir|
|
|
|
179
220
|
|
|
180
221
|
end
|
|
181
222
|
|
|
182
|
-
#===========================================================================================
|
|
183
|
-
# Loads R and require libraries to run Galaaz
|
|
184
|
-
#===========================================================================================
|
|
185
|
-
|
|
186
|
-
desc 'Prepare R for running'
|
|
187
|
-
task :make_r do
|
|
188
|
-
(sh %{ gu install r })
|
|
189
|
-
end
|
|
190
|
-
|
|
191
223
|
#===========================================================================================
|
|
192
224
|
# Makes a gem for publishing in RubyGems
|
|
193
225
|
#===========================================================================================
|
|
@@ -206,27 +238,22 @@ task :publish_gem do
|
|
|
206
238
|
(sh %{ gem push #{$gem_name}-#{$version}.gem })
|
|
207
239
|
end
|
|
208
240
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
desc 'Install the gem in the standard location'
|
|
214
|
-
task :install_gem => [:make_gem] do
|
|
215
|
-
sh "gem install #{$gem_name}-#{$version}-java.gem"
|
|
216
|
-
end
|
|
241
|
+
#===========================================================================================
|
|
242
|
+
# NewBridge gatekeeper + combined spec run (JRuby; see also bin/run_all_rspec)
|
|
243
|
+
#===========================================================================================
|
|
217
244
|
|
|
218
|
-
desc '
|
|
219
|
-
task :
|
|
220
|
-
sh
|
|
245
|
+
desc 'Compile the NewBridge gatekeeper shared library (ext/new_bridge; incremental make)'
|
|
246
|
+
task :compile_gatekeeper do
|
|
247
|
+
Dir.chdir('ext/new_bridge') { sh 'make all' }
|
|
221
248
|
end
|
|
222
249
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
250
|
+
desc 'Run specs/ and new_bridge_specs/ with SimpleCov (same idea as bin/run_all_rspec; GALAAZ_RUBY overrides)'
|
|
251
|
+
task :specs_all_with_new_bridge => [:compile_gatekeeper] do
|
|
252
|
+
root = File.expand_path(__dir__)
|
|
253
|
+
inv = MakeTask.galaaz_ruby_invocation
|
|
254
|
+
top = Dir[File.join(root, 'specs', '*_spec.rb')] + Dir[File.join(root, 'specs', '*.spec.rb')]
|
|
255
|
+
files = top.sort.map { |p| Shellwords.escape(p) }.join(' ')
|
|
256
|
+
nb = Shellwords.escape(File.join(root, 'new_bridge_specs'))
|
|
257
|
+
helper = Shellwords.escape(File.join(root, 'specs', 'spec_helper.rb'))
|
|
258
|
+
sh %{ #{inv} -r #{helper} -S bundle exec rspec #{files} #{nb} }
|
|
230
259
|
end
|
|
231
|
-
|
|
232
|
-
=end
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
require 'optparse'
|
|
5
|
+
require 'open3'
|
|
6
|
+
|
|
7
|
+
ROOT = File.expand_path('..', __dir__)
|
|
8
|
+
$LOAD_PATH.unshift(File.join(ROOT, 'lib'))
|
|
9
|
+
|
|
10
|
+
require 'new_bridge/bootstrap/windows_bootstrap'
|
|
11
|
+
|
|
12
|
+
mode = :check
|
|
13
|
+
runtime_mode = :auto
|
|
14
|
+
prompt_doc_tools = true
|
|
15
|
+
|
|
16
|
+
OptionParser.new do |opts|
|
|
17
|
+
opts.banner = 'Usage: bin/galaaz-bootstrap [--check|--apply] [--runtime docker|local|auto]'
|
|
18
|
+
|
|
19
|
+
opts.on('--check', 'Run diagnostics only (default)') do
|
|
20
|
+
mode = :check
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
opts.on('--apply', 'Apply WSL-side fixes where possible') do
|
|
24
|
+
mode = :apply
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
opts.on('--runtime MODE', 'Runtime mode: auto (default), docker, or local') do |v|
|
|
28
|
+
runtime_mode = v.to_sym
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
opts.on('--[no-]prompt-doc-tools',
|
|
32
|
+
'In apply mode, ask to install TinyTeX/poppler for gknit PDF support (default: enabled)') do |v|
|
|
33
|
+
prompt_doc_tools = v
|
|
34
|
+
end
|
|
35
|
+
end.parse!(ARGV)
|
|
36
|
+
|
|
37
|
+
bootstrap = NewBridge::Bootstrap::WindowsBootstrap.new
|
|
38
|
+
result = bootstrap.run(mode: mode, runtime_mode: runtime_mode)
|
|
39
|
+
|
|
40
|
+
def command_exists?(cmd)
|
|
41
|
+
system("command -v #{cmd} >/dev/null 2>&1")
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def yes_no_prompt(question, default_yes: true)
|
|
45
|
+
return default_yes unless $stdin.tty? && $stdout.tty?
|
|
46
|
+
|
|
47
|
+
suffix = default_yes ? '[Y/n]' : '[y/N]'
|
|
48
|
+
print "#{question} #{suffix} "
|
|
49
|
+
answer = $stdin.gets
|
|
50
|
+
return default_yes if answer.nil?
|
|
51
|
+
|
|
52
|
+
value = answer.strip.downcase
|
|
53
|
+
return default_yes if value.empty?
|
|
54
|
+
return true if %w[y yes].include?(value)
|
|
55
|
+
return false if %w[n no].include?(value)
|
|
56
|
+
|
|
57
|
+
default_yes
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
def install_tinytex
|
|
61
|
+
return puts('TinyTeX/LaTeX already available (pdflatex found).') if command_exists?('pdflatex')
|
|
62
|
+
|
|
63
|
+
installer = File.join(ROOT, 'bin', 'install-tinytex')
|
|
64
|
+
cmd =
|
|
65
|
+
if File.exist?(installer)
|
|
66
|
+
"bash #{installer.inspect}"
|
|
67
|
+
else
|
|
68
|
+
"curl -fsSL https://raw.githubusercontent.com/rstudio/tinytex/master/tools/install-bin-unix.sh | sh"
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
puts 'Installing TinyTeX (LaTeX) for gknit/pdf_document...'
|
|
72
|
+
ok = system(cmd)
|
|
73
|
+
puts('TinyTeX install finished.') if ok
|
|
74
|
+
puts('TinyTeX install failed. Re-run manually: bin/install-tinytex') unless ok
|
|
75
|
+
puts 'PATH note: ensure ~/bin is available in your shell, or use the Phase 2 spec env helper.'
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def install_poppler
|
|
79
|
+
return puts('Poppler already available (pdftotext found).') if command_exists?('pdftotext')
|
|
80
|
+
|
|
81
|
+
puts 'Installing poppler-utils (pdftotext) for full PDF text assertions...'
|
|
82
|
+
ok = system('sudo apt-get update && sudo apt-get install -y poppler-utils')
|
|
83
|
+
puts('poppler-utils installed.') if ok
|
|
84
|
+
puts('poppler-utils install failed or was cancelled.') unless ok
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
def arrow_available_in_r?
|
|
88
|
+
return false unless command_exists?('Rscript')
|
|
89
|
+
|
|
90
|
+
system(%q{Rscript -e "quit(status = ifelse(requireNamespace('arrow', quietly=TRUE), 0, 1))"})
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def install_arrow
|
|
94
|
+
unless command_exists?('Rscript')
|
|
95
|
+
puts 'Rscript not found; cannot install arrow package.'
|
|
96
|
+
return
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
if arrow_available_in_r?
|
|
100
|
+
puts 'R arrow package already available.'
|
|
101
|
+
return
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
puts 'Installing R arrow package for Galaaz Arrow helpers...'
|
|
105
|
+
ok = system(%q{Rscript -e "install.packages('arrow', repos='https://cloud.r-project.org/')"})
|
|
106
|
+
unless ok && arrow_available_in_r?
|
|
107
|
+
puts 'arrow install failed or package still unavailable.'
|
|
108
|
+
puts "Try manually: Rscript -e \"install.packages('arrow', repos='https://cloud.r-project.org/')\""
|
|
109
|
+
return
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
puts 'R arrow package installed.'
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def verify_arrow_from_ruby
|
|
116
|
+
cmd = "bin/galaaz-jruby -I lib -e \"require 'galaaz'; df=R.data__frame(x:(1..2), y:(2..1)); t=R::Arrow.table_from(df); puts t.rclass\""
|
|
117
|
+
ok = system("cd #{ROOT.inspect} && #{cmd}")
|
|
118
|
+
puts(ok ? 'Ruby Arrow bridge check passed.' : 'Ruby Arrow bridge check failed.')
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
if mode == :apply && prompt_doc_tools
|
|
122
|
+
if yes_no_prompt('Will you render PDF documents with gknit (LaTeX required)?', default_yes: true)
|
|
123
|
+
install_tinytex
|
|
124
|
+
|
|
125
|
+
if yes_no_prompt('Also install poppler (pdftotext) for strict PDF text checks?', default_yes: true)
|
|
126
|
+
install_poppler
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if yes_no_prompt('Will you use Arrow (Feather/Parquet) from Ruby/R?', default_yes: true)
|
|
131
|
+
install_arrow
|
|
132
|
+
verify_arrow_from_ruby if yes_no_prompt('Run a quick Ruby Arrow bridge verification now?', default_yes: true)
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
exit(result[:exit_code])
|
|
137
|
+
|
data/bin/galaaz-jruby
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run jruby with Galaaz-required JVM flags and lib/ on the load path.
|
|
3
|
+
# Thin JRuby wrapper around bin/galaaz-ruby (forces jruby).
|
|
4
|
+
# Optional: GALAAZ_JRUBY_OPTS (space-separated extra -J... or jruby args).
|
|
5
|
+
#
|
|
6
|
+
# Usage: bin/galaaz-jruby path/to/script.rb [args...]
|
|
7
|
+
# bin/galaaz-jruby -S rspec specs/foo_spec.rb
|
|
8
|
+
set -e
|
|
9
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
10
|
+
export GALAAZ_RUBY=jruby
|
|
11
|
+
exec "$ROOT/bin/galaaz-ruby" "$@"
|
data/bin/galaaz-ruby
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run Galaaz with the selected Ruby (default: ruby on PATH; JRuby or CRuby).
|
|
3
|
+
# JVM flags are applied only when the interpreter is JRuby.
|
|
4
|
+
#
|
|
5
|
+
# Usage: bin/galaaz-ruby path/to/script.rb [args...]
|
|
6
|
+
# GALAAZ_RUBY=jruby bin/galaaz-ruby path/to/script.rb
|
|
7
|
+
# GALAAZ_RUBY=ruby bin/galaaz-ruby path/to/script.rb
|
|
8
|
+
# bin/galaaz-ruby -S rspec specs/foo_spec.rb
|
|
9
|
+
set -e
|
|
10
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
11
|
+
# shellcheck source=galaaz_ruby_env.inc.sh
|
|
12
|
+
source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
13
|
+
# shellcheck disable=SC2086
|
|
14
|
+
exec "$GALAAZ_RUBY_BIN" -I "$ROOT/lib" \
|
|
15
|
+
$GALAAZ_RUBY_J_ARGS \
|
|
16
|
+
"$@"
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Galaaz required JVM flags for JRuby (Apache Arrow on Java 9+).
|
|
2
|
+
# Source from bin/*.sh: source "$ROOT/bin/galaaz_jruby_env.inc.sh"
|
|
3
|
+
#
|
|
4
|
+
# Source of truth in Ruby/Rake: lib/galaaz_jruby.rb (GalaazJRuby::REQUIRED_JRUBY_J_ARGS).
|
|
5
|
+
# Optional extra -J flags: export GALAAZ_JRUBY_OPTS="-J-Xmx4g" (space-separated).
|
|
6
|
+
GALAAZ_REQUIRED_JRUBY_J_ARGS='-J--add-opens=java.base/java.nio=ALL-UNNAMED'
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Galaaz Ruby interpreter selection for bin/* launchers.
|
|
2
|
+
# Source from bin/*.sh: source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
3
|
+
#
|
|
4
|
+
# Sets:
|
|
5
|
+
# GALAAZ_RUBY_BIN — interpreter to exec (default: ruby on PATH)
|
|
6
|
+
# GALAAZ_RUBY_J_ARGS — JVM -J flags when that interpreter is JRuby; empty on CRuby
|
|
7
|
+
#
|
|
8
|
+
# JRuby and CRuby are both first-class. Override with GALAAZ_RUBY=jruby, GALAAZ_RUBY=ruby,
|
|
9
|
+
# or a full path. Extra JRuby flags: GALAAZ_JRUBY_OPTS="-J-Xmx4g" (ignored on CRuby).
|
|
10
|
+
|
|
11
|
+
GALAAZ_RUBY_BIN="${GALAAZ_RUBY:-ruby}"
|
|
12
|
+
|
|
13
|
+
_galaaz_ruby_base="$(basename -- "$GALAAZ_RUBY_BIN")"
|
|
14
|
+
_galaaz_ruby_engine="$("$GALAAZ_RUBY_BIN" -e 'print RUBY_ENGINE' 2>/dev/null || true)"
|
|
15
|
+
case "$_galaaz_ruby_base" in
|
|
16
|
+
jruby|jruby.*)
|
|
17
|
+
_galaaz_is_jruby=1
|
|
18
|
+
;;
|
|
19
|
+
*)
|
|
20
|
+
if [[ "$_galaaz_ruby_engine" == "jruby" ]]; then
|
|
21
|
+
_galaaz_is_jruby=1
|
|
22
|
+
else
|
|
23
|
+
_galaaz_is_jruby=0
|
|
24
|
+
fi
|
|
25
|
+
;;
|
|
26
|
+
esac
|
|
27
|
+
|
|
28
|
+
if [[ "$_galaaz_is_jruby" -eq 1 ]]; then
|
|
29
|
+
# shellcheck source=galaaz_jruby_env.inc.sh
|
|
30
|
+
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/galaaz_jruby_env.inc.sh"
|
|
31
|
+
GALAAZ_RUBY_J_ARGS="$GALAAZ_REQUIRED_JRUBY_J_ARGS ${GALAAZ_JRUBY_OPTS:-}"
|
|
32
|
+
else
|
|
33
|
+
GALAAZ_REQUIRED_JRUBY_J_ARGS=''
|
|
34
|
+
GALAAZ_RUBY_J_ARGS=''
|
|
35
|
+
fi
|
|
36
|
+
unset _galaaz_ruby_base _galaaz_ruby_engine _galaaz_is_jruby
|
data/bin/gbookdown
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
require 'optparse'
|
|
5
|
+
require 'shellwords'
|
|
6
|
+
|
|
7
|
+
options = {}
|
|
8
|
+
parser = OptionParser.new do |opts|
|
|
9
|
+
opts.banner = 'Usage: gbookdown [options]'
|
|
10
|
+
|
|
11
|
+
opts.on('-f', '--filename FILE', 'Bookdown input file (typically index.Rmd).') do |opt|
|
|
12
|
+
options[:input_file] = opt
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
opts.on('--output_format FORMAT',
|
|
16
|
+
"Bookdown output format (e.g. 'bookdown::gitbook', 'bookdown::pdf_book').") do |opt|
|
|
17
|
+
options[:output_format] = opt
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
opts.on('--bridge_timeout_sec TIMEOUT_SEC', Integer,
|
|
21
|
+
'Bridge request timeout in seconds for Ruby->R eval calls.') do |opt|
|
|
22
|
+
options[:bridge_timeout_sec] = opt
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
opts.on('--callback_timeout_ms TIMEOUT_MS', Integer,
|
|
26
|
+
'Callback timeout in milliseconds for R<->Ruby calls.') do |opt|
|
|
27
|
+
options[:callback_timeout_ms] = opt
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
remaining_args = parser.permute(ARGV.dup)
|
|
32
|
+
ARGV.replace(remaining_args)
|
|
33
|
+
|
|
34
|
+
options[:input_file] ||= ARGV[0]
|
|
35
|
+
raise 'Input file name is required. Add -f FILE. For help, type gbookdown -h' if options[:input_file].nil?
|
|
36
|
+
|
|
37
|
+
input_file = File.expand_path(options[:input_file], Dir.pwd)
|
|
38
|
+
raise "File #{input_file} does not exist!" unless File.exist?(input_file)
|
|
39
|
+
|
|
40
|
+
input_dir = File.dirname(input_file)
|
|
41
|
+
output_format = options[:output_format].nil? ? 'nil' : %("#{options[:output_format]}")
|
|
42
|
+
r_call = "bookdown::render_book(#{File.basename(input_file).inspect}, #{output_format})"
|
|
43
|
+
|
|
44
|
+
puts '================================'
|
|
45
|
+
puts "gBookdown #{input_file} with options:"
|
|
46
|
+
puts " * Output format: \t #{output_format}"
|
|
47
|
+
|
|
48
|
+
code = <<EOF
|
|
49
|
+
ENV['GALAAZ_CALLBACK_TIMEOUT_MS'] = #{options[:callback_timeout_ms].to_s.inspect} if #{!options[:callback_timeout_ms].nil?}
|
|
50
|
+
ENV['GALAAZ_BRIDGE_TIMEOUT_SEC'] = #{options[:bridge_timeout_sec].to_s.inspect} if #{!options[:bridge_timeout_sec].nil?}
|
|
51
|
+
require %q(galaaz)
|
|
52
|
+
require %q(gknit)
|
|
53
|
+
|
|
54
|
+
Dir.chdir(#{input_dir.inspect}) do
|
|
55
|
+
R.install_and_loads('bookdown')
|
|
56
|
+
R::Support.eval(#{r_call.inspect})
|
|
57
|
+
end
|
|
58
|
+
EOF
|
|
59
|
+
|
|
60
|
+
libx = File.expand_path('../lib', File.dirname(__FILE__))
|
|
61
|
+
require File.join(libx, 'galaaz_ruby')
|
|
62
|
+
exec "#{GalaazRuby.shell_invocation(libx)} -e #{Shellwords.escape(code)}"
|
|
63
|
+
|
data/bin/gknit
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
# coding: utf-8
|
|
3
3
|
|
|
4
4
|
require 'optionparser'
|
|
5
|
+
require 'shellwords'
|
|
5
6
|
|
|
6
7
|
options = {}
|
|
7
|
-
|
|
8
|
-
OptionParser.new do |opts|
|
|
8
|
+
parser = OptionParser.new do |opts|
|
|
9
9
|
opts.banner = "Usage: gknit [options]"
|
|
10
10
|
opts.on("-f", "--filename FILE", "The input file to be rendered.
|
|
11
11
|
This value can also be provided without the '-f' or '--filename'
|
|
@@ -59,7 +59,19 @@ file.") do |opt|
|
|
|
59
59
|
that are created during rendering.") do |opt|
|
|
60
60
|
options[:clean] = opt
|
|
61
61
|
end
|
|
62
|
-
|
|
62
|
+
opts.on("--debugR", "Log R/Ruby bridge traffic to logs; print only [RUBY] (commands sent) to stderr. Full R output is in logs/galaaz_r_stdout.log.") do
|
|
63
|
+
ENV["GALAAZ_DEBUG_R"] = "1"
|
|
64
|
+
end
|
|
65
|
+
opts.on("--callback_timeout_ms TIMEOUT_MS", Integer, "Callback timeout in milliseconds for R<->Ruby calls inside chunk execution. Use for long installs/computation (e.g., 7200000 for 2h).") do |opt|
|
|
66
|
+
options[:callback_timeout_ms] = opt
|
|
67
|
+
end
|
|
68
|
+
opts.on("--bridge_timeout_sec TIMEOUT_SEC", Integer, "Bridge request timeout in seconds for Ruby->R eval calls (default 60). Increase for long install.packages/compilation work.") do |opt|
|
|
69
|
+
options[:bridge_timeout_sec] = opt
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
remaining_args = parser.permute(ARGV.dup)
|
|
74
|
+
ARGV.replace(remaining_args)
|
|
63
75
|
|
|
64
76
|
# Sets the directory
|
|
65
77
|
dir = Dir.pwd
|
|
@@ -133,22 +145,80 @@ puts " * Output directory: \t #{options[:output_dir]}"
|
|
|
133
145
|
puts " * Clean: \t\t #{options[:clean]}"
|
|
134
146
|
|
|
135
147
|
|
|
136
|
-
# Code to be evaluated by the polyglot Ruby script
|
|
148
|
+
# Code to be evaluated by the polyglot Ruby script.
|
|
149
|
+
# Run render with the input file's directory as current so figure paths (e.g. oh_my_files/figure-html/)
|
|
150
|
+
# are created and found inside the document directory (e.g. blogs/oh_my/).
|
|
151
|
+
input_file = options[:input_file]
|
|
152
|
+
input_dir = File.dirname(input_file)
|
|
137
153
|
code = <<EOF
|
|
154
|
+
ENV['GALAAZ_CALLBACK_TIMEOUT_MS'] = #{options[:callback_timeout_ms].to_s.inspect} if #{!options[:callback_timeout_ms].nil?}
|
|
155
|
+
ENV['GALAAZ_BRIDGE_TIMEOUT_SEC'] = #{options[:bridge_timeout_sec].to_s.inspect} if #{!options[:bridge_timeout_sec].nil?}
|
|
138
156
|
require %q(galaaz)
|
|
139
157
|
require %q(gknit)
|
|
140
158
|
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
159
|
+
Dir.chdir(#{input_dir.inspect}) do
|
|
160
|
+
GknitDiagnostics.reset! if defined?(GknitDiagnostics)
|
|
161
|
+
begin
|
|
162
|
+
R::Rmarkdown.render(
|
|
163
|
+
%q(#{input_file}),
|
|
164
|
+
output_format: #{options[:output_format]},
|
|
165
|
+
output_file: #{options[:output_file]},
|
|
166
|
+
output_dir: #{options[:output_dir]},
|
|
167
|
+
clean: #{options[:clean]}
|
|
168
|
+
)
|
|
169
|
+
rescue StandardError => e
|
|
170
|
+
# Friendly handling for LaTeX/render errors (including bridge timeout wrappers):
|
|
171
|
+
# prefer actionable message over a Ruby stack trace.
|
|
172
|
+
log_file = begin
|
|
173
|
+
base = File.basename(%q(#{input_file}), File.extname(%q(#{input_file})))
|
|
174
|
+
candidate = File.join(Dir.pwd, "\#{base}.log")
|
|
175
|
+
File.file?(candidate) ? candidate : nil
|
|
176
|
+
rescue StandardError
|
|
177
|
+
nil
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
missing_pkg = nil
|
|
181
|
+
latex_fatal = nil
|
|
182
|
+
if log_file
|
|
183
|
+
begin
|
|
184
|
+
log_text = File.read(log_file)
|
|
185
|
+
m = log_text.match(/LaTeX Error: File [`']([^`']+\.sty)[`'] not found\./)
|
|
186
|
+
missing_pkg = m[1] if m
|
|
187
|
+
fatal_match = log_text.match(/!pdfTeX error:[^\n]+/)
|
|
188
|
+
latex_fatal = fatal_match[0] if fatal_match
|
|
189
|
+
rescue StandardError
|
|
190
|
+
missing_pkg = nil
|
|
191
|
+
latex_fatal = nil
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
STDERR.puts "gknit render failed: \#{e.message}"
|
|
196
|
+
if e.message.to_s.include?('no RET for')
|
|
197
|
+
callback_ms = ENV['GALAAZ_CALLBACK_TIMEOUT_MS'] || '120000'
|
|
198
|
+
bridge_sec = ENV['GALAAZ_BRIDGE_TIMEOUT_SEC'] || '60'
|
|
199
|
+
STDERR.puts "Likely bridge timeout during long-running Ruby->R evaluation."
|
|
200
|
+
STDERR.puts "Current bridge timeout: \#{bridge_sec} sec; callback timeout: \#{callback_ms} ms."
|
|
201
|
+
STDERR.puts "Use gknit --bridge_timeout_sec <sec> and/or --callback_timeout_ms <ms> for longer operations."
|
|
202
|
+
end
|
|
203
|
+
if missing_pkg
|
|
204
|
+
STDERR.puts "Likely missing LaTeX package: \#{missing_pkg} (install with tlmgr)."
|
|
205
|
+
elsif latex_fatal
|
|
206
|
+
STDERR.puts "LaTeX fatal error: \#{latex_fatal}"
|
|
207
|
+
elsif log_file
|
|
208
|
+
STDERR.puts "See LaTeX log for details: \#{log_file}"
|
|
209
|
+
end
|
|
210
|
+
exit 1
|
|
211
|
+
ensure
|
|
212
|
+
GknitDiagnostics.print_report(STDERR) if defined?(GknitDiagnostics)
|
|
213
|
+
end
|
|
214
|
+
end
|
|
148
215
|
EOF
|
|
149
216
|
|
|
150
|
-
libx = File.expand_path('
|
|
151
|
-
|
|
217
|
+
libx = File.expand_path('../lib', File.dirname(__FILE__))
|
|
218
|
+
require File.join(libx, 'galaaz_ruby')
|
|
219
|
+
ENV['GALAAZ_CALLBACK_TIMEOUT_MS'] = options[:callback_timeout_ms].to_s if !options[:callback_timeout_ms].nil?
|
|
220
|
+
ENV['GALAAZ_BRIDGE_TIMEOUT_SEC'] = options[:bridge_timeout_sec].to_s if !options[:bridge_timeout_sec].nil?
|
|
221
|
+
exec "#{GalaazRuby.shell_invocation(libx)} -e #{Shellwords.escape(code)}"
|
|
152
222
|
|
|
153
223
|
=begin
|
|
154
224
|
# how to call rmarkdown::render with a parameter list
|
data/bin/gknit-draft.rb
CHANGED
|
File without changes
|
data/bin/gstudio
CHANGED
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
##########################################################################################
|
|
24
24
|
|
|
25
25
|
require 'optionparser'
|
|
26
|
+
require 'shellwords'
|
|
26
27
|
|
|
27
28
|
options = {}
|
|
28
29
|
|
|
@@ -40,12 +41,13 @@ end.parse!
|
|
|
40
41
|
|
|
41
42
|
bin_dir = File.expand_path('..', __FILE__)
|
|
42
43
|
libx = File.expand_path('../../lib', __FILE__)
|
|
44
|
+
require File.join(libx, 'galaaz_ruby')
|
|
45
|
+
inv = GalaazRuby.shell_invocation(Shellwords.escape(libx))
|
|
43
46
|
|
|
44
47
|
if options[:pry]
|
|
45
48
|
puts "Loading PRY and Galaaz... Please wait!"
|
|
46
|
-
|
|
47
|
-
exec "ruby --polyglot --jvm --experimental-options --single-threaded -I#{libx} -S pry -r #{bin_dir}/gstudio_pry.rb"
|
|
49
|
+
exec "#{inv} -S pry -r #{Shellwords.escape(File.join(bin_dir, 'gstudio_pry.rb'))}"
|
|
48
50
|
else
|
|
49
51
|
puts "Loading IRB and Galaaz... Please wait!"
|
|
50
|
-
exec "
|
|
52
|
+
exec "#{inv} -S irb -r #{Shellwords.escape(File.join(bin_dir, 'gstudio_irb.rb'))}"
|
|
51
53
|
end
|
data/bin/gstudio_irb.rb
CHANGED
|
File without changes
|
data/bin/gstudio_pry.rb
CHANGED
|
File without changes
|
data/bin/install-tinytex
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Install TinyTeX to ~/.TinyTeX with symlinks in ~/bin (no sudo).
|
|
3
|
+
# Needed for rmarkdown pdf_document and specs/phase2_gknit_chunk_output_spec.rb.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
curl -fsSL https://raw.githubusercontent.com/rstudio/tinytex/master/tools/install-bin-unix.sh | sh
|
|
6
|
+
echo "TinyTeX installed. Ensure ~/bin is on PATH for interactive shells, or rely on the Phase 2 spec prepending it for gknit."
|
data/bin/run_all_rspec
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run default galaaz specs (specs/) and NewBridge gatekeeper specs (new_bridge_specs/)
|
|
3
|
+
# in a single RSpec process so SimpleCov produces one merged report under coverage/.
|
|
4
|
+
#
|
|
5
|
+
# Compiles ext/new_bridge (incremental make) first — required for integration specs.
|
|
6
|
+
#
|
|
7
|
+
# Usage:
|
|
8
|
+
# bin/run_all_rspec
|
|
9
|
+
# bin/run_all_rspec --format documentation
|
|
10
|
+
# bin/run_all_rspec new_bridge_specs/phase0_protocol_spec.rb
|
|
11
|
+
# GALAAZ_RUBY=ruby bin/run_all_rspec
|
|
12
|
+
#
|
|
13
|
+
# If the first argument is an option (starts with -), default dirs are prepended
|
|
14
|
+
# so `bin/run_all_rspec --format doc` still runs specs/ + new_bridge_specs/.
|
|
15
|
+
#
|
|
16
|
+
# For specs/ only (faster day-to-day): bin/run_rspec
|
|
17
|
+
set -e
|
|
18
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
19
|
+
# shellcheck source=galaaz_ruby_env.inc.sh
|
|
20
|
+
source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
21
|
+
|
|
22
|
+
echo "[run_all_rspec] compiling gatekeeper: ext/new_bridge"
|
|
23
|
+
make -C "$ROOT/ext/new_bridge" -s all
|
|
24
|
+
|
|
25
|
+
# Same top-level file set as bin/run_rspec (maxdepth 1), plus whole new_bridge_specs/ tree.
|
|
26
|
+
DEFAULT_SPECS=()
|
|
27
|
+
while IFS= read -r f; do
|
|
28
|
+
DEFAULT_SPECS+=("$f")
|
|
29
|
+
done < <(find "$ROOT/specs" -maxdepth 1 -type f \( -name '*_spec.rb' -o -name '*.spec.rb' \) | sort)
|
|
30
|
+
DEFAULT_SPECS+=( "$ROOT/new_bridge_specs" )
|
|
31
|
+
|
|
32
|
+
# With no args, run those paths. If args are only RSpec options (e.g. --format progress),
|
|
33
|
+
# prepend defaults so flags alone do not mean "run zero files".
|
|
34
|
+
if [ $# -eq 0 ]; then
|
|
35
|
+
set -- "${DEFAULT_SPECS[@]}"
|
|
36
|
+
elif [[ "${1:-}" == -* ]]; then
|
|
37
|
+
set -- "${DEFAULT_SPECS[@]}" "$@"
|
|
38
|
+
fi
|
|
39
|
+
# shellcheck disable=SC2086
|
|
40
|
+
exec "$GALAAZ_RUBY_BIN" -I "$ROOT/lib" \
|
|
41
|
+
$GALAAZ_RUBY_J_ARGS \
|
|
42
|
+
-S bundle exec rspec \
|
|
43
|
+
-r "$ROOT/specs/spec_helper.rb" \
|
|
44
|
+
"$@"
|
data/bin/run_example
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Run a Galaaz example (default: ruby on PATH). Override with GALAAZ_RUBY=jruby|ruby.
|
|
3
|
+
# Uses bundle exec so msgpack (and other Gemfile deps) resolve under vendor/bundle.
|
|
4
|
+
# Optional: GALAAZ_JRUBY_OPTS (JRuby only).
|
|
5
|
+
#
|
|
6
|
+
# Usage: bin/run_example examples/sthda_ggplot/all.rb
|
|
7
|
+
# bin/run_example examples/sthda_ggplot/one_variable_continuous/geom_density.rb
|
|
8
|
+
# GALAAZ_RUBY=ruby bin/run_example examples/misc/subsetting.rb
|
|
9
|
+
set -e
|
|
10
|
+
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
11
|
+
# shellcheck source=galaaz_ruby_env.inc.sh
|
|
12
|
+
source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
13
|
+
# shellcheck disable=SC2086
|
|
14
|
+
exec "$GALAAZ_RUBY_BIN" -I "$ROOT/lib" \
|
|
15
|
+
$GALAAZ_RUBY_J_ARGS \
|
|
16
|
+
-S bundle exec ruby -I "$ROOT/lib" \
|
|
17
|
+
"$@"
|