Sha256: 1ee3694ea0607cb0fc1f06b4aa2b663472f11a2fd0653c7f8c2ced599f417401

Contents?: true

Size: 816 Bytes

Versions: 3

Compression:

Stored size: 816 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  module Generators
    # Abstract class from which all generators inherit from.
    class Base
      def initialize cli, configuration: {}
        @cli = cli
        @configuration = configuration
      end

      def self.run cli, configuration: {}
        new(cli, configuration: configuration).run
      end

      def run
        fail NotImplementedError, "The method, #run, is not implemented yet."
      end

      protected

      attr_reader :cli, :configuration

      def lib_root
        File.join "%gem_name%", "lib"
      end

      def lib_gem_root
        File.join lib_root, "%gem_path%"
      end

      def gem_name
        configuration.dig :gem, :name
      end

      def gem_path
        configuration.dig :gem, :path
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gemsmith-9.2.0 lib/gemsmith/generators/base.rb
gemsmith-9.1.0 lib/gemsmith/generators/base.rb
gemsmith-9.0.0 lib/gemsmith/generators/base.rb