Sha256: 21e60daea13f7908add711b7db224d02086e0f74d23e19e098e535d05b5a2d63

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

# frozen_string_literal: true

module SublimeTextKit
  module CLI
    module Actions
      # Handles update action.
      class Update
        def initialize metadata: SublimeTextKit::Metadata::Handler,
                       session: Sessions::Rebuilder.new,
                       container: Container
          @metadata = metadata
          @session = session
          @container = container
        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, :container

        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

        def configuration = container[__method__]

        def logger = container[__method__]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sublime_text_kit-12.3.2 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-12.3.1 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-12.3.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-12.2.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-12.1.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-12.0.1 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-12.0.0 lib/sublime_text_kit/cli/actions/update.rb