Sha256: 85f61fac1d67d6b4fe6ea503603f59df7399cff42d81c5583c11fcbaea88a6ae

Contents?: true

Size: 1.05 KB

Versions: 82

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

require "rails/generators/base"
require_relative "../core"

module Graphql
  module Generators
    module Install
      class MutationRootGenerator < Rails::Generators::Base
        include Core

        desc "Create mutation base type, mutation root tipe, and adds the latter to the schema"
        source_root File.expand_path('../templates', __FILE__)

        class_option :schema,
          type: :string,
          default: nil,
          desc: "Name for the schema constant (default: {app_name}Schema)"

        class_option :skip_keeps,
          type: :boolean,
          default: false,
          desc: "Skip .keep files for source control"

        def generate
          create_dir("#{options[:directory]}/mutations")
          template("base_mutation.erb", "#{options[:directory]}/mutations/base_mutation.rb", { skip: true })
          template("mutation_type.erb", "#{options[:directory]}/types/mutation_type.rb", { skip: true })
          insert_root_type('mutation', 'MutationType') 
        end
      end
    end
  end
end 

Version data entries

82 entries across 82 versions & 1 rubygems

Version Path
graphql-2.2.16 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.1.13 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.0.31 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.3.2 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.3.1 lib/generators/graphql/install/mutation_root_generator.rb
graphql-1.13.23 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.3.0 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.14 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.13 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.12 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.0.29 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.1.12 lib/generators/graphql/install/mutation_root_generator.rb
graphql-1.13.22 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.11 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.10 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.9 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.8 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.7 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.2.6 lib/generators/graphql/install/mutation_root_generator.rb
graphql-2.1.11 lib/generators/graphql/install/mutation_root_generator.rb