Class: Graphql::Generators::InitGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Graphql::Generators::InitGenerator
- Defined in:
- lib/generators/graphql/init_generator.rb
Instance Method Summary collapse
Instance Method Details
#add_gems ⇒ Object
6 7 8 9 10 |
# File 'lib/generators/graphql/init_generator.rb', line 6 def add_gems gem 'graphql' gem 'graphiql-rails' gem 'graphql-formatter' end |
#autoload_paths ⇒ Object
17 18 19 20 21 22 |
# File 'lib/generators/graphql/init_generator.rb', line 17 def autoload_paths application do <<-'RUBY' config.autoload_paths += Dir["#{config.root}/app/graphql/**/"] RUBY end end |
#copy_templates ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/generators/graphql/init_generator.rb', line 24 def copy_templates copy_file 'controllers/graph_ql_controller.rb', 'app/controllers/graph_ql_controller.rb' copy_file 'models/root_level.rb', 'app/models/root_level.rb' copy_file 'graph/relay_schema.rb', 'app/graphql/relay_schema.rb' copy_file 'graph/node_identification.rb', 'app/graphql/node_identification.rb' copy_file 'graph/types/root_level_type.rb', 'app/graphql/types/root_level_type.rb' copy_file 'graph/types/query_type.rb', 'app/graphql/types/query_type.rb' copy_file 'graph/types/mutation_type.rb', 'app/graphql/types/mutation_type.rb' copy_file 'config/graphiql.rb', 'config/initializers/graphiql.rb' end |
#routes ⇒ Object
12 13 14 15 |
# File 'lib/generators/graphql/init_generator.rb', line 12 def routes route "post 'graphql' => 'graph_ql#execute'" route "mount GraphiQL::Rails::Engine, at: '/graphiql', graphql_path: '/graphql'" end |