Sha256: c0a85476df9afed577a299cc774dbc6160299ac4d41704ceff91f733456fc808

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require_relative '../setup/setup_generator.rb'
require_relative '../helper'

module Service
  module Generators
    class MicroGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('templates', __dir__)

      argument :micros, type: :array, default: [], banner: 'micros micros'

      def setup
        invoke Service::Generators::SetupGenerator, [name]
      end

      def create_micros
        micros.each do |m|
          @micro = m.classify

          path = "#{service_path}/usecases/micros/#{m.underscore}.rb"
          template 'micro.rb.erb', path
        end
      end

      private

      def service_name
        Service::Helper.service_name(name)
      end

      def service_path
        Service::Helper.service_path(name)
      end

      def spec_path
        Service::Helper.spec_path(name)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
command_service_object-1.3.0 lib/generators/service/micro/micro_generator.rb
command_service_object-1.2.1 lib/generators/service/micro/micro_generator.rb