galaaz 2.0.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 +25 -5
- data/README.md +119 -94
- data/Rakefile +17 -10
- data/bin/galaaz-jruby +3 -6
- data/bin/galaaz-ruby +16 -0
- data/bin/galaaz_ruby_env.inc.sh +36 -0
- data/bin/gbookdown +2 -3
- data/bin/gknit +2 -3
- data/bin/gstudio +4 -4
- data/bin/run_all_rspec +6 -5
- data/bin/run_example +10 -7
- data/bin/run_old_rspec +6 -5
- data/bin/run_rspec +9 -8
- data/bin/run_slow_rspec +6 -5
- 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/gknit/gknit_files/figure-gfm/bubble-1.png +0 -0
- data/blogs/gknit/gknit_files/figure-gfm/diverging_bar.png +0 -0
- data/blogs/manual/manual.Rmd +22 -19
- data/blogs/manual/manual.md +119 -94
- 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/test/test.md +10 -0
- data/examples/50Plots_MasterList/ScatterPlot.rb +2 -1
- data/examples/50Plots_MasterList/scatter_plot.rb +1 -0
- data/examples/bioconductor_deseq2_airway/bench_galaaz_three_same_process.rb +1 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb +1 -0
- data/examples/bioconductor_deseq2_airway/deseq2_airway_galaaz_optimized.rb +1 -0
- data/examples/islr/all.rb +1 -0
- data/examples/islr/ch2.spec.rb +1 -0
- data/examples/islr/ch3.spec.rb +1 -0
- data/examples/islr/ch3_boston.rb +1 -0
- data/examples/islr/ch3_multiple_regression.rb +1 -0
- data/examples/islr/ch6.spec.rb +1 -0
- data/examples/islr/x_y_rnorm.jpg +0 -0
- data/examples/misc/ggplot.rb +2 -1
- data/examples/misc/moneyball.rb +1 -0
- data/examples/misc/subsetting.rb +1 -0
- data/examples/multithread_shards_to_r/shards_to_r.rb +1 -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 +1 -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 +1 -0
- 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/lib/R_interface/rvector.rb +15 -0
- data/lib/galaaz_ruby.rb +34 -0
- data/lib/new_bridge/envelope.rb +2 -2
- data/specs/gknit_include_engine_spec.rb +2 -2
- data/specs/gknit_install_timeout_report_spec.rb +2 -2
- data/specs/gknit_internal_error_report_spec.rb +2 -2
- data/specs/gknit_vector_map_output_spec.rb +2 -2
- data/version.rb +1 -1
- metadata +39 -13
data/bin/run_all_rspec
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
# bin/run_all_rspec
|
|
9
9
|
# bin/run_all_rspec --format documentation
|
|
10
10
|
# bin/run_all_rspec new_bridge_specs/phase0_protocol_spec.rb
|
|
11
|
+
# GALAAZ_RUBY=ruby bin/run_all_rspec
|
|
11
12
|
#
|
|
12
13
|
# If the first argument is an option (starts with -), default dirs are prepended
|
|
13
14
|
# so `bin/run_all_rspec --format doc` still runs specs/ + new_bridge_specs/.
|
|
@@ -15,8 +16,8 @@
|
|
|
15
16
|
# For specs/ only (faster day-to-day): bin/run_rspec
|
|
16
17
|
set -e
|
|
17
18
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
18
|
-
# shellcheck source=
|
|
19
|
-
source "$ROOT/bin/
|
|
19
|
+
# shellcheck source=galaaz_ruby_env.inc.sh
|
|
20
|
+
source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
20
21
|
|
|
21
22
|
echo "[run_all_rspec] compiling gatekeeper: ext/new_bridge"
|
|
22
23
|
make -C "$ROOT/ext/new_bridge" -s all
|
|
@@ -35,9 +36,9 @@ if [ $# -eq 0 ]; then
|
|
|
35
36
|
elif [[ "${1:-}" == -* ]]; then
|
|
36
37
|
set -- "${DEFAULT_SPECS[@]}" "$@"
|
|
37
38
|
fi
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
$
|
|
39
|
+
# shellcheck disable=SC2086
|
|
40
|
+
exec "$GALAAZ_RUBY_BIN" -I "$ROOT/lib" \
|
|
41
|
+
$GALAAZ_RUBY_J_ARGS \
|
|
41
42
|
-S bundle exec rspec \
|
|
42
43
|
-r "$ROOT/specs/spec_helper.rb" \
|
|
43
44
|
"$@"
|
data/bin/run_example
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Run a Galaaz example
|
|
3
|
-
#
|
|
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).
|
|
4
5
|
#
|
|
5
6
|
# Usage: bin/run_example examples/sthda_ggplot/all.rb
|
|
6
7
|
# bin/run_example examples/sthda_ggplot/one_variable_continuous/geom_density.rb
|
|
8
|
+
# GALAAZ_RUBY=ruby bin/run_example examples/misc/subsetting.rb
|
|
7
9
|
set -e
|
|
8
10
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
9
|
-
# shellcheck source=
|
|
10
|
-
source "$ROOT/bin/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
$
|
|
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" \
|
|
14
17
|
"$@"
|
data/bin/run_old_rspec
CHANGED
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
# Usage:
|
|
4
4
|
# bin/run_old_rspec
|
|
5
5
|
# bin/run_old_rspec old_specs/r_environment.spec.rb
|
|
6
|
+
# GALAAZ_RUBY=ruby bin/run_old_rspec
|
|
6
7
|
set -e
|
|
7
8
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
8
|
-
# shellcheck source=
|
|
9
|
-
source "$ROOT/bin/
|
|
9
|
+
# shellcheck source=galaaz_ruby_env.inc.sh
|
|
10
|
+
source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
10
11
|
if [ $# -eq 0 ]; then
|
|
11
12
|
shopt -s nullglob
|
|
12
13
|
SPECS=( "$ROOT"/old_specs/*.spec.rb "$ROOT"/old_specs/*_spec.rb )
|
|
13
14
|
IFS=$'\n' SPECS=( $(printf '%s\n' "${SPECS[@]}" | sort) )
|
|
14
15
|
set -- "${SPECS[@]}"
|
|
15
16
|
fi
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
$
|
|
17
|
+
# shellcheck disable=SC2086
|
|
18
|
+
exec "$GALAAZ_RUBY_BIN" -I "$ROOT/lib" \
|
|
19
|
+
$GALAAZ_RUBY_J_ARGS \
|
|
19
20
|
-S bundle exec rspec "$@"
|
data/bin/run_rspec
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
# Run rspec with
|
|
3
|
-
# Optional
|
|
2
|
+
# Run rspec with Galaaz (default: ruby on PATH; JRuby or CRuby).
|
|
3
|
+
# JVM options applied only on JRuby. Optional: GALAAZ_RUBY=jruby|ruby; GALAAZ_JRUBY_OPTS.
|
|
4
4
|
#
|
|
5
5
|
# Usage:
|
|
6
6
|
# bin/run_rspec # run fast specs in specs/ only
|
|
7
|
-
# bin/run_all_rspec # top-level specs/ + new_bridge_specs/ + gatekeeper compile
|
|
7
|
+
# bin/run_all_rspec # top-level specs/ + new_bridge_specs/ + gatekeeper compile
|
|
8
8
|
# bin/run_slow_rspec # run slow specs in slow-specs/
|
|
9
9
|
# bin/run_rspec specs/protocol_result_spec.rb
|
|
10
|
+
# GALAAZ_RUBY=ruby bin/run_rspec specs/r_bridge_bootstrap_spec.rb
|
|
10
11
|
# GALAAZ_DEBUG=1 bin/run_rspec specs/r_vector_subsetting.spec.rb:61 ...
|
|
11
12
|
set -e
|
|
12
13
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
13
|
-
# shellcheck source=
|
|
14
|
-
source "$ROOT/bin/
|
|
14
|
+
# shellcheck source=galaaz_ruby_env.inc.sh
|
|
15
|
+
source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
15
16
|
if [ $# -eq 0 ]; then
|
|
16
17
|
set -- $(find "$ROOT/specs" -maxdepth 1 -type f \( -name '*_spec.rb' -o -name '*.spec.rb' \) | sort)
|
|
17
18
|
fi
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
$
|
|
19
|
+
# shellcheck disable=SC2086
|
|
20
|
+
exec "$GALAAZ_RUBY_BIN" -I "$ROOT/lib" \
|
|
21
|
+
$GALAAZ_RUBY_J_ARGS \
|
|
21
22
|
-S bundle exec rspec \
|
|
22
23
|
-r "$ROOT/specs/spec_helper.rb" \
|
|
23
24
|
"$@"
|
data/bin/run_slow_rspec
CHANGED
|
@@ -3,17 +3,18 @@
|
|
|
3
3
|
# Usage:
|
|
4
4
|
# bin/run_slow_rspec
|
|
5
5
|
# bin/run_slow_rspec slow-specs/phase2_gknit_chunk_output_spec.rb
|
|
6
|
+
# GALAAZ_RUBY=ruby bin/run_slow_rspec
|
|
6
7
|
set -e
|
|
7
8
|
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
8
|
-
# shellcheck source=
|
|
9
|
-
source "$ROOT/bin/
|
|
9
|
+
# shellcheck source=galaaz_ruby_env.inc.sh
|
|
10
|
+
source "$ROOT/bin/galaaz_ruby_env.inc.sh"
|
|
10
11
|
if [ $# -eq 0 ]; then
|
|
11
12
|
shopt -s nullglob globstar
|
|
12
13
|
SPECS=( "$ROOT"/slow-specs/**/*_spec.rb "$ROOT"/slow-specs/**/*.spec.rb )
|
|
13
14
|
IFS=$'\n' SPECS=( $(printf '%s\n' "${SPECS[@]}" | sort) )
|
|
14
15
|
set -- "${SPECS[@]}"
|
|
15
16
|
fi
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
$
|
|
17
|
+
# shellcheck disable=SC2086
|
|
18
|
+
exec "$GALAAZ_RUBY_BIN" -I "$ROOT/lib" \
|
|
19
|
+
$GALAAZ_RUBY_J_ARGS \
|
|
19
20
|
-S bundle exec rspec "$@"
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
data/blogs/manual/manual.Rmd
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Galaaz Manual"
|
|
3
|
-
subtitle: "
|
|
3
|
+
subtitle: "R-on-Rails: GNU R meets Ruby for the web"
|
|
4
4
|
author: "Rodrigo Botafogo"
|
|
5
|
-
tags: [Galaaz, Ruby, JRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
5
|
+
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
6
6
|
date: "2026"
|
|
7
7
|
bibliography: "../../examples/Bibliography/stats.bib"
|
|
8
8
|
output:
|
|
@@ -114,10 +114,11 @@ The Galaaz repository ships many helpers under **`bin/`**. When working from a *
|
|
|
114
114
|
them as **`bin/<name>`** from the project root (or `./bin/<name>`). If you install the **gem**,
|
|
115
115
|
only a subset is guaranteed on your `PATH` (see the gemspec: **`galaaz`**, **`gstudio`**, **`gknit`**, **`grun`**, **`gknit-draft`**); for development and CI, prefer the **`bin/`** copies so JVM flags and paths stay correct.
|
|
116
116
|
|
|
117
|
-
Below, **current (Galaaz 2.0 + JRuby + GNU R)** means the tool
|
|
118
|
-
**`
|
|
119
|
-
|
|
120
|
-
|
|
117
|
+
Below, **current (Galaaz 2.0 + JRuby or CRuby + GNU R)** means the tool uses **`bin/galaaz-ruby`**
|
|
118
|
+
/ **`GALAAZ_RUBY`** (default: `ruby` on `PATH`) and applies JVM flags only when the interpreter is
|
|
119
|
+
JRuby (`bin/galaaz_jruby_env.inc.sh` / `lib/galaaz_jruby.rb`). **`bin/galaaz-jruby`** forces JRuby.
|
|
120
|
+
**Legacy** means the script still targets **GraalVM** polyglot Ruby / FastR-era invocation and is
|
|
121
|
+
**not** expected to work on a typical JRuby or CRuby NewBridge setup.
|
|
121
122
|
|
|
122
123
|
**Table layout:** names in the first column are **`bin/`** filenames (run as `bin/<name>` from the repo root). Long options and examples sit **outside** the tables so PDF columns stay readable.
|
|
123
124
|
|
|
@@ -233,7 +234,7 @@ df_ot <- data.frame(
|
|
|
233
234
|
bin_tbl(df_ot)
|
|
234
235
|
```
|
|
235
236
|
|
|
236
|
-
For day-to-day **2.0** use, rely on **`bin/galaaz-jruby
|
|
237
|
+
For day-to-day **2.0** use, rely on **`bin/galaaz-ruby`** (or **`bin/galaaz-jruby`** when you want to force JRuby), **`bin/gstudio`**, **`bin/gknit`**, **`bin/run_example`**, **`bin/run_rspec`** / **`bin/run_all_rspec`**, and **`bin/galaaz-bootstrap`** on WSL when using Dockerized R. Treat **`grun`**, **`gknit_Rscript`**, and the polyglot **`ruby`** invocation in **`gknit-draft`** as **legacy** until they are ported to the same launcher path as **`gknit`**.
|
|
237
238
|
|
|
238
239
|
# System Compatibility
|
|
239
240
|
|
|
@@ -279,7 +280,7 @@ A **table of all `bin/` scripts** (bootstrap, JRuby wrapper, gstudio, gknit, tes
|
|
|
279
280
|
2. Build the bridge native code: **`make -C ext/new_bridge all`** (or **`rake compile_gatekeeper`**).
|
|
280
281
|
3. Run scripts with **`bin/galaaz-jruby`** (sources **`bin/galaaz_jruby_env.inc.sh`** and adds **`-I lib`**).
|
|
281
282
|
|
|
282
|
-
Maintainers can prove a
|
|
283
|
+
A **gstudio** try image (JRuby + R + Galaaz already installed) is **`docker run --rm -it ghcr.io/rbotafogo/galaaz-try:gstudio`** (or **`./docker/try-gstudio/run.sh`** from a checkout). Maintainers can prove a RubyGems install on a throwaway Ubuntu machine (no repo inside the container) with **`./docker/cold-install/run.sh published-specs`**.
|
|
283
284
|
|
|
284
285
|
## Windows + WSL2 (optional: Docker / R in a container)
|
|
285
286
|
|
|
@@ -342,11 +343,13 @@ WSL integration is enabled for the distro where Galaaz is installed.
|
|
|
342
343
|
|
|
343
344
|
> galaaz master_list:scatter_plot
|
|
344
345
|
|
|
345
|
-
# JRuby, multithreading, and the R bridge
|
|
346
|
+
# JRuby, CRuby, multithreading, and the R bridge
|
|
346
347
|
|
|
347
|
-
Galaaz 2.0
|
|
348
|
-
I/O-bound work (HTTP clients, database
|
|
349
|
-
|
|
348
|
+
Galaaz 2.0 supports **JRuby** and **CRuby** equally for NewBridge. On **JRuby**, your
|
|
349
|
+
application can use **real parallel threads** for I/O-bound work (HTTP clients, database
|
|
350
|
+
connections, message consumers, and so on). On **CRuby**, prefer multi-process scaling for
|
|
351
|
+
CPU-bound concurrency. R itself is still executed in a **single GNU R process** behind the
|
|
352
|
+
Galaaz bridge (use multiple R workers when you need more R throughput).
|
|
350
353
|
|
|
351
354
|
When several Ruby threads call into R at the same time, the bridge **serializes** those calls:
|
|
352
355
|
each request is matched to a reply using an internal per-call **queue**, so you do not need to
|
|
@@ -417,19 +420,19 @@ the outcome to storage, and notify the client (poll, WebSocket, Turbo Stream, et
|
|
|
417
420
|
Ruby pattern above is only to show **when** the result exists (inside the block, or after data
|
|
418
421
|
written there is observed elsewhere). Runnable specs live in **`new_bridge_specs/eval_r_async_spec.rb`**.
|
|
419
422
|
|
|
420
|
-
## Galaaz + Rails (
|
|
423
|
+
## Galaaz + Rails (R-on-Rails) integration baseline
|
|
421
424
|
|
|
422
|
-
This
|
|
423
|
-
The
|
|
425
|
+
This is the practical **R-on-Rails** starter: an R scientist’s analysis behind a small Rails
|
|
426
|
+
app. The baseline we used in WSL aimed at:
|
|
424
427
|
|
|
425
|
-
1. Rails boots under **JRuby
|
|
428
|
+
1. Rails boots under **JRuby or CRuby** (same bridge; see Installation).
|
|
426
429
|
2. Galaaz is loaded from a local checkout (before publishing to RubyGems).
|
|
427
430
|
3. A request path can execute **`R.eval(...)`** and return a result.
|
|
428
431
|
|
|
429
|
-
### 1) Create the app with
|
|
432
|
+
### 1) Create the app with Ruby-friendly options
|
|
430
433
|
|
|
431
|
-
Rails defaults can pull gems that are
|
|
432
|
-
extension paths
|
|
434
|
+
Rails defaults can pull gems that are awkward on some setups (for example sqlite native
|
|
435
|
+
extension paths on JRuby, or deployment extras you do not need). A minimal app avoids early friction:
|
|
433
436
|
|
|
434
437
|
```bash
|
|
435
438
|
cd /home/rbotafogo/desenv_linux
|
data/blogs/manual/manual.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Galaaz Manual"
|
|
3
|
-
subtitle: "
|
|
3
|
+
subtitle: "R-on-Rails: GNU R meets Ruby for the web"
|
|
4
4
|
author: "Rodrigo Botafogo"
|
|
5
|
-
tags: [Galaaz, Ruby, JRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
5
|
+
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
6
6
|
date: "2026"
|
|
7
7
|
bibliography: "../../examples/Bibliography/stats.bib"
|
|
8
8
|
output:
|
|
@@ -28,64 +28,64 @@ fontsize: 11pt
|
|
|
28
28
|
|
|
29
29
|
# Introduction
|
|
30
30
|
|
|
31
|
-
Galaaz is
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
not
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
Ruby
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
Implementing a complete scientific computing infrastructure would take too long.
|
|
62
|
-
|
|
63
|
-
**Galaaz 2.0** couples **JRuby** (Ruby on the JVM) with **GNU R**—the same R you use for
|
|
64
|
-
CRAN and Bioconductor. Ruby and R run in **separate processes**; the **Galaaz bridge**
|
|
65
|
-
sends requests to R and returns results to Ruby. From your point of view you still write
|
|
66
|
-
Ruby: `R.c(...)`, `R.library('ggplot2')`, `~R[:mtcars]`, and dplyr-style chains on R objects.
|
|
67
|
-
You do not need to learn R syntax to get a lot done, though reading R documentation for
|
|
68
|
-
individual packages remains useful.
|
|
69
|
-
|
|
70
|
-
Earlier experiments with Galaaz used Oracle’s **GraalVM** with TruffleRuby and FastR so that
|
|
71
|
-
Ruby and R could share one runtime. That path is no longer the focus: **standard GNU R**
|
|
72
|
-
gives full compatibility with the R package ecosystem (including compiled extensions and
|
|
73
|
-
Bioconductor) while JRuby gives a mature Ruby with **real multithreading** for application
|
|
74
|
-
and I/O code.
|
|
31
|
+
**Galaaz is R-on-Rails:** keep **GNU R** for statistics, graphics, and the CRAN /
|
|
32
|
+
Bioconductor ecosystem, and use **Ruby** (with **Rails** when you need a web app) for
|
|
33
|
+
everything R was never meant to own—HTTP, auth, databases, background jobs, HTML, APIs.
|
|
34
|
+
|
|
35
|
+
The primary audience is the **R scientist** who already has models, dplyr/ggplot pipelines,
|
|
36
|
+
and domain knowledge, and wants a **one-person path to production on the web**. Learning
|
|
37
|
+
enough Ruby and Rails to ship an app is usually easier than hiring (or becoming) a dedicated
|
|
38
|
+
web-and-stats dual specialist. Ruby developers gain full access to R libraries as a
|
|
39
|
+
secondary benefit; the design priority is **R workflow first, web second**.
|
|
40
|
+
|
|
41
|
+
Galaaz does **not** re-implement scientific libraries in Ruby. Ruby and R run in **separate
|
|
42
|
+
processes**; the **Galaaz bridge** sends requests to standard **GNU R** and returns typed
|
|
43
|
+
results. You keep calling familiar ideas from Ruby (`R.c(...)`, `R.library('ggplot2')`,
|
|
44
|
+
`~R[:mtcars]`, dplyr-style chains) while Rails (or plain Ruby) owns the application shell.
|
|
45
|
+
|
|
46
|
+
**Python** remains a strong competitor for end-to-end data science stacks (NumPy, pandas,
|
|
47
|
+
SciPy, scikit-learn, Django/Flask). Galaaz’s bet is different: if your science already lives
|
|
48
|
+
in **R**, do not rewrite it in Python to get a website—**put R on Rails**.
|
|
49
|
+
|
|
50
|
+
Ruby is a dynamic, object-oriented language that became widely known through **Ruby on Rails**
|
|
51
|
+
(RoR). It remains a practical choice for web applications and general-purpose scripting.
|
|
52
|
+
Until Galaaz, Ruby lacked a tight, ecosystem-complete bridge to GNU R. Library wrapping
|
|
53
|
+
(one gem per package) does not scale; Galaaz wraps **the R language**, so thousands of R
|
|
54
|
+
packages are available without a new handcrafted wrapper for each one.
|
|
55
|
+
|
|
56
|
+
**Galaaz 2.0** supports **JRuby** and **CRuby** equally for the same NewBridge protocol.
|
|
57
|
+
Pick the Ruby that fits your app: JRuby when you want real multithreading for web and I/O;
|
|
58
|
+
CRuby when you prefer MRI. R remains the same **GNU R** you use interactively—including
|
|
59
|
+
compiled extensions and Bioconductor. Earlier GraalVM / TruffleRuby / FastR experiments
|
|
60
|
+
are no longer the focus.
|
|
75
61
|
|
|
76
62
|
The bridge handles **communication and typing** between the two worlds; large tables can
|
|
77
63
|
also flow through **Apache Arrow** on the R side when you use the optional helpers described
|
|
78
64
|
later in this manual.
|
|
79
65
|
|
|
80
|
-
|
|
81
|
-
To improve performance, Python often wraps more efficient C libraries. For the
|
|
82
|
-
Python developer, the existence of such C libraries is hidden. The problem with
|
|
83
|
-
library wrapping is that for any new library, there is the need to handcraft a new
|
|
84
|
-
wrapper.
|
|
66
|
+
## R-on-Rails: the one-person app for R scientists
|
|
85
67
|
|
|
86
|
-
|
|
87
|
-
in
|
|
88
|
-
|
|
68
|
+
If you already think in R, the usual web options are painful: Shiny for some apps, or a full
|
|
69
|
+
rewrite in another stack. **R-on-Rails** means:
|
|
70
|
+
|
|
71
|
+
1. **Keep your science in R** — packages, formulas, plots, Bioconductor, the same engine as RStudio.
|
|
72
|
+
2. **Learn enough Ruby/Rails** — routes, controllers, views, jobs, auth—not a second statistics career.
|
|
73
|
+
3. **Call R from the app** — Galaaz loads R behind the scenes; long jobs can complete asynchronously
|
|
74
|
+
while Rails stays responsive (see later sections on the bridge and `R::Async`).
|
|
75
|
+
4. **Ship alone when you need to** — one developer can own both the analysis and the product UI,
|
|
76
|
+
without waiting for a separate “stats engineer” and “Rails engineer.”
|
|
77
|
+
|
|
78
|
+
Typical shape:
|
|
79
|
+
|
|
80
|
+
- Interactive exploration and reports: **gstudio**, **gknit** (R Markdown with Ruby chunks).
|
|
81
|
+
- Product: a **Rails** (or Sinatra) app that calls `R.*` for the heavy statistical steps.
|
|
82
|
+
- Scale for many users: more **R worker processes/containers** behind the app (R is single-threaded
|
|
83
|
+
per process); the Ruby web tier scales separately (JRuby threads or a multi-process CRuby
|
|
84
|
+
setup). Galaaz’s instance manager is the starting point for that pattern—not a rewrite of
|
|
85
|
+
every algorithm à la enterprise ScaleR.
|
|
86
|
+
|
|
87
|
+
Rubyists are welcome: the same bridge exposes CRAN to application code. The **intended** on-ramp,
|
|
88
|
+
though, is **R scientist → small Rails app**, not “hire a stats team to teach Rails developers R.”
|
|
89
89
|
|
|
90
90
|
## What does Galaaz mean
|
|
91
91
|
|
|
@@ -108,10 +108,11 @@ The Galaaz repository ships many helpers under **`bin/`**. When working from a *
|
|
|
108
108
|
them as **`bin/<name>`** from the project root (or `./bin/<name>`). If you install the **gem**,
|
|
109
109
|
only a subset is guaranteed on your `PATH` (see the gemspec: **`galaaz`**, **`gstudio`**, **`gknit`**, **`grun`**, **`gknit-draft`**); for development and CI, prefer the **`bin/`** copies so JVM flags and paths stay correct.
|
|
110
110
|
|
|
111
|
-
Below, **current (Galaaz 2.0 + JRuby + GNU R)** means the tool
|
|
112
|
-
**`
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
Below, **current (Galaaz 2.0 + JRuby or CRuby + GNU R)** means the tool uses **`bin/galaaz-ruby`**
|
|
112
|
+
/ **`GALAAZ_RUBY`** (default: `ruby` on `PATH`) and applies JVM flags only when the interpreter is
|
|
113
|
+
JRuby (`bin/galaaz_jruby_env.inc.sh` / `lib/galaaz_jruby.rb`). **`bin/galaaz-jruby`** forces JRuby.
|
|
114
|
+
**Legacy** means the script still targets **GraalVM** polyglot Ruby / FastR-era invocation and is
|
|
115
|
+
**not** expected to work on a typical JRuby or CRuby NewBridge setup.
|
|
115
116
|
|
|
116
117
|
**Table layout:** names in the first column are **`bin/`** filenames (run as `bin/<name>` from the repo root). Long options and examples sit **outside** the tables so PDF columns stay readable.
|
|
117
118
|
|
|
@@ -131,14 +132,24 @@ expected to work on a typical JRuby-only setup.
|
|
|
131
132
|
<td style="text-align:left;"> WSL2 helper: Docker checks; optional TinyTeX or poppler for gKnit PDF. </td>
|
|
132
133
|
<td style="text-align:left;"> Yes* </td>
|
|
133
134
|
</tr>
|
|
135
|
+
<tr>
|
|
136
|
+
<td style="text-align:left;"> galaaz-ruby </td>
|
|
137
|
+
<td style="text-align:left;"> Selected Ruby (default: ruby on PATH) with repo lib/ on LOAD_PATH; JVM flags only on JRuby. </td>
|
|
138
|
+
<td style="text-align:left;"> Yes </td>
|
|
139
|
+
</tr>
|
|
134
140
|
<tr>
|
|
135
141
|
<td style="text-align:left;"> galaaz-jruby </td>
|
|
136
|
-
<td style="text-align:left;">
|
|
142
|
+
<td style="text-align:left;"> Thin wrapper that forces JRuby (same flags as galaaz-ruby under JRuby). </td>
|
|
137
143
|
<td style="text-align:left;"> Yes </td>
|
|
138
144
|
</tr>
|
|
145
|
+
<tr>
|
|
146
|
+
<td style="text-align:left;"> galaaz_ruby_env.inc.sh </td>
|
|
147
|
+
<td style="text-align:left;"> Sourced by bash wrappers; sets GALAAZ_RUBY_BIN and optional JVM args. </td>
|
|
148
|
+
<td style="text-align:left;"> Yes† </td>
|
|
149
|
+
</tr>
|
|
139
150
|
<tr>
|
|
140
151
|
<td style="text-align:left;"> galaaz_jruby_env.inc.sh </td>
|
|
141
|
-
<td style="text-align:left;"> Sourced
|
|
152
|
+
<td style="text-align:left;"> Sourced when the interpreter is JRuby; sets GALAAZ_REQUIRED_JRUBY_J_ARGS. </td>
|
|
142
153
|
<td style="text-align:left;"> Yes† </td>
|
|
143
154
|
</tr>
|
|
144
155
|
<tr>
|
|
@@ -153,11 +164,13 @@ expected to work on a typical JRuby-only setup.
|
|
|
153
164
|
|
|
154
165
|
† Not run directly.
|
|
155
166
|
|
|
156
|
-
**`galaaz-jruby` examples** (from repo root):
|
|
167
|
+
**`galaaz-ruby` / `galaaz-jruby` examples** (from repo root):
|
|
157
168
|
|
|
158
169
|
```text
|
|
170
|
+
bin/galaaz-ruby my_script.rb
|
|
171
|
+
GALAAZ_RUBY=jruby bin/galaaz-ruby my_script.rb
|
|
159
172
|
bin/galaaz-jruby my_script.rb
|
|
160
|
-
bin/galaaz-
|
|
173
|
+
bin/galaaz-ruby -S rspec
|
|
161
174
|
```
|
|
162
175
|
|
|
163
176
|
## Interactive use, examples, and Rake
|
|
@@ -173,17 +186,17 @@ bin/galaaz-jruby -S rspec
|
|
|
173
186
|
<tbody>
|
|
174
187
|
<tr>
|
|
175
188
|
<td style="text-align:left;"> gstudio </td>
|
|
176
|
-
<td style="text-align:left;"> IRB or Pry with Galaaz preloaded (
|
|
189
|
+
<td style="text-align:left;"> IRB or Pry with Galaaz preloaded (ruby on PATH; JVM flags on JRuby). </td>
|
|
177
190
|
<td style="text-align:left;"> Yes </td>
|
|
178
191
|
</tr>
|
|
179
192
|
<tr>
|
|
180
193
|
<td style="text-align:left;"> run_example </td>
|
|
181
|
-
<td style="text-align:left;"> Run one Ruby file using the same
|
|
194
|
+
<td style="text-align:left;"> Run one Ruby file using the same Ruby/JVM setup as tests. </td>
|
|
182
195
|
<td style="text-align:left;"> Yes </td>
|
|
183
196
|
</tr>
|
|
184
197
|
<tr>
|
|
185
198
|
<td style="text-align:left;"> galaaz </td>
|
|
186
|
-
<td style="text-align:left;"> Forward arguments to rake (needs rake;
|
|
199
|
+
<td style="text-align:left;"> Forward arguments to rake (needs rake; same GALAAZ_RUBY as other launchers). </td>
|
|
187
200
|
<td style="text-align:left;"> Yes </td>
|
|
188
201
|
</tr>
|
|
189
202
|
</tbody>
|
|
@@ -202,7 +215,7 @@ bin/galaaz-jruby -S rspec
|
|
|
202
215
|
<tbody>
|
|
203
216
|
<tr>
|
|
204
217
|
<td style="text-align:left;"> gknit </td>
|
|
205
|
-
<td style="text-align:left;"> Knit .Rmd via JRuby and R Markdown render. </td>
|
|
218
|
+
<td style="text-align:left;"> Knit .Rmd via ruby on PATH (JRuby or CRuby) and R Markdown render. </td>
|
|
206
219
|
<td style="text-align:left;"> Yes </td>
|
|
207
220
|
</tr>
|
|
208
221
|
<tr>
|
|
@@ -212,8 +225,8 @@ bin/galaaz-jruby -S rspec
|
|
|
212
225
|
</tr>
|
|
213
226
|
<tr>
|
|
214
227
|
<td style="text-align:left;"> gknit-draft.rb </td>
|
|
215
|
-
<td style="text-align:left;"> Ruby entry: GKnit.draft (use with
|
|
216
|
-
<td style="text-align:left;">
|
|
228
|
+
<td style="text-align:left;"> Ruby entry: GKnit.draft (use with galaaz-ruby + LOAD_PATH). </td>
|
|
229
|
+
<td style="text-align:left;"> Yes </td>
|
|
217
230
|
</tr>
|
|
218
231
|
<tr>
|
|
219
232
|
<td style="text-align:left;"> gknit_Rscript </td>
|
|
@@ -290,21 +303,23 @@ Prefer **`galaaz-jruby`** for **`gknit-draft`** workflows until that wrapper mat
|
|
|
290
303
|
</tbody>
|
|
291
304
|
</table>
|
|
292
305
|
|
|
293
|
-
For day-to-day **2.0** use, rely on **`bin/galaaz-jruby
|
|
306
|
+
For day-to-day **2.0** use, rely on **`bin/galaaz-ruby`** (or **`bin/galaaz-jruby`** when you want to force JRuby), **`bin/gstudio`**, **`bin/gknit`**, **`bin/run_example`**, **`bin/run_rspec`** / **`bin/run_all_rspec`**, and **`bin/galaaz-bootstrap`** on WSL when using Dockerized R. Treat **`grun`**, **`gknit_Rscript`**, and the polyglot **`ruby`** invocation in **`gknit-draft`** as **legacy** until they are ported to the same launcher path as **`gknit`**.
|
|
294
307
|
|
|
295
308
|
# System Compatibility
|
|
296
309
|
|
|
297
310
|
Typical development and CI targets:
|
|
298
311
|
|
|
299
312
|
* **Linux** — recent Ubuntu LTS or comparable distributions (x86_64).
|
|
300
|
-
* **macOS** — recent releases with JRuby and GNU R available.
|
|
313
|
+
* **macOS** — recent releases with JRuby or CRuby and GNU R available.
|
|
301
314
|
* **Windows** — use **WSL2** (same Linux stack as above); native Windows is not the primary target.
|
|
302
315
|
|
|
303
316
|
The native **gatekeeper** component under `ext/new_bridge` is built with `make` and a C++ toolchain; see the project `README` if compilation fails on your platform.
|
|
304
317
|
|
|
305
318
|
# Dependencies
|
|
306
319
|
|
|
307
|
-
* **
|
|
320
|
+
* **Ruby** — **JRuby** or **CRuby** (both supported for NewBridge). Tested with **JRuby 10.1.1.0**
|
|
321
|
+
(+ **JDK 21**) and **CRuby 3.3.12**. Use `bin/galaaz-ruby` (honors `GALAAZ_RUBY`) or plain
|
|
322
|
+
`gem install galaaz` under the Ruby you choose.
|
|
308
323
|
* **GNU R** — `R` and `Rscript` on your `PATH` (tested with **4.3.3**), plus a C++ toolchain (`g++`, `make`) and the **Rcpp** package to compile the gatekeeper.
|
|
309
324
|
* **galaaz gem** — runtime dependency `msgpack` is pulled in by `gem install`.
|
|
310
325
|
* Optional: **Docker** — if you run R in a container (common on WSL2); see bootstrap below.
|
|
@@ -314,29 +329,34 @@ The native **gatekeeper** component under `ext/new_bridge` is built with `make`
|
|
|
314
329
|
|
|
315
330
|
The supported install is **`gem install` + compile the gatekeeper**. You do not need a git clone.
|
|
316
331
|
|
|
317
|
-
1. Install **JRuby
|
|
332
|
+
1. Install **JRuby** (and a compatible **JDK**) **or CRuby 3.3+**, plus **GNU R** (with `Rscript` and a C++ compiler).
|
|
318
333
|
2. In R, install **Rcpp**: `install.packages("Rcpp")`.
|
|
319
|
-
3. Install the gem: `jruby -S gem install galaaz`
|
|
334
|
+
3. Install the gem: `jruby -S gem install galaaz` (or `gem install galaaz` under CRuby).
|
|
320
335
|
4. Compile the native gatekeeper from the installed gem:
|
|
321
336
|
|
|
322
337
|
```
|
|
323
|
-
gem_dir="$(
|
|
338
|
+
gem_dir="$(ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path")"
|
|
339
|
+
# under JRuby: gem_dir="$(jruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path")"
|
|
324
340
|
make -C "${gem_dir}/ext/new_bridge" all
|
|
325
341
|
```
|
|
326
342
|
|
|
327
|
-
5. Ensure **`R`** starts GNU R and can install packages (network access to CRAN when you first call `R.install_and_loads`). For **Apache Arrow** on Java 9+, pass `-J--add-opens=java.base/java.nio=ALL-UNNAMED` to JRuby (from a checkout, `bin/galaaz-jruby` does this).
|
|
343
|
+
5. Ensure **`R`** starts GNU R and can install packages (network access to CRAN when you first call `R.install_and_loads`). For **Apache Arrow** on Java 9+, pass `-J--add-opens=java.base/java.nio=ALL-UNNAMED` to JRuby (from a checkout, `bin/galaaz-jruby` does this; on CRuby this flag is not needed).
|
|
328
344
|
|
|
329
345
|
For **gKnit**, **knitr**, **rmarkdown**, and LaTeX (PDF output), install the corresponding R packages, **Pandoc**, and a TeX distribution if you need PDF; the repository includes helpers such as **`bin/install-tinytex`** where appropriate.
|
|
330
346
|
|
|
331
|
-
A **table of all `bin/` scripts** (bootstrap,
|
|
347
|
+
A **table of all `bin/` scripts** (bootstrap, Ruby launcher, gstudio, gknit, test runners, and which ones are legacy) is in the section **Command-line tools (`bin/`)** earlier in this manual.
|
|
332
348
|
|
|
333
349
|
### From a repository checkout (contributors)
|
|
334
350
|
|
|
335
|
-
1. Install **bundler** if needed, then run **`
|
|
351
|
+
1. Install **bundler** if needed, then run **`bundle install`** with your chosen Ruby
|
|
352
|
+
(`jruby -S bundle install` or CRuby `bundle install`) in the repository root.
|
|
336
353
|
2. Build the bridge native code: **`make -C ext/new_bridge all`** (or **`rake compile_gatekeeper`**).
|
|
337
|
-
3. Run scripts with **`bin/galaaz-
|
|
354
|
+
3. Run scripts with **`bin/galaaz-ruby`** (uses `ruby` on `PATH`; set **`GALAAZ_RUBY=jruby`** or
|
|
355
|
+
**`GALAAZ_RUBY=ruby`** to force an engine). Spec runners: **`bin/run_rspec`** /
|
|
356
|
+
**`bin/run_all_rspec`** (same `GALAAZ_RUBY` rule). **`bin/galaaz-jruby`** remains a thin
|
|
357
|
+
wrapper that forces JRuby.
|
|
338
358
|
|
|
339
|
-
Maintainers can prove a
|
|
359
|
+
A **gstudio** try image (JRuby + R + Galaaz already installed) is **`docker run --rm -it ghcr.io/rbotafogo/galaaz-try:gstudio`** (or **`./docker/try-gstudio/run.sh`** from a checkout). Maintainers can prove a RubyGems install on a throwaway Ubuntu machine (no repo inside the container) with **`./docker/cold-install/run.sh published-specs`** (JRuby) or **`./docker/cold-install-cruby/run.sh published-specs`** (CRuby).
|
|
340
360
|
|
|
341
361
|
## Windows + WSL2 (optional: Docker / R in a container)
|
|
342
362
|
|
|
@@ -404,11 +424,13 @@ WSL integration is enabled for the distro where Galaaz is installed.
|
|
|
404
424
|
|
|
405
425
|
> galaaz master_list:scatter_plot
|
|
406
426
|
|
|
407
|
-
# JRuby, multithreading, and the R bridge
|
|
427
|
+
# JRuby, CRuby, multithreading, and the R bridge
|
|
408
428
|
|
|
409
|
-
Galaaz 2.0
|
|
410
|
-
I/O-bound work (HTTP clients, database
|
|
411
|
-
|
|
429
|
+
Galaaz 2.0 supports **JRuby** and **CRuby** equally for NewBridge. On **JRuby**, your
|
|
430
|
+
application can use **real parallel threads** for I/O-bound work (HTTP clients, database
|
|
431
|
+
connections, message consumers, and so on). On **CRuby**, prefer multi-process scaling for
|
|
432
|
+
CPU-bound concurrency. R itself is still executed in a **single GNU R process** behind the
|
|
433
|
+
Galaaz bridge (use multiple R workers when you need more R throughput).
|
|
412
434
|
|
|
413
435
|
When several Ruby threads call into R at the same time, the bridge **serializes** those calls:
|
|
414
436
|
each request is matched to a reply using an internal per-call **queue**, so you do not need to
|
|
@@ -488,19 +510,22 @@ the outcome to storage, and notify the client (poll, WebSocket, Turbo Stream, et
|
|
|
488
510
|
Ruby pattern above is only to show **when** the result exists (inside the block, or after data
|
|
489
511
|
written there is observed elsewhere). Runnable specs live in **`new_bridge_specs/eval_r_async_spec.rb`**.
|
|
490
512
|
|
|
491
|
-
## Galaaz + Rails (
|
|
513
|
+
## Galaaz + Rails (R-on-Rails) integration baseline
|
|
492
514
|
|
|
493
|
-
This
|
|
494
|
-
The
|
|
515
|
+
This is the practical **R-on-Rails** starter: an R scientist’s analysis behind a small Rails
|
|
516
|
+
app. The baseline we used in WSL aimed at:
|
|
495
517
|
|
|
496
|
-
1. Rails boots under **JRuby
|
|
518
|
+
1. Rails boots under **JRuby or CRuby** (same bridge; see Installation).
|
|
497
519
|
2. Galaaz is loaded from a local checkout (before publishing to RubyGems).
|
|
498
|
-
3. A request path can execute **`R.eval(...)`** and return a result.
|
|
520
|
+
3. A request path can execute **`R.eval(...)`** (or `R.*`) and return a result.
|
|
521
|
+
|
|
522
|
+
You keep statistical work in R; Rails owns HTTP, sessions, and HTML. See **R-on-Rails: the
|
|
523
|
+
one-person app for R scientists** in the Introduction for the product framing.
|
|
499
524
|
|
|
500
|
-
### 1) Create the app with
|
|
525
|
+
### 1) Create the app with Ruby-friendly options
|
|
501
526
|
|
|
502
|
-
Rails defaults can pull gems that are
|
|
503
|
-
extension paths
|
|
527
|
+
Rails defaults can pull gems that are awkward on some setups (for example sqlite native
|
|
528
|
+
extension paths on JRuby, or deployment extras you do not need). A minimal app avoids early friction:
|
|
504
529
|
|
|
505
530
|
```bash
|
|
506
531
|
cd /home/rbotafogo/desenv_linux
|
|
@@ -788,7 +813,7 @@ puts vec.map { |x| x + 2 }
|
|
|
788
813
|
|
|
789
814
|
This manual has been formatted using gKnit. gKnit uses knitr and R Markdown to knit
|
|
790
815
|
a document in Ruby or R and output it in any of the available formats for R Markdown.
|
|
791
|
-
gKnit runs with **JRuby**, **GNU R**, and Galaaz. In gKnit, Ruby variables are persisted between
|
|
816
|
+
gKnit runs with **JRuby or CRuby**, **GNU R**, and Galaaz. In gKnit, Ruby variables are persisted between
|
|
792
817
|
chunks, making it an ideal solution for literate programming. Also, since it is based
|
|
793
818
|
on Galaaz, Ruby chunks can have access to R variables and combining Ruby with R in one
|
|
794
819
|
document is natural.
|
|
@@ -4923,8 +4948,8 @@ arguments.
|
|
|
4923
4948
|
|
|
4924
4949
|
* Fork it
|
|
4925
4950
|
* Create your feature branch (`git checkout -b my-new-feature`)
|
|
4926
|
-
* Write tests — use **`bin/run_rspec`** or **`bin/run_all_rspec`**
|
|
4927
|
-
the load path match **`docs/testing.md`**
|
|
4951
|
+
* Write tests — use **`bin/run_rspec`** or **`bin/run_all_rspec`** (JRuby or CRuby via
|
|
4952
|
+
**`GALAAZ_RUBY`**) so JVM flags and the load path match **`docs/testing.md`**
|
|
4928
4953
|
* Commit your changes (`git commit -am 'Add some feature'`)
|
|
4929
4954
|
* Push to the branch (`git push origin my-new-feature`)
|
|
4930
4955
|
* Open a pull request
|
|
Binary file
|
|
Binary file
|