Sha256: 97066e3d30031ec74b68977d9bc3c58cf35c2abff6535e425bb79574d3201584

Contents?: true

Size: 769 Bytes

Versions: 68

Compression:

Stored size: 769 Bytes

Contents

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

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
souls-4.1.2 lib/souls/cli/generate/connection.rb
souls-4.1.1 lib/souls/cli/generate/connection.rb
souls-4.1.0 lib/souls/cli/generate/connection.rb
souls-4.0.3 lib/souls/cli/generate/connection.rb
souls-4.0.2 lib/souls/cli/generate/connection.rb
souls-4.0.1 lib/souls/cli/generate/connection.rb
souls-4.0.0 lib/souls/cli/generate/connection.rb
souls-3.0.8 lib/souls/cli/generate/connection.rb
souls-3.0.7 lib/souls/cli/generate/connection.rb
souls-3.0.6 lib/souls/cli/generate/connection.rb
souls-3.0.5 lib/souls/cli/generate/connection.rb
souls-3.0.4 lib/souls/cli/generate/connection.rb
souls-3.0.3 lib/souls/cli/generate/connection.rb
souls-3.0.2 lib/souls/cli/generate/connection.rb
souls-3.0.1 lib/souls/cli/generate/connection.rb
souls-3.0.0 lib/souls/cli/generate/connection.rb
souls-2.0.4 lib/souls/cli/generate/connection.rb
souls-2.0.3 lib/souls/cli/generate/connection.rb
souls-2.0.2 lib/souls/cli/generate/connection.rb
souls-2.0.1 lib/souls/cli/generate/connection.rb