Sha256: 743883ab04ee66bbb7d88c723684da6426f518136ec45f1ac48449ff392b6b2b

Contents?: true

Size: 720 Bytes

Versions: 28

Compression:

Stored size: 720 Bytes

Contents

module Souls
  class Generate < Thor
    desc "edge [CLASS_NAME]", "Generate GraphQL Edge from schema.rb"
    def edge(class_name)
      file_dir = "./app/graphql/types/edges"
      FileUtils.mkdir_p(file_dir) unless Dir.exist?(file_dir)
      singularized_class_name = class_name.underscore.singularize
      file_path = "./app/graphql/types/edges/#{singularized_class_name}_edge.rb"
      File.open(file_path, "w") do |f|
        f.write(<<~TEXT)
          class Types::#{singularized_class_name.camelize}Edge < Types::BaseEdge
            node_type(Types::#{singularized_class_name.camelize}Type)
          end
        TEXT
      end
      Souls::Painter.create_file(file_path.to_s)
      file_path
    end
  end
end

Version data entries

28 entries across 28 versions & 1 rubygems

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