Module: Outset::Recipes

Defined in:
lib/outset/recipes.rb

Constant Summary collapse

REGISTRY =
{
  "saas" => {
    description: "Full SaaS stack — auth, jobs, pagination",
    database:    "postgresql",
    css:         "tailwind",
    js:          "importmap",
    gems:        %w[devise pundit sidekiq pagy annotate letter_opener]
  },
  "api" => {
    description: "API-only app — no frontend assets",
    database:    "postgresql",
    css:         "none",
    js:          "importmap",
    gems:        %w[devise rspec]
  },
  "minimal" => {
    description: "Bare minimum — SQLite, no extras",
    database:    "sqlite3",
    css:         "none",
    js:          "importmap",
    gems:        []
  }
}.freeze

Class Method Summary collapse

Class Method Details

.allObject



37
38
39
# File 'lib/outset/recipes.rb', line 37

def self.all
  REGISTRY.merge(user_recipes)
end

.find(name) ⇒ Object



29
30
31
32
33
34
35
# File 'lib/outset/recipes.rb', line 29

def self.find(name)
  REGISTRY[name] || user_recipes[name] || begin
    UI.error("Unknown recipe: '#{name}'")
    UI.muted("  Available recipes: #{all.keys.join(", ")}")
    exit(1)
  end
end

.user_recipesObject



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/outset/recipes.rb', line 41

def self.user_recipes
  config = Config.load
  (config["recipes"] || {}).each_with_object({}) do |(name, value), hash|
    next unless value.is_a?(Hash)
    hash[name] = {
      description: value["description"] || "Custom recipe",
      database:    value["database"]    || "postgresql",
      css:         value["css"]         || "tailwind",
      js:          value["js"]          || "importmap",
      gems:        value["gems"]        || []
    }
  end
end