| Age | Commit message (Collapse) | Author |
|
system() returns false/nil on failure but the original code ignored the
return value, silently swallowing dnf errors.
Add a private run_dnf! helper that checks the return value and raises
DNFPackageManager::CommandFailed with the dnf exit code on failure.
Replace the one-liner methods with full method bodies that delegate to
run_dnf!.
Also fix two latent constant-resolution bugs:
- Use $? instead of $CHILD_STATUS (the latter requires `require 'English'`
and is always nil without it)
- Use ::File instead of File in Package#initialize to avoid resolving to
RCM::File once file.rb is loaded
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Loading config.toml at module eval time (during require) runs before
the application's working directory is set, can slow down tests that
don't use config at all, and gives no way to reload between calls.
Move the load logic into Config.load! (mirrors the Options.parse! pattern
added in the previous commit). The module body now just initialises
@@config to {}. Call Config.load! alongside Options.parse! at the top
of configure() so all entry points reload from the correct directory.
Also qualify File as ::File inside the RCM module to avoid resolving it
as RCM::File once the keyword files are loaded.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Parsing ARGV at module eval time (during require) is fragile: it runs
before the application is ready, can pick up test-runner flags, and
bleeds stale values across repeated configure calls in tests.
Move the OptionParser setup and ARGV slicing into Options.parse!. The
module body now only sets safe defaults. parse! resets to defaults
before each parse so state cannot accumulate across calls.
Call Options.parse! once at the top of configure() in dsl.rb so all
entry points (scripts, Rake tasks) still receive parsed options without
any caller needing to know about the details.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
ResourceDependencies#initialize iterated every live object in the Ruby
heap (ObjectSpace.each_object(Class)) to discover Resource subclasses,
which is O(heap), non-deterministic, and load-order-dependent (subclasses
loaded after an instance was created were invisible to it).
Add Resource.inherited + @@subclass_names so each subclass self-registers
at load time. ResourceDependencies#initialize now just assigns the shared
(frozen) registry reference instead of scanning ObjectSpace.
Benefits:
- O(1) constructor path instead of O(heap)
- Load-order safe: new subclasses are visible to all instances immediately
- Deterministic: set is built in require order, not GC-dependent order
Also fix the "recource" typo in the ResourceDependencies comment.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Each of the file/symlink/touch/directory DSL methods repeated the same
four-step pattern: nil-path identity return, @conds_met guard, create-
configure-register, return object. Add a private register_keyword helper
to DSL in dsl.rb and collapse each method to a one-liner.
No behaviour changed; all 29 tests continue to pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Touch and Directory inherited content/from from BaseFile but had no use
for them. Directory worked around this by repurposing content() as a
source-directory path store, which was semantically misleading.
Changes:
- Move content/from down into BaseFile (only File and Symlink need them)
- Move evaluate_absent! up into BasicFile (Touch and Directory need it)
- Move UnsupportedOperation up into BasicFile (validate raises it there)
- Re-parent Touch and Directory to BasicFile directly
- Add Directory#source accessor to replace the content() misuse
- Update DSL#directory to call d.source(...) instead of d.content(...)
All 29 tests continue to pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
do? (dry-run-aware block execution) was sitting inside
ResourceDependencies, which is responsible for dependency tracking —
an SRP violation. Move it into its own DryRun module and include that
in Resource alongside the existing concerns.
No logic changed; all 29 tests continue to pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
file.rb was a ~400-line monolith holding seven unrelated classes/modules.
Extract each into its own file so each file has a single responsibility
and stays within the 50-line guideline:
file_backup.rb — FileBackup mixin
symlink.rb — Symlink class + DSL#symlink
touch.rb — Touch class + DSL#touch
directory.rb — Directory class + DSL#directory
file.rb keeps BasicFile, BaseFile, File, and DSL#file.
dsl.rb gains explicit require_relative lines for the new files.
No logic was changed; all 29 tests continue to pass.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
The method is defined as backup_recursively! but was called as
backup_resursively! — a NoMethodError at runtime for any configuration
using the recursive directory copy directive. Also fix the matching
misspelling in the log message string.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Backtick calls interpolated the package name directly into a shell
command string, allowing metacharacters (;, $(), backticks) to execute
arbitrary commands. Using system() with separate arguments bypasses the
shell entirely, so the package name is passed as a literal argv element
to dnf.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
|
|
fallback to examples
|
|
- Add lib/rcm.rb entry point and bin/rcm CLI executable
- Update gemspec: v0.1.0, proper files list, executables, runtime deps
- Support standalone arg parsing and --hosts filtering in options
- Fix inverted logic and typo in FileBackup#different? (== vs !=, cecksum_b)
- Fix unqualified File.directory? resolving to RCM::File in Directory
- Fix test_chown assertions running before evaluate! creates files
- Add setup to file tests to prevent order-dependent failures
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|