Module: EnolaRb::Guides

Defined in:
lib/enola_rb/guides.rb

Overview

The enola-guides gem carries the starter laws; it is found at run time so a missing gem is a refusal naming the Gemfile line rather than a load error.

Constant Summary collapse

BUILT_IN_RECIPES =
%w[
  rails-conventions rails-strict vanilla-rails layered ports-and-adapters
  modular-monolith event-driven clean cqrs ruby-conventions
].freeze

Class Method Summary collapse

Class Method Details

.rootObject



12
13
14
15
16
# File 'lib/enola_rb/guides.rb', line 12

def self.root
  ENV.fetch("ENOLA_GUIDES_DIR") { Gem::Specification.find_by_name("enola-guides").gem_dir }
rescue Gem::MissingSpecError
  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"
end

.starter_lawsObject



18
19
20
# File 'lib/enola_rb/guides.rb', line 18

def self.starter_laws
  Dir.glob(File.join(root, "templates", "constraints-starter", "*.rb")).sort
end