Sha256: 4243dde521b2fd253623df3a24d880c1c7462af075dab349c470052d1dc92469

Contents?: true

Size: 867 Bytes

Versions: 3

Compression:

Stored size: 867 Bytes

Contents

# frozen_string_literal: true

require "snowpack/cli/application/command"
require_relative "structure/dump"

module Snowpack
  module CLI
    module Application
      module Commands
        module DB
          class Seed < Command
            desc "Load database seeds"

            def call(**)
              if has_file?
                measure "Database seeds loaded" do
                  application.boot
                  load file_path
                end
              else
                out.puts "=> no database seeds available"
              end
            end

            private

            def file_path
              File.join(application.root, "db/seed.rb")
            end

            def has_file?
              File.exist?(seeds_path)
            end
          end
        end

        register "db seed", DB::Seed
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
snowpack-1.0.0.alpha4 lib/snowpack/cli/application/commands/db/seed.rb
snowpack-1.0.0.alpha3 lib/snowpack/cli/application/commands/db/seed.rb
snowpack-1.0.0.alpha2 lib/snowpack/cli/application/commands/db/seed.rb