Sha256: 8c1ec45b23710c40b4828b914188a15bdb5220f1eefed6f9256148869db1b4ff

Contents?: true

Size: 805 Bytes

Versions: 2

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

require 'thor/group'
require 'active_support/inflector'

module Funkce
  module Generators
    class Function < Thor::Group
      include Thor::Actions

      argument :group, type: :string
      argument :name, type: :string

      def self.source_root
        "#{File.dirname(__FILE__)}/function"
      end

      def create_group
        empty_directory(group.to_s)
        empty_directory("#{group}/#{name}")
        empty_directory("#{group}/#{name}/lib")
      end

      def create_app_file
        template('app.tt', "#{group}/#{name}/app.rb")
      end

      def create_gemfile
        template('Gemfile.tt', "#{group}/#{name}/Gemfile")
      end

      def create_lib_file
        template('lib.tt', "#{group}/#{name}/lib/#{name}.rb")
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
funkce-0.1.1 lib/funkce/generators/function.rb
funkce-0.1.0 lib/funkce/generators/function.rb