enola-rb 0.0.0 → 0.4.4

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: 49c42cacd2a76196fffc485125ee37e75188acc4a402634a31b7f80d8e543af2
4
- data.tar.gz: 1d316a926b68739e7e05ef369af0cbf729ae922335579b5a642d530c98f928b0
3
+ metadata.gz: 8187cf70720cf851a17def67c9ca82f66766dbf0437779037143298f7b219aec
4
+ data.tar.gz: da2463ad162461bfcf32015aa7074ef6e5c534e50c3533c995077c53fd1298ab
5
5
  SHA512:
6
- metadata.gz: 34678e619b8f770de051b56d96730942cd61dc3b8b6bc2bcd2707c4f6b86ed2aa67a9e9760fe12bda6eba88720c52e50392945b2a14ac3200b21f5f055eb0a5b
7
- data.tar.gz: 2726fa7f26271a06953f9097767582c864a3d25d2a3e5f55bac785e0139ee5c2fc9a10da897215a87bdee8aefea7a22f57ebe3c7e927d7d1b0801d04c96da387
6
+ metadata.gz: bd244d2988659a63032fca993b743a12897cc18eaf722e826c4f1f4e63620d60932f0ba481ff095260f0cd9f60bd669d5add4dd4c0b16d3b114fe58b5503456b
7
+ data.tar.gz: 3faf0965d57a14e8e853a444d9481fd90ae14732006ffc73eb0e2b1da9b14c4740f5af3728bceecb6ff08e370c3b9f335685004976737eacd609fb2c940397bc
data/CHANGELOG.md ADDED
@@ -0,0 +1,47 @@
1
+ ## munola 0.4.4.1 (2026-08-23)
2
+
3
+ The wrapper over the munola channel, first release with an implementation.
4
+ `munola init` writes the starter laws and upstream's bindings the way
5
+ `enola:install` does, then the recipe catalogue from enola-guides, binds the
6
+ recipes the tree shows a need for, fills the tenant foreign-key template
7
+ from the schema, writes `mcp-arch.yaml` with Prism and Rubydex on and fetches
8
+ the Rubydex library; `munola --version` names the munola version, its
9
+ upstream base and the binary that answered; `MUNOLA_BINARY` names a binary
10
+ to drive until the first munola release is cut. The channel's tag shape is
11
+ `munola-v<version>` on the fork's releases.
12
+
13
+ ## enola 0.4.4 (2026-08-23)
14
+
15
+ The wrapper, first release with an implementation: a pure-Ruby `enola`
16
+ executable that drives upstream's v0.4.4. The binary is fetched on first use
17
+ from the release for the running platform, verified against the sha256 the
18
+ release publishes, and kept under `~/.cache/enola/upstream/0.4.4/`; a binary on
19
+ PATH is used only when it answers the pinned version; offline with an empty
20
+ cache is a refusal that names the cache and the release. Every argument and
21
+ exit code is forwarded; `--verbose` adds one stderr line naming channel,
22
+ version and where the binary came from; `enola --wrapper-probe` prints the
23
+ channel, pin, found version and which surfaces the binary answers.
24
+
25
+ Both providers by default: the gem vendors upstream's Prism provider script
26
+ at the pinned version and depends on the `prism` gem; `enola init` writes
27
+ `mcp-arch.yaml` with Prism (run by this Ruby) and Rubydex on, then runs the
28
+ binary's `constraints init`; the Rubydex engine library is fetched once per
29
+ binary version after the binary itself, a failure printed once as a named
30
+ skip. `Enola::Config.write_default` and `Enola::Providers` are the seams the
31
+ Rails layer and munola call.
32
+
33
+ ## enola-rb 0.4.4 (2026-08-23)
34
+
35
+ The Rails layer, first release with an implementation. `rails generate
36
+ enola:install` writes `enola/constraints/` from the enola-guides starter laws,
37
+ binds the recipes the binary's own `constraints init` picks, writes the rest
38
+ as commented bindings and ignores `.enola/`; the `enola:init`,
39
+ `enola:snapshot` and `enola:check` rake tasks drive the binary the `enola` gem
40
+ fetches. A surface the pinned binary lacks is refused by name with the remedy;
41
+ an absent binary still leaves the laws written. Depends on `enola` at the same
42
+ version and on `enola-guides`. The generator writes the provider config first,
43
+ so a fresh app's graph carries Prism and Rubydex facts from its first snapshot.
44
+
45
+ ## munola 0.0.0
46
+
47
+ Placeholder. `munola` is the same wrapper over another channel. Follows.
data/README.md CHANGED
@@ -1,13 +1,103 @@
1
1
  # enola-rb
2
2
 
3
- Runs [enola](https://github.com/enola-labs/enola), the architecture-graph
4
- tool, from Ruby, with presets and defaults chosen for Rails stacks.
3
+ Three pure-Ruby gems, one repository, for running
4
+ [enola](https://github.com/enola-labs/enola), the architecture-graph tool,
5
+ from Ruby. None of them carries a binary or compiles anything.
5
6
 
6
- Two channels, picked in your Gemfile. `enola-rb` on its own drives whichever
7
- enola binary is on your path. Adding the `munola` gem switches it to the build
8
- this project ships, which carries capabilities not yet in an upstream release.
7
+ ## `enola`
9
8
 
10
- Presets come from
11
- [enola-guides](https://github.com/misabegovic/enola-guides).
9
+ The wrapper of the released enola. Its version is the upstream release it
10
+ drives: `enola 0.4.4` runs enola-labs' v0.4.4.
12
11
 
13
- Placeholder release. No implementation yet.
12
+ ```ruby
13
+ gem "enola"
14
+ ```
15
+
16
+ ```sh
17
+ bundle exec enola --generate .
18
+ bundle exec enola baseline pin .
19
+ bundle exec enola check .
20
+ ```
21
+
22
+ The first command that needs the binary downloads the release for your
23
+ platform (linux, darwin, windows; amd64, arm64), verifies it against the
24
+ sha256 file the same release publishes, and keeps it under
25
+ `~/.cache/enola/upstream/0.4.4/` (`ENOLA_CACHE_DIR` moves the root). An
26
+ `enola` already on your PATH is used only when it answers the pinned version;
27
+ offline with an empty cache is a refusal that names the cache and the release
28
+ rather than a fallback to whatever is installed. Nothing downloads at
29
+ `bundle install`.
30
+
31
+ Every argument and exit code is forwarded unchanged; the wrapper adds no flag
32
+ of its own to enola's surface. `--verbose` on any command writes one line to
33
+ stderr first, naming the channel, the version and where the binary came from.
34
+ `enola --wrapper-probe` prints the channel, the pin, the version the binary
35
+ answers and which surfaces it has (`constraints`, `providers`, `check`,
36
+ `hook`), read by running them, never by comparing version strings.
37
+
38
+ This gem is not an enola-labs release; it runs theirs.
39
+
40
+ ## `enola-rb`
41
+
42
+ The Rails layer over `enola`. It depends on `enola` at the same version and on
43
+ [enola-guides](https://github.com/misabegovic/enola-guides), and adds nothing
44
+ to the binary's surface.
45
+
46
+ ```ruby
47
+ gem "enola-rb"
48
+ ```
49
+
50
+ ```sh
51
+ bin/rails generate enola:install
52
+ bin/rake enola:snapshot
53
+ bin/rake enola:check
54
+ ```
55
+
56
+ The generator writes `enola/constraints/` from the guides' starter laws (four
57
+ laws a Rails team keeps, each with its reason), asks the binary's own
58
+ `constraints init` to bind the shipped recipes whose roles resolve in the app,
59
+ writes every other shipped recipe as a commented binding to uncomment once the
60
+ directories exist, and ignores `.enola/`. It reads what `init` wrote rather
61
+ than its exit code, and when the binary cannot be fetched it still writes the
62
+ laws and says so. `enola:snapshot` generates and pins the baseline;
63
+ `enola:check` grades the working tree against it and fails on a new breach of
64
+ a declared law. A surface the pinned binary lacks is refused by name with the
65
+ remedy.
66
+
67
+ ## `munola`
68
+
69
+ One person's taste on top of enola: the same wrapper over another channel,
70
+ the builds cut from [a fork of enola](https://github.com/misabegovic/enola),
71
+ versioned as the upstream they are built on plus a fourth segment
72
+ (`0.4.4.1` drives a build on v0.4.4), each release naming what differs from
73
+ that upstream. It is offered upstream where it fits and is not positioned
74
+ against it. What it adds is the channel and the catalogue.
75
+
76
+ ```ruby
77
+ gem "munola"
78
+ ```
79
+
80
+ ```sh
81
+ bin/rails generate munola:install --tenant-column company_id
82
+ bundle exec munola init .
83
+ bundle exec munola --version
84
+ ```
85
+
86
+ `munola init` does what `enola:install` does, then what only munola carries:
87
+ it writes the recipe catalogue the `enola-guides` gem ships (Ember
88
+ conventions, data ownership, API boundaries, background work, a tenant
89
+ foreign key) into `enola/recipes/`, binds the recipes the tree justifies
90
+ (`ember-cli-build.js`, a schema with `app/models`, `config/routes.rb` with
91
+ `app/policies`, `app/tasks`, a column most tables share confirmed against
92
+ `db/schema.rb`) and writes every other one as a commented binding; it fills
93
+ the tenant template from the schema's own table names, never from an
94
+ inflection table; it writes `mcp-arch.yaml` with both Ruby providers on by
95
+ default, Prism through the script the `enola` gem carries and Rubydex built
96
+ into the binary, and fetches the Rubydex library, a failed fetch reported as a
97
+ named skip. It never asks a question. `munola --version` names the munola
98
+ version, the upstream it is built on and which binary answered.
99
+
100
+ The first munola release is what makes the channel real; until it is cut,
101
+ `MUNOLA_BINARY=/path/to/enola` names the binary to drive, and every command
102
+ says so. `munola` depends on `enola` and `enola-rb` at its upstream version
103
+ and on `enola-guides` 0.3.1 or later.
data/lib/enola-rb.rb CHANGED
@@ -1,5 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- module Enola
4
- VERSION = "0.0.0"
3
+ require "enola"
4
+ require_relative "enola_rb/version"
5
+ require_relative "enola_rb/guides"
6
+ require_relative "enola_rb/surface"
7
+ require_relative "enola_rb/installer"
8
+ begin
9
+ require "rails"
10
+ rescue LoadError
11
+ nil
12
+ end
13
+ require_relative "enola_rb/railtie" if defined?(Rails::Railtie)
14
+
15
+ module EnolaRb
16
+ TASKS = File.expand_path("enola_rb/tasks.rake", __dir__)
5
17
  end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EnolaRb
4
+ # The enola-guides gem carries the starter laws; it is found at run time so a
5
+ # missing gem is a refusal naming the Gemfile line rather than a load error.
6
+ module Guides
7
+ BUILT_IN_RECIPES = %w[
8
+ rails-conventions rails-strict vanilla-rails layered ports-and-adapters
9
+ modular-monolith event-driven clean cqrs ruby-conventions
10
+ ].freeze
11
+
12
+ def self.root
13
+ ENV.fetch("ENOLA_GUIDES_DIR") { Gem::Specification.find_by_name("enola-guides").gem_dir }
14
+ rescue Gem::MissingSpecError
15
+ raise Enola::Unavailable, "the enola-guides gem is not installed; add `gem \"enola-guides\"` to the Gemfile, it carries the starter laws the generator writes"
16
+ end
17
+
18
+ def self.starter_laws
19
+ Dir.glob(File.join(root, "templates", "constraints-starter", "*.rb")).sort
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "fileutils"
4
+ require "open3"
5
+ require "yaml"
6
+
7
+ module EnolaRb
8
+ class Installer
9
+ Report = Struct.new(:written, :bound, :unbound, :notes, keyword_init: true) do
10
+ def lines
11
+ out = written.map { |path| "wrote #{path}" }
12
+ out << "bound #{bound.join(', ')}" unless bound.empty?
13
+ out << "left commented, bind when the directories exist: #{unbound.join(', ')}" unless unbound.empty?
14
+ out + notes
15
+ end
16
+ end
17
+
18
+ def initialize(root, binary: nil, stderr: $stderr)
19
+ @root = File.expand_path(root)
20
+ @binary = binary
21
+ @stderr = stderr
22
+ @report = Report.new(written: [], bound: [], unbound: [], notes: [])
23
+ end
24
+
25
+ def install
26
+ raise Enola::Unavailable, "#{@root} holds no app/ directory; run this from the Rails root" unless File.directory?(File.join(@root, "app"))
27
+
28
+ write_config
29
+ copy_starter_laws
30
+ init_with_binary
31
+ comment_unbound
32
+ ignore_artifacts
33
+ @report
34
+ end
35
+
36
+ private
37
+
38
+ def write_config
39
+ written = Enola::Config.write_default(@root)
40
+ @report.written << relative(written) if written
41
+ end
42
+
43
+ def constraints_dir
44
+ File.join(@root, "enola", "constraints")
45
+ end
46
+
47
+ def bindings_path
48
+ File.join(constraints_dir, "recipes.yaml")
49
+ end
50
+
51
+ def copy_starter_laws
52
+ FileUtils.mkdir_p(constraints_dir)
53
+ Guides.starter_laws.each do |law|
54
+ target = File.join(constraints_dir, File.basename(law))
55
+ next if File.exist?(target)
56
+
57
+ FileUtils.cp(law, target)
58
+ @report.written << relative(target)
59
+ end
60
+ end
61
+
62
+ # The binary's own `constraints init` decides what binds; what it wrote is
63
+ # read rather than its exit code, because the release that shipped the
64
+ # surface exits through its unknown-command line after doing the work.
65
+ def init_with_binary
66
+ binary = @binary || Surface.require!(:constraints, binary: Enola.resolver.resolve.path)
67
+ out, status = Open3.capture2e(binary, "constraints", "init", @root)
68
+ note("constraints init: #{out.lines.last&.strip}") unless status.success? || File.exist?(bindings_path)
69
+ rescue Enola::Error => e
70
+ note("the enola binary is absent (#{e.message}); the laws are written, run `rake enola:init` once it can be fetched")
71
+ end
72
+
73
+ def bound
74
+ return [] unless File.exist?(bindings_path)
75
+
76
+ Array((YAML.safe_load(File.read(bindings_path)) || {})["use_recipe"]).map { |entry| entry["recipe"] }.compact
77
+ end
78
+
79
+ def comment_unbound
80
+ @report.bound = bound
81
+ @report.unbound = Guides::BUILT_IN_RECIPES - @report.bound
82
+ return if @report.unbound.empty?
83
+
84
+ existing = File.exist?(bindings_path) ? File.read(bindings_path) : "use_recipe: []\n"
85
+ return if existing.include?("# Shipped recipes not bound")
86
+
87
+ commented = @report.unbound.map { |name| "# - recipe: #{name}\n# as: #{name}\n# mode: ratchet\n" }.join
88
+ File.write(bindings_path, "#{existing.chomp}\n\n# Shipped recipes not bound because their roles found no directory here.\n# Uncomment one once the directories exist, then run `enola constraints lint`.\n#{commented}")
89
+ @report.written << relative(bindings_path)
90
+ end
91
+
92
+ def ignore_artifacts
93
+ path = File.join(@root, ".gitignore")
94
+ existing = File.exist?(path) ? File.read(path) : ""
95
+ return if existing.lines.any? { |line| line.strip == ".enola/" }
96
+
97
+ File.write(path, "#{existing.chomp}\n.enola/\n".lstrip)
98
+ @report.written << ".gitignore"
99
+ end
100
+
101
+ def relative(path)
102
+ path.delete_prefix("#{@root}/")
103
+ end
104
+
105
+ def note(text)
106
+ @report.notes << text
107
+ @stderr.puts "enola: #{text}"
108
+ end
109
+ end
110
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EnolaRb
4
+ class Railtie < Rails::Railtie
5
+ rake_tasks { load EnolaRb::TASKS }
6
+ generators { require_relative "../generators/enola/install/install_generator" }
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EnolaRb
4
+ module Surface
5
+ REMEDY = {
6
+ upstream: "upgrade the enola gem to a release that carries it, or switch the Gemfile to munola",
7
+ munola: "upgrade the munola gem"
8
+ }.freeze
9
+
10
+ def self.require!(name, binary:, channel: Enola.channel)
11
+ return binary if Enola::Probe.new(binary).capabilities.fetch(name.to_sym, false)
12
+
13
+ remedy = REMEDY.fetch(channel.name.to_sym, "upgrade the gem that pins this binary")
14
+ raise Enola::Unavailable, "the #{channel} binary at #{binary} has no `#{name}` surface; #{remedy}"
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "enola-rb"
4
+
5
+ namespace :enola do
6
+ root = -> { defined?(Rails) && Rails.respond_to?(:root) && Rails.root ? Rails.root.to_s : Dir.pwd }
7
+ run = lambda do |*args|
8
+ status = Enola::Runner.new.run(args)
9
+ abort("enola: exited #{status}") unless status.zero?
10
+ rescue Enola::Error => e
11
+ abort("enola: #{e.message}")
12
+ end
13
+
14
+ desc "Write enola/constraints/ from the guides' starter and bind the shipped recipes whose roles resolve"
15
+ task :init do
16
+ EnolaRb::Installer.new(root.call).install.lines.each { |line| puts line }
17
+ rescue Enola::Error => e
18
+ abort("enola: #{e.message}")
19
+ end
20
+
21
+ desc "Snapshot the application and pin the result as the baseline a change is graded against"
22
+ task :snapshot do
23
+ run.call("--generate", root.call)
24
+ run.call("baseline", "pin", root.call)
25
+ end
26
+
27
+ desc "Grade the working tree against the pinned baseline; fails on a new breach of a declared law"
28
+ task :check do
29
+ run.call("check", "--fail-on", "constraints", root.call)
30
+ end
31
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EnolaRb
4
+ VERSION = "0.4.4"
5
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "enola-rb"
5
+
6
+ module Enola
7
+ module Generators
8
+ class InstallGenerator < Rails::Generators::Base
9
+ desc "Writes enola/constraints/ from the guides' starter laws and binds the shipped recipes whose roles resolve"
10
+ def install
11
+ EnolaRb::Installer.new(destination_root).install.lines.each { |line| say line }
12
+ rescue Enola::Error => e
13
+ raise Thor::Error, "enola: #{e.message}"
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rails/generators"
4
+ require "munola"
5
+
6
+ module Munola
7
+ module Generators
8
+ class InstallGenerator < Rails::Generators::Base
9
+ desc "Writes enola/constraints/ and the munola recipe catalogue, binding what the tree shows a need for"
10
+ class_option :tenant_column, type: :string, default: nil, desc: "The column most tables carry; confirmed against db/schema.rb"
11
+
12
+ def install
13
+ Munola::Installer.new(destination_root, tenant_column: options[:tenant_column]).install.lines.each { |line| say line }
14
+ rescue Enola::Error => e
15
+ raise Thor::Error, "munola: #{e.message}"
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,29 +1,67 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enola-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Muhamed Isabegovic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-21 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2026-08-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: enola
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '='
18
+ - !ruby/object:Gem::Version
19
+ version: 0.4.4
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.4.4
27
+ - !ruby/object:Gem::Dependency
28
+ name: enola-guides
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.2.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.2.1
13
41
  description: |
14
- A Ruby wrapper around enola, the architecture-graph tool: presets, defaults
15
- and a command surface aimed at Rails applications. Drives whichever enola
16
- binary is on your path; add the munola gem to use the build this project
17
- ships instead. Placeholder release; no implementation yet.
42
+ Adds the Rails layer to the enola gem: `rails generate enola:install` writes
43
+ enola/constraints/ from the enola-guides starter laws and binds the recipes
44
+ the released enola's own `constraints init` picks for the app, and the
45
+ enola:init, enola:snapshot and enola:check rake tasks drive the binary the
46
+ `enola` gem fetches and verifies. Pure Ruby; no binary, nothing compiled.
18
47
  email:
19
48
  - m.isabegovic@hotmail.com
20
49
  executables: []
21
50
  extensions: []
22
51
  extra_rdoc_files: []
23
52
  files:
53
+ - CHANGELOG.md
24
54
  - LICENSE
25
55
  - README.md
26
56
  - lib/enola-rb.rb
57
+ - lib/enola_rb/guides.rb
58
+ - lib/enola_rb/installer.rb
59
+ - lib/enola_rb/railtie.rb
60
+ - lib/enola_rb/surface.rb
61
+ - lib/enola_rb/tasks.rake
62
+ - lib/enola_rb/version.rb
63
+ - lib/generators/enola/install/install_generator.rb
64
+ - lib/generators/munola/install/install_generator.rb
27
65
  homepage: https://github.com/misabegovic/enola-rb
28
66
  licenses:
29
67
  - Apache-2.0
@@ -48,5 +86,6 @@ requirements: []
48
86
  rubygems_version: 3.5.22
49
87
  signing_key:
50
88
  specification_version: 4
51
- summary: Runs enola from Ruby, with defaults chosen for Rails stacks.
89
+ summary: 'The Rails layer over the enola gem: rake tasks and a generator that writes
90
+ the guides'' starter laws.'
52
91
  test_files: []