Class: Hanami::CLI::Commands::App::DB::Command Private

Inherits:
App::Command
  • Object
show all
Defined in:
lib/hanami/cli/commands/app/db/command.rb

Overview

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

Base class for hanami CLI commands intended to be executed within an existing Hanami app.

Since:

  • 2.2.0

Direct Known Subclasses

Structure::Dump, Structure::Load

Defined Under Namespace

Modules: SkipTestDB

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(out:, err:, system_call: SystemCall.new, test_env_executor: InteractiveSystemCall.new(out: out, err: err), nested_command: false, **opts) ⇒ Command

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.

Returns a new instance of Command.

Since:

  • 2.2.0



62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/hanami/cli/commands/app/db/command.rb', line 62

def initialize(
  out:, err:,
  system_call: SystemCall.new,
  test_env_executor: InteractiveSystemCall.new(out: out, err: err),
  nested_command: false,
  **opts
)
  super(out: out, err: err, **opts)
  @system_call = system_call
  @test_env_executor = test_env_executor
  @nested_command = nested_command
end

Instance Attribute Details

#system_callObject (readonly)

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.2.0



57
58
59
# File 'lib/hanami/cli/commands/app/db/command.rb', line 57

def system_call
  @system_call
end

#test_env_executorObject (readonly)

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.2.0



60
61
62
# File 'lib/hanami/cli/commands/app/db/command.rb', line 60

def test_env_executor
  @test_env_executor
end

Class Method Details

.inherited(klass) ⇒ 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:

  • 3.0.0



48
49
50
51
# File 'lib/hanami/cli/commands/app/db/command.rb', line 48

def self.inherited(klass)
  super
  klass.prepend(SkipTestDB)
end

Instance Method Details

#nested_command?Boolean

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.

Returns:

  • (Boolean)

Since:

  • 2.2.0



85
86
87
# File 'lib/hanami/cli/commands/app/db/command.rb', line 85

def nested_command?
  @nested_command
end

#run_command(klass) ⇒ 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.2.0



75
76
77
78
79
80
81
82
83
# File 'lib/hanami/cli/commands/app/db/command.rb', line 75

def run_command(klass, ...)
  klass.new(
    out: out,
    fs: fs,
    system_call: system_call,
    test_env_executor: test_env_executor,
    nested_command: true
  ).call(...)
end