Sha256: 047d82ca9f40bf44d8c44a0ae1346c7cff523e91ebbfb34d317ebe3f78f48934

Contents?: true

Size: 1.06 KB

Versions: 156

Compression:

Stored size: 1.06 KB

Contents

require 'rails/generators'

module CmAdmin
  module Generators
    class AddGraphqlGenerator < Rails::Generators::Base
      source_root File.expand_path('templates', __dir__)

      def add_graphql
        gem 'graphql'
        gem 'graphql-errors'
        gem 'graphql-rails_logger'
        generate 'graphql:install'
        template 'graphql/graphql_schema.rb', "app/graphql/#{Rails.application.class.module_parent_name.underscore}_schema.rb"
        directory 'graphql/inputs/base', 'app/graphql/types/inputs/base'
        directory 'graphql/enums/base', 'app/graphql/types/enums/base'
        directory 'graphql/objects/base', 'app/graphql/types/objects/base'
        directory 'concerns', 'app/models/concerns'
        copy_file 'graphql/mutations/base_mutation.rb', 'app/graphql/mutations/base_mutation.rb'
        copy_file 'graphql/queries/base_query.rb', 'app/graphql/queries/base_query.rb'
        copy_file 'exceptions/base_exception.rb', 'app/exceptions/base_exception.rb'
        copy_file 'constants.rb', 'config/initializers/constants.rb'
      end
    end
  end
end

Version data entries

156 entries across 156 versions & 1 rubygems

Version Path
cm-admin-4.4.8 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.4.6 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.4.1 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.4.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.3.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.2.1 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.2.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.1.2 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.1.1 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.1.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-4.0.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.16 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.15 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.14 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.13 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.12 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.11 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.10 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.9 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-3.0.8 lib/generators/cm_admin/add_graphql_generator.rb