Sha256: 637c2435f0247e434a1f02b4206091dbf52ce0eab9c3af27f496b13c4540092a

Contents?: true

Size: 1.1 KB

Versions: 5

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require "refinements/pathname"
require "sod"

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

          using Refinements::Pathname

          description "Create metadata."

          on %w[-c --create]

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

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

          private

          attr_reader :handler

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

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sublime_text_kit-16.5.0 lib/sublime_text_kit/cli/actions/metadata/create.rb
sublime_text_kit-16.3.0 lib/sublime_text_kit/cli/actions/metadata/create.rb
sublime_text_kit-16.2.0 lib/sublime_text_kit/cli/actions/metadata/create.rb
sublime_text_kit-16.1.0 lib/sublime_text_kit/cli/actions/metadata/create.rb
sublime_text_kit-16.0.0 lib/sublime_text_kit/cli/actions/metadata/create.rb