Sha256: 54181bc62e581eb6e1319c17db7704aef6dee5b80d82190b741fa522f9e7f21a

Contents?: true

Size: 783 Bytes

Versions: 6

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

require "snowpack/cli/application/command"
require_relative "utils/database_config"

module Snowpack
  module CLI
    module Application
      module Commands
        module DB
          class Create < Command
            desc "Create database"

            def call(**)
              db_name = database_config.db_name

              system(database_config.cli_env_vars, "createdb #{Shellwords.escape(db_name)}")
              out.puts "=> database #{db_name} created" if $?.success?
            end

            private

            def database_config
              @database_config ||= Utils::DatabaseConfig.for_application(application)
            end
          end
        end

        register "db create", DB::Create
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha7 lib/snowpack/cli/application/commands/db/create.rb
snowpack-1.0.0.alpha6 lib/snowpack/cli/application/commands/db/create.rb
snowpack-1.0.0.alpha5 lib/snowpack/cli/application/commands/db/create.rb
snowpack-1.0.0.alpha4 lib/snowpack/cli/application/commands/db/create.rb
snowpack-1.0.0.alpha3 lib/snowpack/cli/application/commands/db/create.rb
snowpack-1.0.0.alpha2 lib/snowpack/cli/application/commands/db/create.rb