Sha256: 85f3bb71b29a18b6df22a111c5a217f3f0f85d1dc6c03d407815b4cbb217ccdd
Contents?: true
Size: 775 Bytes
Versions: 52
Compression:
Stored size: 775 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 puts(Paint % ["Created file! : %{white_text}", :green, { white_text: [file_path.to_s, :white] }]) file_path end end end
Version data entries
52 entries across 52 versions & 1 rubygems