Sha256: be319ef7c3f885aa63387c19e88f8f5d5baf340e247e7ba26d13bb3ed185498f

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require "refinements/pathnames"
require "sod"

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

          using Refinements::Pathnames

          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

7 entries across 7 versions & 1 rubygems

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