rubycli 0.1.7 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '07113181085c0df0c8f4bc34aca661d4c29fb9bbc309012ace52b36e8bdf9ead'
4
- data.tar.gz: 773d7de6a820fd1702e4e618c595237e2293c74dca6cc83f3ea57ba9eaaa18db
3
+ metadata.gz: 22ae6572f53adb977eaa1e53075ab43336bd6ff127ba9005c7bf9e23b23642b3
4
+ data.tar.gz: 98745b7445b85fcc9d0193f16e031e49932534dd92eb5eeaa1d3844559187656
5
5
  SHA512:
6
- metadata.gz: dadd19c4c2081e6fd7f8d6e40750c3cbc727a2c7f0452a5eb81b6feb80ce878e50fac111589ea87415d7656db4d288591bf7352fd4ee80031998e5835e84e732
7
- data.tar.gz: 0aef161e5d6fd30fb475de5afc908ecc94f1b5d4d1c96c0d735399c90b615e865e91286fa100008804d846d22e37874528b192dcbcea74b52484e45ef56273b6
6
+ metadata.gz: 706bab463fb79c2d3effa670746de1b985430660c61986cf7d11195688088040868c51df4f048673903129585daa1a5a27b23994c167fda871c36682d7c130af
7
+ data.tar.gz: 34610eceb65e9519fd3bcd90d3aba67bba71ae5991b2b80857f23175e9a89a1fb627dd931793bc46f470a156909529c2d926cd494be966fe7f91f3e0bfe191c6
data/CHANGELOG.md CHANGED
@@ -1,11 +1,86 @@
1
1
  # Changelog
2
2
 
3
- # Changelog
3
+ ## [0.2.0] - 2026-07-26
4
+
5
+ Final release. Rubycli is no longer maintained; see the project status
6
+ section in the README.
7
+
8
+ ### Added
9
+ - Gemfile, Rakefile, and gemspec development dependencies, so a fresh clone runs `bundle install && bundle exec rake` (test suite plus RuboCop).
10
+ - RuboCop configuration with a generated `.rubocop_todo.yml`, plus a lint job in GitHub Actions.
11
+ - End-to-end tests that run the shipped `exe/rubycli` in a subprocess and assert exit codes, stdout, and stderr.
12
+
13
+ ### Changed
14
+ - `Rubycli::Runner` moved from `lib/rubycli.rb` into `lib/rubycli/runner.rb`, and `Rubycli::CommandLine.run` was split into flag parsing, target extraction, validation, and dispatch steps.
15
+ - `Rubycli::CLI#exposable_method?` is public API now; the runner used to reach into it with `send`.
16
+ - Every library file carries the `frozen_string_literal` magic comment, and string literals follow one style across the repository.
17
+ - The unused repository-root `rubycli.rb` entry point was removed together with the `$LOADED_FEATURES` workaround it needed; use `exe/rubycli` (or the installed `rubycli` executable) instead.
18
+ - `rubycli --help` no longer shows example invocations that referenced files outside this repository; the JSON/eval samples now use forms that actually parse.
19
+ - The gem package ships `examples/*.rb`, so the walkthrough in both READMEs also works from an installed gem.
20
+ - `changelog_uri` in the gemspec points at `CHANGELOG.md` instead of the (empty) GitHub Releases page, and the LICENSE copyright year matches the first release (2025).
21
+ - `Rubycli::CommandLine.run` returns the command status instead of terminating the process from inside the runner, so it can be embedded in another program; `exe/rubycli` still exits with that status, and the documented `Rubycli.run(MyApp)` entry point still exits as before.
22
+ - Diagnostics now go to stderr: the usage text printed after a wrong invocation, `Command '…' is not available.`, `Command '…' does not accept arguments.`, and the top-level usage shown when arguments are missing. `--help` still prints to stdout, so redirecting stdout captures only command results.
23
+
24
+ ### Documentation
25
+ - Corrected the `--auto-target` guidance: `examples/hello_app_with_docs.rb` defines a matching constant alias, so it runs without `-a`; the constant-selection walkthrough now uses `examples/multi_constant_runner.rb` and `examples/mismatched_constant_runner.rb`.
26
+ - `RUBYCLI_ALLOW_PARAM_COMMENT=OFF` is documented as a `rubycli --check` lint switch: it does not change normal runs and never applies to `@return`.
27
+ - Documented the previously missing `-n`, `-c`, `--help`, and `--print-result` / `RUBYCLI_PRINT_RESULT` entries in the flag tables.
28
+ - Clarified that `--new=VALUE` supplies exactly one value, bound to the constructor's first parameter, and corrected the 0.1.7 entry that claimed arrays and hashes expand into positional and keyword arguments.
29
+ - Documented that arguments annotated as plain `[String]` skip literal parsing and keep surrounding quote characters, and that `--eval-args` requires every argument to be valid Ruby.
30
+ - The constant-resolution walkthrough shows both output lines the bundled examples produce (the method's own `puts` plus the return value printed by Rubycli) instead of only the first one.
31
+ - Documented that results go to stdout while warnings, errors, and post-failure usage go to stderr.
32
+ - Documented that only public methods defined directly on the target become commands: inherited, included, and `attr_accessor`-generated methods are not exposed.
33
+ - Replaced non-existent `scripts/*.rb` paths in both READMEs with bundled examples, and re-recorded the demo GIF, which still advertised the `--debug` flag removed in 0.1.5 along with pre-0.1.2 help formatting.
34
+ - Fixed the JSON, eval, and pre-script command examples in `examples/new_mode_runner.rb`, which could not run as written, and documented `--mode` there and `--quiet` in `examples/mismatched_constant_runner.rb` so both pass `rubycli --check`.
35
+
36
+ ### Fixed
37
+ - Parameterless commands now reject unexpected arguments without invoking the target method or attempting implicit return-value traversal.
38
+ - Required options now report a missing value instead of consuming the following option token, while explicit values such as `true` remain valid.
39
+ - Required options accept negative exponent, digit-separated decimal, and radix notation such as `-1e3`, `-1_000`, and `-0x10` without mistaking them for another option.
40
+ - Required options in eval mode accept space-separated lambda and unary expressions without consuming known option tokens as values.
41
+ - Constant discovery now includes classes and modules assigned with `Class.new` / `Module.new` during the target file load.
42
+ - Repeated loads retain assigned constant aliases when the source file is unchanged.
43
+ - Repeated loads retain aliases from completed direct, multiple, and `const_set` assignments or matching fully qualified existence guards, including loop initializers and receivers found by Ruby's lexical constant fallback, without reviving failed assignments or aliases behind disabled conditions.
44
+ - Constant discovery analyzes the preloaded source without triggering autoloads, so inactive autoload branches and self-removing target files do not add side effects or fail after a successful load.
45
+ - Constructor arity errors raised by `--new` are now wrapped in Rubycli's user-facing runner error.
46
+ - Framework argument errors raised by constructors are also wrapped in the same user-facing runner error.
47
+ - Positional type conversion now waits for JSON/eval coercion, matching keyword-option behavior and preserving `--new` JSON/eval inputs.
48
+ - Runner tests now execute without terminating the Minitest process and assert converted command arguments instead of stubbed targets.
49
+ - `--check --new` now inspects exposed instance/class commands without running constructors, while `--check` rejects pre-scripts instead of evaluating them.
50
+ - `--check` now inspects explicitly selected commands even when their methods or defining procs come from required files.
51
+ - Explicit nested constant names no longer fall back to inherited top-level constants, and malformed pre-scripts now produce contextual Rubycli errors.
52
+ - Rest, optional-before-required, and trailing-required positional arguments now follow Ruby's argument binding rules for conversion, validation, and help output.
53
+ - Documented scalar/list conversions now preserve numeric-, boolean-, and null-looking strings, handle repeated booleans, return real `DateTime` values, accept JSON arrays, and reject scalar/array values where `JSON`/`Hash` shapes do not allow them.
54
+ - Positional `Symbol` annotations preserve colon-prefixed symbol literals instead of embedding the colon in the symbol name.
55
+ - Assignment-like positional values remain positional unless they match a keyword, while matching assignments use the same documented conversion as long options.
56
+ - YARD positional tags are aligned by parameter name instead of comment order.
57
+ - Eval-mode local variables and command-line strict/check/result-output flags no longer leak across separate programmatic runs.
58
+ - Constructor and command eval arguments share one binding per Runner execution without enabling eval mode while the target file loads.
59
+ - Required options accept a lone `-` value, bare rest placeholders render with an ellipsis, and quoted positional/option `String[]` elements remain strings.
60
+ - Invalid Ruby syntax passed through strict eval mode now produces a user-facing Rubycli argument error instead of leaking a `SyntaxError` backtrace.
61
+ - Circular arrays/hashes returned by commands now fall back to inspected output instead of raising a JSON nesting error.
62
+ - Keyword options whose default is `0` or `1` accept a space-separated value again (`--count 3`); those defaults are boolean-ish strings, so they used to turn the option into a flag, drop its documented placeholder from the help output, and fail with `Value 'true' … is invalid`. Explicitly documented `[Boolean]` options keep working with such defaults.
63
+ - Negative numbers are treated as values instead of options, so `greet -5` and rest parameters such as `collect -5 -1_000 -0x10` no longer swallow the following argument or turn it into a keyword.
64
+ - Type annotations naming a class from an uninstalled library (`BigDecimal` without the bigdecimal gem, which stopped being a default gem in Ruby 3.4) report an installation hint instead of leaking a `LoadError` backtrace.
65
+ - Target files that exist but cannot be read report `File is not readable:` instead of an `Errno::EACCES` backtrace.
66
+ - Summary lines that open with an uppercase word ("A command that ...", "JSON output formatter for reports.", "TODO: split this later", "HTTP requests are cached") are no longer parsed as a positional placeholder. Such a summary used to take over the first argument, rename it in the help output, and make `rubycli --check` report the real placeholder line as an extra comment. An untyped leading line is now kept as a placeholder only while the remaining lines do not already document every positional parameter, and a single uppercase letter counts as a placeholder only with a type (`A [String] ...`).
67
+ - `--pre-script` / `--init` can expose a class that only defines instance methods without also passing `--new`; the target used to be rejected before the pre-script ran, so the documented "build/replace the exposed object" behaviour needed a throwaway `--new` value.
68
+ - Commands returning an Enumerable whose elements are not pairs (`Set`, `Range`, `Enumerator`) print their inspected form instead of raising `TypeError` from the duck-typed `to_h` conversion.
69
+ - A constant that exists but exposes no callable command no longer reports `Could not find definition:` while listing that same constant as found; the message now says it cannot be used as a CLI target and keeps the `--new` hint.
70
+
71
+ ### Testing
72
+ - Added tests for previously uncovered behaviour: the `return Type Description` comment shorthand, documentation issues reported without a file or line, keyword-splat usage rendering, placeholder type inference, and the json/eval mutual-exclusion guard.
73
+ - Runner tests drive the real CLI instead of a "run without exiting" wrapper, and `Rubycli::CommandLine.run` is covered end to end for both a successful command and a missing one.
74
+ - Added a regression test asserting that default mode passes shell/Ruby/YAML-looking arguments through untouched.
75
+ - Added a documentation path check asserting that repository paths referenced by both READMEs, the changelog, and the CLI usage text exist.
76
+ - Added dependency-free overall line, branch, and changed-line coverage gates plus GitHub Actions checks spanning the supported Ruby range.
77
+ - Changed-line coverage now treats new library files that were never loaded by the test suite as uncovered, including non-ASCII paths quoted by Git.
78
+ - Push coverage compares against the previous commit and falls back to the default branch when a new ref has no previous commit or a ref is deleted.
4
79
 
5
80
  ## [0.1.7] - 2025-11-12
6
81
 
7
82
  ### Added
8
- - `--new` now optionally accepts constructor arguments inline (e.g., `--new=[...]`); YAML/JSON-like literals are safely parsed, and `--json-args` / `--eval-args` / `--eval-lax` still apply. Arrays become positional args, hashes become keyword args.
83
+ - `--new` now optionally accepts a constructor argument inline (e.g., `--new=[...]`); YAML/JSON-like literals are safely parsed, and `--json-args` / `--eval-args` / `--eval-lax` still apply. The value is bound to the constructor's first parameter, so `--new='["a","b"]'` passes that array as a single argument (corrected in 0.2.0: the original note claimed arrays and hashes expand into positional and keyword arguments).
9
84
  - Positional argument coercion now runs through the same type-conversion pipeline as options/`--new`, including comment-driven array/element coercion and strict-mode validation; new tests cover arrays, hashes, booleans, and `--new` with JSON/eval modes.
10
85
  - Added `examples/new_mode_runner.rb` to showcase `--new` with constructor args, eval/JSON modes, and pre-script initialization for instance-only classes.
11
86
  - Strengthened tests for `--eval-lax` success/fallback with `--new` and end-to-end positional Hash coercion to guard against regressions.
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2024 inakaegg
3
+ Copyright (c) 2025 inakaegg
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal