Sha256: c82edc29cf16db43e73de71238115eac64c4564f3d30801063bfb7778678ed03

Contents?: true

Size: 734 Bytes

Versions: 5

Compression:

Stored size: 734 Bytes

Contents

module BooticCli
  module Themes
    class MissingItemsTheme
      def initialize(source:, target:)
        @source, @target = source, target
      end

      def any?
        templates.any? || assets.any?
      end

      def count
        templates.count + assets.count
      end

      def templates
        @templates ||= find_missing_files(source.templates, target.templates)
      end

      def assets
        @assets ||= find_missing_files(source.assets, target.assets)
      end

      private
      attr_reader :source, :target

      def find_missing_files(set1, set2)
        file_names = set2.map(&:file_name)
        set1.select do |f|
          !file_names.include?(f.file_name)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bootic_cli-1.2.0 lib/bootic_cli/themes/missing_items_theme.rb
bootic_cli-1.1.0 lib/bootic_cli/themes/missing_items_theme.rb
bootic_cli-1.0.0 lib/bootic_cli/themes/missing_items_theme.rb
bootic_cli-0.9.6 lib/bootic_cli/themes/missing_items_theme.rb
bootic_cli-0.9.5 lib/bootic_cli/themes/missing_items_theme.rb