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-2.2.1 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.2.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.1.5 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.1.4 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.1.3 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.1.2 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.1.1 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.1.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.0.2 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.0.1 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-2.0.0 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.56 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.55 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.54 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.53 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.52 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.51 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.50 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.49 lib/generators/cm_admin/add_graphql_generator.rb
cm-admin-1.5.48 lib/generators/cm_admin/add_graphql_generator.rb