Sha256: 197364619552b2cad4ff15cfefb7a1d8ad436ff676afd606f6460916ad741bd7

Contents?: true

Size: 856 Bytes

Versions: 8

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

require_relative "../../application"
require_relative "structure/dump"

module Hanami
  module CLI
    module Commands
      module Monolith
        module DB
          class SampleData < Application
            FILE_PATH = "db/sample_data.rb"

            desc "Load sample data"

            def call(**)
              if has_file?
                measure "sample data loaded from #{FILE_PATH}" do
                  load full_file_path
                end
              else
                out.puts "=> #{FILE_PATH} not found"
              end
            end

            private

            def full_file_path
              File.join(application.root, FILE_PATH)
            end

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hanami-cli-2.0.0.alpha8.1 lib/hanami/cli/commands/monolith/db/sample_data.rb
hanami-cli-2.0.0.alpha8 lib/hanami/cli/commands/monolith/db/sample_data.rb
hanami-cli-2.0.0.alpha7 lib/hanami/cli/commands/monolith/db/sample_data.rb
hanami-cli-2.0.0.alpha6.1 lib/hanami/cli/commands/monolith/db/sample_data.rb
hanami-cli-2.0.0.alpha6 lib/hanami/cli/commands/monolith/db/sample_data.rb
hanami-cli-2.0.0.alpha4 lib/hanami/cli/commands/monolith/db/sample_data.rb
hanami-cli-2.0.0.alpha3 lib/hanami/cli/commands/monolith/db/sample_data.rb
hanami-cli-2.0.0.alpha2 lib/hanami/cli/commands/monolith/db/sample_data.rb