Sha256: cad173cbda6a202b21553e583d5360ba7166afec61a33826275f843b2c5dc11c

Contents?: true

Size: 1.05 KB

Versions: 9

Compression:

Stored size: 1.05 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,
                       **dependencies

          super(**dependencies)

          @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

9 entries across 9 versions & 1 rubygems

Version Path
sublime_text_kit-14.1.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-14.0.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-13.5.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-13.4.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-13.3.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-13.2.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-13.1.0 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-13.0.1 lib/sublime_text_kit/cli/actions/update.rb
sublime_text_kit-13.0.0 lib/sublime_text_kit/cli/actions/update.rb