Sha256: 98a88f51d478d4ae26d8ca9b10feb52e24ca4d59da29072156bb8b7790674e17

Contents?: true

Size: 831 Bytes

Versions: 3

Compression:

Stored size: 831 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
                  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?(file_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.alpha7 lib/snowpack/cli/application/commands/db/seed.rb
snowpack-1.0.0.alpha6 lib/snowpack/cli/application/commands/db/seed.rb
snowpack-1.0.0.alpha5 lib/snowpack/cli/application/commands/db/seed.rb