galaaz 2.1.4 → 2.1.5
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 +18 -0
- data/README.md +19 -5
- data/bin/gknit +2 -9
- data/bin/gknit_Rscript +2 -4
- data/bin/gstudio_irb.rb +71 -22
- data/blogs/README.md +1 -1
- data/blogs/galaaz_ggplot/galaaz_ggplot.Rmd +8 -8
- data/blogs/galaaz_ggplot/galaaz_ggplot.md +6 -6
- data/blogs/gknit/gknit.Rmd +10 -10
- data/blogs/gknit/gknit.md +10 -10
- data/blogs/manual/manual.Rmd +54 -30
- data/blogs/manual/manual.md +19 -5
- data/blogs/oh_my/oh_my.Rmd +7 -7
- data/blogs/oh_my/oh_my.md +7 -7
- data/blogs/ruby_plot/ruby_plot.Rmd +13 -14
- data/blogs/ruby_plot/ruby_plot.md +13 -14
- data/examples/misc/ggplot.rb +1 -1
- data/lib/galaaz/cli.rb +43 -10
- data/version.rb +1 -1
- metadata +6 -9
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d39a98e695448ffb0166d33746445cc0076efcbd15e6f34250c99512e7c8e71d
|
|
4
|
+
data.tar.gz: eff6228e3febeb502838f1a6b99e38d03186327678b1a5535e58e8548e516d72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffe309c54323c08acabe1752c677cd67090878170b33853eb739195f4be36450379b2e100dc5e9ecfa317e4e4373aed8082dfee8407bb5231cd1d5b41c6fbdf2
|
|
7
|
+
data.tar.gz: daef47d66a2f3c20e2e430797ffd6193e9d80cde6ffc9b82856835dab4c0a3e3f8833b17d1b6b3389e4e5e3c5a7cccba8aee42d9b023b2e110758b6e678e9a2c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 2.1.5
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- `gknit` / `gknit_Rscript`: resolve input with `File.expand_path` so absolute paths
|
|
8
|
+
(e.g. `~/galaaz-blogs/...`) are not prefixed with `Dir.pwd` (broke when run from
|
|
9
|
+
`~/.local/bin`).
|
|
10
|
+
- `galaaz add ledger`: do not strip app Ruby version pins; keep engine-agnostic
|
|
11
|
+
RubyGems `gem "galaaz"` rewrites only.
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Omarchy `omarchy-galaaz-add`: install pandoc via `pandoc-bin` or the latest GitHub
|
|
16
|
+
linux binary into `~/.local/bin` — not Arch `pandoc` / `pandoc-cli` (Haskell deps).
|
|
17
|
+
- Omarchy menu Docs / GitHub rows use `omarchy-launch-webapp` (same as Omarchy Learn).
|
|
18
|
+
- `galaaz add arrow` / ledger path: prefer Apache `LIBARROW_BINARY` prebuilt libarrow
|
|
19
|
+
(avoid Arch pacman arrow version skew on Omarchy).
|
|
20
|
+
|
|
3
21
|
## 2.1.4
|
|
4
22
|
|
|
5
23
|
### Added
|
data/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "Galaaz Manual"
|
|
3
3
|
subtitle: "R-on-Rails: GNU R meets Ruby for the web"
|
|
4
4
|
author: "Rodrigo Botafogo"
|
|
5
|
-
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
5
|
+
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, CRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
6
6
|
date: "2026"
|
|
7
7
|
bibliography: "../../examples/Bibliography/stats.bib"
|
|
8
8
|
output:
|
|
@@ -358,7 +358,13 @@ A **table of all `bin/` scripts** (bootstrap, Ruby launcher, gstudio, gknit, tes
|
|
|
358
358
|
**`bin/run_all_rspec`** (same `GALAAZ_RUBY` rule). **`bin/galaaz-jruby`** remains a thin
|
|
359
359
|
wrapper that forces JRuby.
|
|
360
360
|
|
|
361
|
-
A **gstudio** try image
|
|
361
|
+
A **gstudio** try image with Galaaz already installed is available for both engines:
|
|
362
|
+
**JRuby** — `docker run --rm -it ghcr.io/rbotafogo/galaaz-try:gstudio` (or
|
|
363
|
+
`./docker/try-gstudio/run.sh` from a checkout); **CRuby** —
|
|
364
|
+
`docker run --rm -it ghcr.io/rbotafogo/galaaz-try:cruby` (or `./docker/try-cruby/run.sh`).
|
|
365
|
+
Maintainers can prove a RubyGems install on a throwaway Ubuntu machine (no repo inside
|
|
366
|
+
the container) with `./docker/cold-install/run.sh published-specs` (JRuby) or
|
|
367
|
+
`./docker/cold-install-cruby/run.sh published-specs` (CRuby).
|
|
362
368
|
|
|
363
369
|
## Windows + WSL2 (optional: Docker / R in a container)
|
|
364
370
|
|
|
@@ -394,11 +400,18 @@ WSL integration is enabled for the distro where Galaaz is installed.
|
|
|
394
400
|
``` ruby
|
|
395
401
|
vec = R.c(1, 2, 3, 4)
|
|
396
402
|
puts vec
|
|
403
|
+
|
|
404
|
+
# R.foo(...) calls an R *function*. Datasets are objects — fetch with ~:
|
|
405
|
+
df = ~R[:mtcars]
|
|
406
|
+
puts R.summary(df)
|
|
397
407
|
```
|
|
398
408
|
|
|
399
409
|
```
|
|
400
410
|
## [1] 1 2 3 4
|
|
401
411
|
```
|
|
412
|
+
|
|
413
|
+
(`R.mtcars` is wrong: it becomes `mtcars()` in R and fails. With
|
|
414
|
+
`using Galaaz::SymbolDSL`, the short form `~:mtcars` also works.)
|
|
402
415
|
|
|
403
416
|
* Run all specs
|
|
404
417
|
|
|
@@ -4261,10 +4274,11 @@ pulls in several dependencies; the first install can take several minutes.
|
|
|
4261
4274
|
## Example: DESeq2 on the airway dataset
|
|
4262
4275
|
|
|
4263
4276
|
The script **`examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb`** is the canonical
|
|
4264
|
-
version in the repository. Run it from the **Galaaz repository root** with
|
|
4277
|
+
version in the repository. Run it from the **Galaaz repository root** with either engine, for example:
|
|
4265
4278
|
|
|
4266
4279
|
```text
|
|
4267
|
-
bin/galaaz-
|
|
4280
|
+
bin/galaaz-ruby examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
4281
|
+
# or: bin/galaaz-jruby examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
4268
4282
|
```
|
|
4269
4283
|
|
|
4270
4284
|
The workflow in Ruby mirrors a standard DESeq2 vignette:
|
|
@@ -4293,7 +4307,7 @@ manual is knitted, because **DESeq2** is heavy and may be absent on the build ma
|
|
|
4293
4307
|
|
|
4294
4308
|
``` ruby
|
|
4295
4309
|
# Canonical script: examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
4296
|
-
# Run: bin/galaaz-
|
|
4310
|
+
# Run: bin/galaaz-ruby examples/.../deseq2_airway_galaaz.rb (repo root).
|
|
4297
4311
|
|
|
4298
4312
|
require 'galaaz'
|
|
4299
4313
|
|
data/bin/gknit
CHANGED
|
@@ -76,18 +76,11 @@ end
|
|
|
76
76
|
remaining_args = parser.permute(ARGV.dup)
|
|
77
77
|
ARGV.replace(remaining_args)
|
|
78
78
|
|
|
79
|
-
# Sets the directory
|
|
80
|
-
dir = Dir.pwd
|
|
81
|
-
|
|
82
|
-
#=========================================================================================
|
|
83
|
-
# Check if the name of the file to gKnit was given and that it exists. If not,
|
|
84
|
-
# issue error.
|
|
85
|
-
#=========================================================================================
|
|
86
|
-
|
|
87
79
|
options[:input_file] = ARGV[0] if !ARGV[0].nil?
|
|
88
80
|
raise "Input file name is required for gKnitting. Add -f FILE or --input_file FILE. For help, type gknit -h" if
|
|
89
81
|
options[:input_file].nil?
|
|
90
|
-
|
|
82
|
+
# File.expand_path keeps absolute paths intact (do not prefix Dir.pwd).
|
|
83
|
+
options[:input_file] = File.expand_path(options[:input_file])
|
|
91
84
|
raise "File #{options[:input_file]} does not exist!" if !File.exist?(options[:input_file])
|
|
92
85
|
|
|
93
86
|
#=========================================================================================
|
data/bin/gknit_Rscript
CHANGED
|
@@ -30,9 +30,6 @@ OptionParser.new do |opts|
|
|
|
30
30
|
end
|
|
31
31
|
end.parse!
|
|
32
32
|
|
|
33
|
-
# Sets the directory
|
|
34
|
-
dir = Dir.pwd
|
|
35
|
-
|
|
36
33
|
#=========================================================================================
|
|
37
34
|
# Check if the name of the file to gKnit was given and that it exists. If not,
|
|
38
35
|
# issue error.
|
|
@@ -41,7 +38,8 @@ dir = Dir.pwd
|
|
|
41
38
|
options[:input_file] = ARGV[0] if !ARGV[0].nil?
|
|
42
39
|
raise "Input file name is required for gKnitting. Add -f FILE or --input_file FILE. For help, type gknit -h" if
|
|
43
40
|
options[:input_file].nil?
|
|
44
|
-
|
|
41
|
+
# File.expand_path keeps absolute paths intact (do not prefix Dir.pwd).
|
|
42
|
+
options[:input_file] = File.expand_path(options[:input_file])
|
|
45
43
|
raise "File #{options[:input_file]} does not exist!" if !File.exist?(options[:input_file])
|
|
46
44
|
|
|
47
45
|
#=========================================================================================
|
data/bin/gstudio_irb.rb
CHANGED
|
@@ -1,36 +1,85 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
1
3
|
require 'galaaz'
|
|
2
4
|
require 'ggplot'
|
|
3
|
-
require 'irb/completion'
|
|
4
5
|
require 'pp'
|
|
6
|
+
require 'irb'
|
|
7
|
+
require 'reline'
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
:PROMPT_I => "galaaz >> ",
|
|
8
|
-
:PROMPT_S => "%l>> ",
|
|
9
|
-
:PROMPT_C => ".. ",
|
|
10
|
-
:PROMPT_N => ".. ",
|
|
11
|
-
:RETURN => "=> %s\n"
|
|
12
|
-
}
|
|
9
|
+
# --- terminal capability -------------------------------------------------------
|
|
13
10
|
|
|
14
|
-
|
|
11
|
+
def gstudio_colorize?
|
|
12
|
+
return false unless ENV['NO_COLOR'].to_s.empty?
|
|
13
|
+
return false if ENV['TERM'].to_s == 'dumb'
|
|
14
|
+
true
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def gstudio_version
|
|
18
|
+
spec = Gem.loaded_specs['galaaz']
|
|
19
|
+
return spec.version.to_s if spec
|
|
20
|
+
|
|
21
|
+
version_rb = File.expand_path('../../version.rb', __FILE__)
|
|
22
|
+
if File.file?(version_rb)
|
|
23
|
+
load version_rb
|
|
24
|
+
return $version.to_s if defined?($version) && $version
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
'?'
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
colorize = gstudio_colorize?
|
|
31
|
+
dumb = ENV['TERM'].to_s == 'dumb'
|
|
32
|
+
|
|
33
|
+
# --- modern IRB defaults (Ruby >= 3.1 / Reline) --------------------------------
|
|
34
|
+
|
|
35
|
+
IRB.conf[:USE_MULTILINE] = !dumb
|
|
36
|
+
IRB.conf[:USE_COLORIZE] = colorize
|
|
37
|
+
IRB.conf[:USE_AUTOCOMPLETE] = !dumb
|
|
15
38
|
IRB.conf[:AUTO_INDENT] = true
|
|
16
39
|
IRB.conf[:SAVE_HISTORY] = 1000
|
|
17
|
-
IRB.conf[:HISTORY_FILE] = '~/.galaaz.history'
|
|
40
|
+
IRB.conf[:HISTORY_FILE] = File.expand_path('~/.galaaz.history')
|
|
41
|
+
# R-like session: expression results are printed by Galaaz/R, not Ruby inspect.
|
|
18
42
|
IRB.conf[:ECHO] = false
|
|
19
43
|
|
|
20
|
-
|
|
21
|
-
|
|
44
|
+
cyan = colorize ? "\e[36m" : ''
|
|
45
|
+
bold = colorize ? "\e[1m" : ''
|
|
46
|
+
reset = colorize ? "\e[0m" : ''
|
|
47
|
+
|
|
48
|
+
IRB.conf[:PROMPT][:CUSTOM] = {
|
|
49
|
+
PROMPT_I: "#{bold}#{cyan}galaaz#{reset} >> ",
|
|
50
|
+
PROMPT_S: '%l>> ',
|
|
51
|
+
PROMPT_C: '.. ',
|
|
52
|
+
PROMPT_N: '.. ',
|
|
53
|
+
RETURN: "=> %s\n"
|
|
54
|
+
}
|
|
55
|
+
IRB.conf[:PROMPT_MODE] = :CUSTOM
|
|
56
|
+
|
|
57
|
+
prior_rc = IRB.conf[:IRB_RC]
|
|
58
|
+
IRB.conf[:IRB_RC] = lambda do |context|
|
|
59
|
+
prior_rc.call(context) if prior_rc.respond_to?(:call)
|
|
60
|
+
puts "Galaaz #{gstudio_version} on #{RUBY_ENGINE} #{RUBY_VERSION} " \
|
|
61
|
+
"(IRB #{IRB::VERSION}). Tab completes; `history` lists input."
|
|
62
|
+
end
|
|
22
63
|
|
|
23
|
-
|
|
24
|
-
history_array = Readline::HISTORY.to_a
|
|
64
|
+
# --- session helpers -----------------------------------------------------------
|
|
25
65
|
|
|
26
|
-
|
|
27
|
-
#
|
|
28
|
-
count =
|
|
66
|
+
module Kernel
|
|
67
|
+
# Print recent input lines. Optional +count+ limits to the last N entries.
|
|
68
|
+
def history(count = 0)
|
|
69
|
+
history_array =
|
|
70
|
+
if defined?(Reline::HISTORY)
|
|
71
|
+
Reline::HISTORY.to_a
|
|
72
|
+
elsif defined?(Readline::HISTORY)
|
|
73
|
+
Readline::HISTORY.to_a
|
|
74
|
+
else
|
|
75
|
+
[]
|
|
76
|
+
end
|
|
29
77
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
end
|
|
78
|
+
if count.is_a?(Integer) && count > 0
|
|
79
|
+
history_array = history_array.last(count)
|
|
80
|
+
end
|
|
34
81
|
|
|
35
|
-
|
|
82
|
+
puts history_array.join("\n")
|
|
83
|
+
nil
|
|
84
|
+
end
|
|
36
85
|
end
|
data/blogs/README.md
CHANGED
|
@@ -95,6 +95,6 @@ GALAAZ_DEBUG_R=1 bin/run_example examples/sthda_ggplot/all.rb
|
|
|
95
95
|
|
|
96
96
|
## Requirements
|
|
97
97
|
|
|
98
|
-
- **JRuby** (same as specs/examples).
|
|
98
|
+
- **JRuby** or **CRuby** (same as specs/examples; use `bin/galaaz-ruby` / `GALAAZ_RUBY`).
|
|
99
99
|
- **R** with packages used by the document (e.g. `rmarkdown`, `knitr`, `ggplot2`).
|
|
100
100
|
- Run from the project root so `lib` and `bin` resolve correctly.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
title: "Ruby Plotting with Galaaz"
|
|
3
|
-
subtitle: "An example of tightly coupling Ruby and R (JRuby + GNU R, Galaaz 2.0)"
|
|
3
|
+
subtitle: "An example of tightly coupling Ruby and R (JRuby or CRuby + GNU R, Galaaz 2.0)"
|
|
4
4
|
author: "Rodrigo Botafogo"
|
|
5
|
-
tags: [Galaaz, Ruby, R, JRuby, "GNU R", ggplot2]
|
|
5
|
+
tags: [Galaaz, Ruby, R, JRuby, CRuby, "GNU R", ggplot2]
|
|
6
6
|
date: "16 October 2018 (narrative updated for Galaaz 2.0, 2026)"
|
|
7
7
|
output:
|
|
8
8
|
html_document:
|
|
@@ -36,11 +36,11 @@ widely used examples among **many thousands** of packages on PyPI for numerical
|
|
|
36
36
|
With Galaaz we do not intend to re-implement any of the scientific libraries in R; we allow
|
|
37
37
|
for very tight coupling between the two languages to the point that the Ruby developer does
|
|
38
38
|
not need to think about R syntax for every call. **Galaaz 2.0** does this with **[JRuby](https://www.jruby.org/)**
|
|
39
|
-
and **GNU R**: a **bridge** evaluates R from Ruby and exchanges data between processes.
|
|
39
|
+
or **CRuby** and **GNU R**: a **bridge** evaluates R from Ruby and exchanges data between processes.
|
|
40
40
|
|
|
41
41
|
An **earlier** Galaaz prototype used Oracle’s **GraalVM** with **TruffleRuby** and **FastR** in one JVM.
|
|
42
|
-
That stack is **historical**; today’s documentation and tooling assume **JRuby
|
|
43
|
-
project manual and **`bin/galaaz-
|
|
42
|
+
That stack is **historical**; today’s documentation and tooling assume **NewBridge on JRuby or CRuby**
|
|
43
|
+
(see the project manual and **`bin/galaaz-ruby`** / **`bin/gknit`**).
|
|
44
44
|
|
|
45
45
|
For background on the old stack:
|
|
46
46
|
|
|
@@ -68,7 +68,7 @@ Galaaz is the Portuguese name for "Galahad". From Wikipedia:
|
|
|
68
68
|
|
|
69
69
|
## Prerequisites (Galaaz 2.0)
|
|
70
70
|
|
|
71
|
-
* **JRuby** and a compatible **JDK**
|
|
71
|
+
* **JRuby** and a compatible **JDK**, *or* **CRuby 3.3+**
|
|
72
72
|
* **GNU R** on your `PATH`
|
|
73
73
|
|
|
74
74
|
The following R packages will be automatically installed when necessary, but could be installed prior
|
|
@@ -334,5 +334,5 @@ nicely complement R packages.
|
|
|
334
334
|
|
|
335
335
|
For the Ruby developer, Galaaz allows the immediate use of R functions with minimal ceremony. As
|
|
336
336
|
shown in the second example above, class `ScatterPlot` hides most R call details from the Ruby
|
|
337
|
-
developer. **JRuby**
|
|
338
|
-
ecosystem
|
|
337
|
+
developer. Prefer **JRuby** when you want **real parallel threads** on the Ruby side and access to
|
|
338
|
+
the JVM ecosystem; **CRuby** works equally for the Galaaz bridge itself.
|
|
@@ -12,13 +12,13 @@ With Galaaz we do not intend to re-implement any of the scientific
|
|
|
12
12
|
libraries in R; we allow for very tight coupling between the two
|
|
13
13
|
languages to the point that the Ruby developer does not need to think
|
|
14
14
|
about R syntax for every call. **Galaaz 2.0** does this with
|
|
15
|
-
**[JRuby](https://www.jruby.org/)** and **GNU R**: a **bridge**
|
|
15
|
+
**[JRuby](https://www.jruby.org/)** or **CRuby** and **GNU R**: a **bridge**
|
|
16
16
|
evaluates R from Ruby and exchanges data between processes.
|
|
17
17
|
|
|
18
18
|
An **earlier** Galaaz prototype used Oracle’s **GraalVM** with
|
|
19
19
|
**TruffleRuby** and **FastR** in one JVM. That stack is **historical**;
|
|
20
|
-
today’s documentation and tooling assume **JRuby
|
|
21
|
-
project manual and **`bin/galaaz-
|
|
20
|
+
today’s documentation and tooling assume **NewBridge on JRuby or CRuby**
|
|
21
|
+
(see the project manual and **`bin/galaaz-ruby`** / **`bin/gknit`**).
|
|
22
22
|
|
|
23
23
|
For background on the old stack:
|
|
24
24
|
|
|
@@ -47,7 +47,7 @@ Galaaz is the Portuguese name for “Galahad”. From Wikipedia:
|
|
|
47
47
|
|
|
48
48
|
## Prerequisites (Galaaz 2.0)
|
|
49
49
|
|
|
50
|
-
- **JRuby** and a compatible **JDK**
|
|
50
|
+
- **JRuby** and a compatible **JDK**, *or* **CRuby 3.3+**
|
|
51
51
|
- **GNU R** on your `PATH`
|
|
52
52
|
|
|
53
53
|
The following R packages will be automatically installed when necessary,
|
|
@@ -360,5 +360,5 @@ nicely complement R packages.
|
|
|
360
360
|
For the Ruby developer, Galaaz allows the immediate use of R functions
|
|
361
361
|
with minimal ceremony. As shown in the second example above, class
|
|
362
362
|
`ScatterPlot` hides most R call details from the Ruby developer.
|
|
363
|
-
**JRuby**
|
|
364
|
-
to the JVM ecosystem
|
|
363
|
+
Prefer **JRuby** when you want **real parallel threads** on the Ruby side and access
|
|
364
|
+
to the JVM ecosystem; **CRuby** works equally for the Galaaz bridge itself.
|
data/blogs/gknit/gknit.Rmd
CHANGED
|
@@ -3,7 +3,7 @@ title: "How to do reproducible research in Ruby with gKnit"
|
|
|
3
3
|
author:
|
|
4
4
|
- "Rodrigo Botafogo"
|
|
5
5
|
- "Daniel Mossé - University of Pittsburgh"
|
|
6
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz, gKnit, knitr]
|
|
6
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz, gKnit, knitr]
|
|
7
7
|
date: "29/04/2019 (narrative updated for Galaaz 2.0, 2026)"
|
|
8
8
|
bibliography: stats.bib
|
|
9
9
|
output:
|
|
@@ -109,7 +109,7 @@ written both in Ruby and/or R and output it in any of the available formats of _
|
|
|
109
109
|
allows ruby developers to do literate programming and reproducible research by allowing them to
|
|
110
110
|
have in a single document, text and code.
|
|
111
111
|
|
|
112
|
-
gKnit runs with **JRuby**, **GNU R**, and **Galaaz** (the integration layer between Ruby and R—see below).
|
|
112
|
+
gKnit runs with **JRuby or CRuby**, **GNU R**, and **Galaaz** (the integration layer between Ruby and R—see below).
|
|
113
113
|
Knitr and **R Markdown** orchestrate the document; Galaaz’s engine keeps **Ruby state across chunks**
|
|
114
114
|
and talks to R through the **bridge**. Ruby chunks can read and update R variables (`~R[:name]`, `R.*`)
|
|
115
115
|
without GraalVM-style polyglot interop.
|
|
@@ -139,7 +139,7 @@ title: "How to do reproducible research in Ruby with gKnit"
|
|
|
139
139
|
author:
|
|
140
140
|
- "Rodrigo Botafogo"
|
|
141
141
|
- "Daniel Mossé - University of Pittsburgh"
|
|
142
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz]
|
|
142
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz]
|
|
143
143
|
date: "20/02/2019"
|
|
144
144
|
output:
|
|
145
145
|
html_document:
|
|
@@ -634,7 +634,7 @@ puts model.test.head
|
|
|
634
634
|
gKnit also allows developers to document and load files that are not in the same directory
|
|
635
635
|
of the '.Rmd' file.
|
|
636
636
|
|
|
637
|
-
Here is an example of loading the 'find.rb' file from
|
|
637
|
+
Here is an example of loading the 'find.rb' file from Ruby (via `$LOAD_PATH`). In this example, relative
|
|
638
638
|
is set to FALSE, so Ruby will look for the file in its $LOAD\_PATH, and the user does not
|
|
639
639
|
need to know its directory.
|
|
640
640
|
|
|
@@ -658,9 +658,9 @@ the Yaml header to generate this blog in PDF format instead of HTML:
|
|
|
658
658
|
|
|
659
659
|
```
|
|
660
660
|
---
|
|
661
|
-
title: "gKnit - Ruby and R Knitting with Galaaz (JRuby + GNU R)"
|
|
661
|
+
title: "gKnit - Ruby and R Knitting with Galaaz (JRuby or CRuby + GNU R)"
|
|
662
662
|
author: "Rodrigo Botafogo"
|
|
663
|
-
tags: [Galaaz, Ruby, R, JRuby, "GNU R", knitr, gknit]
|
|
663
|
+
tags: [Galaaz, Ruby, R, JRuby, CRuby, "GNU R", knitr, gknit]
|
|
664
664
|
date: "29 October 2018"
|
|
665
665
|
output:
|
|
666
666
|
pdf\_document:
|
|
@@ -683,13 +683,13 @@ be imported from files in the system. Ideally, in reproducible research, all th
|
|
|
683
683
|
needed to rebuild a report should be easily packed together (in the same zipped directory)
|
|
684
684
|
and distributed to peers for reexecution.
|
|
685
685
|
|
|
686
|
-
**Galaaz 2.0** pairs **JRuby** with **GNU R**: you keep the full CRAN/Bioconductor world in R while
|
|
686
|
+
**Galaaz 2.0** pairs **JRuby or CRuby** with **GNU R**: you keep the full CRAN/Bioconductor world in R while
|
|
687
687
|
writing orchestration, reuse, and application code in Ruby. The effort to wrap Ruby over R (Galaaz)
|
|
688
688
|
and to wrap Knitr as gKnit was tiny compared to reimplementing R’s ecosystem in Ruby—much like
|
|
689
689
|
Python’s investment in NumPy and Pandas, which no Ruby project is likely to duplicate.
|
|
690
690
|
|
|
691
691
|
An **earlier** prototype used Oracle’s **GraalVM** and Truffle interop; the **current** stack is
|
|
692
|
-
deliberately **standard GNU R** plus the Galaaz **bridge
|
|
692
|
+
deliberately **standard GNU R** plus the Galaaz **bridge** on JRuby or CRuby, documented in the project manual.
|
|
693
693
|
|
|
694
694
|
More interesting than wrapping the R libraries with Ruby, is that Ruby adds
|
|
695
695
|
value to R, by allowing developers to use powerful and modern constructs for code reuse that
|
|
@@ -701,7 +701,7 @@ readability.
|
|
|
701
701
|
|
|
702
702
|
## Prerequisites (Galaaz 2.0)
|
|
703
703
|
|
|
704
|
-
* **JRuby** and a compatible **JDK**
|
|
704
|
+
* **JRuby** and a compatible **JDK**, *or* **CRuby 3.3+**
|
|
705
705
|
* **GNU R** on your `PATH`
|
|
706
706
|
|
|
707
707
|
The following R packages will be automatically installed when necessary, but could be installed prior
|
|
@@ -721,7 +721,7 @@ the usual build tools are typically enough. On macOS, Xcode command-line tools
|
|
|
721
721
|
## Usage
|
|
722
722
|
|
|
723
723
|
* **`bin/gknit`** \<filename\> (from the Galaaz repo or your install layout); use **`--output_format all`** for HTML and PDF together.
|
|
724
|
-
* Run Ruby with **`bin/galaaz-jruby`** when you need
|
|
724
|
+
* Run Ruby with **`bin/galaaz-ruby`** (either engine) or **`bin/galaaz-jruby`** when you need JRuby JVM flags (see the manual).
|
|
725
725
|
|
|
726
726
|
|
|
727
727
|
# References
|
data/blogs/gknit/gknit.md
CHANGED
|
@@ -3,7 +3,7 @@ title: "How to do reproducible research in Ruby with gKnit"
|
|
|
3
3
|
author:
|
|
4
4
|
- "Rodrigo Botafogo"
|
|
5
5
|
- "Daniel Mossé - University of Pittsburgh"
|
|
6
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz, gKnit, knitr]
|
|
6
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz, gKnit, knitr]
|
|
7
7
|
date: "29/04/2019 (narrative updated for Galaaz 2.0, 2026)"
|
|
8
8
|
bibliography: stats.bib
|
|
9
9
|
output:
|
|
@@ -133,7 +133,7 @@ written both in Ruby and/or R and output it in any of the available formats of _
|
|
|
133
133
|
allows ruby developers to do literate programming and reproducible research by allowing them to
|
|
134
134
|
have in a single document, text and code.
|
|
135
135
|
|
|
136
|
-
gKnit runs with **JRuby**, **GNU R**, and **Galaaz** (the integration layer between Ruby and R—see below).
|
|
136
|
+
gKnit runs with **JRuby or CRuby**, **GNU R**, and **Galaaz** (the integration layer between Ruby and R—see below).
|
|
137
137
|
Knitr and **R Markdown** orchestrate the document; Galaaz’s engine keeps **Ruby state across chunks**
|
|
138
138
|
and talks to R through the **bridge**. Ruby chunks can read and update R variables (`~R[:name]`, `R.*`)
|
|
139
139
|
without GraalVM-style polyglot interop.
|
|
@@ -163,7 +163,7 @@ title: "How to do reproducible research in Ruby with gKnit"
|
|
|
163
163
|
author:
|
|
164
164
|
- "Rodrigo Botafogo"
|
|
165
165
|
- "Daniel Mossé - University of Pittsburgh"
|
|
166
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz]
|
|
166
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz]
|
|
167
167
|
date: "20/02/2019"
|
|
168
168
|
output:
|
|
169
169
|
html_document:
|
|
@@ -1246,7 +1246,7 @@ puts model.test.head
|
|
|
1246
1246
|
gKnit also allows developers to document and load files that are not in the same directory
|
|
1247
1247
|
of the '.Rmd' file.
|
|
1248
1248
|
|
|
1249
|
-
Here is an example of loading the 'find.rb' file from
|
|
1249
|
+
Here is an example of loading the 'find.rb' file from Ruby (via `$LOAD_PATH`). In this example, relative
|
|
1250
1250
|
is set to FALSE, so Ruby will look for the file in its $LOAD\_PATH, and the user does not
|
|
1251
1251
|
need to know its directory.
|
|
1252
1252
|
|
|
@@ -1361,9 +1361,9 @@ the Yaml header to generate this blog in PDF format instead of HTML:
|
|
|
1361
1361
|
|
|
1362
1362
|
```
|
|
1363
1363
|
---
|
|
1364
|
-
title: "gKnit - Ruby and R Knitting with Galaaz (JRuby + GNU R)"
|
|
1364
|
+
title: "gKnit - Ruby and R Knitting with Galaaz (JRuby or CRuby + GNU R)"
|
|
1365
1365
|
author: "Rodrigo Botafogo"
|
|
1366
|
-
tags: [Galaaz, Ruby, R, JRuby, "GNU R", knitr, gknit]
|
|
1366
|
+
tags: [Galaaz, Ruby, R, JRuby, CRuby, "GNU R", knitr, gknit]
|
|
1367
1367
|
date: "29 October 2018"
|
|
1368
1368
|
output:
|
|
1369
1369
|
pdf\_document:
|
|
@@ -1386,13 +1386,13 @@ be imported from files in the system. Ideally, in reproducible research, all th
|
|
|
1386
1386
|
needed to rebuild a report should be easily packed together (in the same zipped directory)
|
|
1387
1387
|
and distributed to peers for reexecution.
|
|
1388
1388
|
|
|
1389
|
-
**Galaaz 2.0** pairs **JRuby** with **GNU R**: you keep the full CRAN/Bioconductor world in R while
|
|
1389
|
+
**Galaaz 2.0** pairs **JRuby or CRuby** with **GNU R**: you keep the full CRAN/Bioconductor world in R while
|
|
1390
1390
|
writing orchestration, reuse, and application code in Ruby. The effort to wrap Ruby over R (Galaaz)
|
|
1391
1391
|
and to wrap Knitr as gKnit was tiny compared to reimplementing R’s ecosystem in Ruby—much like
|
|
1392
1392
|
Python’s investment in NumPy and Pandas, which no Ruby project is likely to duplicate.
|
|
1393
1393
|
|
|
1394
1394
|
An **earlier** prototype used Oracle’s **GraalVM** and Truffle interop; the **current** stack is
|
|
1395
|
-
deliberately **standard GNU R** plus the Galaaz **bridge
|
|
1395
|
+
deliberately **standard GNU R** plus the Galaaz **bridge** on JRuby or CRuby, documented in the project manual.
|
|
1396
1396
|
|
|
1397
1397
|
More interesting than wrapping the R libraries with Ruby, is that Ruby adds
|
|
1398
1398
|
value to R, by allowing developers to use powerful and modern constructs for code reuse that
|
|
@@ -1404,7 +1404,7 @@ readability.
|
|
|
1404
1404
|
|
|
1405
1405
|
## Prerequisites (Galaaz 2.0)
|
|
1406
1406
|
|
|
1407
|
-
* **JRuby** and a compatible **JDK**
|
|
1407
|
+
* **JRuby** and a compatible **JDK**, *or* **CRuby 3.3+**
|
|
1408
1408
|
* **GNU R** on your `PATH`
|
|
1409
1409
|
|
|
1410
1410
|
The following R packages will be automatically installed when necessary, but could be installed prior
|
|
@@ -1424,7 +1424,7 @@ the usual build tools are typically enough. On macOS, Xcode command-line tools
|
|
|
1424
1424
|
## Usage
|
|
1425
1425
|
|
|
1426
1426
|
* **`bin/gknit`** \<filename\> (from the Galaaz repo or your install layout); use **`--output_format all`** for HTML and PDF together.
|
|
1427
|
-
* Run Ruby with **`bin/galaaz-jruby`** when you need
|
|
1427
|
+
* Run Ruby with **`bin/galaaz-ruby`** (either engine) or **`bin/galaaz-jruby`** when you need JRuby JVM flags (see the manual).
|
|
1428
1428
|
|
|
1429
1429
|
|
|
1430
1430
|
# References
|
data/blogs/manual/manual.Rmd
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "Galaaz Manual"
|
|
3
3
|
subtitle: "R-on-Rails: GNU R meets Ruby for the web"
|
|
4
4
|
author: "Rodrigo Botafogo"
|
|
5
|
-
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
5
|
+
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, CRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
6
6
|
date: "2026"
|
|
7
7
|
bibliography: "../../examples/Bibliography/stats.bib"
|
|
8
8
|
output:
|
|
@@ -66,18 +66,20 @@ of libraries for data analysis.
|
|
|
66
66
|
Until recently, there was no real perspective for Ruby to bridge this gap.
|
|
67
67
|
Implementing a complete scientific computing infrastructure would take too long.
|
|
68
68
|
|
|
69
|
-
**Galaaz 2.0**
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
**Galaaz 2.0** supports **JRuby** and **CRuby** equally for the same NewBridge protocol.
|
|
70
|
+
Pick the Ruby that fits your app: JRuby when you want real multithreading for web and I/O;
|
|
71
|
+
CRuby when you prefer MRI. R remains the same **GNU R** you use interactively—including
|
|
72
|
+
compiled extensions and Bioconductor. Ruby and R run in **separate processes**; the
|
|
73
|
+
**Galaaz bridge** sends requests to R and returns results to Ruby. From your point of view
|
|
74
|
+
you still write Ruby: `R.c(...)`, `R.library('ggplot2')`, `~R[:mtcars]`, and dplyr-style
|
|
75
|
+
chains on R objects. You do not need to learn R syntax to get a lot done, though reading R
|
|
76
|
+
documentation for individual packages remains useful.
|
|
75
77
|
|
|
76
78
|
Earlier experiments with Galaaz used Oracle’s **GraalVM** with TruffleRuby and FastR so that
|
|
77
79
|
Ruby and R could share one runtime. That path is no longer the focus: **standard GNU R**
|
|
78
80
|
gives full compatibility with the R package ecosystem (including compiled extensions and
|
|
79
|
-
Bioconductor) while
|
|
80
|
-
|
|
81
|
+
Bioconductor) while either Ruby engine talks to R over NewBridge (JRuby for mature
|
|
82
|
+
multithreading on the application side; CRuby when you prefer MRI).
|
|
81
83
|
|
|
82
84
|
The bridge handles **communication and typing** between the two worlds; large tables can
|
|
83
85
|
also flow through **Apache Arrow** on the R side when you use the optional helpers described
|
|
@@ -241,14 +243,16 @@ For day-to-day **2.0** use, rely on **`bin/galaaz-ruby`** (or **`bin/galaaz-jrub
|
|
|
241
243
|
Typical development and CI targets:
|
|
242
244
|
|
|
243
245
|
* **Linux** — recent Ubuntu LTS or comparable distributions (x86_64).
|
|
244
|
-
* **macOS** — recent releases with JRuby and GNU R available.
|
|
246
|
+
* **macOS** — recent releases with JRuby or CRuby and GNU R available.
|
|
245
247
|
* **Windows** — use **WSL2** (same Linux stack as above); native Windows is not the primary target.
|
|
246
248
|
|
|
247
249
|
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.
|
|
248
250
|
|
|
249
251
|
# Dependencies
|
|
250
252
|
|
|
251
|
-
* **
|
|
253
|
+
* **Ruby** — **JRuby** or **CRuby** (both supported for NewBridge). Tested with **JRuby 10.1.1.0**
|
|
254
|
+
(+ **JDK 21**) and **CRuby 3.3.12**. Use `bin/galaaz-ruby` (honors `GALAAZ_RUBY`) or plain
|
|
255
|
+
`gem install galaaz` under the Ruby you choose.
|
|
252
256
|
* **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.
|
|
253
257
|
* **galaaz gem** — runtime dependency `msgpack` is pulled in by `gem install`.
|
|
254
258
|
* Optional: **Docker** — if you run R in a container (common on WSL2); see bootstrap below.
|
|
@@ -258,29 +262,40 @@ The native **gatekeeper** component under `ext/new_bridge` is built with `make`
|
|
|
258
262
|
|
|
259
263
|
The supported install is **`gem install` + compile the gatekeeper**. You do not need a git clone.
|
|
260
264
|
|
|
261
|
-
1. Install **JRuby
|
|
265
|
+
1. Install **JRuby** (and a compatible **JDK**) **or CRuby 3.3+**, plus **GNU R** (with `Rscript` and a C++ compiler).
|
|
262
266
|
2. In R, install **Rcpp**: `install.packages("Rcpp")`.
|
|
263
|
-
3. Install the gem: `jruby -S gem install galaaz`
|
|
267
|
+
3. Install the gem: `jruby -S gem install galaaz` (or `gem install galaaz` under CRuby).
|
|
264
268
|
4. Compile the native gatekeeper from the installed gem:
|
|
265
269
|
|
|
266
270
|
```
|
|
267
|
-
gem_dir="$(
|
|
271
|
+
gem_dir="$(ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path")"
|
|
272
|
+
# under JRuby: gem_dir="$(jruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path")"
|
|
268
273
|
make -C "${gem_dir}/ext/new_bridge" all
|
|
269
274
|
```
|
|
270
275
|
|
|
271
|
-
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
|
|
276
|
+
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 **JRuby** (Java 9+), the child JVM needs `--add-opens=java.base/java.nio=ALL-UNNAMED` via **`JAVA_OPTS`** (from a checkout, `bin/galaaz-jruby` and `mise.toml` set this; a leading `jruby -J... -S bundle exec` does **not** pass `-J` to rspec). On **CRuby**, install Apache Arrow GLib (`libarrow-glib-dev` from the [Apache Arrow APT](https://arrow.apache.org/install/) repo) and `gem install red-arrow` matching `pkg-config --modversion arrow-glib`. Do not install the unrelated Rubygems package named `arrow`.
|
|
272
277
|
|
|
273
278
|
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.
|
|
274
279
|
|
|
275
|
-
A **table of all `bin/` scripts** (bootstrap,
|
|
280
|
+
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.
|
|
276
281
|
|
|
277
282
|
### From a repository checkout (contributors)
|
|
278
283
|
|
|
279
|
-
1. Install **bundler** if needed, then run **`
|
|
284
|
+
1. Install **bundler** if needed, then run **`bundle install`** with your chosen Ruby
|
|
285
|
+
(`jruby -S bundle install` or CRuby `bundle install`) in the repository root.
|
|
280
286
|
2. Build the bridge native code: **`make -C ext/new_bridge all`** (or **`rake compile_gatekeeper`**).
|
|
281
|
-
3. Run scripts with **`bin/galaaz-
|
|
282
|
-
|
|
283
|
-
|
|
287
|
+
3. Run scripts with **`bin/galaaz-ruby`** (uses `ruby` on `PATH`; set **`GALAAZ_RUBY=jruby`** or
|
|
288
|
+
**`GALAAZ_RUBY=ruby`** to force an engine). Spec runners: **`bin/run_rspec`** /
|
|
289
|
+
**`bin/run_all_rspec`** (same `GALAAZ_RUBY` rule). **`bin/galaaz-jruby`** remains a thin
|
|
290
|
+
wrapper that forces JRuby.
|
|
291
|
+
|
|
292
|
+
A **gstudio** try image with Galaaz already installed is available for both engines:
|
|
293
|
+
**JRuby** — `docker run --rm -it ghcr.io/rbotafogo/galaaz-try:gstudio` (or
|
|
294
|
+
`./docker/try-gstudio/run.sh` from a checkout); **CRuby** —
|
|
295
|
+
`docker run --rm -it ghcr.io/rbotafogo/galaaz-try:cruby` (or `./docker/try-cruby/run.sh`).
|
|
296
|
+
Maintainers can prove a RubyGems install on a throwaway Ubuntu machine (no repo inside
|
|
297
|
+
the container) with `./docker/cold-install/run.sh published-specs` (JRuby) or
|
|
298
|
+
`./docker/cold-install-cruby/run.sh published-specs` (CRuby).
|
|
284
299
|
|
|
285
300
|
## Windows + WSL2 (optional: Docker / R in a container)
|
|
286
301
|
|
|
@@ -315,8 +330,15 @@ WSL integration is enabled for the distro where Galaaz is installed.
|
|
|
315
330
|
```{ruby simple_example}
|
|
316
331
|
vec = R.c(1, 2, 3, 4)
|
|
317
332
|
puts vec
|
|
333
|
+
|
|
334
|
+
# R.foo(...) calls an R *function*. Datasets are objects — fetch with ~:
|
|
335
|
+
df = ~R[:mtcars]
|
|
336
|
+
puts R.summary(df)
|
|
318
337
|
```
|
|
319
|
-
|
|
338
|
+
|
|
339
|
+
(`R.mtcars` is wrong: it becomes `mtcars()` in R and fails. With
|
|
340
|
+
`using Galaaz::SymbolDSL`, the short form `~:mtcars` also works.)
|
|
341
|
+
|
|
320
342
|
* Run all specs
|
|
321
343
|
|
|
322
344
|
> galaaz specs:all
|
|
@@ -695,9 +717,9 @@ puts vec.map { |x| x + 2 }
|
|
|
695
717
|
|
|
696
718
|
This manual has been formatted using gKnit. gKnit uses knitr and R Markdown to knit
|
|
697
719
|
a document in Ruby or R and output it in any of the available formats for R Markdown.
|
|
698
|
-
gKnit runs with **JRuby**, **GNU R**, and Galaaz. In gKnit, Ruby variables are persisted between
|
|
699
|
-
chunks, making it an ideal solution for literate programming. Also, since it is based
|
|
700
|
-
on Galaaz, Ruby chunks can have access to R variables and combining Ruby with R in one
|
|
720
|
+
gKnit runs with **JRuby or CRuby**, **GNU R**, and Galaaz. In gKnit, Ruby variables are persisted between
|
|
721
|
+
chunks, making it an ideal solution for literate programming. Also, since it is based
|
|
722
|
+
on Galaaz, Ruby chunks can have access to R variables and combining Ruby with R in one
|
|
701
723
|
document is natural.
|
|
702
724
|
|
|
703
725
|
The idea of "literate programming" was first introduced by Donald Knuth in the
|
|
@@ -2071,7 +2093,8 @@ a real **Arrow `Table` inside GNU R**. From there you use R’s **`arrow`** and
|
|
|
2071
2093
|
as usual: **`group_by`** on the Arrow table, **`summarise`** for aggregates, then **`collect()`** to
|
|
2072
2094
|
materialize a tibble when you need in-memory R rows.
|
|
2073
2095
|
|
|
2074
|
-
That pattern matches production use: **JRuby threads**
|
|
2096
|
+
That pattern matches production use: **JRuby threads** or a **multi-process CRuby** app
|
|
2097
|
+
(or sequential code) assemble many rows in
|
|
2075
2098
|
Ruby; you pay **one** bridge-heavy handoff to R; **dplyr** runs vectorised work on the Arrow table
|
|
2076
2099
|
in R.
|
|
2077
2100
|
|
|
@@ -2175,10 +2198,11 @@ pulls in several dependencies; the first install can take several minutes.
|
|
|
2175
2198
|
## Example: DESeq2 on the airway dataset
|
|
2176
2199
|
|
|
2177
2200
|
The script **`examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb`** is the canonical
|
|
2178
|
-
version in the repository. Run it from the **Galaaz repository root** with
|
|
2201
|
+
version in the repository. Run it from the **Galaaz repository root** with either engine, for example:
|
|
2179
2202
|
|
|
2180
2203
|
```text
|
|
2181
|
-
bin/galaaz-
|
|
2204
|
+
bin/galaaz-ruby examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
2205
|
+
# or: bin/galaaz-jruby examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
2182
2206
|
```
|
|
2183
2207
|
|
|
2184
2208
|
The workflow in Ruby mirrors a standard DESeq2 vignette:
|
|
@@ -2206,7 +2230,7 @@ manual is knitted, because **DESeq2** is heavy and may be absent on the build ma
|
|
|
2206
2230
|
|
|
2207
2231
|
```{ruby deseq2_airway_full_listing, eval=FALSE}
|
|
2208
2232
|
# Canonical script: examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
2209
|
-
# Run: bin/galaaz-
|
|
2233
|
+
# Run: bin/galaaz-ruby examples/.../deseq2_airway_galaaz.rb (repo root).
|
|
2210
2234
|
|
|
2211
2235
|
require 'galaaz'
|
|
2212
2236
|
|
|
@@ -2728,8 +2752,8 @@ arguments.
|
|
|
2728
2752
|
|
|
2729
2753
|
* Fork it
|
|
2730
2754
|
* Create your feature branch (`git checkout -b my-new-feature`)
|
|
2731
|
-
* Write tests — use **`bin/run_rspec`** or **`bin/run_all_rspec`**
|
|
2732
|
-
the load path
|
|
2755
|
+
* Write tests — use **`bin/run_rspec`** or **`bin/run_all_rspec`** (JRuby or CRuby via
|
|
2756
|
+
**`GALAAZ_RUBY`**) so the load path matches **`docs/testing.md`**
|
|
2733
2757
|
* Commit your changes (`git commit -am 'Add some feature'`)
|
|
2734
2758
|
* Push to the branch (`git push origin my-new-feature`)
|
|
2735
2759
|
* Open a pull request
|
data/blogs/manual/manual.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
title: "Galaaz Manual"
|
|
3
3
|
subtitle: "R-on-Rails: GNU R meets Ruby for the web"
|
|
4
4
|
author: "Rodrigo Botafogo"
|
|
5
|
-
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
5
|
+
tags: [Galaaz, "R-on-Rails", Ruby, Rails, JRuby, CRuby, R, "GNU R", ggplot2, knitr, dplyr, Bioconductor, Arrow]
|
|
6
6
|
date: "2026"
|
|
7
7
|
bibliography: "../../examples/Bibliography/stats.bib"
|
|
8
8
|
output:
|
|
@@ -358,7 +358,13 @@ A **table of all `bin/` scripts** (bootstrap, Ruby launcher, gstudio, gknit, tes
|
|
|
358
358
|
**`bin/run_all_rspec`** (same `GALAAZ_RUBY` rule). **`bin/galaaz-jruby`** remains a thin
|
|
359
359
|
wrapper that forces JRuby.
|
|
360
360
|
|
|
361
|
-
A **gstudio** try image
|
|
361
|
+
A **gstudio** try image with Galaaz already installed is available for both engines:
|
|
362
|
+
**JRuby** — `docker run --rm -it ghcr.io/rbotafogo/galaaz-try:gstudio` (or
|
|
363
|
+
`./docker/try-gstudio/run.sh` from a checkout); **CRuby** —
|
|
364
|
+
`docker run --rm -it ghcr.io/rbotafogo/galaaz-try:cruby` (or `./docker/try-cruby/run.sh`).
|
|
365
|
+
Maintainers can prove a RubyGems install on a throwaway Ubuntu machine (no repo inside
|
|
366
|
+
the container) with `./docker/cold-install/run.sh published-specs` (JRuby) or
|
|
367
|
+
`./docker/cold-install-cruby/run.sh published-specs` (CRuby).
|
|
362
368
|
|
|
363
369
|
## Windows + WSL2 (optional: Docker / R in a container)
|
|
364
370
|
|
|
@@ -394,11 +400,18 @@ WSL integration is enabled for the distro where Galaaz is installed.
|
|
|
394
400
|
``` ruby
|
|
395
401
|
vec = R.c(1, 2, 3, 4)
|
|
396
402
|
puts vec
|
|
403
|
+
|
|
404
|
+
# R.foo(...) calls an R *function*. Datasets are objects — fetch with ~:
|
|
405
|
+
df = ~R[:mtcars]
|
|
406
|
+
puts R.summary(df)
|
|
397
407
|
```
|
|
398
408
|
|
|
399
409
|
```
|
|
400
410
|
## [1] 1 2 3 4
|
|
401
411
|
```
|
|
412
|
+
|
|
413
|
+
(`R.mtcars` is wrong: it becomes `mtcars()` in R and fails. With
|
|
414
|
+
`using Galaaz::SymbolDSL`, the short form `~:mtcars` also works.)
|
|
402
415
|
|
|
403
416
|
* Run all specs
|
|
404
417
|
|
|
@@ -4261,10 +4274,11 @@ pulls in several dependencies; the first install can take several minutes.
|
|
|
4261
4274
|
## Example: DESeq2 on the airway dataset
|
|
4262
4275
|
|
|
4263
4276
|
The script **`examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb`** is the canonical
|
|
4264
|
-
version in the repository. Run it from the **Galaaz repository root** with
|
|
4277
|
+
version in the repository. Run it from the **Galaaz repository root** with either engine, for example:
|
|
4265
4278
|
|
|
4266
4279
|
```text
|
|
4267
|
-
bin/galaaz-
|
|
4280
|
+
bin/galaaz-ruby examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
4281
|
+
# or: bin/galaaz-jruby examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
4268
4282
|
```
|
|
4269
4283
|
|
|
4270
4284
|
The workflow in Ruby mirrors a standard DESeq2 vignette:
|
|
@@ -4293,7 +4307,7 @@ manual is knitted, because **DESeq2** is heavy and may be absent on the build ma
|
|
|
4293
4307
|
|
|
4294
4308
|
``` ruby
|
|
4295
4309
|
# Canonical script: examples/bioconductor_deseq2_airway/deseq2_airway_galaaz.rb
|
|
4296
|
-
# Run: bin/galaaz-
|
|
4310
|
+
# Run: bin/galaaz-ruby examples/.../deseq2_airway_galaaz.rb (repo root).
|
|
4297
4311
|
|
|
4298
4312
|
require 'galaaz'
|
|
4299
4313
|
|
data/blogs/oh_my/oh_my.Rmd
CHANGED
|
@@ -3,7 +3,7 @@ title: "Extending R with classes, modules, procs, lambdas, oh my!"
|
|
|
3
3
|
author:
|
|
4
4
|
- "Rodrigo Botafogo"
|
|
5
5
|
- "Daniel Mossé - University of Pittsburgh"
|
|
6
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz]
|
|
6
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz]
|
|
7
7
|
date: "November 19th, 2018 (narrative updated for Galaaz 2.0, 2026)"
|
|
8
8
|
output:
|
|
9
9
|
html_document:
|
|
@@ -34,10 +34,10 @@ or similar solutions in Python,
|
|
|
34
34
|
such as [PypeR](https://pypi.python.org/pypi/PypeR/1.1.0), [rpy2](http://rpy2.bitbucket.org/)
|
|
35
35
|
and other similar solutions.
|
|
36
36
|
|
|
37
|
-
**Galaaz 2.0**
|
|
38
|
-
so Ruby code can create and manipulate R objects and call R
|
|
39
|
-
An earlier prototype used Oracle’s **GraalVM** with
|
|
40
|
-
historical and is **not** what current Galaaz targets.
|
|
37
|
+
**Galaaz 2.0** supports **[JRuby](https://www.jruby.org/)** or **CRuby** equally and drives
|
|
38
|
+
**GNU R** through a **bridge**, so Ruby code can create and manipulate R objects and call R
|
|
39
|
+
functions while staying idiomatic Ruby. An earlier prototype used Oracle’s **GraalVM** with
|
|
40
|
+
**TruffleRuby** and **FastR**; that stack is historical and is **not** what current Galaaz targets.
|
|
41
41
|
|
|
42
42
|
|
|
43
43
|
# Bases of Object Programming
|
|
@@ -1673,7 +1673,7 @@ For those interested in Ruby and science, we recommend:
|
|
|
1673
1673
|
|
|
1674
1674
|
* http://sciruby.com/
|
|
1675
1675
|
|
|
1676
|
-
**Galaaz 2.0** runs on **JRuby** and talks to **GNU R** through the bridge described in this
|
|
1676
|
+
**Galaaz 2.0** runs on **JRuby or CRuby** and talks to **GNU R** through the bridge described in this
|
|
1677
1677
|
series — the same integration model used throughout the examples above.
|
|
1678
1678
|
|
|
1679
1679
|
# Callbacks and R calling into Ruby
|
|
@@ -1695,7 +1695,7 @@ path in Galaaz 2.0.
|
|
|
1695
1695
|
|
|
1696
1696
|
# Conclusions II
|
|
1697
1697
|
|
|
1698
|
-
**JRuby + GNU R + Galaaz** gives a practical polyglot stack: idiomatic Ruby for structure and
|
|
1698
|
+
**JRuby or CRuby + GNU R + Galaaz** gives a practical polyglot stack: idiomatic Ruby for structure and
|
|
1699
1699
|
libraries, GNU R for statistics and the CRAN/Bioconductor ecosystem, and Galaaz as the bridge
|
|
1700
1700
|
between them. As always, choose the right tools for the job at hand — and when the job sits
|
|
1701
1701
|
between an R-only workflow and a broader polyglot application, Galaaz is designed to connect those
|
data/blogs/oh_my/oh_my.md
CHANGED
|
@@ -3,7 +3,7 @@ title: "Extending R with classes, modules, procs, lambdas, oh my!"
|
|
|
3
3
|
author:
|
|
4
4
|
- "Rodrigo Botafogo"
|
|
5
5
|
- "Daniel Mossé - University of Pittsburgh"
|
|
6
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz]
|
|
6
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz]
|
|
7
7
|
date: "November 19th, 2018 (narrative updated for Galaaz 2.0, 2026)"
|
|
8
8
|
output:
|
|
9
9
|
html_document:
|
|
@@ -32,10 +32,10 @@ or similar solutions in Python,
|
|
|
32
32
|
such as [PypeR](https://pypi.python.org/pypi/PypeR/1.1.0), [rpy2](http://rpy2.bitbucket.org/)
|
|
33
33
|
and other similar solutions.
|
|
34
34
|
|
|
35
|
-
**Galaaz 2.0**
|
|
36
|
-
so Ruby code can create and manipulate R objects and call R
|
|
37
|
-
An earlier prototype used Oracle’s **GraalVM** with
|
|
38
|
-
historical and is **not** what current Galaaz targets.
|
|
35
|
+
**Galaaz 2.0** supports **[JRuby](https://www.jruby.org/)** or **CRuby** equally and drives
|
|
36
|
+
**GNU R** through a **bridge**, so Ruby code can create and manipulate R objects and call R
|
|
37
|
+
functions while staying idiomatic Ruby. An earlier prototype used Oracle’s **GraalVM** with
|
|
38
|
+
**TruffleRuby** and **FastR**; that stack is historical and is **not** what current Galaaz targets.
|
|
39
39
|
|
|
40
40
|
|
|
41
41
|
# Bases of Object Programming
|
|
@@ -2148,7 +2148,7 @@ For those interested in Ruby and science, we recommend:
|
|
|
2148
2148
|
|
|
2149
2149
|
* http://sciruby.com/
|
|
2150
2150
|
|
|
2151
|
-
**Galaaz 2.0** runs on **JRuby** and talks to **GNU R** through the bridge described in this
|
|
2151
|
+
**Galaaz 2.0** runs on **JRuby or CRuby** and talks to **GNU R** through the bridge described in this
|
|
2152
2152
|
series — the same integration model used throughout the examples above.
|
|
2153
2153
|
|
|
2154
2154
|
# Callbacks and R calling into Ruby
|
|
@@ -2170,7 +2170,7 @@ path in Galaaz 2.0.
|
|
|
2170
2170
|
|
|
2171
2171
|
# Conclusions II
|
|
2172
2172
|
|
|
2173
|
-
**JRuby + GNU R + Galaaz** gives a practical polyglot stack: idiomatic Ruby for structure and
|
|
2173
|
+
**JRuby or CRuby + GNU R + Galaaz** gives a practical polyglot stack: idiomatic Ruby for structure and
|
|
2174
2174
|
libraries, GNU R for statistics and the CRAN/Bioconductor ecosystem, and Galaaz as the bridge
|
|
2175
2175
|
between them. As always, choose the right tools for the job at hand — and when the job sits
|
|
2176
2176
|
between an R-only workflow and a broader polyglot application, Galaaz is designed to connect those
|
|
@@ -3,7 +3,7 @@ title: "How to make Beautiful Ruby Plots with Galaaz"
|
|
|
3
3
|
author:
|
|
4
4
|
- "Rodrigo Botafogo"
|
|
5
5
|
- "Daniel Mossé - University of Pittsburgh"
|
|
6
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz]
|
|
6
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz]
|
|
7
7
|
date: "November 19th, 2018 (narrative updated for Galaaz 2.0, 2026)"
|
|
8
8
|
output:
|
|
9
9
|
html_document:
|
|
@@ -46,16 +46,16 @@ of libraries for data analysis.
|
|
|
46
46
|
Until recently, there was no real perspective for Ruby to bridge this gap.
|
|
47
47
|
Implementing a complete scientific computing infrastructure would take too long.
|
|
48
48
|
|
|
49
|
-
**Galaaz 2.0**
|
|
50
|
-
same R distribution used for data science everywhere. A **bridge** evaluates R from
|
|
51
|
-
exchanges data between the two processes so that, from Ruby, you call R functions and work
|
|
49
|
+
**Galaaz 2.0** supports **[JRuby](https://www.jruby.org/)** or **CRuby** equally and drives
|
|
50
|
+
**GNU R**—the same R distribution used for data science everywhere. A **bridge** evaluates R from
|
|
51
|
+
Ruby and exchanges data between the two processes so that, from Ruby, you call R functions and work
|
|
52
52
|
with R objects using familiar Ruby syntax. In other words, a Ruby programmer can use the
|
|
53
53
|
capabilities of R without memorizing all of R’s syntax for day-to-day tasks.
|
|
54
54
|
|
|
55
55
|
An **earlier line of work** used Oracle’s **GraalVM** with **TruffleRuby** and **FastR** so that
|
|
56
56
|
Ruby and R could share one JVM runtime. That stack is **no longer** what Galaaz targets;
|
|
57
|
-
today’s Galaaz is developed and tested with **JRuby + GNU R** (see the project manual for
|
|
58
|
-
and command-line tools).
|
|
57
|
+
today’s Galaaz is developed and tested with **JRuby or CRuby + GNU R** (see the project manual for
|
|
58
|
+
setup and command-line tools).
|
|
59
59
|
|
|
60
60
|
Library wrapping is a common way to bring features from one language into another.
|
|
61
61
|
To improve performance, Python often wraps more efficient C libraries. For the
|
|
@@ -84,7 +84,7 @@ ggplot themes that will work the same as the Ruby module. Yet, writing a new th
|
|
|
84
84
|
requires specific knowledge on theme writing. Ruby modules are standard to the
|
|
85
85
|
language and don't need special knowledge.
|
|
86
86
|
|
|
87
|
-
[Here](https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021) is an older article (GraalVM-era Galaaz) with a scatter plot in Ruby; the **ideas** still apply under Galaaz 2.0 with JRuby and GNU R.
|
|
87
|
+
[Here](https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021) is an older article (GraalVM-era Galaaz) with a scatter plot in Ruby; the **ideas** still apply under Galaaz 2.0 with JRuby or CRuby and GNU R.
|
|
88
88
|
|
|
89
89
|
# gKnit
|
|
90
90
|
|
|
@@ -549,12 +549,12 @@ Trying to bring to Ruby the power of R starting from scratch is an enormous ende
|
|
|
549
549
|
and would probably never be accomplished. Today's data scientists would certainly
|
|
550
550
|
stick with either Python or R. Now, both the Ruby and R communities can benefit
|
|
551
551
|
from this marriage: **Galaaz 2.0** uses **standard GNU R** for statistics and graphics
|
|
552
|
-
and **JRuby** for application code
|
|
553
|
-
the process to couple Ruby and R; the coupling is implemented by the
|
|
554
|
-
**gKnit** for literate documents, not by a single GraalVM polyglot runtime.
|
|
552
|
+
and **JRuby or CRuby** for application code (prefer **JRuby** when you want real threads and the
|
|
553
|
+
JVM ecosystem). We presented the process to couple Ruby and R; the coupling is implemented by the
|
|
554
|
+
Galaaz bridge and **gKnit** for literate documents, not by a single GraalVM polyglot runtime.
|
|
555
555
|
|
|
556
556
|
For performance, expect **ordinary GNU R** behaviour for model fitting and plotting, while
|
|
557
|
-
**JRuby**
|
|
557
|
+
**JRuby** can give **real parallel threads** on the Ruby side and access to Java libraries when
|
|
558
558
|
you need them.
|
|
559
559
|
|
|
560
560
|
This article has shown how to improve a plot step-by-step. Starting from a very simple
|
|
@@ -571,8 +571,7 @@ be of great help for any Rubyist trying to write articles, blogs or documentatio
|
|
|
571
571
|
|
|
572
572
|
## Prerequisites (Galaaz 2.0)
|
|
573
573
|
|
|
574
|
-
* **JRuby**
|
|
575
|
-
* A **JDK** compatible with your JRuby version
|
|
574
|
+
* **JRuby** and a compatible **JDK**, *or* **CRuby 3.3+**
|
|
576
575
|
* **GNU R** — `R` on your `PATH`, with compilers/tools available if packages must be built from source
|
|
577
576
|
|
|
578
577
|
The following R packages will be automatically installed when necessary, but could be installed prior
|
|
@@ -594,4 +593,4 @@ are commonly required.
|
|
|
594
593
|
|
|
595
594
|
* From the Galaaz repository (or your installed layout), render documents with **`bin/gknit`** (see the project manual for flags such as `--output_format all`).
|
|
596
595
|
* In Ruby code: `require 'galaaz'`
|
|
597
|
-
*
|
|
596
|
+
* Run Ruby with **`bin/galaaz-ruby`** (either engine) or **`bin/galaaz-jruby`** when you need JRuby JVM flags (see the manual).
|
|
@@ -3,7 +3,7 @@ title: "How to make Beautiful Ruby Plots with Galaaz"
|
|
|
3
3
|
author:
|
|
4
4
|
- "Rodrigo Botafogo"
|
|
5
5
|
- "Daniel Mossé - University of Pittsburgh"
|
|
6
|
-
tags: [Tech, Data Science, Ruby, R, JRuby, "GNU R", Galaaz]
|
|
6
|
+
tags: [Tech, Data Science, Ruby, R, JRuby, CRuby, "GNU R", Galaaz]
|
|
7
7
|
date: "November 19th, 2018 (narrative updated for Galaaz 2.0, 2026)"
|
|
8
8
|
output:
|
|
9
9
|
html_document:
|
|
@@ -42,16 +42,16 @@ of libraries for data analysis.
|
|
|
42
42
|
Until recently, there was no real perspective for Ruby to bridge this gap.
|
|
43
43
|
Implementing a complete scientific computing infrastructure would take too long.
|
|
44
44
|
|
|
45
|
-
**Galaaz 2.0**
|
|
46
|
-
same R distribution used for data science everywhere. A **bridge** evaluates R from
|
|
47
|
-
exchanges data between the two processes so that, from Ruby, you call R functions and work
|
|
45
|
+
**Galaaz 2.0** supports **[JRuby](https://www.jruby.org/)** or **CRuby** equally and drives
|
|
46
|
+
**GNU R**—the same R distribution used for data science everywhere. A **bridge** evaluates R from
|
|
47
|
+
Ruby and exchanges data between the two processes so that, from Ruby, you call R functions and work
|
|
48
48
|
with R objects using familiar Ruby syntax. In other words, a Ruby programmer can use the
|
|
49
49
|
capabilities of R without memorizing all of R’s syntax for day-to-day tasks.
|
|
50
50
|
|
|
51
51
|
An **earlier line of work** used Oracle’s **GraalVM** with **TruffleRuby** and **FastR** so that
|
|
52
52
|
Ruby and R could share one JVM runtime. That stack is **no longer** what Galaaz targets;
|
|
53
|
-
today’s Galaaz is developed and tested with **JRuby + GNU R** (see the project manual for
|
|
54
|
-
and command-line tools).
|
|
53
|
+
today’s Galaaz is developed and tested with **JRuby or CRuby + GNU R** (see the project manual for
|
|
54
|
+
setup and command-line tools).
|
|
55
55
|
|
|
56
56
|
Library wrapping is a usual way of bringing features from one language into another.
|
|
57
57
|
To improve performance, Python often wraps more efficient C libraries. For the
|
|
@@ -80,7 +80,7 @@ ggplot themes that will work the same as the Ruby module. Yet, writing a new th
|
|
|
80
80
|
requires specific knowledge on theme writing. Ruby modules are standard to the
|
|
81
81
|
language and don't need special knowledge.
|
|
82
82
|
|
|
83
|
-
[Here](https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021) is an older article (GraalVM-era Galaaz) with a scatter plot in Ruby; the **ideas** still apply under Galaaz 2.0 with JRuby and GNU R.
|
|
83
|
+
[Here](https://towardsdatascience.com/ruby-plotting-with-galaaz-an-example-of-tightly-coupling-ruby-and-r-in-graalvm-520b69e21021) is an older article (GraalVM-era Galaaz) with a scatter plot in Ruby; the **ideas** still apply under Galaaz 2.0 with JRuby or CRuby and GNU R.
|
|
84
84
|
|
|
85
85
|
# gKnit
|
|
86
86
|
|
|
@@ -622,12 +622,12 @@ Trying to bring to Ruby the power of R starting from scratch is an enormous ende
|
|
|
622
622
|
and would probably never be accomplished. Today's data scientists would certainly
|
|
623
623
|
stick with either Python or R. Now, both the Ruby and R communities can benefit
|
|
624
624
|
from this marriage: **Galaaz 2.0** uses **standard GNU R** for statistics and graphics
|
|
625
|
-
and **JRuby** for application code
|
|
626
|
-
the process to couple Ruby and R; the coupling is implemented by the
|
|
627
|
-
**gKnit** for literate documents, not by a single GraalVM polyglot runtime.
|
|
625
|
+
and **JRuby or CRuby** for application code (prefer **JRuby** when you want real threads and the
|
|
626
|
+
JVM ecosystem). We presented the process to couple Ruby and R; the coupling is implemented by the
|
|
627
|
+
Galaaz bridge and **gKnit** for literate documents, not by a single GraalVM polyglot runtime.
|
|
628
628
|
|
|
629
629
|
For performance, expect **ordinary GNU R** behaviour for model fitting and plotting, while
|
|
630
|
-
**JRuby**
|
|
630
|
+
**JRuby** can give **real parallel threads** on the Ruby side and access to Java libraries when
|
|
631
631
|
you need them.
|
|
632
632
|
|
|
633
633
|
This article has shown how to improve a plot step-by-step. Starting from a very simple
|
|
@@ -644,8 +644,7 @@ be of great help for any Rubyist trying to write articles, blogs or documentatio
|
|
|
644
644
|
|
|
645
645
|
## Prerequisites (Galaaz 2.0)
|
|
646
646
|
|
|
647
|
-
* **JRuby**
|
|
648
|
-
* A **JDK** compatible with your JRuby version
|
|
647
|
+
* **JRuby** and a compatible **JDK**, *or* **CRuby 3.3+**
|
|
649
648
|
* **GNU R** — `R` on your `PATH`, with compilers/tools available if packages must be built from source
|
|
650
649
|
|
|
651
650
|
The following R packages will be automatically installed when necessary, but could be installed prior
|
|
@@ -667,4 +666,4 @@ are commonly required.
|
|
|
667
666
|
|
|
668
667
|
* From the Galaaz repository (or your installed layout), render documents with **`bin/gknit`** (see the project manual for flags such as `--output_format all`).
|
|
669
668
|
* In Ruby code: `require 'galaaz'`
|
|
670
|
-
*
|
|
669
|
+
* Run Ruby with **`bin/galaaz-ruby`** (either engine) or **`bin/galaaz-jruby`** when you need JRuby JVM flags (see the manual).
|
data/examples/misc/ggplot.rb
CHANGED
data/lib/galaaz/cli.rb
CHANGED
|
@@ -315,6 +315,12 @@ module Galaaz
|
|
|
315
315
|
end
|
|
316
316
|
|
|
317
317
|
def add_arrow
|
|
318
|
+
# R 'arrow' needs a matching libarrow. Compiling Arrow C++ + Boost from the
|
|
319
|
+
# CRAN source tarball is fragile (especially Arch/Omarchy). Distro libarrow
|
|
320
|
+
# (e.g. Arch extra/arrow) often mismatches the CRAN package major and then
|
|
321
|
+
# pkg-config configure fails. Apache's version-matched prebuilt libarrow is
|
|
322
|
+
# the reliable automated path — HTTPS from Apache, no interactive steps.
|
|
323
|
+
prepare_arrow_cran_env!
|
|
318
324
|
pkgs = read_pkg_list('arrow.txt')
|
|
319
325
|
install_cran!(pkgs)
|
|
320
326
|
if RUBY_ENGINE == 'ruby'
|
|
@@ -330,6 +336,17 @@ module Galaaz
|
|
|
330
336
|
0
|
|
331
337
|
end
|
|
332
338
|
|
|
339
|
+
# Env for install.packages("arrow") — see https://arrow.apache.org/docs/r/articles/install.html
|
|
340
|
+
def prepare_arrow_cran_env!
|
|
341
|
+
ENV['LIBARROW_BINARY'] = 'true'
|
|
342
|
+
ENV['NOT_CRAN'] = 'true'
|
|
343
|
+
# Do not fall back to the Boost/C++ source build that breaks on Arch.
|
|
344
|
+
ENV['LIBARROW_BUILD'] = 'false'
|
|
345
|
+
# Avoid linking against a mismatched system libarrow (e.g. pacman 24.x vs CRAN 25.x).
|
|
346
|
+
ENV['ARROW_USE_PKG_CONFIG'] = 'false'
|
|
347
|
+
puts 'galaaz add arrow: LIBARROW_BINARY=true (Apache prebuilt libarrow; no source build)'
|
|
348
|
+
end
|
|
349
|
+
|
|
333
350
|
def add_tex
|
|
334
351
|
unless command_present?('pandoc')
|
|
335
352
|
warn 'galaaz add tex: pandoc not on PATH — install via your package manager (e.g. pacman -S pandoc)'
|
|
@@ -400,20 +417,21 @@ module Galaaz
|
|
|
400
417
|
abort_unless(ok, 'git clone failed (is the ledger repo public/reachable?)')
|
|
401
418
|
end
|
|
402
419
|
|
|
403
|
-
|
|
404
|
-
text = File.read(gemfile)
|
|
405
|
-
rewritten = text.gsub(/gem\s+["']galaaz["']\s*,\s*path:\s*["'][^"']+["']/, 'gem "galaaz"')
|
|
406
|
-
if rewritten != text
|
|
407
|
-
File.write(gemfile, rewritten)
|
|
408
|
-
puts 'galaaz add ledger: Gemfile now uses RubyGems galaaz (no path:)'
|
|
409
|
-
end
|
|
420
|
+
ensure_ledger_galaaz_gemfile!(File.join(dest, 'Gemfile'))
|
|
410
421
|
|
|
411
422
|
Dir.chdir(dest) do
|
|
412
423
|
need_cmd!('bundle')
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
system('
|
|
424
|
+
# Lockfile often still pins path: ../galaaz @ an old version — pull latest RubyGems.
|
|
425
|
+
puts 'galaaz add ledger: bundle update galaaz'
|
|
426
|
+
unless system('bundle', 'update', 'galaaz')
|
|
427
|
+
abort_unless(system('bundle', 'install'), 'bundle install failed')
|
|
428
|
+
end
|
|
429
|
+
# Setup the gem Bundler will load (not PATH galaaz, which may differ).
|
|
430
|
+
puts 'galaaz add ledger: bundle exec galaaz setup'
|
|
431
|
+
system('bundle', 'exec', 'galaaz', 'setup') ||
|
|
432
|
+
warn('galaaz add ledger: bundle exec galaaz setup returned non-zero; check gatekeeper')
|
|
416
433
|
abort_unless(system('bin/rails', 'db:prepare'), 'rails db:prepare failed')
|
|
434
|
+
abort_unless(system('bin/rails', 'db:migrate'), 'rails db:migrate failed')
|
|
417
435
|
abort_unless(system({ 'SEED_PROFILE' => 'fast' }, 'bin/rails', 'db:seed'), 'rails db:seed failed')
|
|
418
436
|
end
|
|
419
437
|
|
|
@@ -424,6 +442,21 @@ module Galaaz
|
|
|
424
442
|
0
|
|
425
443
|
end
|
|
426
444
|
|
|
445
|
+
# Ledger repo may ship `gem "galaaz", path: "..."`. Standalone installs use RubyGems
|
|
446
|
+
# (CRuby or JRuby), unpinned, so `bundle update galaaz` takes the newest published gem.
|
|
447
|
+
def ensure_ledger_galaaz_gemfile!(gemfile)
|
|
448
|
+
text = File.read(gemfile)
|
|
449
|
+
line = 'gem "galaaz"'
|
|
450
|
+
rewritten = text.gsub(/^\s*gem\s+["']galaaz["'].*$/, line)
|
|
451
|
+
if rewritten == text && text !~ /^\s*gem\s+["']galaaz["']/
|
|
452
|
+
rewritten = text + "\n#{line}\n"
|
|
453
|
+
end
|
|
454
|
+
if rewritten != text
|
|
455
|
+
File.write(gemfile, rewritten)
|
|
456
|
+
puts 'galaaz add ledger: Gemfile → gem "galaaz" (RubyGems latest; not path:)'
|
|
457
|
+
end
|
|
458
|
+
end
|
|
459
|
+
|
|
427
460
|
# ---- helpers ----
|
|
428
461
|
|
|
429
462
|
class CliError < StandardError; end
|
data/version.rb
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
$gem_name = "galaaz"
|
|
2
|
-
$version="2.1.
|
|
2
|
+
$version="2.1.5"
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: galaaz
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.1.
|
|
4
|
+
version: 2.1.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Rodrigo Botafogo
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
10
|
+
date: 2026-09-07 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: msgpack
|
|
@@ -87,11 +86,11 @@ description: |
|
|
|
87
86
|
email: rodrigo.a.botafogo@gmail.com
|
|
88
87
|
executables:
|
|
89
88
|
- galaaz
|
|
90
|
-
- gstudio
|
|
91
|
-
- gknit
|
|
92
89
|
- gbookdown
|
|
93
|
-
-
|
|
90
|
+
- gknit
|
|
94
91
|
- gknit-draft
|
|
92
|
+
- grun
|
|
93
|
+
- gstudio
|
|
95
94
|
extensions: []
|
|
96
95
|
extra_rdoc_files: []
|
|
97
96
|
files:
|
|
@@ -487,7 +486,6 @@ metadata:
|
|
|
487
486
|
documentation_uri: https://rbotafogo.github.io/galaaz/
|
|
488
487
|
changelog_uri: https://github.com/rbotafogo/galaaz/blob/galaaz2_0/CHANGELOG.md
|
|
489
488
|
yard.run: yri
|
|
490
|
-
post_install_message:
|
|
491
489
|
rdoc_options: []
|
|
492
490
|
require_paths:
|
|
493
491
|
- lib
|
|
@@ -502,8 +500,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
502
500
|
- !ruby/object:Gem::Version
|
|
503
501
|
version: '0'
|
|
504
502
|
requirements: []
|
|
505
|
-
rubygems_version:
|
|
506
|
-
signing_key:
|
|
503
|
+
rubygems_version: 4.0.3
|
|
507
504
|
specification_version: 4
|
|
508
505
|
summary: 'R-on-Rails: tightly couple Ruby and GNU R for data science on the web'
|
|
509
506
|
test_files: []
|