Sha256: 48333dbd846f01f43e9773fd05817a0ea4c75a83dbb9bdb7448091db3c716bfc

Contents?: true

Size: 884 Bytes

Versions: 6

Compression:

Stored size: 884 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 SampleData < Command
            desc "Load sample data"

            def call(**)
              if has_file?
                measure "Sample data loaded" do
                  application.boot!
                  load file_path
                end
              else
                out.puts "=> no sample data available"
              end
            end

            private

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

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

        register "db sample_data", DB::SampleData
      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/sample_data.rb
snowpack-1.0.0.alpha6 lib/snowpack/cli/application/commands/db/sample_data.rb
snowpack-1.0.0.alpha5 lib/snowpack/cli/application/commands/db/sample_data.rb
snowpack-1.0.0.alpha4 lib/snowpack/cli/application/commands/db/sample_data.rb
snowpack-1.0.0.alpha3 lib/snowpack/cli/application/commands/db/sample_data.rb
snowpack-1.0.0.alpha2 lib/snowpack/cli/application/commands/db/sample_data.rb