galaaz 2.1.6 → 2.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e648f82c6009651209b9d83f4679a394c1bb37aedaaeab41fc35edbe4a87245b
4
- data.tar.gz: '097fec3901ebd4e65d8df655fb365ebae90478c04cada0bd48778fafb2ea7c19'
3
+ metadata.gz: 8cee9e5a57aa8b29ef17b8b525511b422cf8c06d5d486addaa025c981045f34e
4
+ data.tar.gz: 2e399270c32d42df217b966c5478434f28e9aa5844db4243ef440d07f162b097
5
5
  SHA512:
6
- metadata.gz: cc861f04cd57d1730ef7228dc9328a88bf951fd2e49fd704d9198a08a5f2410289cc976d83e05682682bbf136e66e6a0d81bad79e30f6e16fc72c4770e3492c9
7
- data.tar.gz: 658fab7d7dcdcd023679439111e15dcdee4ba5a565170fc9b50586687d26b40ca14a508f42e0a181f924c2c1465fa25bd7b13812f0817a7ea702122b741ce995
6
+ metadata.gz: 5d48ebe0a5e37459dd44237a9c0ceae8809718eb2f3396999ec6bb8123e524bf34f06e6da67467d8a0ef7b2955e99e5fc4099d14a46e56ef08e69cf25ca37c4e
7
+ data.tar.gz: 5e461b9065b98c347ef94665ecc809717e715da2145ebaab3410c4897c7dbc42df04492a932ada657b2b5767f3074a88c687dea2530875642f69803541b83a6b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## 2.1.7
4
+
5
+ ### Added
6
+
7
+ - **`galaaz omarchy`**: install the Omarchy menu overlay from files bundled in the gem
8
+ (`script/omarchy/` → `~/.local/bin` + `~/.config/omarchy/extensions/`).
9
+ - **`galaaz omarchy install --from-git [--ref REF]`**: same install, but pull overlay
10
+ files from GitHub (default ref `galaaz2_0`, or `GALAAZ_OMARCHY_REF`) without waiting
11
+ for a new gem release.
12
+ - **`galaaz omarchy status`**: report whether overlay helpers and menu jsonc are present.
13
+
3
14
  ## 2.1.6
4
15
 
5
16
  ### Fixed
data/lib/galaaz/cli.rb CHANGED
@@ -4,6 +4,7 @@ require 'fileutils'
4
4
  require 'rbconfig'
5
5
  require 'open3'
6
6
  require 'time'
7
+ require 'tmpdir'
7
8
 
8
9
  module Galaaz
9
10
  module CLI
@@ -15,6 +16,18 @@ module Galaaz
15
16
  DEFAULT_EXAMPLES_DIR = File.join(Dir.home, 'galaaz-examples')
16
17
  DEFAULT_LEDGER_DIR = File.join(Dir.home, 'r_on_rails_ledger')
17
18
  LEDGER_REPO = 'https://github.com/rbotafogo/r_on_rails_ledger.git'
19
+ OMARCHY_GITHUB_REPO = 'rbotafogo/galaaz'
20
+ OMARCHY_DEFAULT_GIT_REF = 'galaaz2_0'
21
+ # [source under script/omarchy/, dest basename under ~/.local/bin, executable?]
22
+ OMARCHY_BIN_FILES = [
23
+ ['install-galaaz.sh', 'omarchy-install-galaaz', true],
24
+ ['remove-galaaz.sh', 'omarchy-remove-galaaz', true],
25
+ ['galaaz-add.sh', 'omarchy-galaaz-add', true],
26
+ ['galaaz-guide.sh', 'omarchy-galaaz-guide', true],
27
+ ['galaaz-gknit.sh', 'omarchy-galaaz-gknit', true],
28
+ ['debug-galaaz.sh', 'omarchy-galaaz-debug', true]
29
+ ].freeze
30
+ OMARCHY_MENU_FILE = 'omarchy-menu.jsonc'
18
31
  BLOGS_MARKER = '.galaaz-blogs'
19
32
  EXAMPLES_MARKER = '.galaaz-examples'
20
33
  CRAN = 'https://cloud.r-project.org'
@@ -41,6 +54,8 @@ module Galaaz
41
54
  cmd_doctor
42
55
  when 'add'
43
56
  cmd_add(argv[1..])
57
+ when 'omarchy'
58
+ cmd_omarchy(argv[1..] || [])
44
59
  else
45
60
  # Legacy: `galaaz some:rake_task` forwarded to rake (see README / blogs).
46
61
  Dir.chdir(root) do
@@ -68,6 +83,9 @@ module Galaaz
68
83
  doctor Report Ruby, R, gatekeeper, Rcpp, sty, profiles
69
84
  add PROFILE Install an add-on (idempotent)
70
85
  Profiles: #{PROFILES.join(', ')}
86
+ omarchy [install] Install Omarchy menu overlay (bundled in gem)
87
+ Options: --from-git [--ref REF]
88
+ omarchy status Show whether overlay helpers are installed
71
89
 
72
90
  Legacy: any other argument is passed to rake in the Galaaz root
73
91
  (e.g. galaaz master_list:scatter_plot).
@@ -91,10 +109,146 @@ module Galaaz
91
109
  mark_profile!('core')
92
110
  puts 'galaaz setup: OK'
93
111
  puts "You can now run: galaaz doctor"
94
- puts 'Omarchy menu: Install Development Galaaz (add-ons appear after core)'
112
+ puts 'On Omarchy: galaaz omarchy # install menu overlay (gem-bundled)'
95
113
  0
96
114
  end
97
115
 
116
+ # ---- omarchy overlay ----
117
+
118
+ def cmd_omarchy(argv)
119
+ argv = argv.dup
120
+ case argv[0]
121
+ when nil, 'install'
122
+ argv.shift if argv[0] == 'install'
123
+ omarchy_install(argv)
124
+ when 'status'
125
+ omarchy_status
126
+ when '-h', '--help', 'help'
127
+ print_omarchy_help
128
+ 0
129
+ else
130
+ if argv[0].to_s.start_with?('-')
131
+ omarchy_install(argv)
132
+ else
133
+ raise CliError, "unknown omarchy subcommand: #{argv[0].inspect} (try: install|status)"
134
+ end
135
+ end
136
+ end
137
+
138
+ def print_omarchy_help
139
+ puts <<~HELP
140
+ Usage: galaaz omarchy [install|status] [options]
141
+
142
+ install Copy menu helpers from the gem (default)
143
+ install --from-git [--ref REF]
144
+ Pull script/omarchy from GitHub instead of the gem
145
+ Default REF: #{OMARCHY_DEFAULT_GIT_REF} (or GALAAZ_OMARCHY_REF)
146
+ status Show installed overlay paths
147
+
148
+ Writes:
149
+ ~/.local/bin/omarchy-install-galaaz (and add/remove/guide/gknit/debug)
150
+ ~/.config/omarchy/extensions/omarchy-menu.jsonc
151
+
152
+ Then: Super+Space → Install → Development → Galaaz
153
+ HELP
154
+ end
155
+
156
+ def omarchy_install(argv)
157
+ argv = argv.dup
158
+ from_git = argv.delete('--from-git') || argv.delete('--github')
159
+ ref = nil
160
+ if (i = argv.index('--ref'))
161
+ argv.delete_at(i)
162
+ ref = argv.delete_at(i)
163
+ raise CliError, '--ref requires a branch/tag/commit' if ref.nil? || ref.empty?
164
+ end
165
+ raise CliError, "unknown omarchy install args: #{argv.join(' ')}" unless argv.empty?
166
+
167
+ src =
168
+ if from_git
169
+ ref = ENV['GALAAZ_OMARCHY_REF'] if ref.nil? || ref.empty?
170
+ ref = OMARCHY_DEFAULT_GIT_REF if ref.nil? || ref.empty?
171
+ fetch_omarchy_overlay_from_git!(ref)
172
+ else
173
+ omarchy_overlay_dir_bundled
174
+ end
175
+
176
+ begin
177
+ install_omarchy_overlay_from!(src)
178
+ ensure
179
+ FileUtils.rm_rf(src) if from_git && src && src.start_with?(Dir.tmpdir)
180
+ end
181
+ puts 'galaaz omarchy: OK'
182
+ puts 'Next: Super+Space → Install → Development → Galaaz → Galaaz (core)'
183
+ puts 'Or: omarchy-install-galaaz'
184
+ 0
185
+ end
186
+
187
+ def omarchy_status
188
+ bin = File.expand_path('~/.local/bin')
189
+ menu = File.expand_path('~/.config/omarchy/extensions/omarchy-menu.jsonc')
190
+ puts 'galaaz omarchy status'
191
+ OMARCHY_BIN_FILES.each do |_src, dest, _exe|
192
+ path = File.join(bin, dest)
193
+ puts " #{dest}: #{File.file?(path) ? path : 'MISSING'}"
194
+ end
195
+ puts " menu: #{File.file?(menu) ? menu : 'MISSING'}"
196
+ bundled = File.join(root, 'script', 'omarchy')
197
+ puts " gem overlay: #{File.directory?(bundled) ? bundled : 'MISSING (reinstall gem)'}"
198
+ 0
199
+ end
200
+
201
+ def omarchy_overlay_dir_bundled
202
+ d = File.join(root, 'script', 'omarchy')
203
+ abort_unless(File.directory?(d), "Omarchy overlay missing from gem (#{d}). Reinstall galaaz.")
204
+ abort_unless(
205
+ File.file?(File.join(d, 'install-galaaz.sh')) && File.file?(File.join(d, OMARCHY_MENU_FILE)),
206
+ "incomplete Omarchy overlay in gem (#{d})"
207
+ )
208
+ d
209
+ end
210
+
211
+ def fetch_omarchy_overlay_from_git!(ref)
212
+ need_cmd!('curl')
213
+ tmp = Dir.mktmpdir('galaaz-omarchy-')
214
+ base = "https://raw.githubusercontent.com/#{OMARCHY_GITHUB_REPO}/#{ref}/script/omarchy"
215
+ puts "galaaz omarchy: fetching #{base}/…"
216
+ names = OMARCHY_BIN_FILES.map(&:first) + [OMARCHY_MENU_FILE]
217
+ names.uniq.each do |name|
218
+ url = "#{base}/#{name}"
219
+ dest = File.join(tmp, name)
220
+ ok = system('curl', '-fsSL', '-o', dest, url)
221
+ unless ok && File.file?(dest) && File.size(dest).positive?
222
+ FileUtils.rm_rf(tmp)
223
+ raise CliError, "failed to download #{url} (check --ref #{ref})"
224
+ end
225
+ puts " got #{name}"
226
+ end
227
+ tmp
228
+ end
229
+
230
+ def install_omarchy_overlay_from!(src_dir)
231
+ bin = File.expand_path('~/.local/bin')
232
+ ext = File.expand_path('~/.config/omarchy/extensions')
233
+ FileUtils.mkdir_p(bin)
234
+ FileUtils.mkdir_p(ext)
235
+
236
+ OMARCHY_BIN_FILES.each do |src_name, dest_name, executable|
237
+ src = File.join(src_dir, src_name)
238
+ abort_unless(File.file?(src), "missing #{src}")
239
+ dest = File.join(bin, dest_name)
240
+ FileUtils.cp(src, dest)
241
+ FileUtils.chmod(0o755, dest) if executable
242
+ puts "galaaz omarchy: #{dest}"
243
+ end
244
+
245
+ menu_src = File.join(src_dir, OMARCHY_MENU_FILE)
246
+ abort_unless(File.file?(menu_src), "missing #{menu_src}")
247
+ menu_dest = File.join(ext, OMARCHY_MENU_FILE)
248
+ FileUtils.cp(menu_src, menu_dest)
249
+ puts "galaaz omarchy: #{menu_dest}"
250
+ end
251
+
98
252
  # ---- blogs ----
99
253
 
100
254
  def cmd_blogs(argv)
@@ -0,0 +1,94 @@
1
+ # Omarchy dogfood (overlay + scripts)
2
+
3
+ Not an official Omarchy package. Community overlay for [TryOmarchy](https://tryomarchy.com/)
4
+ or a real Omarchy install. Works **with or without** an upstream Omarchy PR.
5
+
6
+ ## Recommended: `galaaz omarchy` (gem-bundled)
7
+
8
+ ```bash
9
+ gem install galaaz
10
+ galaaz setup
11
+ galaaz omarchy # A: copy overlay from this gem
12
+ # optional, newer overlay than the gem:
13
+ # galaaz omarchy install --from-git
14
+ # galaaz omarchy install --from-git --ref galaaz2_0
15
+ galaaz omarchy status
16
+ ```
17
+
18
+ Then Super+Space → Install → Development → **Galaaz**.
19
+
20
+ **Important:** `gem install galaaz` alone does **not** add an Omarchy menu until you run
21
+ `galaaz omarchy` (or an upstream catalog row exists).
22
+
23
+ ## Files
24
+
25
+ | File | Role |
26
+ |------|------|
27
+ | `install-galaaz.sh` | Core install; always writes `~/.local/share/galaaz/install-core.log` |
28
+ | `galaaz-guide.sh` | Guide / docs / knit-demo helper (`omarchy-galaaz-guide`) |
29
+ | `galaaz-add.sh` | Add-on wrapper (`omarchy-galaaz-add`) — pandoc without Arch Haskell stack |
30
+ | `galaaz-gknit.sh` | Safe HTML gknit helper |
31
+ | `debug-galaaz.sh` | Snapshot doctor/PATH/gem/bridge |
32
+ | `remove-galaaz.sh` | Uninstall gem + marked blogs; leave R |
33
+ | `omarchy-menu.jsonc` | Menu overlay submenu under Install → Development |
34
+
35
+ After core, the menu includes **Guide (what's next)**, **Documentation (website)**, and **GitHub repository**. After Knit, **Knit demo (oh_my)** runs an example blog.
36
+
37
+ Docs: https://rbotafogo.github.io/galaaz/ · https://github.com/rbotafogo/galaaz
38
+
39
+ Heavy CRAN installs (`R.install_and_loads`) and long R (`R::Job.eval` / `script`) run in a
40
+ child `Rscript` so the bridge stays free — see **Background R jobs (`R::Job`)** in the
41
+ README / manual (gem **2.1.7+**).
42
+
43
+ ## Manual copy (legacy)
44
+
45
+ Only if you cannot run `galaaz omarchy` yet:
46
+
47
+ ```bash
48
+ mkdir -p ~/.local/bin ~/.config/omarchy/extensions
49
+ cp install-galaaz.sh ~/.local/bin/omarchy-install-galaaz
50
+ cp remove-galaaz.sh ~/.local/bin/omarchy-remove-galaaz
51
+ cp galaaz-add.sh ~/.local/bin/omarchy-galaaz-add
52
+ cp galaaz-guide.sh ~/.local/bin/omarchy-galaaz-guide
53
+ cp galaaz-gknit.sh ~/.local/bin/omarchy-galaaz-gknit
54
+ cp debug-galaaz.sh ~/.local/bin/omarchy-galaaz-debug
55
+ cp omarchy-menu.jsonc ~/.config/omarchy/extensions/omarchy-menu.jsonc
56
+ chmod +x ~/.local/bin/omarchy-*
57
+ ```
58
+
59
+ ## TryOmarchy steps
60
+
61
+ 1. Install → Development → Ruby on Rails (mise Ruby).
62
+ 2. `gem install galaaz && galaaz setup && galaaz omarchy`
63
+ 3. Super+Space → search **Galaaz**, or Install → Development → **Galaaz** → **Galaaz (core)**.
64
+
65
+ That action must finish **gem + setup + blogs + doctor**. It fails if the gatekeeper `.so` is missing — “gem installed” alone is not success.
66
+
67
+ 4. After core finishes, the same submenu shows Knit / Arrow / TeX / Bio / Examples / Ledger.
68
+
69
+ 5. **Ledger (required dogfood / pitch):** Install → Development → **Galaaz → Ledger**
70
+ (or `omarchy-galaaz-add ledger` / `galaaz add ledger`). That pulls **arrow** if
71
+ needed using Apache’s **LIBARROW_BINARY** prebuilt libarrow (no manual steps;
72
+ Arch `pacman` arrow is not used for the R package — version skew breaks
73
+ configure), clones `~/r_on_rails_ledger`, rewrites any `path:` gem to RubyGems
74
+ galaaz, then `bundle install` + fast seed.
75
+
76
+ **Knit / TeX pandoc:** the add wrapper does **not** install Arch `pandoc` /
77
+ `pandoc-cli` (Haskell mega-deps; often fails on TryOmarchy). It uses
78
+ `pandoc-bin` when available, else the latest official GitHub linux tarball
79
+ into `~/.local/bin` (override with `PANDOC_RELEASE_VER=…`).
80
+
81
+ Pass when:
82
+
83
+ ```bash
84
+ grep galaaz ~/r_on_rails_ledger/Gemfile # no path: "../galaaz"
85
+ test -f ~/.config/galaaz/profiles/ledger
86
+ cd ~/r_on_rails_ledger && bin/dev
87
+ ```
88
+
89
+ Open http://localhost:3000 → portfolio → **Run stress test** (Local R / Arrow).
90
+
91
+ 6. Before the upstream Omarchy PR: wipe TryOmarchy (`%LOCALAPPDATA%\TryOmarchy`),
92
+ reinstall, and repeat steps 1–5 on a clean guest (plan Phase E, including Ledger).
93
+
94
+ See `Documentation/PLAN_OMARCHY_INTEGRATION.md` for full phases and tests (D-T10 / D-T11 / E-T3).
@@ -0,0 +1,91 @@
1
+ #!/bin/bash
2
+ # Collect Galaaz / Omarchy debug info into one file you can paste or copy out.
3
+ # Usage: bash debug-galaaz.sh
4
+ # Writes: ~/.local/share/galaaz/debug.log (+ Desktop copy if Desktop exists)
5
+ set -u
6
+
7
+ LOG_DIR="${HOME}/.local/share/galaaz"
8
+ OUT="${LOG_DIR}/debug.log"
9
+ mkdir -p "${LOG_DIR}"
10
+ : >"${OUT}"
11
+
12
+ say() { echo -e "$*" | tee -a "${OUT}"; }
13
+
14
+ say "=== galaaz debug $(date -Iseconds) ==="
15
+ say "user=$(id -un) home=${HOME}"
16
+ say "PATH=${PATH}"
17
+ say ""
18
+
19
+ say "== which =="
20
+ for c in ruby gem mise R Rscript make gcc g++ galaaz omarchy-install-galaaz; do
21
+ say " ${c}: $(command -v "${c}" 2>/dev/null || echo MISSING)"
22
+ done
23
+
24
+ say ""
25
+ say "== versions =="
26
+ { ruby -v; gem -v; mise -v; R --version | head -1; } >>"${OUT}" 2>&1 || true
27
+ say "RUBY_ENGINE=$(ruby -e 'print RUBY_ENGINE' 2>/dev/null || echo '?')"
28
+ if command -v mise >/dev/null 2>&1; then
29
+ say "mise ruby -v: $(mise x ruby -- ruby -v 2>/dev/null || echo fail)"
30
+ say "mise engine: $(mise x ruby -- ruby -e 'print RUBY_ENGINE' 2>/dev/null || echo fail)"
31
+ mise ls >>"${OUT}" 2>&1 || true
32
+ fi
33
+
34
+ say ""
35
+ say "== gem galaaz =="
36
+ {
37
+ gem list galaaz
38
+ gem which galaaz 2>/dev/null || true
39
+ ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path" 2>/dev/null || echo 'gem root: FAIL'
40
+ if command -v mise >/dev/null 2>&1; then
41
+ echo '--- mise x ruby ---'
42
+ mise x ruby -- gem list galaaz
43
+ mise x ruby -- ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path"
44
+ fi
45
+ } >>"${OUT}" 2>&1 || true
46
+
47
+ ROOT="$(ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path" 2>/dev/null || true)"
48
+ if [[ -z "${ROOT}" ]] && command -v mise >/dev/null 2>&1; then
49
+ ROOT="$(mise x ruby -- ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path" 2>/dev/null || true)"
50
+ fi
51
+ say "gem root: ${ROOT:-UNKNOWN}"
52
+ if [[ -n "${ROOT}" ]]; then
53
+ BRIDGE="${ROOT}/ext/new_bridge"
54
+ say "bridge: ${BRIDGE}"
55
+ ls -la "${BRIDGE}" >>"${OUT}" 2>&1 || say "bridge ls FAILED"
56
+ SO="${BRIDGE}/galaaz_gatekeeper.so"
57
+ say "gatekeeper: ${SO} exists=$([[ -f ${SO} ]] && echo YES || echo NO)"
58
+ fi
59
+
60
+ say ""
61
+ say "== galaaz doctor =="
62
+ {
63
+ command -v galaaz && galaaz doctor
64
+ [[ -x "${HOME}/.local/bin/galaaz" ]] && echo '--- ~/.local/bin/galaaz ---' && "${HOME}/.local/bin/galaaz" doctor
65
+ command -v mise && mise x ruby -- ruby -S galaaz doctor
66
+ } >>"${OUT}" 2>&1 || true
67
+
68
+ say ""
69
+ say "== profiles / blogs =="
70
+ ls -la "${HOME}/.config/galaaz/profiles" >>"${OUT}" 2>&1 || say "no profiles dir"
71
+ ls -la "${HOME}/galaaz-blogs" >>"${OUT}" 2>&1 || say "no galaaz-blogs"
72
+ say "install-core.log present=$([[ -f ${LOG_DIR}/install-core.log ]] && echo YES || echo NO)"
73
+
74
+ say ""
75
+ say "== prior install-core.log (tail 80) =="
76
+ if [[ -f "${LOG_DIR}/install-core.log" ]]; then
77
+ tail -n 80 "${LOG_DIR}/install-core.log" | tee -a "${OUT}"
78
+ else
79
+ say "(none yet — run omarchy-install-galaaz first)"
80
+ fi
81
+
82
+ for d in "${HOME}/Desktop" "${HOME}/desktop"; do
83
+ if [[ -d "${d}" ]]; then
84
+ cp "${OUT}" "${d}/galaaz-debug.log"
85
+ say "copied to ${d}/galaaz-debug.log"
86
+ fi
87
+ done
88
+
89
+ say ""
90
+ say "FULL DEBUG LOG: ${OUT}"
91
+ say "Paste that file contents back for diagnosis."
@@ -0,0 +1,176 @@
1
+ #!/bin/bash
2
+ # Omarchy wrapper for `galaaz add PROFILE`.
3
+ # - Installs system deps the gem cannot (e.g. pandoc for knit)
4
+ # - Keeps the TUI open on success/failure so errors are readable
5
+ #
6
+ # Usage: omarchy-galaaz-add knit|arrow|tex|bio|examples|ledger|demo
7
+ set -euo pipefail
8
+
9
+ PROFILE="${1:-}"
10
+ if [[ -z "${PROFILE}" ]]; then
11
+ echo "Usage: omarchy-galaaz-add <profile>"
12
+ echo "Profiles: knit arrow tex bio examples ledger demo"
13
+ exit 1
14
+ fi
15
+
16
+ GALAAZ="${HOME}/.local/bin/galaaz"
17
+ [[ -x "${GALAAZ}" ]] || GALAAZ="galaaz"
18
+
19
+ # Prefer user-local bin (installer / static pandoc land here).
20
+ export PATH="${HOME}/.local/bin:${PATH}"
21
+
22
+ # Official static release — avoid Arch extra/pandoc|pandoc-cli (pulls ~200 Haskell pkgs
23
+ # and often fails on TryOmarchy nested VMs).
24
+ # Default: latest GitHub release. Pin with PANDOC_RELEASE_VER=3.6.4 if needed.
25
+ latest_pandoc_ver() {
26
+ if [[ -n "${PANDOC_RELEASE_VER:-}" ]]; then
27
+ echo "${PANDOC_RELEASE_VER}"
28
+ return 0
29
+ fi
30
+ local ver
31
+ ver="$(
32
+ curl -fsSL https://api.github.com/repos/jgm/pandoc/releases/latest \
33
+ | sed -n 's/.*"tag_name"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/p' \
34
+ | head -1
35
+ )"
36
+ if [[ -z "${ver}" ]]; then
37
+ echo "ERROR: could not resolve latest pandoc release from GitHub API" >&2
38
+ return 1
39
+ fi
40
+ echo "${ver}"
41
+ }
42
+
43
+ # Install pandoc without Arch's Haskell stack. Order:
44
+ # 1) already on PATH 2) AUR pandoc-bin 3) GitHub linux tarball → ~/.local/bin
45
+ ensure_pandoc() {
46
+ if command -v pandoc >/dev/null 2>&1; then
47
+ echo "pandoc: $(pandoc --version | head -1) (already installed)"
48
+ return 0
49
+ fi
50
+
51
+ echo "==> pandoc missing — installing (not Arch pandoc / pandoc-cli)"
52
+
53
+ if command -v omarchy-pkg-add >/dev/null 2>&1; then
54
+ echo "==> try: omarchy-pkg-add pandoc-bin"
55
+ if omarchy-pkg-add pandoc-bin && command -v pandoc >/dev/null 2>&1; then
56
+ echo "pandoc: $(pandoc --version | head -1) (pandoc-bin)"
57
+ return 0
58
+ fi
59
+ echo "WARN: pandoc-bin via omarchy-pkg-add failed; trying GitHub binary" >&2
60
+ elif command -v yay >/dev/null 2>&1; then
61
+ echo "==> try: yay -S pandoc-bin"
62
+ if yay -S --noconfirm --needed pandoc-bin && command -v pandoc >/dev/null 2>&1; then
63
+ echo "pandoc: $(pandoc --version | head -1) (pandoc-bin)"
64
+ return 0
65
+ fi
66
+ echo "WARN: yay pandoc-bin failed; trying GitHub binary" >&2
67
+ fi
68
+
69
+ local arch asset url tmp ver
70
+ case "$(uname -m)" in
71
+ x86_64|amd64) arch="amd64" ;;
72
+ aarch64|arm64) arch="arm64" ;;
73
+ *)
74
+ echo "ERROR: unsupported arch $(uname -m) for pandoc binary; install pandoc yourself" >&2
75
+ return 1
76
+ ;;
77
+ esac
78
+
79
+ if ! ver="$(latest_pandoc_ver)"; then
80
+ return 1
81
+ fi
82
+ echo "==> pandoc release: ${ver}"
83
+
84
+ asset="pandoc-${ver}-linux-${arch}.tar.gz"
85
+ url="https://github.com/jgm/pandoc/releases/download/${ver}/${asset}"
86
+ tmp="$(mktemp -d)"
87
+ echo "==> download: ${url}"
88
+ if ! curl -fsSL -o "${tmp}/${asset}" "${url}"; then
89
+ echo "ERROR: failed to download pandoc ${ver}" >&2
90
+ rm -rf "${tmp}"
91
+ return 1
92
+ fi
93
+ tar -xzf "${tmp}/${asset}" -C "${tmp}"
94
+ mkdir -p "${HOME}/.local/bin"
95
+ if ! cp "${tmp}/pandoc-${ver}/bin/pandoc" "${HOME}/.local/bin/pandoc"; then
96
+ echo "ERROR: pandoc binary missing from tarball" >&2
97
+ rm -rf "${tmp}"
98
+ return 1
99
+ fi
100
+ chmod +x "${HOME}/.local/bin/pandoc"
101
+ rm -rf "${tmp}"
102
+
103
+ if ! command -v pandoc >/dev/null 2>&1; then
104
+ echo "ERROR: pandoc still not on PATH after install to ~/.local/bin" >&2
105
+ return 1
106
+ fi
107
+ echo "pandoc: $(pandoc --version | head -1) (~/.local/bin, static)"
108
+ return 0
109
+ }
110
+
111
+ pause() {
112
+ local st=$1
113
+ echo
114
+ if [[ "${st}" -ne 0 ]]; then
115
+ echo "FAILED (exit ${st}). Read the messages above, then press Enter to close."
116
+ else
117
+ echo "OK. Press Enter to close."
118
+ fi
119
+ read -r _ || true
120
+ exit "${st}"
121
+ }
122
+
123
+ echo "=== galaaz add ${PROFILE} ==="
124
+ echo
125
+
126
+ case "${PROFILE}" in
127
+ knit)
128
+ # rmarkdown/gknit need system pandoc >= 2.8 — not shipped by CRAN packages alone.
129
+ echo "==> system: pandoc"
130
+ if ! ensure_pandoc; then
131
+ pause 1
132
+ fi
133
+ ;;
134
+ tex)
135
+ echo "==> system: pandoc (TinyTeX is installed by galaaz add tex)"
136
+ if ! ensure_pandoc; then
137
+ pause 1
138
+ fi
139
+ ;;
140
+ arrow|ledger|demo)
141
+ # R package arrow: do NOT rely on pacman "arrow" for linking — Arch libarrow
142
+ # often lags CRAN and breaks configure. galaaz add arrow sets LIBARROW_BINARY
143
+ # (Apache version-matched prebuilt). Export here too so a stale gem still works
144
+ # if the user only refreshed this wrapper.
145
+ export LIBARROW_BINARY=true
146
+ export NOT_CRAN=true
147
+ export LIBARROW_BUILD=false
148
+ export ARROW_USE_PKG_CONFIG=false
149
+ echo "==> arrow env: LIBARROW_BINARY=true LIBARROW_BUILD=false ARROW_USE_PKG_CONFIG=false"
150
+ ;;
151
+ bio|examples) ;;
152
+ *)
153
+ echo "Unknown profile: ${PROFILE}" >&2
154
+ pause 1
155
+ ;;
156
+ esac
157
+
158
+ echo "==> ${GALAAZ} add ${PROFILE}"
159
+ set +e
160
+ "${GALAAZ}" add "${PROFILE}"
161
+ st=$?
162
+ set -e
163
+
164
+ if [[ "${PROFILE}" == "knit" && "${st}" -eq 0 ]]; then
165
+ echo
166
+ echo "Try: gknit ~/galaaz-blogs/oh_my/oh_my.Rmd"
167
+ echo "Or menu: Knit demo (oh_my)"
168
+ fi
169
+
170
+ if [[ "${PROFILE}" == "ledger" && "${st}" -eq 0 ]]; then
171
+ echo
172
+ echo "Try: cd ~/r_on_rails_ledger && bin/dev"
173
+ echo "Then http://localhost:3000 — portfolio → Run stress test"
174
+ fi
175
+
176
+ pause "${st}"
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+ # Safe/debug gknit for Omarchy: force HTML, log everything, keep the window open.
3
+ #
4
+ # Usage:
5
+ # omarchy-galaaz-gknit [path/to/file.Rmd]
6
+ # omarchy-galaaz-gknit ~/galaaz-blogs/gknit/gknit.Rmd
7
+ #
8
+ # Many shipped blogs list pdf_document before html_document in YAML. A bare
9
+ # `gknit file.Rmd` then tries PDF first (LaTeX) — that often fails hard or OOMs
10
+ # a small VM. This wrapper always requests html_document and tees a log.
11
+ set -uo pipefail
12
+
13
+ LOG_DIR="${HOME}/.local/share/galaaz"
14
+ LOG="${LOG_DIR}/gknit-debug.log"
15
+ mkdir -p "${LOG_DIR}"
16
+
17
+ RMD="${1:-${HOME}/galaaz-blogs/oh_my/oh_my.Rmd}"
18
+ if [[ ! -f "${RMD}" ]]; then
19
+ echo "Missing Rmd: ${RMD}"
20
+ echo "Press Enter to close..."
21
+ read -r _ || true
22
+ exit 1
23
+ fi
24
+
25
+ {
26
+ echo "=== gknit debug $(date -Iseconds) ==="
27
+ echo "rmd: ${RMD}"
28
+ echo "cwd: $(pwd)"
29
+ echo "forcing: --output_format html_document"
30
+ echo "log: ${LOG}"
31
+ command -v pandoc >/dev/null && pandoc --version | head -1 || echo "pandoc: MISSING"
32
+ command -v gknit >/dev/null && echo "gknit: $(command -v gknit)" || echo "gknit: via mise/wrapper"
33
+ free -h 2>/dev/null | head -2 || true
34
+ echo
35
+ } | tee "${LOG}"
36
+
37
+ # Prefer HTML explicitly — do not let YAML's pdf_document win.
38
+ set +e
39
+ (
40
+ cd "$(dirname "${RMD}")" || exit 1
41
+ base="$(basename "${RMD}")"
42
+ if command -v mise >/dev/null 2>&1; then
43
+ mise x ruby -- gknit --output_format html_document --no_clean "${base}"
44
+ else
45
+ gknit --output_format html_document --no_clean "${base}"
46
+ fi
47
+ ) 2>&1 | tee -a "${LOG}"
48
+ st=${PIPESTATUS[0]}
49
+ set -e
50
+
51
+ {
52
+ echo
53
+ echo "exit: ${st}"
54
+ echo "--- recent kernel/OOM hints (if any) ---"
55
+ dmesg -T 2>/dev/null | grep -iE 'oom|killed process|out of memory' | tail -5 || echo "(no dmesg access or no OOM lines)"
56
+ html="${RMD%.Rmd}.html"
57
+ if [[ -f "${html}" ]]; then
58
+ echo "html: ${html}"
59
+ else
60
+ echo "html: not found (knit likely failed before write)"
61
+ fi
62
+ echo "FULL LOG: ${LOG}"
63
+ } | tee -a "${LOG}"
64
+
65
+ echo
66
+ if [[ "${st}" -ne 0 ]]; then
67
+ echo "FAILED (exit ${st}). Scroll up or: less ${LOG}"
68
+ else
69
+ echo "OK."
70
+ fi
71
+ echo "Press Enter to close (so a crash mid-run still leaves this log on disk)..."
72
+ read -r _ || true
73
+ exit "${st}"
@@ -0,0 +1,123 @@
1
+ #!/bin/bash
2
+ # Omarchy helpers for Galaaz discovery (docs + example knits).
3
+ # Installed as ~/.local/bin/omarchy-galaaz-guide (and thin aliases).
4
+ set -euo pipefail
5
+
6
+ DOCS_WEB="https://rbotafogo.github.io/galaaz/"
7
+ DOCS_GH="https://github.com/rbotafogo/galaaz"
8
+ DOCS_README="https://github.com/rbotafogo/galaaz/blob/galaaz2_0/README.md"
9
+ DOCS_OMARCHY="https://github.com/rbotafogo/galaaz/blob/galaaz2_0/script/omarchy/README.md"
10
+ BLOGS="${HOME}/galaaz-blogs"
11
+ GALAAZ_BIN="${HOME}/.local/bin/galaaz"
12
+ [[ -x "${GALAAZ_BIN}" ]] || GALAAZ_BIN="galaaz"
13
+
14
+ open_url() {
15
+ local url="$1"
16
+ # Omarchy Learn menu uses launch-webapp; try browser helpers before xdg-open.
17
+ if command -v omarchy-launch-webapp >/dev/null 2>&1; then
18
+ omarchy-launch-webapp "${url}"
19
+ elif command -v omarchy-launch-browser >/dev/null 2>&1; then
20
+ omarchy-launch-browser "${url}"
21
+ elif command -v omarchy-launch-web >/dev/null 2>&1; then
22
+ omarchy-launch-web "${url}"
23
+ elif command -v xdg-open >/dev/null 2>&1; then
24
+ xdg-open "${url}" >/dev/null 2>&1 &
25
+ elif command -v open >/dev/null 2>&1; then
26
+ open "${url}"
27
+ else
28
+ echo "Open in a browser: ${url}"
29
+ return 1
30
+ fi
31
+ }
32
+
33
+ cmd="${1:-tips}"
34
+ case "${cmd}" in
35
+ tips|guide|help|"")
36
+ cat <<EOF
37
+
38
+ Galaaz — what you can do next
39
+ =============================
40
+
41
+ Core is installed. Blog sources live in:
42
+ ${BLOGS}
43
+
44
+ Documentation
45
+ Website: ${DOCS_WEB}
46
+ GitHub: ${DOCS_GH}
47
+ README: ${DOCS_README}
48
+
49
+ After: galaaz add knit (Install → Development → Galaaz → Knit)
50
+ Needs system pandoc (Omarchy installs it via omarchy-galaaz-add knit).
51
+ Example knits (HTML — force html_document; bare gknit may try PDF first):
52
+ gknit --output_format html_document ${BLOGS}/oh_my/oh_my.Rmd
53
+ gknit --output_format html_document ${BLOGS}/gknit/gknit.Rmd
54
+ omarchy-galaaz-gknit ${BLOGS}/gknit/gknit.Rmd # logged, HTML-only, waits
55
+
56
+ Or from the menu: Knit demo (oh_my)
57
+
58
+ Other add-ons
59
+ galaaz add arrow # Apache Arrow
60
+ galaaz add ledger # R-on-Rails demo app → ~/r_on_rails_ledger && bin/dev
61
+ galaaz add examples # Ruby examples → ~/galaaz-examples
62
+ galaaz add tex # TinyTeX / PDF (large)
63
+ galaaz add bio # Bioconductor DESeq2 (large)
64
+
65
+ Check: galaaz doctor
66
+ Menu: Super+Space → Install → Development → Galaaz
67
+
68
+ Heavy CRAN installs / long R (gem 2.1.7+): R::Job keeps the bridge free.
69
+ See README → “Background R jobs (R::Job)” (${DOCS_README})
70
+
71
+ EOF
72
+ if [[ -d "${BLOGS}" ]]; then
73
+ echo "Blog folders found:"
74
+ ls -1 "${BLOGS}" 2>/dev/null | sed 's/^/ /' || true
75
+ echo
76
+ fi
77
+ echo "Press Enter to close..."
78
+ read -r _ || true
79
+ ;;
80
+ docs|web)
81
+ echo "Opening ${DOCS_WEB}"
82
+ open_url "${DOCS_WEB}"
83
+ ;;
84
+ github|gh)
85
+ echo "Opening ${DOCS_GH}"
86
+ open_url "${DOCS_GH}"
87
+ ;;
88
+ knit-demo|demo)
89
+ rmd="${BLOGS}/oh_my/oh_my.Rmd"
90
+ if [[ ! -f "${rmd}" ]]; then
91
+ echo "Missing ${rmd}"
92
+ echo "Run core install first (blogs init), then: galaaz add knit"
93
+ exit 1
94
+ fi
95
+ if [[ ! -f "${HOME}/.config/galaaz/profiles/knit" ]]; then
96
+ echo "Knit profile not installed yet. Run: galaaz add knit"
97
+ exit 1
98
+ fi
99
+ # Prefer debug wrapper (HTML-only + log) when installed.
100
+ if [[ -x "${HOME}/.local/bin/omarchy-galaaz-gknit" ]]; then
101
+ exec "${HOME}/.local/bin/omarchy-galaaz-gknit" "${rmd}"
102
+ fi
103
+ echo "Knitting demo (HTML only): ${rmd}"
104
+ if command -v mise >/dev/null 2>&1; then
105
+ mise x ruby -- gknit --output_format html_document "${rmd}"
106
+ elif command -v gknit >/dev/null 2>&1; then
107
+ gknit --output_format html_document "${rmd}"
108
+ else
109
+ ruby -S gknit --output_format html_document "${rmd}"
110
+ fi
111
+ html="${BLOGS}/oh_my/oh_my.html"
112
+ if [[ -f "${html}" ]]; then
113
+ echo "Wrote ${html}"
114
+ open_url "file://${html}"
115
+ fi
116
+ echo "Press Enter to close..."
117
+ read -r _ || true
118
+ ;;
119
+ *)
120
+ echo "Usage: omarchy-galaaz-guide [tips|docs|github|knit-demo]"
121
+ exit 1
122
+ ;;
123
+ esac
@@ -0,0 +1,308 @@
1
+ #!/bin/bash
2
+ # Omarchy-shaped core installer for Galaaz (R-on-Rails).
3
+ # omarchy:summary=Install Galaaz (R-on-Rails)
4
+ # omarchy:name=galaaz
5
+ #
6
+ # Debug log (always written, even if TUI tee fails):
7
+ # ~/.local/share/galaaz/install-core.log
8
+ set -euo pipefail
9
+
10
+ # Optional pin: GALAAZ_GEM_VERSION=2.1.2 omarchy-install-galaaz
11
+ # Default: latest from RubyGems (Omarchy/Rails shape).
12
+ GALAAZ_GEM_VERSION="${GALAAZ_GEM_VERSION:-}"
13
+ LOG_DIR="${HOME}/.local/share/galaaz"
14
+ LOG="${LOG_DIR}/install-core.log"
15
+ mkdir -p "${LOG_DIR}"
16
+
17
+ # Plain file logging — process-substitution tee often dies under omarchy-launch-tui.
18
+ : >"${LOG}"
19
+ log() {
20
+ # shellcheck disable=SC3037
21
+ echo -e "$*" | tee -a "${LOG}"
22
+ }
23
+ log_cmd() {
24
+ log "+ $*"
25
+ # Capture status without aborting set -e mid-pipeline awkwardly
26
+ set +e
27
+ "$@" >>"${LOG}" 2>&1
28
+ local st=$?
29
+ set -e
30
+ if [[ ${st} -ne 0 ]]; then
31
+ log "ERROR: command failed (exit ${st}): $*"
32
+ log "---- last 40 log lines ----"
33
+ tail -n 40 "${LOG}" | tee -a /dev/tty 2>/dev/null || tail -n 40 "${LOG}"
34
+ fi
35
+ return "${st}"
36
+ }
37
+
38
+ on_err() {
39
+ local st=$?
40
+ log ""
41
+ log "FAILED (exit ${st}) at line ${BASH_LINENO[0]:-?} — see full log:"
42
+ log " ${LOG}"
43
+ log "Copy out with: cat ${LOG}"
44
+ exit "${st}"
45
+ }
46
+ trap on_err ERR
47
+
48
+ log "=== galaaz core install $(date -Iseconds) ==="
49
+ log "log file: ${LOG}"
50
+ log "script: ${BASH_SOURCE[0]}"
51
+ log "pwd: $(pwd)"
52
+ log "user: $(id -un) home=${HOME}"
53
+ log "PATH: ${PATH}"
54
+ log "GALAAZ_GEM_VERSION=${GALAAZ_GEM_VERSION:-latest}"
55
+ log ""
56
+
57
+ pkg_add() {
58
+ if command -v omarchy-pkg-add >/dev/null 2>&1; then
59
+ log_cmd omarchy-pkg-add "$@"
60
+ elif command -v pacman >/dev/null 2>&1; then
61
+ log_cmd sudo pacman -S --noconfirm --needed "$@"
62
+ else
63
+ log "WARN: skipping Arch packages ($*); install GNU R + build tools yourself"
64
+ fi
65
+ }
66
+
67
+ log "==> packages"
68
+ pkg_add r make gcc gcc-libs libyaml pkgconf
69
+
70
+ if ! command -v ruby >/dev/null 2>&1; then
71
+ if command -v mise >/dev/null 2>&1; then
72
+ mise settings add ruby.compile false 2>/dev/null || true
73
+ mise settings add idiomatic_version_file_enable_tools ruby 2>/dev/null || true
74
+ log_cmd mise use --global ruby@latest
75
+ else
76
+ log "ERROR: ruby not found and mise missing"
77
+ exit 1
78
+ fi
79
+ fi
80
+
81
+ if command -v mise >/dev/null 2>&1; then
82
+ if ! mise x ruby -- ruby -e 'exit(RUBY_ENGINE == "ruby" ? 0 : 1)' 2>/dev/null; then
83
+ log "Active Ruby is not CRuby; installing MRI via mise..."
84
+ mise use --global ruby@3.4 2>/dev/null || mise use --global ruby@latest
85
+ fi
86
+ if ! mise x ruby -- ruby -e 'exit(RUBY_ENGINE == "ruby" ? 0 : 1)'; then
87
+ log "ERROR: need CRuby (MRI) for the gatekeeper .so"
88
+ mise x ruby -- ruby -v >>"${LOG}" 2>&1 || true
89
+ exit 1
90
+ fi
91
+ fi
92
+
93
+ if ! command -v R >/dev/null 2>&1 || ! command -v Rscript >/dev/null 2>&1; then
94
+ log "ERROR: R/Rscript missing after package install"
95
+ log "which R: $(command -v R || echo none) Rscript: $(command -v Rscript || echo none)"
96
+ exit 1
97
+ fi
98
+
99
+ log "R: $(R --version 2>/dev/null | head -1)"
100
+ log "RHOME: $(R RHOME 2>/dev/null || echo '?')"
101
+ log "ruby: $(mise x ruby -- ruby -v 2>/dev/null || ruby -v)"
102
+ log "engine: $(mise x ruby -- ruby -e 'print RUBY_ENGINE' 2>/dev/null || ruby -e 'print RUBY_ENGINE')"
103
+
104
+ # Arch/Omarchy: system R library (/usr/lib/R/library) is root-only.
105
+ # Without a user lib, install.packages("Rcpp") fails with "lib is not writable".
106
+ ensure_user_r_lib() {
107
+ export R_LIBS_USER="${R_LIBS_USER:-${HOME}/.local/lib/R/library}"
108
+ mkdir -p "${R_LIBS_USER}"
109
+ local renviron="${HOME}/.Renviron"
110
+ if [[ ! -f "${renviron}" ]] || ! grep -q '^R_LIBS_USER=' "${renviron}" 2>/dev/null; then
111
+ echo "R_LIBS_USER=${R_LIBS_USER}" >>"${renviron}"
112
+ fi
113
+ log "R_LIBS_USER=${R_LIBS_USER}"
114
+ log "Renviron: ${renviron}"
115
+ }
116
+ ensure_user_r_lib
117
+
118
+ {
119
+ echo "---- R CMD config ----"
120
+ R CMD config CXX || true
121
+ R CMD config CXXFLAGS || true
122
+ R CMD config --cppflags || true
123
+ R CMD config --ldflags || true
124
+ echo "---- which ----"
125
+ command -v make; command -v gcc; command -v g++; command -v mise || true
126
+ command -v ruby; command -v gem || true
127
+ mise ls 2>/dev/null || true
128
+ echo "---- .libPaths ----"
129
+ Rscript -e '.libPaths()' || true
130
+ } >>"${LOG}" 2>&1
131
+
132
+ echo "gem: --no-document" >"${HOME}/.gemrc"
133
+
134
+ run_ruby() {
135
+ if command -v mise >/dev/null 2>&1; then
136
+ mise x ruby -- "$@"
137
+ else
138
+ "$@"
139
+ fi
140
+ }
141
+
142
+ gem_root() {
143
+ run_ruby ruby -e "puts Gem::Specification.find_by_name('galaaz').full_gem_path"
144
+ }
145
+
146
+ gatekeeper_path() {
147
+ run_ruby ruby -e "puts File.join(Gem::Specification.find_by_name('galaaz').full_gem_path, 'ext', 'new_bridge', 'galaaz_gatekeeper.so')"
148
+ }
149
+
150
+ # Invoke gem CLI without `ruby -S galaaz` (that finds ~/.local/bin/galaaz wrapper).
151
+ galaaz_cli() {
152
+ run_ruby ruby -e 'load Gem.activate_bin_path("galaaz", "galaaz")' -- "$@"
153
+ }
154
+
155
+ install_wrapper() {
156
+ mkdir -p "${HOME}/.local/bin"
157
+ cat >"${HOME}/.local/bin/galaaz" <<'WRAP'
158
+ #!/bin/bash
159
+ set -euo pipefail
160
+ # Do not use `ruby -S galaaz`: PATH often includes this wrapper → LoadError.
161
+ if command -v mise >/dev/null 2>&1; then
162
+ exec mise x ruby -- ruby -e 'load Gem.activate_bin_path("galaaz", "galaaz")' -- "$@"
163
+ fi
164
+ exec ruby -e 'load Gem.activate_bin_path("galaaz", "galaaz")' -- "$@"
165
+ WRAP
166
+ chmod +x "${HOME}/.local/bin/galaaz"
167
+ log "wrapper: ${HOME}/.local/bin/galaaz"
168
+ }
169
+
170
+ run_ruby gem uninstall galaaz -x -a --ignore-dependencies >>"${LOG}" 2>&1 || true
171
+ if [[ -n "${GALAAZ_GEM_VERSION}" ]]; then
172
+ log "==> gem install galaaz -v ${GALAAZ_GEM_VERSION}"
173
+ set +e
174
+ run_ruby gem install galaaz -v "${GALAAZ_GEM_VERSION}" --no-document --source https://rubygems.org 2>&1 | tee -a "${LOG}"
175
+ st=${PIPESTATUS[0]}
176
+ set -e
177
+ [[ ${st} -eq 0 ]] || exit "${st}"
178
+ else
179
+ LATEST="$(curl -fsSL https://rubygems.org/api/v1/versions/galaaz/latest.json 2>/dev/null \
180
+ | sed -n 's/.*"version":"\([^"]*\)".*/\1/p' || true)"
181
+ if [[ -n "${LATEST}" ]]; then
182
+ log "==> gem install galaaz ${LATEST} (latest on RubyGems)"
183
+ else
184
+ log "==> gem install galaaz (latest on RubyGems)"
185
+ fi
186
+ set +e
187
+ run_ruby gem install galaaz --no-document --source https://rubygems.org 2>&1 | tee -a "${LOG}"
188
+ st=${PIPESTATUS[0]}
189
+ set -e
190
+ [[ ${st} -eq 0 ]] || exit "${st}"
191
+ fi
192
+
193
+ INSTALLED="$(run_ruby ruby -e "puts Gem::Specification.find_by_name('galaaz').version")"
194
+ log "installed galaaz ${INSTALLED}"
195
+
196
+ ROOT="$(gem_root)"
197
+ BRIDGE="${ROOT}/ext/new_bridge"
198
+ log "gem root: ${ROOT}"
199
+ log "bridge: ${BRIDGE}"
200
+ ls -la "${BRIDGE}" >>"${LOG}" 2>&1 || true
201
+ if [[ ! -f "${BRIDGE}/Makefile" ]]; then
202
+ log "ERROR: bridge Makefile missing: ${BRIDGE}/Makefile"
203
+ exit 1
204
+ fi
205
+
206
+ log "==> ensure Rcpp (CRAN, user library)"
207
+ log_cmd Rscript -e "
208
+ lib <- Sys.getenv('R_LIBS_USER')
209
+ if (!nzchar(lib)) lib <- file.path(Sys.getenv('HOME'), '.local', 'lib', 'R', 'library')
210
+ dir.create(lib, recursive=TRUE, showWarnings=FALSE)
211
+ .libPaths(c(lib, .libPaths()))
212
+ if (!requireNamespace('Rcpp', quietly=TRUE))
213
+ install.packages('Rcpp', lib=lib, repos='https://cloud.r-project.org')
214
+ cat('Rcpp=', requireNamespace('Rcpp', quietly=TRUE), ' lib=', lib, '\n', sep='')
215
+ if (!requireNamespace('Rcpp', quietly=TRUE)) quit(status=1)
216
+ "
217
+
218
+ log "==> build gatekeeper (make -C ext/new_bridge)"
219
+ rm -f "${BRIDGE}/galaaz_gatekeeper.so" "${BRIDGE}"/*.o
220
+
221
+ # Older gems hardcoded -L$(R_HOME)/lib -lR which fails on Arch (RHOME=/usr/lib64/R).
222
+ # 2.1.2+ ships a fixed Makefile; still override LDFLAGS for safety.
223
+ R_LDFLAGS="$(R CMD config --ldflags)"
224
+ log "R CMD config --ldflags: ${R_LDFLAGS}"
225
+ log "Rcpp include: $(Rscript -e "cat(system.file('include', package='Rcpp'))")"
226
+ if grep -q 'LDFLAGS := -L\$(R_HOME)/lib -lR' "${BRIDGE}/Makefile" 2>/dev/null; then
227
+ log "patching gem Makefile LDFLAGS for Arch/Omarchy"
228
+ sed -i 's|^LDFLAGS := -L\$(R_HOME)/lib -lR.*|LDFLAGS := \$(shell R CMD config --ldflags) -Wl,-rpath,\$(R_HOME)/lib|' "${BRIDGE}/Makefile" || true
229
+ fi
230
+
231
+ set +e
232
+ make -C "${BRIDGE}" all LDFLAGS="${R_LDFLAGS} -Wl,-rpath,$(R RHOME)/lib" 2>&1 | tee -a "${LOG}"
233
+ make_st=${PIPESTATUS[0]}
234
+ set -e
235
+ if [[ ${make_st} -ne 0 ]]; then
236
+ log "ERROR: make failed (exit ${make_st}) — retry verbose"
237
+ make -C "${BRIDGE}" all LDFLAGS="${R_LDFLAGS} -Wl,-rpath,$(R RHOME)/lib" 2>&1 | tee -a "${LOG}" || true
238
+ log "---- bridge dir ----"
239
+ ls -la "${BRIDGE}" 2>&1 | tee -a "${LOG}" || true
240
+ log "Full log: ${LOG}"
241
+ exit 1
242
+ fi
243
+
244
+ SO="$(gatekeeper_path)"
245
+ log "expected so: ${SO}"
246
+ ls -la "${SO}" >>"${LOG}" 2>&1 || true
247
+ if [[ ! -f "${SO}" ]]; then
248
+ log "ERROR: gatekeeper missing after make"
249
+ ls -la "${BRIDGE}" 2>&1 | tee -a "${LOG}" || true
250
+ exit 1
251
+ fi
252
+ log "gatekeeper OK: ${SO}"
253
+
254
+ log "==> galaaz setup (CLI)"
255
+ galaaz_cli setup >>"${LOG}" 2>&1 || log "WARN: galaaz setup non-zero (so exists; continuing)"
256
+
257
+ log "==> galaaz blogs init"
258
+ galaaz_cli blogs init "${HOME}/galaaz-blogs" >>"${LOG}" 2>&1
259
+
260
+ install_wrapper
261
+
262
+ log "==> doctor"
263
+ export PATH="${HOME}/.local/bin:${PATH}"
264
+ hash -r 2>/dev/null || true
265
+ if ! "${HOME}/.local/bin/galaaz" doctor >>"${LOG}" 2>&1; then
266
+ log "ERROR: doctor incomplete"
267
+ log "so exists=$([[ -f ${SO} ]] && echo yes || echo no)"
268
+ "${HOME}/.local/bin/galaaz" doctor 2>&1 | tee -a "${LOG}" || true
269
+ exit 1
270
+ fi
271
+ "${HOME}/.local/bin/galaaz" doctor 2>&1 | tee -a "${LOG}" || true
272
+
273
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
274
+ mkdir -p "${HOME}/.config/omarchy/extensions" "${HOME}/.local/bin"
275
+ if [[ -f "${SCRIPT_DIR}/omarchy-menu.jsonc" ]]; then
276
+ cp "${SCRIPT_DIR}/omarchy-menu.jsonc" "${HOME}/.config/omarchy/extensions/omarchy-menu.jsonc"
277
+ fi
278
+ cp "${BASH_SOURCE[0]}" "${HOME}/.local/bin/omarchy-install-galaaz"
279
+ chmod +x "${HOME}/.local/bin/omarchy-install-galaaz"
280
+ if [[ -f "${SCRIPT_DIR}/remove-galaaz.sh" ]]; then
281
+ cp "${SCRIPT_DIR}/remove-galaaz.sh" "${HOME}/.local/bin/omarchy-remove-galaaz"
282
+ chmod +x "${HOME}/.local/bin/omarchy-remove-galaaz"
283
+ fi
284
+ if [[ -f "${SCRIPT_DIR}/galaaz-guide.sh" ]]; then
285
+ cp "${SCRIPT_DIR}/galaaz-guide.sh" "${HOME}/.local/bin/omarchy-galaaz-guide"
286
+ chmod +x "${HOME}/.local/bin/omarchy-galaaz-guide"
287
+ log "guide: ${HOME}/.local/bin/omarchy-galaaz-guide"
288
+ fi
289
+ if [[ -f "${SCRIPT_DIR}/galaaz-add.sh" ]]; then
290
+ cp "${SCRIPT_DIR}/galaaz-add.sh" "${HOME}/.local/bin/omarchy-galaaz-add"
291
+ chmod +x "${HOME}/.local/bin/omarchy-galaaz-add"
292
+ log "add helper: ${HOME}/.local/bin/omarchy-galaaz-add"
293
+ fi
294
+ if [[ -f "${SCRIPT_DIR}/galaaz-gknit.sh" ]]; then
295
+ cp "${SCRIPT_DIR}/galaaz-gknit.sh" "${HOME}/.local/bin/omarchy-galaaz-gknit"
296
+ chmod +x "${HOME}/.local/bin/omarchy-galaaz-gknit"
297
+ log "gknit helper: ${HOME}/.local/bin/omarchy-galaaz-gknit"
298
+ fi
299
+
300
+ mkdir -p "${HOME}/.config/galaaz/profiles"
301
+ date -Iseconds >"${HOME}/.config/galaaz/profiles/core"
302
+
303
+ log ""
304
+ log "Core install complete."
305
+ log "Next: Super+Space → Install → Development → Galaaz → Guide (what's next)"
306
+ log "Docs: https://rbotafogo.github.io/galaaz/"
307
+ log "FULL LOG: ${LOG}"
308
+ log "Done!"
@@ -0,0 +1,92 @@
1
+ {
2
+ // Galaaz overlay for ~/.config/omarchy/extensions/omarchy-menu.jsonc
3
+ // Copy/merge into that path on TryOmarchy. Whole-line // comments only.
4
+ //
5
+ // Use ~/.local/bin/galaaz (installer wrapper). Do not quote the whole
6
+ // "galaaz add …" as one word — omarchy-launch-tui then does nothing useful.
7
+
8
+ "install.development.galaaz": {
9
+ "icon": "󰫏",
10
+ "label": "Galaaz",
11
+ "description": "R on Rails"
12
+ },
13
+ "install.development.galaaz.core": {
14
+ "icon": "󰫏",
15
+ "label": "Galaaz (core)",
16
+ "description": "gem + setup + blogs (not just gem install)",
17
+ "action": "omarchy-launch-tui omarchy-install-galaaz",
18
+ "disabled": "test -f ~/.config/galaaz/profiles/core"
19
+ },
20
+ "install.development.galaaz.guide": {
21
+ "icon": "󰋗",
22
+ "label": "Guide (what's next)",
23
+ "description": "Example knits, docs links, add-ons",
24
+ "action": "omarchy-launch-tui omarchy-galaaz-guide",
25
+ "when": "test -f ~/.config/galaaz/profiles/core"
26
+ },
27
+ "install.development.galaaz.docs": {
28
+ "icon": "󰂺",
29
+ "label": "Documentation (website)",
30
+ "description": "Open rbotafogo.github.io/galaaz",
31
+ "action": "omarchy-launch-webapp https://rbotafogo.github.io/galaaz/",
32
+ "when": "test -f ~/.config/galaaz/profiles/core"
33
+ },
34
+ "install.development.galaaz.github": {
35
+ "icon": "󰊤",
36
+ "label": "GitHub repository",
37
+ "description": "Open github.com/rbotafogo/galaaz",
38
+ "action": "omarchy-launch-webapp https://github.com/rbotafogo/galaaz",
39
+ "when": "test -f ~/.config/galaaz/profiles/core"
40
+ },
41
+ "install.development.galaaz.knit": {
42
+ "icon": "󰫏",
43
+ "label": "Knit (HTML blogs)",
44
+ "description": "pandoc + knitr/rmarkdown",
45
+ "action": "omarchy-launch-tui omarchy-galaaz-add knit",
46
+ "disabled": "test -f ~/.config/galaaz/profiles/knit"
47
+ },
48
+ "install.development.galaaz.knit-demo": {
49
+ "icon": "󰐊",
50
+ "label": "Knit demo (oh_my)",
51
+ "description": "gknit ~/galaaz-blogs/oh_my/oh_my.Rmd",
52
+ "action": "omarchy-launch-tui omarchy-galaaz-guide knit-demo",
53
+ "when": "test -f ~/.config/galaaz/profiles/knit"
54
+ },
55
+ "install.development.galaaz.arrow": {
56
+ "icon": "󰫏",
57
+ "label": "Arrow",
58
+ "action": "omarchy-launch-tui omarchy-galaaz-add arrow",
59
+ "disabled": "test -f ~/.config/galaaz/profiles/arrow"
60
+ },
61
+ "install.development.galaaz.tex": {
62
+ "icon": "󰫏",
63
+ "label": "TeX (PDF blogs)",
64
+ "action": "omarchy-launch-tui omarchy-galaaz-add tex",
65
+ "disabled": "test -f ~/.config/galaaz/profiles/tex"
66
+ },
67
+ "install.development.galaaz.bio": {
68
+ "icon": "󰫏",
69
+ "label": "Bioconductor (DESeq2)",
70
+ "action": "omarchy-launch-tui omarchy-galaaz-add bio",
71
+ "disabled": "test -f ~/.config/galaaz/profiles/bio"
72
+ },
73
+ "install.development.galaaz.examples": {
74
+ "icon": "󰫏",
75
+ "label": "Examples",
76
+ "action": "omarchy-launch-tui omarchy-galaaz-add examples",
77
+ "disabled": "test -f ~/.config/galaaz/profiles/examples"
78
+ },
79
+ "install.development.galaaz.ledger": {
80
+ "icon": "󰫏",
81
+ "label": "Ledger (R-on-Rails demo)",
82
+ "description": "Clone app, seed, bin/dev",
83
+ "action": "omarchy-launch-tui omarchy-galaaz-add ledger",
84
+ "disabled": "test -f ~/.config/galaaz/profiles/ledger"
85
+ },
86
+ "remove.development.galaaz": {
87
+ "icon": "󰫏",
88
+ "label": "Galaaz",
89
+ "description": "Core gem (add-on R packages stay)",
90
+ "action": "omarchy-launch-tui omarchy-remove-galaaz"
91
+ }
92
+ }
@@ -0,0 +1,34 @@
1
+ #!/bin/bash
2
+ # Remove Galaaz core gem + blogs we created. Leaves Ruby, R, and add-on R packages.
3
+ set -euo pipefail
4
+
5
+ echo -e "Removing Galaaz...\n"
6
+
7
+ run_ruby() {
8
+ if command -v mise >/dev/null 2>&1; then
9
+ mise x ruby -- "$@"
10
+ else
11
+ "$@"
12
+ fi
13
+ }
14
+
15
+ if command -v gem >/dev/null 2>&1 || command -v mise >/dev/null 2>&1; then
16
+ run_ruby gem uninstall galaaz -x -a --ignore-dependencies 2>/dev/null || true
17
+ fi
18
+
19
+ blogs="${HOME}/galaaz-blogs"
20
+ if [[ -f "${blogs}/.galaaz-blogs" ]]; then
21
+ echo "Removing ${blogs} (galaaz blogs marker present)"
22
+ rm -rf "${blogs}"
23
+ else
24
+ echo "Leaving ${blogs} untouched (no .galaaz-blogs marker)"
25
+ fi
26
+
27
+ # Profile markers only — do not uninstall CRAN/Bioconductor/TinyTeX.
28
+ if [[ -d "${HOME}/.config/galaaz/profiles" ]]; then
29
+ rm -rf "${HOME}/.config/galaaz/profiles"
30
+ echo "Cleared ~/.config/galaaz/profiles"
31
+ fi
32
+
33
+ echo -e "\nNote: GNU R and language packages (arrow, knitr, …) were left installed."
34
+ echo "Done!"
data/version.rb CHANGED
@@ -1,2 +1,2 @@
1
1
  $gem_name = "galaaz"
2
- $version="2.1.6"
2
+ $version="2.1.7"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: galaaz
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.6
4
+ version: 2.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Botafogo
@@ -394,6 +394,14 @@ files:
394
394
  - r_requires/knit-extras.txt
395
395
  - r_requires/knit.txt
396
396
  - r_requires/knitr.rb
397
+ - script/omarchy/README.md
398
+ - script/omarchy/debug-galaaz.sh
399
+ - script/omarchy/galaaz-add.sh
400
+ - script/omarchy/galaaz-gknit.sh
401
+ - script/omarchy/galaaz-guide.sh
402
+ - script/omarchy/install-galaaz.sh
403
+ - script/omarchy/omarchy-menu.jsonc
404
+ - script/omarchy/remove-galaaz.sh
397
405
  - specs/all.rb
398
406
  - specs/arrow_from_ruby_batches_spec.rb
399
407
  - specs/arrow_ipc_export_spec.rb