Sha256: 631067977a086b97be4ab0fb6838a8398a292cf0aa68d45c84cd71400822a106

Contents?: true

Size: 703 Bytes

Versions: 1

Compression:

Stored size: 703 Bytes

Contents

require 'thor/group'
require 'active_support/inflector'
module Testg
  module Generators
    class Template < Thor::Group
      argument :name, type: :string
      include Thor::Actions

      def self.source_root
        File.dirname(__FILE__)
      end

      def create_group
        empty_directory(name)
      end

      def create_lib_file
        folder_name = name.dasherize
        file_name = name.underscore

        copy_file('templates/Guardfile', "#{folder_name}/Guardfile")
        template('templates/test/test_class_name.txt', "#{folder_name}/test/test_#{file_name}.rb")
        template('templates/lib/class_name.txt', "#{folder_name}/lib/#{file_name}.rb")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
testg-0.1.1 lib/testg/generators/template.rb