omagem 0.1.0 → 0.1.1

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: 2344de2cc3f80a70f3d4b6a11ebb165bee0889404128750aa48ea8ee405b2b4f
4
- data.tar.gz: ccd3fc5c8bd1520787c27fd15936ffc289de0efd9e3451abb73554c11d6cc4c0
3
+ metadata.gz: e330b39968b7711d9f1cf9f46232efec3c2f342b207ba65a772c48a5a6cac1d7
4
+ data.tar.gz: dae10b20eb9dc463ca7be29c358b0f2f858cf12196604f56a67a5bd4638b1d54
5
5
  SHA512:
6
- metadata.gz: e4fff8c4af197d669db31d245cf82309ff5ceccf96073a94d6892d333f9feb10b25efdfff9b26fceb42e55163bb0427b6977b8db8c69bf69058d7a6152c61f9f
7
- data.tar.gz: a5a0e991ac167211d827f38d5734a1fde76f3c37a0405749202ab94d788d24b906b3b9a74bb6edecf4feaecfd3b2c9e0cc57d821f7c965a3431561df8ccfd1c3
6
+ metadata.gz: 7867469319e28f0f4174bb131f83808865650a561ebf375342a438b8363b201401a66722a20e21494c48878e79e4bfaf569fb3cf6529bca38d43ce7fa9083cf5
7
+ data.tar.gz: f9ea24917b880e554f016b459201ea7151eb95c4f14fe52e84419a1a508faeeeb654122123030aa6707df209838dccf9242fcf5adf6ab4126d972efe44235606
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Omarchy
1
+ # OmaGem
2
2
 
3
3
  [![CI](https://github.com/azzenabidi/OmaGem/actions/workflows/ci.yml/badge.svg)](https://github.com/azzenabidi/OmaGem/actions/workflows/ci.yml)
4
4
  [![Gem Version](https://img.shields.io/gem/v/omagem)](https://rubygems.org/gems/omagem)
@@ -39,9 +39,9 @@ bundle install
39
39
  ## Usage
40
40
 
41
41
  ```ruby
42
- require "omarchy"
42
+ require "omagem"
43
43
 
44
- Omarchy.run do
44
+ OmaGem.run do
45
45
  theme "catppuccin"
46
46
  background "/home/me/Pictures/forest.png"
47
47
 
@@ -62,11 +62,11 @@ Omarchy.run do
62
62
  end
63
63
  ```
64
64
 
65
- Every method is documented on `Omarchy::Config`. The block is evaluated
65
+ Every method is documented on `OmaGem::Config`. The block is evaluated
66
66
  against a fresh `Config`, so you can call any DSL method directly:
67
67
 
68
68
  ```ruby
69
- config = Omarchy.run do
69
+ config = OmaGem.run do
70
70
  theme "catppuccin"
71
71
  add_packages "git"
72
72
  end
@@ -173,12 +173,12 @@ focus_app "org.mozilla.firefox"
173
173
 
174
174
  ## From a Rails app
175
175
 
176
- Because `Omarchy.run` returns the `Config` (and records every executed
176
+ Because `OmaGem.run` returns the `Config` (and records every executed
177
177
  command), you can invoke it from a controller, job, or service and inspect
178
178
  the results:
179
179
 
180
180
  ```ruby
181
- result = Omarchy.run { theme params[:theme] }
181
+ result = OmaGem.run { theme params[:theme] }
182
182
  flash[:notice] = result.current_theme
183
183
  ```
184
184
 
@@ -187,16 +187,16 @@ flash[:notice] = result.current_theme
187
187
  Pass a fake (recording) client to build a config without touching the system:
188
188
 
189
189
  ```ruby
190
- config = Omarchy::Config.new(client: Omarchy::Client::Fake.new)
190
+ config = OmaGem::Config.new(client: OmaGem::Client::Fake.new)
191
191
  config.theme "catppuccin"
192
192
  config.executed # => [["theme", "set", "catppuccin"]]
193
193
  ```
194
194
 
195
195
  ## Errors
196
196
 
197
- - `Omarchy::CommandFailed` — a command exited non-zero (set `ignore_errors: true` in `Omarchy.run` to raise nothing and keep going).
198
- - `Omarchy::CommandNotFound` — the `omarchy` binary isn't on `PATH` (`ensure_command!`).
199
- - `Omarchy::ArgumentError` — an invalid enum value (e.g. an unknown terminal).
197
+ - `OmaGem::CommandFailed` — a command exited non-zero (set `ignore_errors: true` in `OmaGem.run` to raise nothing and keep going).
198
+ - `OmaGem::CommandNotFound` — the `omarchy` binary isn't on `PATH` (`ensure_command!`).
199
+ - `OmaGem::ArgumentError` — an invalid enum value (e.g. an unknown terminal).
200
200
 
201
201
  ## Development
202
202
 
@@ -208,4 +208,4 @@ bundle exec rubocop
208
208
 
209
209
  ## License
210
210
 
211
- MIT
211
+ MIT
@@ -2,13 +2,13 @@
2
2
 
3
3
  require 'open3'
4
4
 
5
- module Omarchy
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
- # Omarchy::Client::Fake) so the DSL can be exercised without a live system.
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 Omarchy
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: Omarchy::Client.new, ignore_errors: false)
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 Omarchy::Client::Result.
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 Omarchy::ArgumentError unless value is in the allowed list.
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
 
@@ -86,12 +86,12 @@ require_relative 'dsl/toggle'
86
86
  require_relative 'dsl/snapshot'
87
87
  require_relative 'dsl/misc'
88
88
 
89
- Omarchy::Config.include(Omarchy::DSL::Theme)
90
- Omarchy::Config.include(Omarchy::DSL::Package)
91
- Omarchy::Config.include(Omarchy::DSL::Service)
92
- Omarchy::Config.include(Omarchy::DSL::System)
93
- Omarchy::Config.include(Omarchy::DSL::Bar)
94
- Omarchy::Config.include(Omarchy::DSL::Plugin)
95
- Omarchy::Config.include(Omarchy::DSL::Toggle)
96
- Omarchy::Config.include(Omarchy::DSL::Snapshot)
97
- Omarchy::Config.include(Omarchy::DSL::Misc)
89
+ OmaGem::Config.include(OmaGem::DSL::Theme)
90
+ OmaGem::Config.include(OmaGem::DSL::Package)
91
+ OmaGem::Config.include(OmaGem::DSL::Service)
92
+ OmaGem::Config.include(OmaGem::DSL::System)
93
+ OmaGem::Config.include(OmaGem::DSL::Bar)
94
+ OmaGem::Config.include(OmaGem::DSL::Plugin)
95
+ OmaGem::Config.include(OmaGem::DSL::Toggle)
96
+ OmaGem::Config.include(OmaGem::DSL::Snapshot)
97
+ OmaGem::Config.include(OmaGem::DSL::Misc)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
3
+ module OmaGem
4
4
  module DSL
5
5
  # The status bar: which bar and widget layout is used, plus widget layout.
6
6
  module Bar
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
3
+ module OmaGem
4
4
  module DSL
5
5
  # Misc: reminders, screen capture, launch app, focus app, default agent.
6
6
  module Misc
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative '../errors'
4
4
 
5
- module Omarchy
5
+ module OmaGem
6
6
  module DSL
7
7
  # Package management: add / drop Arch and AUR packages, plus queries.
8
8
  module Package
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
3
+ module OmaGem
4
4
  module DSL
5
5
  # Shell plugin and bar-widget management.
6
6
  module Plugin
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative '../errors'
4
4
 
5
- module Omarchy
5
+ module OmaGem
6
6
  module DSL
7
7
  # Install/manage optional software, services, apps, browsers, editors,
8
8
  # terminals, development environments, and gaming.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
3
+ module OmaGem
4
4
  module DSL
5
5
  # System snapshots via snapper.
6
6
  module Snapshot
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
3
+ module OmaGem
4
4
  module DSL
5
5
  # System-level operations: updates, reboot/shutdown/lock, default apps,
6
6
  # font, snapshots, and diagnostics.
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative '../errors'
4
4
 
5
- module Omarchy
5
+ module OmaGem
6
6
  module DSL
7
7
  # Theme management: apply, list, install, remove, refresh, backgrounds.
8
8
  module Theme
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
3
+ module OmaGem
4
4
  module DSL
5
5
  # Toggle Omarchy features on/off: nightlight, touchpad, Bluetooth, etc.
6
6
  module Toggle
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
4
- # Base class for all Omarchy::DSL errors.
3
+ module OmaGem
4
+ # Base class for all OmaGem::DSL errors.
5
5
  class Error < StandardError; end
6
6
 
7
7
  # Raised when the `omarchy` CLI is not available on the system.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Omarchy
4
- VERSION = '0.1.0'
3
+ module OmaGem
4
+ VERSION = '0.1.1'
5
5
  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,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omagem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - azzen
@@ -19,20 +19,20 @@ extra_rdoc_files: []
19
19
  files:
20
20
  - LICENSE
21
21
  - README.md
22
- - lib/omarchy.rb
23
- - lib/omarchy/client.rb
24
- - lib/omarchy/config.rb
25
- - lib/omarchy/dsl/bar.rb
26
- - lib/omarchy/dsl/misc.rb
27
- - lib/omarchy/dsl/package.rb
28
- - lib/omarchy/dsl/plugin.rb
29
- - lib/omarchy/dsl/service.rb
30
- - lib/omarchy/dsl/snapshot.rb
31
- - lib/omarchy/dsl/system.rb
32
- - lib/omarchy/dsl/theme.rb
33
- - lib/omarchy/dsl/toggle.rb
34
- - lib/omarchy/errors.rb
35
- - lib/omarchy/version.rb
22
+ - lib/omagem.rb
23
+ - lib/omagem/client.rb
24
+ - lib/omagem/config.rb
25
+ - lib/omagem/dsl/bar.rb
26
+ - lib/omagem/dsl/misc.rb
27
+ - lib/omagem/dsl/package.rb
28
+ - lib/omagem/dsl/plugin.rb
29
+ - lib/omagem/dsl/service.rb
30
+ - lib/omagem/dsl/snapshot.rb
31
+ - lib/omagem/dsl/system.rb
32
+ - lib/omagem/dsl/theme.rb
33
+ - lib/omagem/dsl/toggle.rb
34
+ - lib/omagem/errors.rb
35
+ - lib/omagem/version.rb
36
36
  homepage: https://github.com/azzenabidi/OmaGem
37
37
  licenses:
38
38
  - 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