Module: Hanami::CLIBulma

Extended by:
Dry::CLI::Registry
Defined in:
lib/hanami/cli_bulma.rb,
lib/hanami/cli_bulma/bundler.rb,
lib/hanami/cli_bulma/version.rb,
lib/hanami/cli_bulma/commands.rb,
lib/hanami/cli_bulma/commands/app.rb,
lib/hanami/cli_bulma/commands/gem.rb,
lib/hanami/cli_bulma/commands/gem/new.rb,
lib/hanami/cli_bulma/generators/gem/app.rb,
lib/hanami/cli_bulma/generators/app/view.rb,
lib/hanami/cli_bulma/commands/app/command.rb,
lib/hanami/cli_bulma/generators/app/slice.rb,
lib/hanami/cli_bulma/commands/app/generate.rb,
lib/hanami/cli_bulma/generators/app/action.rb,
lib/hanami/cli_bulma/commands/app/generate/view.rb,
lib/hanami/cli_bulma/commands/app/generate/slice.rb,
lib/hanami/cli_bulma/generators/app/view_context.rb,
lib/hanami/cli_bulma/commands/app/generate/action.rb

Overview

Extensible command line interface for Hanami.

Since:

  • 0.0.1

Defined Under Namespace

Modules: Commands, Generators Classes: Bundler

Constant Summary collapse

VERSION =

The current hanami-cli_bulma version.

Since:

  • 0.0.1

"0.0.2"

Class Method Summary collapse

Class Method Details

.gem_loaderObject

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:

  • 0.0.1



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/hanami/cli_bulma.rb', line 26

def self.gem_loader
  @gem_loader ||= Zeitwerk::Loader.new.tap do |loader|
    root = File.expand_path("..", __dir__)
    loader.tag = "hanami-cli_bulma"
    loader.inflector = Zeitwerk::GemInflector.new("#{root}/hanami-cli_bulma.rb")
    loader.push_dir(root)
    loader.ignore(
      "#{root}/hanami-cli_bulma.rb",
      "#{root}/hanami/cli_bulma/{errors,version}.rb"
    )
    loader.inflector.inflect("cli_bulma" => "CLIBulma")
    loader.inflector.inflect("cli" => "CLI")
    loader.inflector.inflect("db" => "DB")
    loader.inflector.inflect("url" => "URL")
  end
end

.register_commands!(within_hanami_app = within_hanami_app?) ) ⇒ 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:

  • 0.0.1



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hanami/cli_bulma/commands.rb', line 18

def self.register_commands!(within_hanami_app = within_hanami_app?)
  commands =
    if within_hanami_app
      require "hanami/cli/commands/app"
      extend(Hanami::CLI::Commands::App)

      require_relative "commands/app"
      extend(Hanami::CLIBulma::Commands::App)
    else
      require "hanami/cli/commands/gem"
      extend(Hanami::CLI::Commands::Gem)

      require_relative "commands/gem"
      extend(Hanami::CLIBulma::Commands::Gem)
    end
end

.within_hanami_app?Boolean

Returns:

  • (Boolean)

Since:

  • 0.0.1



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/hanami/cli_bulma.rb', line 12

def self.within_hanami_app?
  require "hanami"

  !!Hanami.app_path
rescue LoadError => e
  raise e unless e.path == "hanami"

  # If for any reason the hanami gem isn't installed, make a simple best effort to determine
  # whether we're inside an app.
  File.exist?("config/app.rb") || File.exist?("app.rb")
end