Sha256: 36b6ac5142fc0e9412e7f5d7abbeec9ba0c48db6a9074fd00b84a46e3aedd5b9

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

require "refinements/pathnames"
require "sod"

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

          using Refinements::Pathnames

          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

7 entries across 7 versions & 1 rubygems

Version Path
sublime_text_kit-15.2.1 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-15.2.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-15.1.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-15.0.3 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-15.0.2 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-15.0.1 lib/sublime_text_kit/cli/actions/metadata/recreate.rb
sublime_text_kit-15.0.0 lib/sublime_text_kit/cli/actions/metadata/recreate.rb