Sha256: 5d9d5e734aa9f4e8690edb6637c0cf4ce7b9c3a30be76fdd52a1660ffdc0b32e

Contents?: true

Size: 722 Bytes

Versions: 8

Compression:

Stored size: 722 Bytes

Contents

# frozen_string_literal: true
module ThemeCheck
  # Reports missing shopify required directories

  class RequiredDirectories < LiquidCheck
    severity :error
    category :liquid
    doc docs_url(__FILE__)

    REQUIRED_DIRECTORIES = %w(assets config layout locales sections snippets templates)

    def on_end
      directories = theme.directories.map(&:to_s)
      missing_directories = REQUIRED_DIRECTORIES - directories
      missing_directories.each { |d| add_missing_directories_offense(d) }
    end

    private

    def add_missing_directories_offense(directory)
      add_offense("Theme is missing '#{directory}' directory") do |corrector|
        corrector.mkdir(@theme, directory)
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
theme-check-1.8.0 lib/theme_check/checks/required_directories.rb
theme-check-1.7.2 lib/theme_check/checks/required_directories.rb
theme-check-1.7.1 lib/theme_check/checks/required_directories.rb
theme-check-1.7.0 lib/theme_check/checks/required_directories.rb
theme-check-1.6.2 lib/theme_check/checks/required_directories.rb
theme-check-1.6.1 lib/theme_check/checks/required_directories.rb
theme-check-1.6.0 lib/theme_check/checks/required_directories.rb
theme-check-1.5.2 lib/theme_check/checks/required_directories.rb