Sha256: 7a3703f7831416483c0ec206b67bec74488325276e146a99be11ba0d6240eaa3

Contents?: true

Size: 851 Bytes

Versions: 2

Compression:

Stored size: 851 Bytes

Contents

require "pathname"
require "active_support/inflector"

module Tset
  module Commands
    class Generate

      GENERATOR_NAMESPACE = "Tset::Generators::%sTest".freeze

      class Error < ::StandardError ; end

      attr_reader :type, :name, :framework, :cli, :source, :target

      def initialize(type, name, framework, cli)
        @type = type
        @name = name.downcase
        @framework = framework

        @cli = cli
        @source = Pathname.new(::File.dirname(__FILE__) + "/../generators/#{ @type }_test").realpath
        @target = Pathname.pwd.realpath
      end

      def start
        generator.start
      end

      private

      def generator
        require "tset/generators/#{ @type }_test"
        class_name = @type.classify
        Object.const_get(GENERATOR_NAMESPACE % class_name).new(self)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tset-0.0.2 lib/tset/commands/generate.rb
tset-0.0.1 lib/tset/commands/generate.rb