Sha256: dfaa4a941e97a0c28f688934e8c8625d358daa7f727ba39d03802cc20132b9b3

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

module SublimeTextKit
  module CLI
    module Actions
      # Handles update action.
      class Update
        include SublimeTextKit::Import[:configuration, :logger]

        def initialize(
          metadata: SublimeTextKit::Metadata::Handler,
          session: Sessions::Rebuilder.new,
          **
        )
          super(**)
          @metadata = metadata
          @session = session
        end

        def call
          logger.info "Updating metadata and session..."
          create_metadata
          session.call
          logger.info { "Metadata and session updated." }
        end

        private

        attr_reader :metadata, :session

        def create_metadata
          configuration.project_dirs.each do |directory|
            metadata.with_project(directory, metadata_dir).create
            metadata.with_workspace(directory, metadata_dir).create
          end
        end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sublime_text_kit-14.2.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-14.1.2 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-14.1.1 lib/sublime_text_kit/cli/actions/update.rb