omagem 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +138 -16
- data/lib/{omarchy → omagem}/client.rb +2 -2
- data/lib/{omarchy → omagem}/config.rb +15 -13
- data/lib/{omarchy → omagem}/dsl/bar.rb +1 -1
- data/lib/omagem/dsl/git.rb +38 -0
- data/lib/{omarchy → omagem}/dsl/misc.rb +1 -1
- data/lib/{omarchy → omagem}/dsl/package.rb +1 -1
- data/lib/{omarchy → omagem}/dsl/plugin.rb +1 -1
- data/lib/{omarchy → omagem}/dsl/service.rb +1 -1
- data/lib/{omarchy → omagem}/dsl/snapshot.rb +1 -1
- data/lib/{omarchy → omagem}/dsl/system.rb +1 -1
- data/lib/{omarchy → omagem}/dsl/theme.rb +1 -1
- data/lib/{omarchy → omagem}/dsl/toggle.rb +1 -1
- data/lib/{omarchy → omagem}/errors.rb +2 -2
- data/lib/{omarchy → omagem}/version.rb +2 -2
- data/lib/omagem.rb +33 -0
- metadata +17 -16
- data/lib/omarchy.rb +0 -33
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0bc981fccab22219589e1c2c9ecc6cc32ddb00747e5d6de7fa8bfe0d21bb985d
|
|
4
|
+
data.tar.gz: c2accf94983f574ae949c2fd80edf33bde1c585827e78436dfe16eb8c68b24eb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 89f09a6abf18ae0eb2b9ce38bfbcc1adec5a5e096b9d02d36cef53767bdc3864e68ce94e01e8d61f77171ab984b09bef8f0cd7b41b619ff8965b433b586489df
|
|
7
|
+
data.tar.gz: e26b908126dba3e76cf832eac257a2ff0a1818da938fd43024fe384899c928e85f5214ccd391b1fca9ba407fd3ec6e1be8352ed3a648a68da9591f152a901169
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# OmaGem
|
|
2
2
|
|
|
3
3
|
[](https://github.com/azzenabidi/OmaGem/actions/workflows/ci.yml)
|
|
4
4
|
[](https://rubygems.org/gems/omagem)
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
|
|
7
7
|
A small Ruby DSL for configuring and managing [Omarchy](https://omarchy.org/)
|
|
8
8
|
Linux systems: themes, backgrounds, packages, services, the shell bar,
|
|
9
|
-
plugins, toggles, snapshots, and system operations.
|
|
10
|
-
`omarchy` CLI, so it stays in sync with the real command
|
|
9
|
+
plugins, toggles, snapshots, git-installed software, and system operations.
|
|
10
|
+
It wraps the single `omarchy` CLI, so it stays in sync with the real command
|
|
11
|
+
surface.
|
|
11
12
|
|
|
12
13
|
Designed to be used both in scripts and inside a Rails application.
|
|
13
14
|
|
|
@@ -18,30 +19,69 @@ Designed to be used both in scripts and inside a Rails application.
|
|
|
18
19
|
|
|
19
20
|
## Installation
|
|
20
21
|
|
|
22
|
+
### As a dependency (Bundler)
|
|
23
|
+
|
|
21
24
|
Add this line to your application's Gemfile:
|
|
22
25
|
|
|
23
26
|
```ruby
|
|
24
27
|
gem "omagem"
|
|
25
28
|
```
|
|
26
29
|
|
|
30
|
+
Then execute:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
bundle install
|
|
34
|
+
```
|
|
35
|
+
|
|
27
36
|
Or install directly from the repository:
|
|
28
37
|
|
|
29
38
|
```ruby
|
|
30
39
|
gem "omagem", github: "azzenabidi/OmaGem", branch: "main"
|
|
31
40
|
```
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
### Standalone (scripts and one-off use)
|
|
43
|
+
|
|
44
|
+
If you just want the DSL in a plain Ruby script or from the terminal:
|
|
34
45
|
|
|
35
46
|
```bash
|
|
36
|
-
|
|
47
|
+
gem install omagem
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Verify the gem is installed and loadable:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
ruby -e 'require "omagem"; puts OmaGem::VERSION'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Uninstalling
|
|
57
|
+
|
|
58
|
+
### Remove from a Bundler project
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
bundle remove omagem
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
(Or delete the `gem "omagem"` line from your Gemfile and run
|
|
65
|
+
`bundle install`.)
|
|
66
|
+
|
|
67
|
+
### Uninstall the gem
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
gem uninstall omagem
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
To remove it from every RubyGems environment on the machine:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
gem uninstall omagem --all
|
|
37
77
|
```
|
|
38
78
|
|
|
39
79
|
## Usage
|
|
40
80
|
|
|
41
81
|
```ruby
|
|
42
|
-
require "
|
|
82
|
+
require "omagem"
|
|
43
83
|
|
|
44
|
-
|
|
84
|
+
OmaGem.run do
|
|
45
85
|
theme "catppuccin"
|
|
46
86
|
background "/home/me/Pictures/forest.png"
|
|
47
87
|
|
|
@@ -62,11 +102,11 @@ Omarchy.run do
|
|
|
62
102
|
end
|
|
63
103
|
```
|
|
64
104
|
|
|
65
|
-
Every method is documented on `
|
|
105
|
+
Every method is documented on `OmaGem::Config`. The block is evaluated
|
|
66
106
|
against a fresh `Config`, so you can call any DSL method directly:
|
|
67
107
|
|
|
68
108
|
```ruby
|
|
69
|
-
config =
|
|
109
|
+
config = OmaGem.run do
|
|
70
110
|
theme "catppuccin"
|
|
71
111
|
add_packages "git"
|
|
72
112
|
end
|
|
@@ -161,6 +201,19 @@ bar_visible :toggle
|
|
|
161
201
|
notification_silencing # do-not-disturb
|
|
162
202
|
```
|
|
163
203
|
|
|
204
|
+
### Git-installed software
|
|
205
|
+
|
|
206
|
+
```ruby
|
|
207
|
+
valid_git_url? "https://...git" # true when git can clone the URL
|
|
208
|
+
git_themes # names of user themes cloned from git
|
|
209
|
+
git_plugins # IDs of third-party plugins added from git
|
|
210
|
+
|
|
211
|
+
update_git_installs # pull every git theme + plugin (yes: true skips prompts)
|
|
212
|
+
update_git_installs(yes: false) # keep the plugin update confirmation prompt
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Everything installed through the DSL from a git URL — `install_theme`, `add_plugin` — is already captured in `config.executed`. The Git methods above track what is currently git-managed and keep it up to date.
|
|
216
|
+
|
|
164
217
|
### Misc
|
|
165
218
|
|
|
166
219
|
```ruby
|
|
@@ -173,12 +226,12 @@ focus_app "org.mozilla.firefox"
|
|
|
173
226
|
|
|
174
227
|
## From a Rails app
|
|
175
228
|
|
|
176
|
-
Because `
|
|
229
|
+
Because `OmaGem.run` returns the `Config` (and records every executed
|
|
177
230
|
command), you can invoke it from a controller, job, or service and inspect
|
|
178
231
|
the results:
|
|
179
232
|
|
|
180
233
|
```ruby
|
|
181
|
-
result =
|
|
234
|
+
result = OmaGem.run { theme params[:theme] }
|
|
182
235
|
flash[:notice] = result.current_theme
|
|
183
236
|
```
|
|
184
237
|
|
|
@@ -187,16 +240,85 @@ flash[:notice] = result.current_theme
|
|
|
187
240
|
Pass a fake (recording) client to build a config without touching the system:
|
|
188
241
|
|
|
189
242
|
```ruby
|
|
190
|
-
config =
|
|
243
|
+
config = OmaGem::Config.new(client: OmaGem::Client::Fake.new)
|
|
191
244
|
config.theme "catppuccin"
|
|
192
245
|
config.executed # => [["theme", "set", "catppuccin"]]
|
|
193
246
|
```
|
|
194
247
|
|
|
248
|
+
## Use cases
|
|
249
|
+
|
|
250
|
+
### 1. Machine bootstrap / dotfiles as code
|
|
251
|
+
|
|
252
|
+
Declare the desired state of a fresh Omarchy install in a single script you
|
|
253
|
+
can re-run on any machine:
|
|
254
|
+
|
|
255
|
+
```ruby
|
|
256
|
+
OmaGem.run do
|
|
257
|
+
theme "catppuccin"
|
|
258
|
+
add_packages "docker", "git", "lazygit"
|
|
259
|
+
add_packages "yay-bin", aur: true
|
|
260
|
+
install_service "tailscale"
|
|
261
|
+
default_terminal "kitty"
|
|
262
|
+
update(yes: true)
|
|
263
|
+
end
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### 2. Rails admin panel
|
|
267
|
+
|
|
268
|
+
Expose theme, package, and service management through a web UI. Because
|
|
269
|
+
`OmaGem.run` returns the `Config`, controllers apply an operation and
|
|
270
|
+
immediately inspect the result:
|
|
271
|
+
|
|
272
|
+
```ruby
|
|
273
|
+
class ThemesController < ApplicationController
|
|
274
|
+
def update
|
|
275
|
+
result = OmaGem.run { theme params[:theme] }
|
|
276
|
+
render json: { current: result.current_theme }
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
### 3. Scheduled automation
|
|
282
|
+
|
|
283
|
+
Drive background jobs — switches your environment on a schedule or keeps the
|
|
284
|
+
system up to date without touching the terminal:
|
|
285
|
+
|
|
286
|
+
```ruby
|
|
287
|
+
class NightlightJob < ApplicationJob
|
|
288
|
+
def perform(on:)
|
|
289
|
+
OmaGem.run { nightlight(on ? :on : :off) }
|
|
290
|
+
end
|
|
291
|
+
end
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
### 4. Dry-run / preview
|
|
295
|
+
|
|
296
|
+
Preview exactly which commands a config would run, without mutating the
|
|
297
|
+
system, using the recording fake client (see
|
|
298
|
+
[Reusable, non-destructive configuration](#reusable-non-destructive-configuration)):
|
|
299
|
+
|
|
300
|
+
```ruby
|
|
301
|
+
config = OmaGem::Config.new(client: OmaGem::Client::Fake.new)
|
|
302
|
+
config.theme "tokyo-night"
|
|
303
|
+
config.add_packages "docker"
|
|
304
|
+
config.executed
|
|
305
|
+
# => [["theme", "set", "tokyo-night"], ["pkg", "add", "docker"]]
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
### 5. Remote management
|
|
309
|
+
|
|
310
|
+
Ship an apply script to an Omarchy box and run it over SSH:
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
scp apply.rb omarchy-box:
|
|
314
|
+
ssh omarchy-box "ruby apply.rb"
|
|
315
|
+
```
|
|
316
|
+
|
|
195
317
|
## Errors
|
|
196
318
|
|
|
197
|
-
- `
|
|
198
|
-
- `
|
|
199
|
-
- `
|
|
319
|
+
- `OmaGem::CommandFailed` — a command exited non-zero (set `ignore_errors: true` in `OmaGem.run` to raise nothing and keep going).
|
|
320
|
+
- `OmaGem::CommandNotFound` — the `omarchy` binary isn't on `PATH` (`ensure_command!`).
|
|
321
|
+
- `OmaGem::ArgumentError` — an invalid enum value (e.g. an unknown terminal).
|
|
200
322
|
|
|
201
323
|
## Development
|
|
202
324
|
|
|
@@ -208,4 +330,4 @@ bundle exec rubocop
|
|
|
208
330
|
|
|
209
331
|
## License
|
|
210
332
|
|
|
211
|
-
MIT
|
|
333
|
+
MIT
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
require 'open3'
|
|
4
4
|
|
|
5
|
-
module
|
|
5
|
+
module OmaGem
|
|
6
6
|
# Wraps the `omarchy` CLI. It shells out to the single `omarchy` binary and
|
|
7
7
|
# exposes the resulting output, whether the command succeeded, and the exit
|
|
8
8
|
# status. Errors raised by the command are captured rather than thrown.
|
|
9
9
|
#
|
|
10
10
|
# The class is designed to be subclassed or stubbed in tests (see
|
|
11
|
-
#
|
|
11
|
+
# OmaGem::Client::Fake) so the DSL can be exercised without a live system.
|
|
12
12
|
class Client
|
|
13
13
|
Result = Struct.new(:success, :stdout, :stderr, :status, keyword_init: true) do
|
|
14
14
|
def success?
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require_relative 'client'
|
|
4
4
|
require_relative 'errors'
|
|
5
5
|
|
|
6
|
-
module
|
|
6
|
+
module OmaGem
|
|
7
7
|
# The DSL surface. A Config instance exposes all the management methods
|
|
8
8
|
# (theme, package, service, system, ...). The methods are defined in
|
|
9
9
|
# feature modules mixed in below, so the DSL is easy to extend and keep
|
|
@@ -14,7 +14,7 @@ module Omarchy
|
|
|
14
14
|
class Config
|
|
15
15
|
attr_reader :client
|
|
16
16
|
|
|
17
|
-
def initialize(client:
|
|
17
|
+
def initialize(client: OmaGem::Client.new, ignore_errors: false)
|
|
18
18
|
@client = client
|
|
19
19
|
@ignore_errors = ignore_errors
|
|
20
20
|
@executed = []
|
|
@@ -24,7 +24,7 @@ module Omarchy
|
|
|
24
24
|
# argument array.
|
|
25
25
|
attr_reader :executed
|
|
26
26
|
|
|
27
|
-
# Run an Omarchy command and return the
|
|
27
|
+
# Run an Omarchy command and return the OmaGem::Client::Result.
|
|
28
28
|
# Records the call and validates the exit status unless ignore_errors.
|
|
29
29
|
def run(*args)
|
|
30
30
|
@executed << args
|
|
@@ -67,7 +67,7 @@ module Omarchy
|
|
|
67
67
|
client.run('theme', 'list').stdout.lines.map(&:strip).reject(&:empty?)
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
# Raise
|
|
70
|
+
# Raise OmaGem::ArgumentError unless value is in the allowed list.
|
|
71
71
|
def validate_in!(value, allowed, label)
|
|
72
72
|
return if allowed.include?(value.to_s)
|
|
73
73
|
|
|
@@ -82,16 +82,18 @@ require_relative 'dsl/service'
|
|
|
82
82
|
require_relative 'dsl/system'
|
|
83
83
|
require_relative 'dsl/bar'
|
|
84
84
|
require_relative 'dsl/plugin'
|
|
85
|
+
require_relative 'dsl/git'
|
|
85
86
|
require_relative 'dsl/toggle'
|
|
86
87
|
require_relative 'dsl/snapshot'
|
|
87
88
|
require_relative 'dsl/misc'
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
90
|
+
OmaGem::Config.include(OmaGem::DSL::Theme)
|
|
91
|
+
OmaGem::Config.include(OmaGem::DSL::Package)
|
|
92
|
+
OmaGem::Config.include(OmaGem::DSL::Service)
|
|
93
|
+
OmaGem::Config.include(OmaGem::DSL::System)
|
|
94
|
+
OmaGem::Config.include(OmaGem::DSL::Bar)
|
|
95
|
+
OmaGem::Config.include(OmaGem::DSL::Plugin)
|
|
96
|
+
OmaGem::Config.include(OmaGem::DSL::Git)
|
|
97
|
+
OmaGem::Config.include(OmaGem::DSL::Toggle)
|
|
98
|
+
OmaGem::Config.include(OmaGem::DSL::Snapshot)
|
|
99
|
+
OmaGem::Config.include(OmaGem::DSL::Misc)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'json'
|
|
4
|
+
|
|
5
|
+
module OmaGem
|
|
6
|
+
module DSL
|
|
7
|
+
# Track and update software installed from git: user themes cloned from a
|
|
8
|
+
# repository and shell plugins added from a git URL.
|
|
9
|
+
module Git
|
|
10
|
+
# True when the URL names a repository git can clone.
|
|
11
|
+
def valid_git_url?(url)
|
|
12
|
+
client.run('git', 'url', 'check', url).success?
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Names of the user-installed themes that came from a git clone.
|
|
16
|
+
def git_themes
|
|
17
|
+
paths = client.run('theme', 'extras').stdout.lines.map(&:strip).reject(&:empty?)
|
|
18
|
+
paths.map { |path| File.basename(path) }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# IDs of the installed third-party shell plugins (those added from git).
|
|
22
|
+
def git_plugins
|
|
23
|
+
JSON.parse(client.run('plugin', 'list', '--json').stdout)
|
|
24
|
+
.select { |plugin| plugin['firstParty'] == false }
|
|
25
|
+
.map { |plugin| plugin['id'] }
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Update every theme and plugin installed from git. yes: true (default)
|
|
29
|
+
# skips the confirmation prompt, as scripts cannot answer it.
|
|
30
|
+
def update_git_installs(yes: true)
|
|
31
|
+
run('theme', 'update')
|
|
32
|
+
args = %w[plugin update]
|
|
33
|
+
args << '--yes' if yes
|
|
34
|
+
run(*args)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
end
|
data/lib/omagem.rb
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require_relative 'omagem/version'
|
|
4
|
+
require_relative 'omagem/errors'
|
|
5
|
+
require_relative 'omagem/client'
|
|
6
|
+
require_relative 'omagem/config'
|
|
7
|
+
|
|
8
|
+
# OmaGem is a Ruby DSL for configuring and managing Omarchy Linux systems.
|
|
9
|
+
#
|
|
10
|
+
# require "omagem"
|
|
11
|
+
#
|
|
12
|
+
# OmaGem.run do
|
|
13
|
+
# theme "catppuccin"
|
|
14
|
+
# add_packages "docker", "git"
|
|
15
|
+
# install_service "tailscale"
|
|
16
|
+
# nightlight :on
|
|
17
|
+
# end
|
|
18
|
+
#
|
|
19
|
+
# The block is evaluated against an OmaGem::Config, which exposes every
|
|
20
|
+
# DSL method. See OmaGem::Config for the full list.
|
|
21
|
+
module OmaGem
|
|
22
|
+
class << self
|
|
23
|
+
# Execute a DSL block against a fresh OmaGem::Config. Returns the config
|
|
24
|
+
# so the caller can inspect what ran via config.executed / config.client.
|
|
25
|
+
#
|
|
26
|
+
# config = OmaGem.run { theme "catppuccin" }
|
|
27
|
+
def run(client: OmaGem::Client.new, ignore_errors: false, &block)
|
|
28
|
+
config = Config.new(client: client, ignore_errors: ignore_errors)
|
|
29
|
+
config.instance_eval(&block) if block
|
|
30
|
+
config
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: omagem
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- azzen
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-09-
|
|
11
|
+
date: 2026-09-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: A tiny Ruby DSL that wraps the `omarchy` CLI so you can manage themes,
|
|
14
14
|
packages, services, the shell bar, and more from Ruby or a Rails application.
|
|
@@ -19,20 +19,21 @@ extra_rdoc_files: []
|
|
|
19
19
|
files:
|
|
20
20
|
- LICENSE
|
|
21
21
|
- README.md
|
|
22
|
-
- lib/
|
|
23
|
-
- lib/
|
|
24
|
-
- lib/
|
|
25
|
-
- lib/
|
|
26
|
-
- lib/
|
|
27
|
-
- lib/
|
|
28
|
-
- lib/
|
|
29
|
-
- lib/
|
|
30
|
-
- lib/
|
|
31
|
-
- lib/
|
|
32
|
-
- lib/
|
|
33
|
-
- lib/
|
|
34
|
-
- lib/
|
|
35
|
-
- lib/
|
|
22
|
+
- lib/omagem.rb
|
|
23
|
+
- lib/omagem/client.rb
|
|
24
|
+
- lib/omagem/config.rb
|
|
25
|
+
- lib/omagem/dsl/bar.rb
|
|
26
|
+
- lib/omagem/dsl/git.rb
|
|
27
|
+
- lib/omagem/dsl/misc.rb
|
|
28
|
+
- lib/omagem/dsl/package.rb
|
|
29
|
+
- lib/omagem/dsl/plugin.rb
|
|
30
|
+
- lib/omagem/dsl/service.rb
|
|
31
|
+
- lib/omagem/dsl/snapshot.rb
|
|
32
|
+
- lib/omagem/dsl/system.rb
|
|
33
|
+
- lib/omagem/dsl/theme.rb
|
|
34
|
+
- lib/omagem/dsl/toggle.rb
|
|
35
|
+
- lib/omagem/errors.rb
|
|
36
|
+
- lib/omagem/version.rb
|
|
36
37
|
homepage: https://github.com/azzenabidi/OmaGem
|
|
37
38
|
licenses:
|
|
38
39
|
- MIT
|
data/lib/omarchy.rb
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'omarchy/version'
|
|
4
|
-
require_relative 'omarchy/errors'
|
|
5
|
-
require_relative 'omarchy/client'
|
|
6
|
-
require_relative 'omarchy/config'
|
|
7
|
-
|
|
8
|
-
# Omarchy is a Ruby DSL for configuring and managing Omarchy Linux systems.
|
|
9
|
-
#
|
|
10
|
-
# require "omarchy"
|
|
11
|
-
#
|
|
12
|
-
# Omarchy.run do
|
|
13
|
-
# theme "catppuccin"
|
|
14
|
-
# add_packages "docker", "git"
|
|
15
|
-
# install_service "tailscale"
|
|
16
|
-
# nightlight :on
|
|
17
|
-
# end
|
|
18
|
-
#
|
|
19
|
-
# The block is evaluated against an Omarchy::Config, which exposes every
|
|
20
|
-
# DSL method. See Omarchy::Config for the full list.
|
|
21
|
-
module Omarchy
|
|
22
|
-
class << self
|
|
23
|
-
# Execute a DSL block against a fresh Omarchy::Config. Returns the config
|
|
24
|
-
# so the caller can inspect what ran via config.executed / config.client.
|
|
25
|
-
#
|
|
26
|
-
# config = Omarchy.run { theme "catppuccin" }
|
|
27
|
-
def run(client: Omarchy::Client.new, ignore_errors: false, &block)
|
|
28
|
-
config = Config.new(client: client, ignore_errors: ignore_errors)
|
|
29
|
-
config.instance_eval(&block) if block
|
|
30
|
-
config
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|