Sha256: 68510055b6b016d5123d20c80e150ba214780d09f9f5dde10d4ff138fa98f441

Contents?: true

Size: 1.09 KB

Versions: 8

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

require "refinements/pathname"
require "sod"

module SublimeTextKit
  module CLI
    module Actions
      module Metadata
        # Deletes project metadata.
        class Delete < Sod::Action
          include Import[:settings, :logger]

          using Refinements::Pathname

          description "Delete metadata."

          on %w[-d --delete]

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

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

          private

          attr_reader :handler

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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
sublime_text_kit-17.6.0 lib/sublime_text_kit/cli/actions/metadata/delete.rb
sublime_text_kit-17.5.0 lib/sublime_text_kit/cli/actions/metadata/delete.rb
sublime_text_kit-17.4.0 lib/sublime_text_kit/cli/actions/metadata/delete.rb
sublime_text_kit-17.3.0 lib/sublime_text_kit/cli/actions/metadata/delete.rb
sublime_text_kit-17.2.0 lib/sublime_text_kit/cli/actions/metadata/delete.rb
sublime_text_kit-17.1.0 lib/sublime_text_kit/cli/actions/metadata/delete.rb
sublime_text_kit-17.0.1 lib/sublime_text_kit/cli/actions/metadata/delete.rb
sublime_text_kit-17.0.0 lib/sublime_text_kit/cli/actions/metadata/delete.rb