class Boring::Graphql::InstallGenerator
Constants
- OPTIONS
Public Instance Methods
add_graphql_gem()
click to toggle source
# File lib/generators/boring/graphql/install/install_generator.rb, line 14 def add_graphql_gem say "Adding graphql gem", :green Bundler.with_unbundled_env do run "bundle add graphql" end end
adds_graphql_resolver()
click to toggle source
# File lib/generators/boring/graphql/install/install_generator.rb, line 35 def adds_graphql_resolver return if options[:skip_resolver_setup] template("base_resolver.rb", "app/graphql/resolvers/base_resolver.rb") template("hello_world_resolver.rb", "app/graphql/resolvers/hello_world_resolver.rb") insert_into_file "app/graphql/types/query_type.rb", <<~RUBY, after: /class QueryType < Types::BaseObject\n/ \t\t# TODO: remove me \t\tfield :hello, resolver: Resolvers::HelloWorldResolver RUBY end
run_graphql_generator()
click to toggle source
# File lib/generators/boring/graphql/install/install_generator.rb, line 21 def run_graphql_generator say "Running GraphQL default generator", :green run "bundle exec rails generate graphql:install" run "bundle install" graphiql_precompile_assets = <<~RUBY \n if Rails.env.development? Rails.application.config.assets.precompile += %w[graphiql/rails/application.js graphiql/rails/application.css] end RUBY append_to_file "config/initializers/assets.rb", graphiql_precompile_assets end