Sha256: 12a918fabd5f64ce94aff58d7dc942372db46a98df0af858d382a4ab452a5345

Contents?: true

Size: 1.12 KB

Versions: 5

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require "refinements/pathname"
require "sod"

module SublimeTextKit
  module CLI
    module Actions
      module Metadata
        # Recreates project metadata.
        class Recreate < Sod::Action
          include Import[:configuration, :logger]

          using Refinements::Pathname

          description "Recreate metadata."

          on %w[-r --recreate]

          def initialize(handler: SublimeTextKit::Metadata::Handler, **)
            super(**)
            @handler = handler
          end

          def call(*)
            logger.info "Recreating metadata in #{metadata_dir}..."
            process_projects
            logger.info "Metadata recreated."
          end

          private

          attr_reader :handler

          def process_projects
            configuration.project_dirs.each do |directory|
              handler.with_project(directory, metadata_dir).recreate
              handler.with_workspace(directory, metadata_dir).recreate
            end
          end

          def metadata_dir = Pathname(configuration.metadata_dir).expand_path
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sublime_text_kit-16.5.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-16.3.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-16.2.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-16.1.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-16.0.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb