Sha256: 3a28cedb1239293d4fd81658b3fefed313d90007dc4922b901deca7b34dbf2ac

Contents?: true

Size: 1.01 KB

Versions: 52

Compression:

Stored size: 1.01 KB

Contents

module SOULs
  class Generate < Thor
    desc "edge_rbs [CLASS_NAME]", "Generate GraphQL Edge RBS from schema.rb"
    def edge_rbs(class_name)
      file_path = ""
      Dir.chdir(SOULs.get_mother_path.to_s) do
        file_dir = "./sig/api/app/graphql/types/edges/"
        FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
        singularized_class_name = class_name.underscore.singularize
        file_path = "#{file_dir}#{singularized_class_name}_edge.rbs"
        File.open(file_path, "w") do |f|
          f.write(<<~TEXT)
            module Types
              class #{singularized_class_name.camelize}Edge < Types::BaseEdge
                def self.edge_type: (*untyped) -> untyped
                def self.node_type: (*untyped) -> untyped
                def self.global_id_field: (*untyped) -> untyped
                def self.connection_type: ()-> untyped
              end
            end
          TEXT
        end
        SOULs::Painter.create_file(file_path.to_s)
      end
      file_path
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
souls-2.0.4 lib/souls/cli/generate/edge_rbs.rb
souls-2.0.3 lib/souls/cli/generate/edge_rbs.rb
souls-2.0.2 lib/souls/cli/generate/edge_rbs.rb
souls-2.0.1 lib/souls/cli/generate/edge_rbs.rb
souls-2.0.0 lib/souls/cli/generate/edge_rbs.rb
souls-1.23.0 lib/souls/cli/generate/edge_rbs.rb
souls-1.22.0 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.11 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.10 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.9 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.8 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.7 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.6 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.5 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.4 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.3 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.2 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.1 lib/souls/cli/generate/edge_rbs.rb
souls-1.21.0 lib/souls/cli/generate/edge_rbs.rb
souls-1.20.13 lib/souls/cli/generate/edge_rbs.rb