Sha256: 54e8b162f7b337d1cfb440c1409a75521b23436425163c215fa3ba2838c34686

Contents?: true

Size: 1.05 KB

Versions: 52

Compression:

Stored size: 1.05 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 < BaseObject
                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
        puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }])
      end
      file_path
    end
  end
end

Version data entries

52 entries across 52 versions & 1 rubygems

Version Path
souls-1.12.5 lib/souls/cli/generate/edge_rbs.rb
souls-1.12.4 lib/souls/cli/generate/edge_rbs.rb
souls-1.12.3 lib/souls/cli/generate/edge_rbs.rb
souls-1.12.2 lib/souls/cli/generate/edge_rbs.rb
souls-1.12.1 lib/souls/cli/generate/edge_rbs.rb
souls-1.12.0 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.7 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.6 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.5 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.4 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.3 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.2 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.1 lib/souls/cli/generate/edge_rbs.rb
souls-1.11.0 lib/souls/cli/generate/edge_rbs.rb
souls-1.10.8 lib/souls/cli/generate/edge_rbs.rb
souls-1.10.7 lib/souls/cli/generate/edge_rbs.rb
souls-1.10.6 lib/souls/cli/generate/edge_rbs.rb
souls-1.10.5 lib/souls/cli/generate/edge_rbs.rb
souls-1.10.4 lib/souls/cli/generate/edge_rbs.rb
souls-1.10.3 lib/souls/cli/generate/edge_rbs.rb