Sha256: c7ec5fe37ddb19adddffbc7d97b45580a5ababf1f2f68e6528805db93c9643ed

Contents?: true

Size: 913 Bytes

Versions: 11

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  module Generators
    # Abstract class from which all generators inherit from.
    class Base
      LIB_ROOT = File.join("%gem_name%", "lib").freeze

      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

      # :reek:UtilityFunction
      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

      def gem_root
        File.join cli.destination_root, gem_name
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gemsmith-11.2.0 lib/gemsmith/generators/base.rb
gemsmith-11.1.0 lib/gemsmith/generators/base.rb
gemsmith-11.0.1 lib/gemsmith/generators/base.rb
gemsmith-11.0.0 lib/gemsmith/generators/base.rb
gemsmith-10.4.2 lib/gemsmith/generators/base.rb
gemsmith-10.4.1 lib/gemsmith/generators/base.rb
gemsmith-10.4.0 lib/gemsmith/generators/base.rb
gemsmith-10.3.0 lib/gemsmith/generators/base.rb
gemsmith-10.2.0 lib/gemsmith/generators/base.rb
gemsmith-10.1.0 lib/gemsmith/generators/base.rb
gemsmith-10.0.0 lib/gemsmith/generators/base.rb