Module: Hanami::CLI::Commands::App Private

Defined in:
lib/hanami/cli/commands/app.rb,
lib/hanami/cli/commands/app/dev.rb,
lib/hanami/cli/commands/app/assets.rb,
lib/hanami/cli/commands/app/routes.rb,
lib/hanami/cli/commands/app/server.rb,
lib/hanami/cli/commands/app/command.rb,
lib/hanami/cli/commands/app/console.rb,
lib/hanami/cli/commands/app/db/drop.rb,
lib/hanami/cli/commands/app/db/seed.rb,
lib/hanami/cli/commands/app/install.rb,
lib/hanami/cli/commands/app/version.rb,
lib/hanami/cli/commands/app/generate.rb,
lib/hanami/cli/commands/app/db/create.rb,
lib/hanami/cli/commands/app/db/command.rb,
lib/hanami/cli/commands/app/db/migrate.rb,
lib/hanami/cli/commands/app/db/prepare.rb,
lib/hanami/cli/commands/app/db/version.rb,
lib/hanami/cli/commands/app/middleware.rb,
lib/hanami/cli/commands/app/assets/watch.rb,
lib/hanami/cli/commands/app/generate/part.rb,
lib/hanami/cli/commands/app/generate/repo.rb,
lib/hanami/cli/commands/app/generate/view.rb,
lib/hanami/cli/commands/app/assets/command.rb,
lib/hanami/cli/commands/app/assets/compile.rb,
lib/hanami/cli/commands/app/db/utils/mysql.rb,
lib/hanami/cli/commands/app/generate/slice.rb,
lib/hanami/cli/commands/app/db/utils/sqlite.rb,
lib/hanami/cli/commands/app/generate/action.rb,
lib/hanami/cli/commands/app/generate/struct.rb,
lib/hanami/cli/commands/app/generate/command.rb,
lib/hanami/cli/commands/app/db/structure/dump.rb,
lib/hanami/cli/commands/app/db/structure/load.rb,
lib/hanami/cli/commands/app/db/utils/database.rb,
lib/hanami/cli/commands/app/db/utils/postgres.rb,
lib/hanami/cli/commands/app/generate/relation.rb,
lib/hanami/cli/commands/app/generate/component.rb,
lib/hanami/cli/commands/app/generate/migration.rb,
lib/hanami/cli/commands/app/generate/operation.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Commands made available when the hanami CLI is executed within an Hanami app.

Since:

  • 2.0.0

Defined Under Namespace

Modules: Assets, DB, Generate Classes: Command, Console, Dev, Install, Middleware, Routes, Server, Version

Class Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 2.0.0



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/hanami/cli/commands/app.rb', line 13

def self.extended(base)
  base.module_eval do
    register "version", Commands::App::Version, aliases: ["v", "-v", "--version"]
    register "install", Commands::App::Install
    register "dev", Commands::App::Dev
    register "console", Commands::App::Console, aliases: ["c"]
    register "server", Commands::App::Server, aliases: ["s"]
    register "routes", Commands::App::Routes
    register "middleware", Commands::App::Middleware

    if Hanami.bundled?("hanami-assets")
      register "assets" do |prefix|
        prefix.register "compile", Assets::Compile
        prefix.register "watch", Assets::Watch
      end
    end

    if Hanami.bundled?("hanami-db")
      register "db" do |db|
        db.register "create", DB::Create
        db.register "drop", DB::Drop
        db.register "migrate", DB::Migrate
        db.register "structure dump", DB::Structure::Dump
        db.register "structure load", DB::Structure::Load
        db.register "seed", DB::Seed
        db.register "prepare", DB::Prepare
        db.register "version", DB::Version
      end
    end

    register "generate", aliases: ["g"] do |prefix|
      prefix.register "slice", Generate::Slice
      prefix.register "component", Generate::Component

      if Hanami.bundled?("hanami-controller")
        prefix.register "action", Generate::Action
      end

      if Hanami.bundled?("dry-operation")
        prefix.register "operation", Generate::Operation
      end

      if Hanami.bundled?("hanami-view")
        prefix.register "view", Generate::View
        prefix.register "part", Generate::Part
      end

      if Hanami.bundled?("hanami-db")
        prefix.register "migration", Generate::Migration
        prefix.register "relation", Generate::Relation
        prefix.register "repo", Generate::Repo
        prefix.register "struct", Generate::Struct
      end
    end
  end
end