Sha256: 35b20c737e7ddbb4aeed729edbc3b04f3f7eee8e622abce2bde5b06b7e02e6e7

Contents?: true

Size: 1.25 KB

Versions: 21

Compression:

Stored size: 1.25 KB

Contents

module Souls
  class Generate < Thor
    desc "manager_rbs [CLASS_NAME]", "Generate SOULs Manager RBS Template"
    method_option :mutation, aliases: "--mutation", required: true, desc: "Mutation File Name"
    def manager_rbs(class_name)
      file_path = ""
      singularized_class_name = class_name.underscore.singularize
      Dir.chdir(Souls.get_mother_path.to_s) do
        file_dir = "./sig/api/app/graphql/mutations/managers/#{singularized_class_name}_manager"
        FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
        file_path = "#{file_dir}/#{options[:mutation]}.rbs"
        File.open(file_path, "w") do |f|
          f.write(<<~TEXT)
            module Mutations
              module Managers
                module #{singularized_class_name.camelize}Manager
                  class #{options[:mutation].singularize.camelize} < BaseMutation
                    def self.description: (String)-> untyped
                    def self.argument: (untyped, untyped, untyped)-> untyped
                    def self.field: (untyped, untyped, untyped)-> untyped
                  end
                end
              end
            end
          TEXT
          Souls::Painter.create_file(file_path.to_s)
        end
      end
      file_path
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
souls-1.17.3 lib/souls/cli/generate/manager_rbs.rb
souls-1.17.2 lib/souls/cli/generate/manager_rbs.rb
souls-1.17.1 lib/souls/cli/generate/manager_rbs.rb
souls-1.17.0 lib/souls/cli/generate/manager_rbs.rb
souls-1.16.4 lib/souls/cli/generate/manager_rbs.rb
souls-1.16.3 lib/souls/cli/generate/manager_rbs.rb
souls-1.16.2 lib/souls/cli/generate/manager_rbs.rb
souls-1.16.1 lib/souls/cli/generate/manager_rbs.rb
souls-1.16.0 lib/souls/cli/generate/manager_rbs.rb
souls-1.15.5 lib/souls/cli/generate/manager_rbs.rb
souls-1.15.4 lib/souls/cli/generate/manager_rbs.rb
souls-1.15.3 lib/souls/cli/generate/manager_rbs.rb
souls-1.15.2 lib/souls/cli/generate/manager_rbs.rb
souls-1.15.1 lib/souls/cli/generate/manager_rbs.rb
souls-1.15.0 lib/souls/cli/generate/manager_rbs.rb
souls-1.14.3 lib/souls/cli/generate/manager_rbs.rb
souls-1.14.2 lib/souls/cli/generate/manager_rbs.rb
souls-1.14.1 lib/souls/cli/generate/manager_rbs.rb
souls-1.14.0 lib/souls/cli/generate/manager_rbs.rb
souls-1.13.8 lib/souls/cli/generate/manager_rbs.rb