├── .gitignore ├── Gemfile ├── Gemfile.lock ├── README.md ├── Rakefile ├── app ├── assets │ ├── config │ │ └── manifest.js │ ├── images │ │ └── .keep │ ├── javascripts │ │ ├── application.js │ │ ├── cable.js │ │ └── channels │ │ │ └── graphql_channel.js │ └── stylesheets │ │ ├── application.css │ │ ├── posts.scss │ │ └── scaffolds.scss ├── channels │ ├── application_cable │ │ ├── channel.rb │ │ └── connection.rb │ └── graphql_channel.rb ├── controllers │ ├── action_cable_transports_controller.rb │ ├── application_controller.rb │ ├── chunked_graphqls_controller.rb │ ├── chunked_transports_controller.rb │ ├── concerns │ │ └── .keep │ ├── graphqls_controller.rb │ ├── homes_controller.rb │ └── posts_controller.rb ├── graph │ ├── schema.rb │ └── types │ │ ├── post.rb │ │ ├── query.rb │ │ └── subscription.rb ├── helpers │ ├── application_helper.rb │ └── posts_helper.rb ├── jobs │ └── application_job.rb ├── mailers │ └── application_mailer.rb ├── models │ ├── application_record.rb │ ├── concerns │ │ └── .keep │ └── post.rb └── views │ ├── action_cable_transports │ └── show.html.erb │ ├── application │ └── _query.html.erb │ ├── chunked_transports │ └── show.html.erb │ ├── homes │ └── show.html.erb │ ├── layouts │ ├── application.html.erb │ ├── mailer.html.erb │ └── mailer.text.erb │ └── posts │ ├── _form.html.erb │ ├── edit.html.erb │ ├── index.html.erb │ ├── index.json.jbuilder │ ├── new.html.erb │ ├── show.html.erb │ └── show.json.jbuilder ├── bin ├── bundle ├── rails ├── rake ├── setup ├── spring └── update ├── config.ru ├── config ├── application.rb ├── boot.rb ├── cable.yml ├── database.yml ├── environment.rb ├── environments │ ├── development.rb │ ├── production.rb │ └── test.rb ├── initializers │ ├── active_record_belongs_to_required_by_default.rb │ ├── application_controller_renderer.rb │ ├── assets.rb │ ├── backtrace_silencers.rb │ ├── callback_terminator.rb │ ├── cookies_serializer.rb │ ├── filter_parameter_logging.rb │ ├── inflections.rb │ ├── mime_types.rb │ ├── per_form_csrf_tokens.rb │ ├── request_forgery_protection.rb │ ├── session_store.rb │ ├── ssl_options.rb │ ├── to_time_preserves_timezone.rb │ └── wrap_parameters.rb ├── locales │ └── en.yml ├── puma.rb ├── routes.rb ├── secrets.yml └── spring.rb ├── db ├── migrate │ └── 20160610000918_create_posts.rb ├── schema.rb └── seeds.rb ├── lib ├── assets │ └── .keep └── tasks │ └── .keep ├── log └── .keep ├── public ├── 404.html ├── 422.html ├── 500.html ├── apple-touch-icon-precomposed.png ├── apple-touch-icon.png ├── favicon.ico └── robots.txt ├── test ├── controllers │ ├── .keep │ └── posts_controller_test.rb ├── fixtures │ ├── .keep │ ├── files │ │ └── .keep │ └── posts.yml ├── helpers │ └── .keep ├── integration │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ └── post_test.rb └── test_helper.rb ├── tmp └── .keep └── vendor └── assets ├── javascripts └── .keep └── stylesheets └── .keep /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files for more about ignoring files. 2 | # 3 | # If you find yourself ignoring temporary files generated by your text editor 4 | # or operating system, you probably want to add a global ignore instead: 5 | # git config --global core.excludesfile '~/.gitignore_global' 6 | 7 | # Ignore bundler config. 8 | /.bundle 9 | 10 | # Ignore all logfiles and tempfiles. 11 | /log/* 12 | /tmp/* 13 | !/log/.keep 14 | !/tmp/.keep 15 | 16 | # Ignore Byebug command history file. 17 | .byebug_history 18 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | 4 | # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 5 | gem 'rails', 6 | github: "rails/rails", 7 | branch: "5-0-stable" 8 | gem "graphql", 9 | github: "rmosolgo/graphql", 10 | branch: "defer-directive" 11 | gem "graphql-streaming", 12 | github: "rmosolgo/graphql-streaming" 13 | 14 | gem "graphiql-rails" 15 | gem 'pg', '~> 0.18' 16 | gem 'puma', '~> 3.0' 17 | gem 'sass-rails', '~> 5.0' 18 | gem 'uglifier', '>= 1.3.0' 19 | gem 'coffee-rails', '~> 4.1.0' 20 | gem 'jquery-rails' 21 | gem 'turbolinks', '~> 5.x' 22 | gem 'jbuilder', '~> 2.0' 23 | gem 'redis', '~> 3.0' 24 | 25 | 26 | group :development do 27 | gem 'listen', '~> 3.0.5' 28 | end 29 | 30 | # Windows does not include zoneinfo files, so bundle the tzinfo-data gem 31 | gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 32 | -------------------------------------------------------------------------------- /Gemfile.lock: -------------------------------------------------------------------------------- 1 | GIT 2 | remote: git://github.com/rails/rails.git 3 | revision: 6a06392817b4b040fcc932d8fe8a62bd006ca025 4 | branch: 5-0-stable 5 | specs: 6 | actioncable (5.0.0.rc1) 7 | actionpack (= 5.0.0.rc1) 8 | nio4r (~> 1.2) 9 | websocket-driver (~> 0.6.1) 10 | actionmailer (5.0.0.rc1) 11 | actionpack (= 5.0.0.rc1) 12 | actionview (= 5.0.0.rc1) 13 | activejob (= 5.0.0.rc1) 14 | mail (~> 2.5, >= 2.5.4) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | actionpack (5.0.0.rc1) 17 | actionview (= 5.0.0.rc1) 18 | activesupport (= 5.0.0.rc1) 19 | rack (~> 2.x) 20 | rack-test (~> 0.6.3) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 23 | actionview (5.0.0.rc1) 24 | activesupport (= 5.0.0.rc1) 25 | builder (~> 3.1) 26 | erubis (~> 2.7.0) 27 | rails-dom-testing (~> 1.0, >= 1.0.5) 28 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 29 | activejob (5.0.0.rc1) 30 | activesupport (= 5.0.0.rc1) 31 | globalid (>= 0.3.6) 32 | activemodel (5.0.0.rc1) 33 | activesupport (= 5.0.0.rc1) 34 | activerecord (5.0.0.rc1) 35 | activemodel (= 5.0.0.rc1) 36 | activesupport (= 5.0.0.rc1) 37 | arel (~> 7.0) 38 | activesupport (5.0.0.rc1) 39 | concurrent-ruby (~> 1.0, >= 1.0.2) 40 | i18n (~> 0.7) 41 | minitest (~> 5.1) 42 | tzinfo (~> 1.1) 43 | rails (5.0.0.rc1) 44 | actioncable (= 5.0.0.rc1) 45 | actionmailer (= 5.0.0.rc1) 46 | actionpack (= 5.0.0.rc1) 47 | actionview (= 5.0.0.rc1) 48 | activejob (= 5.0.0.rc1) 49 | activemodel (= 5.0.0.rc1) 50 | activerecord (= 5.0.0.rc1) 51 | activesupport (= 5.0.0.rc1) 52 | bundler (>= 1.3.0, < 2.0) 53 | railties (= 5.0.0.rc1) 54 | sprockets-rails (>= 2.0.0) 55 | railties (5.0.0.rc1) 56 | actionpack (= 5.0.0.rc1) 57 | activesupport (= 5.0.0.rc1) 58 | method_source 59 | rake (>= 0.8.7) 60 | thor (>= 0.18.1, < 2.0) 61 | 62 | GIT 63 | remote: git://github.com/rmosolgo/graphql-streaming.git 64 | revision: ceb8a01fc0515b69add886f31435aa3bdeb2336e 65 | specs: 66 | graphql-streaming (0.1.0) 67 | graphql 68 | 69 | GIT 70 | remote: git://github.com/rmosolgo/graphql.git 71 | revision: 176f155a1a49185051fc9eaadd76bf2539f4acd9 72 | branch: defer-directive 73 | specs: 74 | graphql (0.18.1) 75 | 76 | GEM 77 | remote: https://rubygems.org/ 78 | specs: 79 | arel (7.0.0) 80 | builder (3.2.2) 81 | coffee-rails (4.1.1) 82 | coffee-script (>= 2.2.0) 83 | railties (>= 4.0.0, < 5.1.x) 84 | coffee-script (2.4.1) 85 | coffee-script-source 86 | execjs 87 | coffee-script-source (1.10.0) 88 | concurrent-ruby (1.0.2) 89 | erubis (2.7.0) 90 | execjs (2.7.0) 91 | ffi (1.9.10) 92 | globalid (0.3.6) 93 | activesupport (>= 4.1.0) 94 | graphiql-rails (1.2.0) 95 | rails 96 | i18n (0.7.0) 97 | jbuilder (2.5.0) 98 | activesupport (>= 3.0.0, < 5.1) 99 | multi_json (~> 1.2) 100 | jquery-rails (4.1.1) 101 | rails-dom-testing (>= 1, < 3) 102 | railties (>= 4.2.0) 103 | thor (>= 0.14, < 2.0) 104 | json (1.8.3) 105 | listen (3.0.8) 106 | rb-fsevent (~> 0.9, >= 0.9.4) 107 | rb-inotify (~> 0.9, >= 0.9.7) 108 | loofah (2.0.3) 109 | nokogiri (>= 1.5.9) 110 | mail (2.6.4) 111 | mime-types (>= 1.16, < 4) 112 | method_source (0.8.2) 113 | mime-types (3.1) 114 | mime-types-data (~> 3.2015) 115 | mime-types-data (3.2016.0521) 116 | mini_portile2 (2.1.0) 117 | minitest (5.9.0) 118 | multi_json (1.12.1) 119 | nio4r (1.2.1) 120 | nokogiri (1.6.8) 121 | mini_portile2 (~> 2.1.0) 122 | pkg-config (~> 1.1.7) 123 | pg (0.18.4) 124 | pkg-config (1.1.7) 125 | puma (3.4.0) 126 | rack (2.0.0.rc1) 127 | json 128 | rack-test (0.6.3) 129 | rack (>= 1.0) 130 | rails-deprecated_sanitizer (1.0.3) 131 | activesupport (>= 4.2.0.alpha) 132 | rails-dom-testing (1.0.7) 133 | activesupport (>= 4.2.0.beta, < 5.0) 134 | nokogiri (~> 1.6.0) 135 | rails-deprecated_sanitizer (>= 1.0.1) 136 | rails-html-sanitizer (1.0.3) 137 | loofah (~> 2.0) 138 | rake (11.1.2) 139 | rb-fsevent (0.9.7) 140 | rb-inotify (0.9.7) 141 | ffi (>= 0.5.0) 142 | redis (3.2.2) 143 | sass (3.4.22) 144 | sass-rails (5.0.4) 145 | railties (>= 4.0.0, < 5.0) 146 | sass (~> 3.1) 147 | sprockets (>= 2.8, < 4.0) 148 | sprockets-rails (>= 2.0, < 4.0) 149 | tilt (>= 1.1, < 3) 150 | sprockets (3.6.0) 151 | concurrent-ruby (~> 1.0) 152 | rack (> 1, < 3) 153 | sprockets-rails (3.0.4) 154 | actionpack (>= 4.0) 155 | activesupport (>= 4.0) 156 | sprockets (>= 3.0.0) 157 | thor (0.19.1) 158 | thread_safe (0.3.5) 159 | tilt (2.0.5) 160 | turbolinks (5.0.0.beta2) 161 | turbolinks-source 162 | turbolinks-source (5.0.0.beta5) 163 | tzinfo (1.2.2) 164 | thread_safe (~> 0.1) 165 | uglifier (3.0.0) 166 | execjs (>= 0.3.0, < 3) 167 | websocket-driver (0.6.4) 168 | websocket-extensions (>= 0.1.0) 169 | websocket-extensions (0.1.2) 170 | 171 | PLATFORMS 172 | ruby 173 | 174 | DEPENDENCIES 175 | coffee-rails (~> 4.1.0) 176 | graphiql-rails 177 | graphql! 178 | graphql-streaming! 179 | jbuilder (~> 2.0) 180 | jquery-rails 181 | listen (~> 3.0.5) 182 | pg (~> 0.18) 183 | puma (~> 3.0) 184 | rails! 185 | redis (~> 3.0) 186 | sass-rails (~> 5.0) 187 | turbolinks (~> 5.x) 188 | tzinfo-data 189 | uglifier (>= 1.3.0) 190 | 191 | BUNDLED WITH 192 | 1.11.2 193 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GraphQL + Rails `@defer` / `@stream` 2 | 3 | A demo of GraphQL subscriptions and "exploratory" `@defer` and `@stream` directives with Ruby on Rails. 4 | 5 | This uses a [WIP branch of `graphql-ruby`](https://github.com/rmosolgo/graphql-ruby/compare/defer-directive) and [`graphql-streaming`](https://github.com/rmosolgo/graphql-streaming) 6 | 7 | ### Stream & Defer 8 | 9 | ![stream-defer](https://cloud.githubusercontent.com/assets/2231765/16359345/b425e240-3afe-11e6-8cf2-33ea294d7e18.gif) 10 | 11 | ### Subscription 12 | 13 | ![subscription](https://cloud.githubusercontent.com/assets/2231765/17562030/d90f7514-5ef6-11e6-93af-2d55a6b63747.gif) 14 | 15 | ### About 16 | 17 | - Setup 18 | - install Ruby 2.2 or greater 19 | - `$ gem install bundler` (install Bundler, Ruby's package manager with) 20 | - `$ bundle install` (install this project's dependencies from `Gemfile`) 21 | - `$ bundle exec rake db:create db:seed` (setup the database and add seed data) 22 | - `$ bundle exec rails server` (start the development server) 23 | - `$ open http://localhost:3000/` (visit the app) 24 | - ActionCable transports 25 | - Send GraphQL with ActionCable, Rails 5's new websocket library 26 | - `http://localhost:3000/action_cable_transport` 27 | - Server: [app/channels/graphql_channel.rb](https://github.com/rmosolgo/graphql-ruby-stream-defer-demo/blob/master/app/channels/graphql_channel.rb) 28 | - Client: `GraphQLChannel` from `graphql-streaming` 29 | - `Transfer-Encoding: chunked` transport 30 | - Return `\n\n`-delimited chunks over a streaming HTTP response 31 | - `http://localhost:3000/chunked_transport` 32 | - Server: [app/controllers/chunked_graphqls_controller.rb](https://github.com/rmosolgo/graphql-ruby-stream-defer-demo/blob/master/app/controllers/chunked_graphqls_controller.rb) 33 | - Client: `StreamingGraphQLClient` from `graphql-streaming` 34 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # Add your own tasks in files placed in lib/tasks ending in .rake, 2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. 3 | 4 | require_relative 'config/application' 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link_tree ../images 2 | //= link_directory ../javascripts .js 3 | //= link_directory ../stylesheets .css 4 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/app/assets/images/.keep -------------------------------------------------------------------------------- /app/assets/javascripts/application.js: -------------------------------------------------------------------------------- 1 | // This is a manifest file that'll be compiled into application.js, which will include all the files 2 | // listed below. 3 | // 4 | // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts, 5 | // or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path. 6 | // 7 | // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the 8 | // compiled file. JavaScript code in this file should be added after the last require_* statement. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require jquery_ujs 15 | //= require turbolinks 16 | //= require graphql-streaming/streaming_graphql_client 17 | //= require graphql-streaming/graphql_channel 18 | //= require ./cable 19 | -------------------------------------------------------------------------------- /app/assets/javascripts/cable.js: -------------------------------------------------------------------------------- 1 | // Action Cable provides the framework to deal with WebSockets in Rails. 2 | // You can generate new channels where WebSocket features live using the rails generate channel command. 3 | // 4 | //= require action_cable 5 | //= require_self 6 | //= require_tree ./channels 7 | 8 | (function() { 9 | this.App || (this.App = {}); 10 | 11 | App.cable = ActionCable.createConsumer(); 12 | 13 | }).call(this); 14 | -------------------------------------------------------------------------------- /app/assets/javascripts/channels/graphql_channel.js: -------------------------------------------------------------------------------- 1 | App.graphqlChannel = App.cable.subscriptions.create( 2 | "GraphqlChannel", 3 | Object.assign(GraphQLChannel.subscription, { 4 | connected: function() { 5 | $(document).trigger("graphql-channel:ready") 6 | }, 7 | }) 8 | ) 9 | 10 | // forward logs to console.log 11 | GraphQLChannel.log = console.log.bind(console) 12 | -------------------------------------------------------------------------------- /app/assets/stylesheets/application.css: -------------------------------------------------------------------------------- 1 | /* 2 | * This is a manifest file that'll be compiled into application.css, which will include all the files 3 | * listed below. 4 | * 5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets, 6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path. 7 | * 8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the 9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS 10 | * files in this directory. Styles in this file should be added after the last require_* statement. 11 | * It is generally better to create a new file per style scope. 12 | * 13 | *= require_tree . 14 | *= require_self 15 | */ 16 | -------------------------------------------------------------------------------- /app/assets/stylesheets/posts.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Posts controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /app/assets/stylesheets/scaffolds.scss: -------------------------------------------------------------------------------- 1 | body { 2 | background-color: #fff; 3 | color: #333; 4 | font-family: verdana, arial, helvetica, sans-serif; 5 | font-size: 13px; 6 | line-height: 18px; 7 | margin: 33px; 8 | } 9 | 10 | p, ol, ul, td { 11 | font-family: verdana, arial, helvetica, sans-serif; 12 | font-size: 13px; 13 | line-height: 18px; 14 | margin: 33px; 15 | } 16 | 17 | pre { 18 | background-color: #eee; 19 | padding: 10px; 20 | font-size: 11px; 21 | } 22 | 23 | a { 24 | color: #000; 25 | 26 | &:visited { 27 | color: #666; 28 | } 29 | 30 | &:hover { 31 | color: #fff; 32 | background-color: #000; 33 | } 34 | } 35 | 36 | th { 37 | padding-bottom: 5px; 38 | } 39 | 40 | td { 41 | padding-bottom: 7px; 42 | padding-left: 5px; 43 | padding-right: 5px; 44 | } 45 | 46 | div { 47 | &.field, &.actions { 48 | margin-bottom: 10px; 49 | } 50 | } 51 | 52 | #notice { 53 | color: green; 54 | } 55 | 56 | .field_with_errors { 57 | padding: 2px; 58 | background-color: red; 59 | display: table; 60 | } 61 | 62 | #error_explanation { 63 | width: 450px; 64 | border: 2px solid red; 65 | padding: 7px; 66 | padding-bottom: 0; 67 | margin-bottom: 20px; 68 | background-color: #f0f0f0; 69 | 70 | h2 { 71 | text-align: left; 72 | font-weight: bold; 73 | padding: 5px 5px 5px 15px; 74 | font-size: 12px; 75 | margin: -7px; 76 | margin-bottom: 0; 77 | background-color: #c00; 78 | color: #fff; 79 | } 80 | 81 | ul li { 82 | font-size: 12px; 83 | list-style: square; 84 | } 85 | } 86 | 87 | label { 88 | display: block; 89 | } 90 | -------------------------------------------------------------------------------- /app/channels/application_cable/channel.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. 2 | module ApplicationCable 3 | class Channel < ActionCable::Channel::Base 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/channels/application_cable/connection.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading. 2 | module ApplicationCable 3 | class Connection < ActionCable::Connection::Base 4 | identified_by :current_user 5 | 6 | def connect 7 | self.current_user = :current_user 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/channels/graphql_channel.rb: -------------------------------------------------------------------------------- 1 | class GraphqlChannel < ApplicationCable::Channel 2 | def subscribed 3 | stream_from(channel_name) 4 | end 5 | 6 | def fetch(data) 7 | query_id = data["query_id"] 8 | query_string = data["query"] 9 | variables = ensure_hash(data["variables"] || {}) 10 | context = {} 11 | 12 | # This object emits patches 13 | context[:collector] = GraphQL::Streaming::ActionCableCollector.new(query_id, ActionCable.server.broadcaster_for(channel_name)) 14 | 15 | # This re-evals the query in response to triggers 16 | context[:subscriber] = GraphQL::Streaming::ActionCableSubscriber.new(self, query_id) do 17 | Schema.execute(query_string, variables: variables, context: context) 18 | end 19 | 20 | Schema.execute(query_string, variables: variables, context: context) 21 | 22 | # If there are no ongoing subscriptions, 23 | # tell the client to stop listening for patches 24 | if !context[:subscriber].subscribed? 25 | context[:collector].close 26 | end 27 | rescue StandardError => err 28 | puts "--- FETCH ---" 29 | raise err 30 | end 31 | 32 | private 33 | 34 | def ensure_hash(hashy_param) 35 | case hashy_param 36 | when String 37 | JSON.parse(hashy_param) 38 | when Hash 39 | hashy_param 40 | else 41 | {} 42 | end 43 | end 44 | 45 | def channel_name 46 | "graphql_#{current_user}" 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /app/controllers/action_cable_transports_controller.rb: -------------------------------------------------------------------------------- 1 | class ActionCableTransportsController < ApplicationController 2 | def show 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | # Prevent CSRF attacks by raising an exception. 3 | # For APIs, you may want to use :null_session instead. 4 | protect_from_forgery with: :exception 5 | end 6 | -------------------------------------------------------------------------------- /app/controllers/chunked_graphqls_controller.rb: -------------------------------------------------------------------------------- 1 | class ChunkedGraphqlsController < ApplicationController 2 | include ActionController::Live 3 | 4 | def create 5 | query_string = params[:query] 6 | variables = ensure_hash(params[:variables] || {}) 7 | context = { 8 | collector: GraphQL::Streaming::StreamCollector.new(response.stream) 9 | } 10 | Schema.execute(query_string, variables: variables, context: context) 11 | response.stream.close 12 | end 13 | 14 | private 15 | 16 | def ensure_hash(hashy_param) 17 | case hashy_param 18 | when String 19 | JSON.parse(hashy_param) 20 | when Hash 21 | hashy_param 22 | else 23 | {} 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /app/controllers/chunked_transports_controller.rb: -------------------------------------------------------------------------------- 1 | class ChunkedTransportsController < ApplicationController 2 | def show 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /app/controllers/graphqls_controller.rb: -------------------------------------------------------------------------------- 1 | class GraphqlsController < ApplicationController 2 | def create 3 | query_string = params[:query] 4 | variables = ensure_hash(params[:variables] || {}) 5 | context = {} 6 | result = Schema.execute(query_string, variables: variables, context: context) 7 | render json: result 8 | end 9 | 10 | private 11 | 12 | def ensure_hash(hashy_param) 13 | case hashy_param 14 | when String 15 | JSON.parse(hashy_param) 16 | when Hash 17 | hashy_param 18 | else 19 | {} 20 | end 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/controllers/homes_controller.rb: -------------------------------------------------------------------------------- 1 | class HomesController < ApplicationController 2 | def show 3 | end 4 | end 5 | -------------------------------------------------------------------------------- /app/controllers/posts_controller.rb: -------------------------------------------------------------------------------- 1 | class PostsController < ApplicationController 2 | before_action :set_post, only: [:show, :edit, :update, :destroy] 3 | 4 | # GET /posts 5 | # GET /posts.json 6 | def index 7 | @posts = Post.all 8 | end 9 | 10 | # GET /posts/1 11 | # GET /posts/1.json 12 | def show 13 | end 14 | 15 | # GET /posts/new 16 | def new 17 | @post = Post.new 18 | end 19 | 20 | # GET /posts/1/edit 21 | def edit 22 | end 23 | 24 | # POST /posts 25 | # POST /posts.json 26 | def create 27 | @post = Post.new(post_params) 28 | 29 | respond_to do |format| 30 | if @post.save 31 | format.html { redirect_to @post, notice: 'Post was successfully created.' } 32 | format.json { render :show, status: :created, location: @post } 33 | else 34 | format.html { render :new } 35 | format.json { render json: @post.errors, status: :unprocessable_entity } 36 | end 37 | end 38 | end 39 | 40 | # PATCH/PUT /posts/1 41 | # PATCH/PUT /posts/1.json 42 | def update 43 | respond_to do |format| 44 | if @post.update(post_params) 45 | format.html { redirect_to @post, notice: 'Post was successfully updated.' } 46 | format.json { render :show, status: :ok, location: @post } 47 | else 48 | format.html { render :edit } 49 | format.json { render json: @post.errors, status: :unprocessable_entity } 50 | end 51 | end 52 | end 53 | 54 | # DELETE /posts/1 55 | # DELETE /posts/1.json 56 | def destroy 57 | @post.destroy 58 | respond_to do |format| 59 | format.html { redirect_to posts_url, notice: 'Post was successfully destroyed.' } 60 | format.json { head :no_content } 61 | end 62 | end 63 | 64 | private 65 | # Use callbacks to share common setup or constraints between actions. 66 | def set_post 67 | @post = Post.find(params[:id]) 68 | end 69 | 70 | # Never trust parameters from the scary internet, only allow the white list through. 71 | def post_params 72 | params.require(:post).permit(:title, :body) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /app/graph/schema.rb: -------------------------------------------------------------------------------- 1 | Schema = GraphQL::Schema.new( 2 | query: Types::Query, 3 | subscription: Types::Subscription, 4 | ) 5 | 6 | Schema.query_execution_strategy = GraphQL::Execution::DeferredExecution 7 | Schema.subscription_execution_strategy = GraphQL::Execution::DeferredExecution 8 | -------------------------------------------------------------------------------- /app/graph/types/post.rb: -------------------------------------------------------------------------------- 1 | Types::Post = GraphQL::ObjectType.define do 2 | name "Post" 3 | field :id, types.Int 4 | field :title, types.String 5 | field :body, types.String do 6 | resolve -> (obj, args, ctx) { 7 | sleep 0.5 8 | obj.body 9 | } 10 | end 11 | field :posts, -> { types[Types::Post] } do 12 | resolve -> (obj, args, ctx) { 13 | Enumerator.new do |yielder| 14 | posts = Post.all 15 | posts.each do |post| 16 | sleep 0.5 17 | yielder.yield(post) 18 | end 19 | end 20 | } 21 | end 22 | end 23 | -------------------------------------------------------------------------------- /app/graph/types/query.rb: -------------------------------------------------------------------------------- 1 | Types::Query = GraphQL::ObjectType.define do 2 | name "Query" 3 | field :echo, types.Int, "Return the same value passed as 'int'" do 4 | argument :int, !types.Int 5 | resolve -> (obj, args, ctx) { args[:int] } 6 | end 7 | field :posts, types[Types::Post] do 8 | resolve -> (obj, args, ctx) { Post.all } 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /app/graph/types/subscription.rb: -------------------------------------------------------------------------------- 1 | module Types 2 | Subscription = GraphQL::ObjectType.define do 3 | name "Subscription" 4 | 5 | subscription :post, Types::Post do 6 | argument :id, !types.Int 7 | resolve -> (obj, args, ctx) { 8 | ::Post.find(args[:id]) 9 | } 10 | end 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/posts_helper.rb: -------------------------------------------------------------------------------- 1 | module PostsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/mailers/application_mailer.rb: -------------------------------------------------------------------------------- 1 | class ApplicationMailer < ActionMailer::Base 2 | default from: 'from@example.com' 3 | layout 'mailer' 4 | end 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/app/models/concerns/.keep -------------------------------------------------------------------------------- /app/models/post.rb: -------------------------------------------------------------------------------- 1 | class Post < ApplicationRecord 2 | after_commit :trigger_subscription 3 | 4 | def trigger_subscription 5 | GraphQL::Streaming::ActionCableSubscriber.trigger(:post, {id: id}) 6 | end 7 | 8 | DEFAULT_QUERY_STRING = "{ 9 | posts @stream { 10 | title 11 | body @defer 12 | } 13 | }" 14 | 15 | SUBSCRIPTION_QUERY_STRING = "subscription { 16 | post(id: 1) { 17 | title 18 | body 19 | } 20 | }" 21 | end 22 | -------------------------------------------------------------------------------- /app/views/action_cable_transports/show.html.erb: -------------------------------------------------------------------------------- 1 | <%= render partial: "query" %> 2 | <%= render partial: "query", locals: { query_string: Post::SUBSCRIPTION_QUERY_STRING } %> 3 | 4 | 22 | -------------------------------------------------------------------------------- /app/views/application/_query.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |

Query

4 |

5 | 6 |

7 | 8 |
9 |
10 |

Response

11 |

12 |


13 |     

14 |
15 |
16 | -------------------------------------------------------------------------------- /app/views/chunked_transports/show.html.erb: -------------------------------------------------------------------------------- 1 | <%= render partial: "query" %> 2 | 3 | 20 | -------------------------------------------------------------------------------- /app/views/homes/show.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | -------------------------------------------------------------------------------- /app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | GraphCable 5 | <%= csrf_meta_tags %> 6 | 7 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %> 8 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %> 9 | 10 | 11 | 12 | <%= yield %> 13 | 14 | 15 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | -------------------------------------------------------------------------------- /app/views/layouts/mailer.text.erb: -------------------------------------------------------------------------------- 1 | <%= yield %> 2 | -------------------------------------------------------------------------------- /app/views/posts/_form.html.erb: -------------------------------------------------------------------------------- 1 | <%= form_for(post) do |f| %> 2 | <% if post.errors.any? %> 3 |
4 |

<%= pluralize(post.errors.count, "error") %> prohibited this post from being saved:

5 | 6 | 11 |
12 | <% end %> 13 | 14 |
15 | <%= f.text_field :title %> 16 | <%= f.text_field :body %> 17 | <%= f.submit %> 18 |
19 | <% end %> 20 | -------------------------------------------------------------------------------- /app/views/posts/edit.html.erb: -------------------------------------------------------------------------------- 1 |

Editing Post

2 | 3 | <%= render 'form', post: @post %> 4 | 5 | <%= link_to 'Show', @post %> | 6 | <%= link_to 'Back', posts_path %> 7 | -------------------------------------------------------------------------------- /app/views/posts/index.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 | 3 |

Posts

4 | 5 | 6 | 7 | 8 | 10 | 11 | 12 | 13 | 14 | 15 | <% @posts.each do |post| %> 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | <% end %> 24 | 25 |
Title 9 | Body
<%= post.title %><%= post.body %><%= link_to 'Show', post %><%= link_to 'Edit', edit_post_path(post) %><%= link_to 'Destroy', post, method: :delete %>
26 | 27 |
28 | 29 | <%= link_to 'New Post', new_post_path %> 30 | -------------------------------------------------------------------------------- /app/views/posts/index.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.array!(@posts) do |post| 2 | json.extract! post, :id 3 | json.url post_url(post, format: :json) 4 | end 5 | -------------------------------------------------------------------------------- /app/views/posts/new.html.erb: -------------------------------------------------------------------------------- 1 |

New Post

2 | 3 | <%= render 'form', post: @post %> 4 | 5 | <%= link_to 'Back', posts_path %> 6 | -------------------------------------------------------------------------------- /app/views/posts/show.html.erb: -------------------------------------------------------------------------------- 1 |

<%= notice %>

2 |

<%= @post.title %>

3 |

<%= @post.body %>

4 | <%= link_to 'Edit', edit_post_path(@post) %> | 5 | <%= link_to 'Back', posts_path %> 6 | -------------------------------------------------------------------------------- /app/views/posts/show.json.jbuilder: -------------------------------------------------------------------------------- 1 | json.extract! @post, :id, :created_at, :updated_at 2 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | APP_PATH = File.expand_path('../config/application', __dir__) 8 | require_relative '../config/boot' 9 | require 'rails/commands' 10 | -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError => e 5 | raise unless e.message.include?('spring') 6 | end 7 | require_relative '../config/boot' 8 | require 'rake' 9 | Rake.application.run 10 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a starting point to setup your application. 15 | # Add necessary setup steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | # puts "\n== Copying sample files ==" 22 | # unless File.exist?('config/database.yml') 23 | # cp 'config/database.yml.sample', 'config/database.yml' 24 | # end 25 | 26 | puts "\n== Preparing database ==" 27 | system! 'bin/rails db:setup' 28 | 29 | puts "\n== Removing old logs and tempfiles ==" 30 | system! 'bin/rails log:clear tmp:clear' 31 | 32 | puts "\n== Restarting application server ==" 33 | system! 'bin/rails restart' 34 | end 35 | -------------------------------------------------------------------------------- /bin/spring: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | # This file loads spring without using Bundler, in order to be fast. 4 | # It gets overwritten when you run the `spring binstub` command. 5 | 6 | unless defined?(Spring) 7 | require 'rubygems' 8 | require 'bundler' 9 | 10 | if (match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m)) 11 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq.join(Gem.path_separator) } 12 | gem 'spring', match[1] 13 | require 'spring/binstub' 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /bin/update: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | require 'fileutils' 4 | include FileUtils 5 | 6 | # path to your application root. 7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 8 | 9 | def system!(*args) 10 | system(*args) || abort("\n== Command #{args} failed ==") 11 | end 12 | 13 | chdir APP_ROOT do 14 | # This script is a way to update your development environment automatically. 15 | # Add necessary update steps to this file. 16 | 17 | puts '== Installing dependencies ==' 18 | system! 'gem install bundler --conservative' 19 | system('bundle check') || system!('bundle install') 20 | 21 | puts "\n== Updating database ==" 22 | system! 'bin/rails db:migrate' 23 | 24 | puts "\n== Removing old logs and tempfiles ==" 25 | system! 'bin/rails log:clear tmp:clear' 26 | 27 | puts "\n== Restarting application server ==" 28 | system! 'bin/rails restart' 29 | end 30 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require_relative 'config/environment' 4 | 5 | run Rails.application 6 | -------------------------------------------------------------------------------- /config/application.rb: -------------------------------------------------------------------------------- 1 | require_relative 'boot' 2 | 3 | require 'rails/all' 4 | 5 | # Require the gems listed in Gemfile, including any gems 6 | # you've limited to :test, :development, or :production. 7 | Bundler.require(*Rails.groups) 8 | 9 | module GraphCable 10 | class Application < Rails::Application 11 | # Settings in config/environments/* take precedence over those specified here. 12 | # Application configuration should go into files in config/initializers 13 | # -- all .rb files in that directory are automatically loaded. 14 | config.autoload_paths += %W(#{config.root}/app/graph) 15 | GraphiQL::Rails.config.csrf = true 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | # Action Cable uses Redis by default to administer connections, channels, and sending/receiving messages over the WebSocket. 2 | production: 3 | adapter: redis 4 | url: redis://localhost:6379/1 5 | 6 | development: 7 | adapter: async 8 | 9 | test: 10 | adapter: async 11 | -------------------------------------------------------------------------------- /config/database.yml: -------------------------------------------------------------------------------- 1 | # PostgreSQL. Versions 9.1 and up are supported. 2 | # 3 | # Install the pg driver: 4 | # gem install pg 5 | # On OS X with Homebrew: 6 | # gem install pg -- --with-pg-config=/usr/local/bin/pg_config 7 | # On OS X with MacPorts: 8 | # gem install pg -- --with-pg-config=/opt/local/lib/postgresql84/bin/pg_config 9 | # On Windows: 10 | # gem install pg 11 | # Choose the win32 build. 12 | # Install PostgreSQL and put its /bin directory on your path. 13 | # 14 | # Configure Using Gemfile 15 | # gem 'pg' 16 | # 17 | default: &default 18 | adapter: postgresql 19 | encoding: unicode 20 | # For details on connection pooling, see rails configuration guide 21 | # http://guides.rubyonrails.org/configuring.html#database-pooling 22 | pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> 23 | 24 | development: 25 | <<: *default 26 | database: graph_cable_development 27 | 28 | # The specified database role being used to connect to postgres. 29 | # To create additional roles in postgres see `$ createuser --help`. 30 | # When left blank, postgres will use the default role. This is 31 | # the same name as the operating system user that initialized the database. 32 | #username: graph_cable 33 | 34 | # The password associated with the postgres role (username). 35 | #password: 36 | 37 | # Connect on a TCP socket. Omitted by default since the client uses a 38 | # domain socket that doesn't need configuration. Windows does not have 39 | # domain sockets, so uncomment these lines. 40 | #host: localhost 41 | 42 | # The TCP port the server listens on. Defaults to 5432. 43 | # If your server runs on a different port number, change accordingly. 44 | #port: 5432 45 | 46 | # Schema search path. The server defaults to $user,public 47 | #schema_search_path: myapp,sharedapp,public 48 | 49 | # Minimum log levels, in increasing order: 50 | # debug5, debug4, debug3, debug2, debug1, 51 | # log, notice, warning, error, fatal, and panic 52 | # Defaults to warning. 53 | #min_messages: notice 54 | 55 | # Warning: The database defined as "test" will be erased and 56 | # re-generated from your development database when you run "rake". 57 | # Do not set this db to the same as development or production. 58 | test: 59 | <<: *default 60 | database: graph_cable_test 61 | 62 | # As with config/secrets.yml, you never want to store sensitive information, 63 | # like your database password, in your source code. If your source code is 64 | # ever seen by anyone, they now have access to your database. 65 | # 66 | # Instead, provide the password as a unix environment variable when you boot 67 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database 68 | # for a full rundown on how to provide these environment variables in a 69 | # production deployment. 70 | # 71 | # On Heroku and other platform providers, you may have a full connection URL 72 | # available as an environment variable. For example: 73 | # 74 | # DATABASE_URL="postgres://myuser:mypass@localhost/somedatabase" 75 | # 76 | # You can use this database configuration with: 77 | # 78 | # production: 79 | # url: <%= ENV['DATABASE_URL'] %> 80 | # 81 | production: 82 | <<: *default 83 | database: graph_cable_production 84 | username: graph_cable 85 | password: <%= ENV['GRAPH_CABLE_DATABASE_PASSWORD'] %> 86 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require_relative 'application' 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /config/environments/development.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # In the development environment your application's code is reloaded on 5 | # every request. This slows down response time but is perfect for development 6 | # since you don't have to restart the web server when you make code changes. 7 | config.cache_classes = false 8 | 9 | # Do not eager load code on boot. 10 | config.eager_load = false 11 | 12 | # Show full error reports. 13 | config.consider_all_requests_local = true 14 | 15 | # Enable/disable caching. By default caching is disabled. 16 | if Rails.root.join('tmp/caching-dev.txt').exist? 17 | config.action_controller.perform_caching = true 18 | 19 | config.cache_store = :memory_store 20 | config.public_file_server.headers = { 21 | 'Cache-Control' => 'public, max-age=172800' 22 | } 23 | else 24 | config.action_controller.perform_caching = false 25 | 26 | config.cache_store = :null_store 27 | end 28 | 29 | # Don't care if the mailer can't send. 30 | config.action_mailer.raise_delivery_errors = false 31 | 32 | config.action_mailer.perform_caching = false 33 | 34 | # Print deprecation notices to the Rails logger. 35 | config.active_support.deprecation = :log 36 | 37 | # Raise an error on page load if there are pending migrations. 38 | config.active_record.migration_error = :page_load 39 | 40 | # Debug mode disables concatenation and preprocessing of assets. 41 | # This option may cause significant delays in view rendering with a large 42 | # number of complex assets. 43 | config.assets.debug = true 44 | 45 | # Raises error for missing translations 46 | # config.action_view.raise_on_missing_translations = true 47 | 48 | # Use an evented file watcher to asynchronously detect changes in source code, 49 | # routes, locales, etc. This feature depends on the listen gem. 50 | config.file_watcher = ActiveSupport::EventedFileUpdateChecker 51 | end 52 | -------------------------------------------------------------------------------- /config/environments/production.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # Code is not reloaded between requests. 5 | config.cache_classes = true 6 | 7 | # Eager load code on boot. This eager loads most of Rails and 8 | # your application in memory, allowing both threaded web servers 9 | # and those relying on copy on write to perform better. 10 | # Rake tasks automatically ignore this option for performance. 11 | config.eager_load = true 12 | 13 | # Full error reports are disabled and caching is turned on. 14 | config.consider_all_requests_local = false 15 | config.action_controller.perform_caching = true 16 | 17 | # Disable serving static files from the `/public` folder by default since 18 | # Apache or NGINX already handles this. 19 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 20 | 21 | # Compress JavaScripts and CSS. 22 | config.assets.js_compressor = :uglifier 23 | # config.assets.css_compressor = :sass 24 | 25 | # Do not fallback to assets pipeline if a precompiled asset is missed. 26 | config.assets.compile = false 27 | 28 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 29 | 30 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 31 | # config.action_controller.asset_host = 'http://assets.example.com' 32 | 33 | # Specifies the header that your server uses for sending files. 34 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 35 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 36 | 37 | # Action Cable endpoint configuration 38 | # config.action_cable.url = 'wss://example.com/cable' 39 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ] 40 | 41 | # Don't mount Action Cable in the main server process. 42 | # config.action_cable.mount_path = nil 43 | 44 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 45 | # config.force_ssl = true 46 | 47 | # Use the lowest log level to ensure availability of diagnostic information 48 | # when problems arise. 49 | config.log_level = :debug 50 | 51 | # Prepend all log lines with the following tags. 52 | config.log_tags = [ :request_id ] 53 | 54 | # Use a different cache store in production. 55 | # config.cache_store = :mem_cache_store 56 | 57 | # Use a real queuing backend for Active Job (and separate queues per environment) 58 | # config.active_job.queue_adapter = :resque 59 | # config.active_job.queue_name_prefix = "graph_cable_#{Rails.env}" 60 | config.action_mailer.perform_caching = false 61 | 62 | # Ignore bad email addresses and do not raise email delivery errors. 63 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 64 | # config.action_mailer.raise_delivery_errors = false 65 | 66 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 67 | # the I18n.default_locale when a translation cannot be found). 68 | config.i18n.fallbacks = true 69 | 70 | # Send deprecation notices to registered listeners. 71 | config.active_support.deprecation = :notify 72 | 73 | # Use default logging formatter so that PID and timestamp are not suppressed. 74 | config.log_formatter = ::Logger::Formatter.new 75 | 76 | # Use a different logger for distributed setups. 77 | # require 'syslog/logger' 78 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') 79 | 80 | if ENV["RAILS_LOG_TO_STDOUT"].present? 81 | logger = ActiveSupport::Logger.new(STDOUT) 82 | logger.formatter = config.log_formatter 83 | config.logger = ActiveSupport::TaggedLogging.new(logger) 84 | end 85 | 86 | # Do not dump schema after migrations. 87 | config.active_record.dump_schema_after_migration = false 88 | end 89 | -------------------------------------------------------------------------------- /config/environments/test.rb: -------------------------------------------------------------------------------- 1 | Rails.application.configure do 2 | # Settings specified here will take precedence over those in config/application.rb. 3 | 4 | # The test environment is used exclusively to run your application's 5 | # test suite. You never need to work with it otherwise. Remember that 6 | # your test database is "scratch space" for the test suite and is wiped 7 | # and recreated between test runs. Don't rely on the data there! 8 | config.cache_classes = true 9 | 10 | # Do not eager load code on boot. This avoids loading your whole application 11 | # just for the purpose of running a single test. If you are using a tool that 12 | # preloads Rails for running tests, you may have to set it to true. 13 | config.eager_load = false 14 | 15 | # Configure public file server for tests with Cache-Control for performance. 16 | config.public_file_server.enabled = true 17 | config.public_file_server.headers = { 18 | 'Cache-Control' => 'public, max-age=3600' 19 | } 20 | 21 | # Show full error reports and disable caching. 22 | config.consider_all_requests_local = true 23 | config.action_controller.perform_caching = false 24 | 25 | # Raise exceptions instead of rendering exception templates. 26 | config.action_dispatch.show_exceptions = false 27 | 28 | # Disable request forgery protection in test environment. 29 | config.action_controller.allow_forgery_protection = false 30 | config.action_mailer.perform_caching = false 31 | 32 | # Tell Action Mailer not to deliver emails to the real world. 33 | # The :test delivery method accumulates sent emails in the 34 | # ActionMailer::Base.deliveries array. 35 | config.action_mailer.delivery_method = :test 36 | 37 | # Print deprecation notices to the stderr. 38 | config.active_support.deprecation = :stderr 39 | 40 | # Raises error for missing translations 41 | # config.action_view.raise_on_missing_translations = true 42 | end 43 | -------------------------------------------------------------------------------- /config/initializers/active_record_belongs_to_required_by_default.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Require `belongs_to` associations by default. This is a new Rails 5.0 4 | # default, so it is introduced as a configuration option to ensure that apps 5 | # made on earlier versions of Rails are not affected when upgrading. 6 | Rails.application.config.active_record.belongs_to_required_by_default = true 7 | -------------------------------------------------------------------------------- /config/initializers/application_controller_renderer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # ApplicationController.renderer.defaults.merge!( 4 | # http_host: 'example.org', 5 | # https: false 6 | # ) 7 | -------------------------------------------------------------------------------- /config/initializers/assets.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Version of your assets, change this if you want to expire all your assets. 4 | Rails.application.config.assets.version = '1.0' 5 | 6 | # Add additional assets to the asset load path 7 | # Rails.application.config.assets.paths << Emoji.images_path 8 | 9 | # Precompile additional assets. 10 | # application.js, application.css, and all non-JS/CSS in app/assets folder are already added. 11 | # Rails.application.config.assets.precompile += %w( search.js ) 12 | -------------------------------------------------------------------------------- /config/initializers/backtrace_silencers.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. 4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ } 5 | 6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code. 7 | # Rails.backtrace_cleaner.remove_silencers! 8 | -------------------------------------------------------------------------------- /config/initializers/callback_terminator.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Do not halt callback chains when a callback returns false. This is a new 4 | # Rails 5.0 default, so it is introduced as a configuration option to ensure 5 | # that apps made with earlier versions of Rails are not affected when upgrading. 6 | ActiveSupport.halt_callback_chains_on_return_false = false 7 | -------------------------------------------------------------------------------- /config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Specify a serializer for the signed and encrypted cookie jars. 4 | # Valid options are :json, :marshal, and :hybrid. 5 | Rails.application.config.action_dispatch.cookies_serializer = :json 6 | -------------------------------------------------------------------------------- /config/initializers/filter_parameter_logging.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure sensitive parameters which will be filtered from the log file. 4 | Rails.application.config.filter_parameters += [:password] 5 | -------------------------------------------------------------------------------- /config/initializers/inflections.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new inflection rules using the following format. Inflections 4 | # are locale specific, and you may define rules for as many different 5 | # locales as you wish. All of these examples are active by default: 6 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 7 | # inflect.plural /^(ox)$/i, '\1en' 8 | # inflect.singular /^(ox)en/i, '\1' 9 | # inflect.irregular 'person', 'people' 10 | # inflect.uncountable %w( fish sheep ) 11 | # end 12 | 13 | # These inflection rules are supported but not enabled by default: 14 | # ActiveSupport::Inflector.inflections(:en) do |inflect| 15 | # inflect.acronym 'RESTful' 16 | # end 17 | -------------------------------------------------------------------------------- /config/initializers/mime_types.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Add new mime types for use in respond_to blocks: 4 | # Mime::Type.register "text/richtext", :rtf 5 | -------------------------------------------------------------------------------- /config/initializers/per_form_csrf_tokens.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Enable per-form CSRF tokens. 4 | Rails.application.config.action_controller.per_form_csrf_tokens = true 5 | -------------------------------------------------------------------------------- /config/initializers/request_forgery_protection.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Enable origin-checking CSRF mitigation. 4 | Rails.application.config.action_controller.forgery_protection_origin_check = true 5 | -------------------------------------------------------------------------------- /config/initializers/session_store.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.session_store :cookie_store, key: '_graph_cable_session' 4 | -------------------------------------------------------------------------------- /config/initializers/ssl_options.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Configure SSL options to enable HSTS with subdomains. 4 | Rails.application.config.ssl_options = { hsts: { subdomains: true } } 5 | -------------------------------------------------------------------------------- /config/initializers/to_time_preserves_timezone.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Preserve the timezone of the receiver when calling to `to_time`. 4 | # Ruby 2.4 will change the behavior of `to_time` to preserve the timezone 5 | # when converting to an instance of `Time` instead of the previous behavior 6 | # of converting to the local system timezone. 7 | # 8 | # Rails 5.0 introduced this config option so that apps made with earlier 9 | # versions of Rails are not affected when upgrading. 10 | ActiveSupport.to_time_preserves_timezone = true 11 | -------------------------------------------------------------------------------- /config/initializers/wrap_parameters.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # This file contains settings for ActionController::ParamsWrapper which 4 | # is enabled by default. 5 | 6 | # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. 7 | ActiveSupport.on_load(:action_controller) do 8 | wrap_parameters format: [:json] 9 | end 10 | 11 | # To enable root element in JSON for ActiveRecord objects. 12 | # ActiveSupport.on_load(:active_record) do 13 | # self.include_root_in_json = true 14 | # end 15 | -------------------------------------------------------------------------------- /config/locales/en.yml: -------------------------------------------------------------------------------- 1 | # Files in the config/locales directory are used for internationalization 2 | # and are automatically loaded by Rails. If you want to use locales other 3 | # than English, add the necessary files in this directory. 4 | # 5 | # To use the locales, use `I18n.t`: 6 | # 7 | # I18n.t 'hello' 8 | # 9 | # In views, this is aliased to just `t`: 10 | # 11 | # <%= t('hello') %> 12 | # 13 | # To use a different locale, set it with `I18n.locale`: 14 | # 15 | # I18n.locale = :es 16 | # 17 | # This would use the information in config/locales/es.yml. 18 | # 19 | # To learn more, please read the Rails Internationalization guide 20 | # available at http://guides.rubyonrails.org/i18n.html. 21 | 22 | en: 23 | hello: "Hello world" 24 | -------------------------------------------------------------------------------- /config/puma.rb: -------------------------------------------------------------------------------- 1 | # Puma can serve each request in a thread from an internal thread pool. 2 | # The `threads` method setting takes two numbers a minimum and maximum. 3 | # Any libraries that use thread pools should be configured to match 4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum 5 | # and maximum, this matches the default thread size of Active Record. 6 | # 7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i 8 | threads threads_count, threads_count 9 | 10 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000. 11 | # 12 | port ENV.fetch("PORT") { 3000 } 13 | 14 | # Specifies the `environment` that Puma will run in. 15 | # 16 | environment ENV.fetch("RAILS_ENV") { "development" } 17 | 18 | # Specifies the number of `workers` to boot in clustered mode. 19 | # Workers are forked webserver processes. If using threads and workers together 20 | # the concurrency of the application would be max `threads` * `workers`. 21 | # Workers do not work on JRuby or Windows (both of which do not support 22 | # processes). 23 | # 24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 } 25 | 26 | # Use the `preload_app!` method when specifying a `workers` number. 27 | # This directive tells Puma to first boot the application and load code 28 | # before forking the application. This takes advantage of Copy On Write 29 | # process behavior so workers use less memory. If you use this option 30 | # you need to make sure to reconnect any threads in the `on_worker_boot` 31 | # block. 32 | # 33 | # preload_app! 34 | 35 | # The code in the `on_worker_boot` will be called if you are using 36 | # clustered mode by specifying a number of `workers`. After each worker 37 | # process is booted this block will be run, if you are using `preload_app!` 38 | # option you will want to use this block to reconnect to any threads 39 | # or connections that may have been created at application boot, Ruby 40 | # cannot share connections between processes. 41 | # 42 | # on_worker_boot do 43 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord) 44 | # end 45 | 46 | # Allow puma to be restarted by `rails restart` command. 47 | plugin :tmp_restart 48 | -------------------------------------------------------------------------------- /config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | root to: redirect("/home") 3 | resource :home, only: :show 4 | resource :action_cable_transport, only: :show 5 | resource :chunked_transport, only: :show 6 | resource :chunked_graphql, only: :create 7 | 8 | resources :posts 9 | resource :graphql, only: :create 10 | mount GraphiQL::Rails::Engine, at: "/graphiql", graphql_path: "/graphql" 11 | end 12 | -------------------------------------------------------------------------------- /config/secrets.yml: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | # Your secret key is used for verifying the integrity of signed cookies. 4 | # If you change this key, all old signed cookies will become invalid! 5 | 6 | # Make sure the secret is at least 30 characters and all random, 7 | # no regular words or you'll be exposed to dictionary attacks. 8 | # You can use `rails secret` to generate a secure secret key. 9 | 10 | # Make sure the secrets in this file are kept private 11 | # if you're sharing your code publicly. 12 | 13 | development: 14 | secret_key_base: 751a101edbc588786ffb60405ea04bf6df6a438799e471a170e49c9eb77025d7adc9d272166f511ceb07c2dedc8a3263d93ae7c9b9310760c8f18da8b124b833 15 | 16 | test: 17 | secret_key_base: f07a06f9c071cb398b235faba2d188835aa4f24c13aa819846db7595856b2c0b7d74ea3d5d56472be5babe7995b4365b86df735899e825e0adbbac3ab4759e6b 18 | 19 | # Do not keep production secrets in the repository, 20 | # instead read values from the environment. 21 | production: 22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %> 23 | -------------------------------------------------------------------------------- /config/spring.rb: -------------------------------------------------------------------------------- 1 | %w( 2 | .ruby-version 3 | .rbenv-vars 4 | tmp/restart.txt 5 | tmp/caching-dev.txt 6 | ).each { |path| Spring.watch(path) } 7 | -------------------------------------------------------------------------------- /db/migrate/20160610000918_create_posts.rb: -------------------------------------------------------------------------------- 1 | class CreatePosts < ActiveRecord::Migration[5.0] 2 | def change 3 | create_table :posts do |t| 4 | t.string :title 5 | t.string :body 6 | 7 | t.timestamps 8 | end 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /db/schema.rb: -------------------------------------------------------------------------------- 1 | # encoding: UTF-8 2 | # This file is auto-generated from the current state of the database. Instead 3 | # of editing this file, please use the migrations feature of Active Record to 4 | # incrementally modify your database, and then regenerate this schema definition. 5 | # 6 | # Note that this schema.rb definition is the authoritative source for your 7 | # database schema. If you need to create the application database on another 8 | # system, you should be using db:schema:load, not running all the migrations 9 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations 10 | # you'll amass, the slower it'll run and the greater likelihood for issues). 11 | # 12 | # It's strongly recommended that you check this file into your version control system. 13 | 14 | ActiveRecord::Schema.define(version: 20160610000918) do 15 | 16 | # These are extensions that must be enabled in order to support this database 17 | enable_extension "plpgsql" 18 | 19 | create_table "posts", force: :cascade do |t| 20 | t.string "title" 21 | t.string "body" 22 | t.datetime "created_at", null: false 23 | t.datetime "updated_at", null: false 24 | end 25 | 26 | end 27 | -------------------------------------------------------------------------------- /db/seeds.rb: -------------------------------------------------------------------------------- 1 | # This file should contain all the record creation needed to seed the database with its default values. 2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }]) 7 | # Character.create(name: 'Luke', movie: movies.first) 8 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/lib/assets/.keep -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/lib/tasks/.keep -------------------------------------------------------------------------------- /log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/log/.keep -------------------------------------------------------------------------------- /public/404.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The page you were looking for doesn't exist (404) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The page you were looking for doesn't exist.

62 |

You may have mistyped the address or the page may have moved.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/422.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | The change you wanted was rejected (422) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

The change you wanted was rejected.

62 |

Maybe you tried to change something you didn't have access to.

63 |
64 |

If you are the application owner check the logs for more information.

65 |
66 | 67 | 68 | -------------------------------------------------------------------------------- /public/500.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | We're sorry, but something went wrong (500) 5 | 6 | 55 | 56 | 57 | 58 | 59 |
60 |
61 |

We're sorry, but something went wrong.

62 |
63 |

If you are the application owner check the logs for more information.

64 |
65 | 66 | 67 | -------------------------------------------------------------------------------- /public/apple-touch-icon-precomposed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/public/apple-touch-icon-precomposed.png -------------------------------------------------------------------------------- /public/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/public/apple-touch-icon.png -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/public/favicon.ico -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file 2 | # 3 | # To ban all spiders from the entire site uncomment the next two lines: 4 | # User-agent: * 5 | # Disallow: / 6 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/test/controllers/.keep -------------------------------------------------------------------------------- /test/controllers/posts_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostsControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/test/fixtures/.keep -------------------------------------------------------------------------------- /test/fixtures/files/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/test/fixtures/files/.keep -------------------------------------------------------------------------------- /test/fixtures/posts.yml: -------------------------------------------------------------------------------- 1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html 2 | 3 | one: 4 | title: MyString 5 | body: MyString 6 | 7 | two: 8 | title: MyString 9 | body: MyString 10 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/test/helpers/.keep -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/test/integration/.keep -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/test/mailers/.keep -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/test/models/.keep -------------------------------------------------------------------------------- /test/models/post_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class PostTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /tmp/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/tmp/.keep -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rmosolgo/graphql-ruby-stream-defer-demo/f5e351571fe982b084cf94dc384f728322b2603c/vendor/assets/stylesheets/.keep --------------------------------------------------------------------------------