├── .gitignore ├── .rspec ├── .rubocop.yml ├── .travis.yml ├── Appraisals ├── DESIGN.md ├── Gemfile ├── LICENSE.txt ├── README.md ├── Rakefile ├── app └── views │ └── progressive_render │ └── _placeholder.html.erb ├── bin ├── console └── setup ├── bump_version.sh ├── gemfiles ├── rails_4_1.gemfile ├── rails_4_1.gemfile.lock ├── rails_4_2.gemfile ├── rails_4_2.gemfile.lock ├── rails_5_0_1.gemfile ├── rails_5_0_1.gemfile.lock ├── rails_5_0_2.gemfile └── rails_5_0_2.gemfile.lock ├── lib ├── progressive_render.rb └── progressive_render │ ├── fragment_name_iterator.rb │ ├── rack.rb │ ├── rack │ └── request_handler.rb │ ├── rails.rb │ ├── rails │ ├── controller.rb │ ├── engine.rb │ ├── helpers.rb │ ├── path_resolver.rb │ ├── view.rb │ └── view_renderer.rb │ └── version.rb ├── progressive_load.gemspec ├── spec ├── .rubocop.yml ├── controller_request_spec.rb ├── dummy │ ├── .gitignore │ ├── Gemfile │ ├── Gemfile.lock │ ├── README.rdoc │ ├── Rakefile │ ├── app │ │ ├── assets │ │ │ ├── images │ │ │ │ └── .keep │ │ │ ├── javascripts │ │ │ │ ├── application.js │ │ │ │ └── jquery.js │ │ │ └── stylesheets │ │ │ │ ├── application.css │ │ │ │ └── load_test.scss │ │ ├── controllers │ │ │ ├── application_controller.rb │ │ │ ├── concerns │ │ │ │ └── .keep │ │ │ └── load_test_controller.rb │ │ ├── helpers │ │ │ ├── application_helper.rb │ │ │ └── load_test_helper.rb │ │ ├── mailers │ │ │ └── .keep │ │ ├── models │ │ │ ├── .keep │ │ │ └── concerns │ │ │ │ └── .keep │ │ └── views │ │ │ ├── layouts │ │ │ ├── application.html.erb │ │ │ └── custom_layout.html.erb │ │ │ └── load_test │ │ │ ├── _placeholder.html.erb │ │ │ ├── _slow_load.html.erb │ │ │ ├── atom_repro.html.erb │ │ │ ├── block.html.erb │ │ │ ├── custom_placeholder.html.erb │ │ │ ├── deprecated_explicit_call.html.erb │ │ │ ├── example.html.erb │ │ │ ├── index.html.erb │ │ │ ├── multiple_blocks.html.erb │ │ │ └── render_params.html.erb │ ├── bin │ │ ├── bundle │ │ ├── rails │ │ ├── rake │ │ ├── setup │ │ └── spring │ ├── config.ru │ ├── config │ │ ├── application.rb │ │ ├── boot.rb │ │ ├── database.yml │ │ ├── environment.rb │ │ ├── environments │ │ │ ├── development.rb │ │ │ ├── production.rb │ │ │ └── test.rb │ │ ├── initializers │ │ │ ├── assets.rb │ │ │ ├── backtrace_silencers.rb │ │ │ ├── cookies_serializer.rb │ │ │ ├── filter_parameter_logging.rb │ │ │ ├── inflections.rb │ │ │ ├── mime_types.rb │ │ │ ├── session_store.rb │ │ │ └── wrap_parameters.rb │ │ ├── locales │ │ │ └── en.yml │ │ ├── routes.rb │ │ └── secrets.yml │ ├── db │ │ └── seeds.rb │ ├── lib │ │ ├── assets │ │ │ └── .keep │ │ └── tasks │ │ │ └── .keep │ ├── log │ │ └── .keep │ ├── public │ │ ├── 404.html │ │ ├── 422.html │ │ ├── 500.html │ │ ├── favicon.ico │ │ └── robots.txt │ ├── test │ │ ├── controllers │ │ │ ├── .keep │ │ │ └── load_test_controller_test.rb │ │ ├── fixtures │ │ │ └── .keep │ │ ├── helpers │ │ │ └── .keep │ │ ├── integration │ │ │ └── .keep │ │ ├── mailers │ │ │ └── .keep │ │ ├── models │ │ │ └── .keep │ │ └── test_helper.rb │ └── vendor │ │ └── assets │ │ ├── javascripts │ │ └── .keep │ │ └── stylesheets │ │ └── .keep ├── lib │ ├── fragment_name_iterator_spec.rb │ ├── rack │ │ └── request_handler_spec.rb │ └── rails │ │ ├── path_resolver_spec.rb │ │ └── view_renderer_spec.rb ├── mock_rails_app.rb ├── progressive_render_spec.rb ├── rails_helper.rb └── spec_helper.rb └── vendor └── assets ├── images └── progressive_render.gif ├── javascripts └── progressive_render.js.coffee └── stylesheets └── progressive_render.scss /.gitignore: -------------------------------------------------------------------------------- 1 | /.bundle/ 2 | /.yardoc 3 | /Gemfile.lock 4 | /_yardoc/ 5 | /coverage/ 6 | /doc/ 7 | /pkg/ 8 | /spec/reports/ 9 | /tmp/ 10 | *.DS_Store 11 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --format documentation 2 | --color 3 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | Metrics/BlockLength: 2 | Max: 50 3 | 4 | Metrics/LineLength: 5 | Max: 120 6 | 7 | AllCops: 8 | Exclude: 9 | - Appraisals 10 | - spec/dummy/bin/rake 11 | - spec/dummy/bin/rails 12 | - spec/dummy/bin/spring 13 | - gemfiles/vendor/**/* 14 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | rvm: 3 | - 2.1.10 4 | - 2.2.5 5 | - 2.3.1 6 | - ruby-head 7 | # Suppress the container warning 8 | sudo: false 9 | 10 | # Cache dependencies 11 | cache: bundler 12 | 13 | before_install: gem install bundler -v 1.10.3 14 | 15 | after_script: 16 | - codeclimate-test-reporter < lcov.info 17 | 18 | gemfile: 19 | - gemfiles/rails_5_0_2.gemfile 20 | - gemfiles/rails_5_0_1.gemfile 21 | - gemfiles/rails_4_2.gemfile 22 | - gemfiles/rails_4_1.gemfile 23 | 24 | matrix: 25 | fast_finish: true 26 | allow_failures: 27 | - rvm: ruby-head 28 | exclude: 29 | - rvm: 2.1.10 30 | gemfile: gemfiles/rails_5_0_2.gemfile 31 | - rvm: 2.1.10 32 | gemfile: gemfiles/rails_5_0_1.gemfile 33 | -------------------------------------------------------------------------------- /Appraisals: -------------------------------------------------------------------------------- 1 | appraise "rails-5-0-1" do 2 | gem "rails", "5.0.1" 3 | gem "nokogiri" 4 | end 5 | 6 | appraise "rails-5-0-2" do 7 | gem "rails", "5.0.2" 8 | gem "nokogiri" 9 | end 10 | 11 | appraise "rails-4-2" do 12 | gem "rails", "4.2.4" 13 | gem "nokogiri" 14 | end 15 | 16 | appraise "rails-4-1" do 17 | gem "rails", "4.1.13" 18 | gem "nokogiri" 19 | end 20 | -------------------------------------------------------------------------------- /DESIGN.md: -------------------------------------------------------------------------------- 1 | # PathResolver (Rails Specific) # 2 | Status: Implemented 3 | 4 | Resolves the full path for views/partials. Might want to give it a RequestHandler. 5 | 6 | ## Basic Syntax ## 7 | ```ruby 8 | dtp = PathResolver.new(template_context) 9 | dtp.path_for('') 10 | ``` 11 | 12 | ## TemplateContext ## 13 | controller:string 14 | action:string 15 | type: :view, :controller 16 | 17 | ## Examples ## 18 | For the Foo controller inside of the view 19 | ```ruby 20 | dtp = PathResolver.new(controller: Foo, action: :index, type: :view) 21 | dtp.path_for('table') == foo/_table 22 | dtp.path_for('shared/dialogs/bar') == shared/dialogs/bar (Or should it also search foo/shared/..?) 23 | dtp.path_for('') == InvalidPath_forException 24 | ``` 25 | 26 | For the Foo controler inside of the controller 27 | ```ruby 28 | dtp = PathResolver.new(controller: Foo, action: :index, type: :controller) 29 | dtp.path_for('') == foo/index 30 | dtp.path_for('bar') == foo/bar 31 | ``` 32 | 33 | # ViewRenderer (Rails Specific) # 34 | Status: Implemented 35 | 36 | Interfaces between the rails renderer and rest of code. 37 | 38 | ## Basic Syntax ## 39 | ```ruby 40 | vr = ViewRenderer.new 41 | # Render a specific partial (just placeholder likely) 42 | vr.render_partial(full_partial_path) 43 | # Render a full view 44 | vr.render_view(full_view_path) 45 | # Render a full view and extract a single fragment 46 | vr.render_fragment(full_view_path, fragment_name) 47 | ``` 48 | 49 | # RequestHandler (Rack Specific) # 50 | Status: Implemented 51 | 52 | Parses the request object to determine if this is the main load of the app and if not, what partial view is being requested 53 | 54 | ## Basic Syntax ## 55 | ```ruby 56 | rh = RequestHandler.new(request) 57 | rh.main_load? 58 | rh.fragment_name 59 | rh.load_path(fragment_name) 60 | rh.should_render_partial?(fragment_name) 61 | ``` 62 | 63 | # Rails Engine # 64 | Status: Implemented 65 | 66 | Installs the view/controller renderer into ActionView/ActionController 67 | 68 | ## Basic Syntax ## 69 | ```ruby 70 | class Engine < ::Rails::Engine 71 | # .. installation code .. 72 | end 73 | ``` 74 | 75 | # Structure # 76 | ``` 77 | lib/ 78 | progressive_render.rb 79 | rails/ 80 | rails.rb 81 | engine.rb 82 | builder.rb 83 | view_renderer.rb 84 | path_resolver.rb 85 | rack/ 86 | request_handler.rb 87 | ``` -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in progressive_render.gemspec 4 | gem 'appraisal' 5 | gemspec 6 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015, 2016 Jeff Johnson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ProgressiveRender [![Gem Version](https://badge.fury.io/rb/progressive_render.svg)](http://badge.fury.io/rb/progressive_render) # 2 | 3 | ![ProgressiveRender Demo](http://i.imgur.com/J9RtbDc.gif) 4 | 5 | Slow content got you down? Load it later! Use this gem to defer loading of portions of your page until after load. They will be fetched via AJAX and placed on the page when ready. 6 | 7 | For a quick start, see [Drifting Ruby #033 - Progressive Render](https://www.driftingruby.com/episodes/progressive-render) based on version 0.3.0. Note the controller changes are no longer required in 0.4.0. 8 | 9 | ## Why? ## 10 | You wrote all your code and it got a bit slow with all that production data. Or perhaps you have less important content that you want on the view, but it's not worth blocking the entire page for. With this gem there's almost no developer work to make this happen. All requests go through your controller and your normal filters so you're permissions are respected. The only added overhead is an additional round-trip for each partial and duplicated rendering of the main view. 11 | 12 | ## State of Project ## 13 | [![Build Status](https://travis-ci.org/johnsonj/progressive_render.svg?branch=master)](https://travis-ci.org/johnsonj/progressive_render) [![Code Climate](https://codeclimate.com/github/johnsonj/progressive_load/badges/gpa.svg)](https://codeclimate.com/github/johnsonj/progressive_load) [![Test Coverage](https://codeclimate.com/github/johnsonj/progressive_load/badges/coverage.svg)](https://codeclimate.com/github/johnsonj/progressive_load/coverage) 14 | 15 | This gem follows semantic versioning. The important part of that being the API will not make breaking changes except for major version numbers. Please use released versions via RubyGems for production applications. Old versions do not have a maintenance plan. [See open issues](https://github.com/johnsonj/progressive_render/issues). Report any issues you have! 16 | 17 | ## Installation ## 18 | 19 | Add this line to your application's Gemfile and run `bundle install` 20 | 21 | ```ruby 22 | gem 'progressive_render' 23 | ``` 24 | 25 | Then add the following to your `application.js`: 26 | 27 | ```javascript 28 | //= require progressive_render 29 | ``` 30 | 31 | If you plan on using the default placeholder, add this to your `application.css`: 32 | 33 | ```css 34 | /* 35 | *= require progressive_render 36 | */ 37 | ``` 38 | ## Basic Usage ## 39 | 40 | Wrap slow content in your view with a call to `progressive_render`: 41 | 42 | ```erb 43 | <%=progressive_render do %> 44 |

Content!

45 | <% sleep 5 %> 46 | <% end %> 47 | ``` 48 | 49 | ## Example Application ## 50 | 51 | For a more in-depth example, see the test application located within this repository in `spec/dummy` 52 | 53 | ## Customizing the Placeholder ## 54 | 55 | Each `progressive_render` call in the view can specify its own placeholder by providing a path to the partial you'd like to initially display to the user: 56 | 57 | ```erb 58 | <%=progressive_render placeholder: 'shared/loading' do %> 59 |

Content!

60 | <% sleep 5 %> 61 | <% end %> 62 | ``` 63 | 64 | The placeholder defaults to rendering the partial `progressive_render/placeholder` so if you'd like to override it globally create the file `app/views/progressive_render/_placeholder.html.erb`. It will also work at the controller level, eg, `app/views/users/progressive_render/_placeholder.html.erb` 65 | 66 | ## Development ## 67 | 68 | After checking out the repo, run `bin/setup` to install dependencies. Then, run `rspec` to run the tests. There is a dummy application located in `spec/dummy/` that demonstrates a sample integration and can be used for interactive testing. 69 | 70 | ## CI Environment ## 71 | 72 | Travis.ci is used to validate changes to the github project. The CI build runs the gem against multiple versions of rails/ruby. When making a change to any dependencies or the version number of the application, be sure to run `appraisal` to update the dependent Gemfile.locks. 73 | 74 | ## Contributing ## 75 | 76 | Bug reports and pull requests are welcome on [GitHub](https://github.com/johnsonj/progressive_render). Any contribution should not decrease test coverage significantly. Please feel free to [reach out](johnsonjeff@gmail.com) if you have an issues contributing. 77 | 78 | ## Release Process ## 79 | 80 | ```bash 81 | gem install gem-release 82 | gem bump --version [major, minor, patch] 83 | cd spec/dummy 84 | bundle install 85 | cd ../../ 86 | appraisal install 87 | git add spec/dummy/Gemfile.lock 88 | git add gemfiles/*.lock 89 | git commit -am "Bumping collateral for new gem version" 90 | gem release --tag 91 | ``` 92 | 93 | ## License ## 94 | 95 | [MIT License](http://opensource.org/licenses/MIT). 96 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require 'bundler/gem_tasks' 2 | require 'rspec/core/rake_task' 3 | require 'rubocop/rake_task' 4 | 5 | RSpec::Core::RakeTask.new(:spec) 6 | RuboCop::RakeTask.new 7 | 8 | task default: %w[spec rubocop] 9 | -------------------------------------------------------------------------------- /app/views/progressive_render/_placeholder.html.erb: -------------------------------------------------------------------------------- 1 |
2 |
3 |
4 | <%= image_tag "progressive_render.gif" %> 5 |
6 |
7 |
-------------------------------------------------------------------------------- /bin/console: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | require 'bundler/setup' 4 | require 'progressive_render' 5 | 6 | # You can add fixtures and/or initialization code here to make experimenting 7 | # with your gem easier. You can also use a different console, if you like. 8 | 9 | # (If you use this, don't forget to add pry to your Gemfile!) 10 | # require "pry" 11 | # Pry.start 12 | 13 | require 'irb' 14 | IRB.start 15 | -------------------------------------------------------------------------------- /bin/setup: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | IFS=$'\n\t' 4 | 5 | bundle install 6 | 7 | # Do any other automated setup that you need to do here 8 | -------------------------------------------------------------------------------- /bump_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # 4 | # Bump the gem version 5 | # Pass in 'patch, minor, major' to specify what to update. Default is patch. 6 | # 7 | # This is needed to ensure all the Gemfile.locks are up to date with the 8 | # new version. Otherwise any CI builds will fail. 9 | # 10 | 11 | gem install gem-release 12 | gem bump --version ${1:-patch} 13 | cd spec/dummy 14 | bundle install 15 | cd ../../ 16 | appraisal install 17 | git add spec/dummy/Gemfile.lock 18 | git add gemfiles/*.lock 19 | git commit -am "Bumping collateral for new gem version" 20 | gem release --tag -------------------------------------------------------------------------------- /gemfiles/rails_4_1.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "appraisal" 6 | gem "rails", "4.1.13" 7 | gem "nokogiri" 8 | 9 | gemspec :path => "../" 10 | -------------------------------------------------------------------------------- /gemfiles/rails_4_1.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | progressive_render (0.7.0) 5 | coffee-rails 6 | jquery-rails 7 | nokogiri 8 | rails (>= 4.1) 9 | railties 10 | sass 11 | sass-rails 12 | uglifier 13 | 14 | GEM 15 | remote: https://rubygems.org/ 16 | specs: 17 | actionmailer (4.1.13) 18 | actionpack (= 4.1.13) 19 | actionview (= 4.1.13) 20 | mail (~> 2.5, >= 2.5.4) 21 | actionpack (4.1.13) 22 | actionview (= 4.1.13) 23 | activesupport (= 4.1.13) 24 | rack (~> 1.5.2) 25 | rack-test (~> 0.6.2) 26 | actionview (4.1.13) 27 | activesupport (= 4.1.13) 28 | builder (~> 3.1) 29 | erubis (~> 2.7.0) 30 | activemodel (4.1.13) 31 | activesupport (= 4.1.13) 32 | builder (~> 3.1) 33 | activerecord (4.1.13) 34 | activemodel (= 4.1.13) 35 | activesupport (= 4.1.13) 36 | arel (~> 5.0.0) 37 | activesupport (4.1.13) 38 | i18n (~> 0.6, >= 0.6.9) 39 | json (~> 1.7, >= 1.7.7) 40 | minitest (~> 5.1) 41 | thread_safe (~> 0.1) 42 | tzinfo (~> 1.1) 43 | appraisal (2.1.0) 44 | bundler 45 | rake 46 | thor (>= 0.14.0) 47 | arel (5.0.1.20140414130214) 48 | ast (2.3.0) 49 | builder (3.2.2) 50 | byebug (5.0.0) 51 | columnize (= 0.9.0) 52 | codeclimate-test-reporter (0.4.8) 53 | simplecov (>= 0.7.1, < 1.0.0) 54 | coderay (1.1.0) 55 | coffee-rails (4.2.1) 56 | coffee-script (>= 2.2.0) 57 | railties (>= 4.0.0, < 5.2.x) 58 | coffee-script (2.4.1) 59 | coffee-script-source 60 | execjs 61 | coffee-script-source (1.12.2) 62 | columnize (0.9.0) 63 | diff-lcs (1.2.5) 64 | docile (1.1.5) 65 | erubis (2.7.0) 66 | execjs (2.7.0) 67 | i18n (0.7.0) 68 | jquery-rails (3.1.4) 69 | railties (>= 3.0, < 5.0) 70 | thor (>= 0.14, < 2.0) 71 | json (1.8.3) 72 | mail (2.6.3) 73 | mime-types (>= 1.16, < 3) 74 | method_source (0.8.2) 75 | mime-types (2.6.1) 76 | mini_portile (0.6.2) 77 | minitest (5.8.0) 78 | nokogiri (1.6.6.2) 79 | mini_portile (~> 0.6.0) 80 | parser (2.4.0.0) 81 | ast (~> 2.2) 82 | powerpack (0.1.1) 83 | pry (0.10.1) 84 | coderay (~> 1.1.0) 85 | method_source (~> 0.8.1) 86 | slop (~> 3.4) 87 | pry-byebug (3.2.0) 88 | byebug (~> 5.0) 89 | pry (~> 0.10) 90 | rack (1.5.5) 91 | rack-test (0.6.3) 92 | rack (>= 1.0) 93 | rails (4.1.13) 94 | actionmailer (= 4.1.13) 95 | actionpack (= 4.1.13) 96 | actionview (= 4.1.13) 97 | activemodel (= 4.1.13) 98 | activerecord (= 4.1.13) 99 | activesupport (= 4.1.13) 100 | bundler (>= 1.3.0, < 2.0) 101 | railties (= 4.1.13) 102 | sprockets-rails (~> 2.0) 103 | railties (4.1.13) 104 | actionpack (= 4.1.13) 105 | activesupport (= 4.1.13) 106 | rake (>= 0.8.7) 107 | thor (>= 0.18.1, < 2.0) 108 | rainbow (2.2.1) 109 | rake (10.4.2) 110 | rspec (3.3.0) 111 | rspec-core (~> 3.3.0) 112 | rspec-expectations (~> 3.3.0) 113 | rspec-mocks (~> 3.3.0) 114 | rspec-core (3.3.2) 115 | rspec-support (~> 3.3.0) 116 | rspec-expectations (3.3.1) 117 | diff-lcs (>= 1.2.0, < 2.0) 118 | rspec-support (~> 3.3.0) 119 | rspec-mocks (3.3.2) 120 | diff-lcs (>= 1.2.0, < 2.0) 121 | rspec-support (~> 3.3.0) 122 | rspec-rails (3.3.3) 123 | actionpack (>= 3.0, < 4.3) 124 | activesupport (>= 3.0, < 4.3) 125 | railties (>= 3.0, < 4.3) 126 | rspec-core (~> 3.3.0) 127 | rspec-expectations (~> 3.3.0) 128 | rspec-mocks (~> 3.3.0) 129 | rspec-support (~> 3.3.0) 130 | rspec-support (3.3.0) 131 | rubocop (0.48.1) 132 | parser (>= 2.3.3.1, < 3.0) 133 | powerpack (~> 0.1) 134 | rainbow (>= 1.99.1, < 3.0) 135 | ruby-progressbar (~> 1.7) 136 | unicode-display_width (~> 1.0, >= 1.0.1) 137 | ruby-progressbar (1.8.1) 138 | sass (3.4.23) 139 | sass-rails (5.0.6) 140 | railties (>= 4.0.0, < 6) 141 | sass (~> 3.1) 142 | sprockets (>= 2.8, < 4.0) 143 | sprockets-rails (>= 2.0, < 4.0) 144 | tilt (>= 1.1, < 3) 145 | simplecov (0.10.0) 146 | docile (~> 1.1.0) 147 | json (~> 1.8) 148 | simplecov-html (~> 0.10.0) 149 | simplecov-html (0.10.0) 150 | slop (3.6.0) 151 | sprockets (3.3.4) 152 | rack (~> 1.0) 153 | sprockets-rails (2.3.2) 154 | actionpack (>= 3.0) 155 | activesupport (>= 3.0) 156 | sprockets (>= 2.8, < 4.0) 157 | sqlite3 (1.3.10) 158 | thor (0.19.1) 159 | thread_safe (0.3.5) 160 | tilt (2.0.7) 161 | tzinfo (1.2.2) 162 | thread_safe (~> 0.1) 163 | uglifier (3.2.0) 164 | execjs (>= 0.3.0, < 3) 165 | unicode-display_width (1.2.1) 166 | 167 | PLATFORMS 168 | ruby 169 | 170 | DEPENDENCIES 171 | appraisal 172 | bundler (~> 1.10) 173 | codeclimate-test-reporter 174 | nokogiri 175 | progressive_render! 176 | pry-byebug 177 | rails (= 4.1.13) 178 | rake (~> 10.0) 179 | rspec 180 | rspec-rails 181 | rubocop (~> 0.48) 182 | sqlite3 183 | 184 | BUNDLED WITH 185 | 1.13.6 186 | -------------------------------------------------------------------------------- /gemfiles/rails_4_2.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "appraisal" 6 | gem "rails", "4.2.4" 7 | gem "nokogiri" 8 | 9 | gemspec :path => "../" 10 | -------------------------------------------------------------------------------- /gemfiles/rails_4_2.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | progressive_render (0.7.0) 5 | coffee-rails 6 | jquery-rails 7 | nokogiri 8 | rails (>= 4.1) 9 | railties 10 | sass 11 | sass-rails 12 | uglifier 13 | 14 | GEM 15 | remote: https://rubygems.org/ 16 | specs: 17 | actionmailer (4.2.4) 18 | actionpack (= 4.2.4) 19 | actionview (= 4.2.4) 20 | activejob (= 4.2.4) 21 | mail (~> 2.5, >= 2.5.4) 22 | rails-dom-testing (~> 1.0, >= 1.0.5) 23 | actionpack (4.2.4) 24 | actionview (= 4.2.4) 25 | activesupport (= 4.2.4) 26 | rack (~> 1.6) 27 | rack-test (~> 0.6.2) 28 | rails-dom-testing (~> 1.0, >= 1.0.5) 29 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 30 | actionview (4.2.4) 31 | activesupport (= 4.2.4) 32 | builder (~> 3.1) 33 | erubis (~> 2.7.0) 34 | rails-dom-testing (~> 1.0, >= 1.0.5) 35 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 36 | activejob (4.2.4) 37 | activesupport (= 4.2.4) 38 | globalid (>= 0.3.0) 39 | activemodel (4.2.4) 40 | activesupport (= 4.2.4) 41 | builder (~> 3.1) 42 | activerecord (4.2.4) 43 | activemodel (= 4.2.4) 44 | activesupport (= 4.2.4) 45 | arel (~> 6.0) 46 | activesupport (4.2.4) 47 | i18n (~> 0.7) 48 | json (~> 1.7, >= 1.7.7) 49 | minitest (~> 5.1) 50 | thread_safe (~> 0.3, >= 0.3.4) 51 | tzinfo (~> 1.1) 52 | appraisal (2.1.0) 53 | bundler 54 | rake 55 | thor (>= 0.14.0) 56 | arel (6.0.3) 57 | ast (2.3.0) 58 | builder (3.2.2) 59 | byebug (5.0.0) 60 | columnize (= 0.9.0) 61 | codeclimate-test-reporter (0.4.8) 62 | simplecov (>= 0.7.1, < 1.0.0) 63 | coderay (1.1.0) 64 | coffee-rails (4.2.1) 65 | coffee-script (>= 2.2.0) 66 | railties (>= 4.0.0, < 5.2.x) 67 | coffee-script (2.4.1) 68 | coffee-script-source 69 | execjs 70 | coffee-script-source (1.12.2) 71 | columnize (0.9.0) 72 | diff-lcs (1.2.5) 73 | docile (1.1.5) 74 | erubis (2.7.0) 75 | execjs (2.7.0) 76 | globalid (0.3.6) 77 | activesupport (>= 4.1.0) 78 | i18n (0.7.0) 79 | jquery-rails (4.3.1) 80 | rails-dom-testing (>= 1, < 3) 81 | railties (>= 4.2.0) 82 | thor (>= 0.14, < 2.0) 83 | json (1.8.3) 84 | loofah (2.0.3) 85 | nokogiri (>= 1.5.9) 86 | mail (2.6.3) 87 | mime-types (>= 1.16, < 3) 88 | method_source (0.8.2) 89 | mime-types (2.6.1) 90 | mini_portile (0.6.2) 91 | minitest (5.8.0) 92 | nokogiri (1.6.6.2) 93 | mini_portile (~> 0.6.0) 94 | parser (2.4.0.0) 95 | ast (~> 2.2) 96 | powerpack (0.1.1) 97 | pry (0.10.1) 98 | coderay (~> 1.1.0) 99 | method_source (~> 0.8.1) 100 | slop (~> 3.4) 101 | pry-byebug (3.2.0) 102 | byebug (~> 5.0) 103 | pry (~> 0.10) 104 | rack (1.6.4) 105 | rack-test (0.6.3) 106 | rack (>= 1.0) 107 | rails (4.2.4) 108 | actionmailer (= 4.2.4) 109 | actionpack (= 4.2.4) 110 | actionview (= 4.2.4) 111 | activejob (= 4.2.4) 112 | activemodel (= 4.2.4) 113 | activerecord (= 4.2.4) 114 | activesupport (= 4.2.4) 115 | bundler (>= 1.3.0, < 2.0) 116 | railties (= 4.2.4) 117 | sprockets-rails 118 | rails-deprecated_sanitizer (1.0.3) 119 | activesupport (>= 4.2.0.alpha) 120 | rails-dom-testing (1.0.7) 121 | activesupport (>= 4.2.0.beta, < 5.0) 122 | nokogiri (~> 1.6.0) 123 | rails-deprecated_sanitizer (>= 1.0.1) 124 | rails-html-sanitizer (1.0.2) 125 | loofah (~> 2.0) 126 | railties (4.2.4) 127 | actionpack (= 4.2.4) 128 | activesupport (= 4.2.4) 129 | rake (>= 0.8.7) 130 | thor (>= 0.18.1, < 2.0) 131 | rainbow (2.2.1) 132 | rake (10.4.2) 133 | rspec (3.3.0) 134 | rspec-core (~> 3.3.0) 135 | rspec-expectations (~> 3.3.0) 136 | rspec-mocks (~> 3.3.0) 137 | rspec-core (3.3.2) 138 | rspec-support (~> 3.3.0) 139 | rspec-expectations (3.3.1) 140 | diff-lcs (>= 1.2.0, < 2.0) 141 | rspec-support (~> 3.3.0) 142 | rspec-mocks (3.3.2) 143 | diff-lcs (>= 1.2.0, < 2.0) 144 | rspec-support (~> 3.3.0) 145 | rspec-rails (3.3.3) 146 | actionpack (>= 3.0, < 4.3) 147 | activesupport (>= 3.0, < 4.3) 148 | railties (>= 3.0, < 4.3) 149 | rspec-core (~> 3.3.0) 150 | rspec-expectations (~> 3.3.0) 151 | rspec-mocks (~> 3.3.0) 152 | rspec-support (~> 3.3.0) 153 | rspec-support (3.3.0) 154 | rubocop (0.48.1) 155 | parser (>= 2.3.3.1, < 3.0) 156 | powerpack (~> 0.1) 157 | rainbow (>= 1.99.1, < 3.0) 158 | ruby-progressbar (~> 1.7) 159 | unicode-display_width (~> 1.0, >= 1.0.1) 160 | ruby-progressbar (1.8.1) 161 | sass (3.4.23) 162 | sass-rails (5.0.6) 163 | railties (>= 4.0.0, < 6) 164 | sass (~> 3.1) 165 | sprockets (>= 2.8, < 4.0) 166 | sprockets-rails (>= 2.0, < 4.0) 167 | tilt (>= 1.1, < 3) 168 | simplecov (0.10.0) 169 | docile (~> 1.1.0) 170 | json (~> 1.8) 171 | simplecov-html (~> 0.10.0) 172 | simplecov-html (0.10.0) 173 | slop (3.6.0) 174 | sprockets (3.3.4) 175 | rack (~> 1.0) 176 | sprockets-rails (2.3.2) 177 | actionpack (>= 3.0) 178 | activesupport (>= 3.0) 179 | sprockets (>= 2.8, < 4.0) 180 | sqlite3 (1.3.10) 181 | thor (0.19.1) 182 | thread_safe (0.3.5) 183 | tilt (2.0.7) 184 | tzinfo (1.2.2) 185 | thread_safe (~> 0.1) 186 | uglifier (3.2.0) 187 | execjs (>= 0.3.0, < 3) 188 | unicode-display_width (1.2.1) 189 | 190 | PLATFORMS 191 | ruby 192 | 193 | DEPENDENCIES 194 | appraisal 195 | bundler (~> 1.10) 196 | codeclimate-test-reporter 197 | nokogiri 198 | progressive_render! 199 | pry-byebug 200 | rails (= 4.2.4) 201 | rake (~> 10.0) 202 | rspec 203 | rspec-rails 204 | rubocop (~> 0.48) 205 | sqlite3 206 | 207 | BUNDLED WITH 208 | 1.13.6 209 | -------------------------------------------------------------------------------- /gemfiles/rails_5_0_1.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "appraisal" 6 | gem "rails", "5.0.1" 7 | gem "nokogiri" 8 | 9 | gemspec :path => "../" 10 | -------------------------------------------------------------------------------- /gemfiles/rails_5_0_1.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | progressive_render (0.7.0) 5 | coffee-rails 6 | jquery-rails 7 | nokogiri 8 | rails (>= 4.1) 9 | railties 10 | sass 11 | sass-rails 12 | uglifier 13 | 14 | GEM 15 | remote: https://rubygems.org/ 16 | specs: 17 | actioncable (5.0.1) 18 | actionpack (= 5.0.1) 19 | nio4r (~> 1.2) 20 | websocket-driver (~> 0.6.1) 21 | actionmailer (5.0.1) 22 | actionpack (= 5.0.1) 23 | actionview (= 5.0.1) 24 | activejob (= 5.0.1) 25 | mail (~> 2.5, >= 2.5.4) 26 | rails-dom-testing (~> 2.0) 27 | actionpack (5.0.1) 28 | actionview (= 5.0.1) 29 | activesupport (= 5.0.1) 30 | rack (~> 2.0) 31 | rack-test (~> 0.6.3) 32 | rails-dom-testing (~> 2.0) 33 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 34 | actionview (5.0.1) 35 | activesupport (= 5.0.1) 36 | builder (~> 3.1) 37 | erubis (~> 2.7.0) 38 | rails-dom-testing (~> 2.0) 39 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 40 | activejob (5.0.1) 41 | activesupport (= 5.0.1) 42 | globalid (>= 0.3.6) 43 | activemodel (5.0.1) 44 | activesupport (= 5.0.1) 45 | activerecord (5.0.1) 46 | activemodel (= 5.0.1) 47 | activesupport (= 5.0.1) 48 | arel (~> 7.0) 49 | activesupport (5.0.1) 50 | concurrent-ruby (~> 1.0, >= 1.0.2) 51 | i18n (~> 0.7) 52 | minitest (~> 5.1) 53 | tzinfo (~> 1.1) 54 | appraisal (2.1.0) 55 | bundler 56 | rake 57 | thor (>= 0.14.0) 58 | arel (7.1.4) 59 | ast (2.3.0) 60 | builder (3.2.3) 61 | byebug (9.0.6) 62 | codeclimate-test-reporter (1.0.8) 63 | simplecov (<= 0.13) 64 | coderay (1.1.1) 65 | coffee-rails (4.2.1) 66 | coffee-script (>= 2.2.0) 67 | railties (>= 4.0.0, < 5.2.x) 68 | coffee-script (2.4.1) 69 | coffee-script-source 70 | execjs 71 | coffee-script-source (1.12.2) 72 | concurrent-ruby (1.0.5) 73 | diff-lcs (1.3) 74 | docile (1.1.5) 75 | erubis (2.7.0) 76 | execjs (2.7.0) 77 | globalid (0.3.7) 78 | activesupport (>= 4.1.0) 79 | i18n (0.8.1) 80 | jquery-rails (4.3.1) 81 | rails-dom-testing (>= 1, < 3) 82 | railties (>= 4.2.0) 83 | thor (>= 0.14, < 2.0) 84 | json (2.0.4) 85 | loofah (2.0.3) 86 | nokogiri (>= 1.5.9) 87 | mail (2.6.4) 88 | mime-types (>= 1.16, < 4) 89 | method_source (0.8.2) 90 | mime-types (3.1) 91 | mime-types-data (~> 3.2015) 92 | mime-types-data (3.2016.0521) 93 | mini_portile2 (2.1.0) 94 | minitest (5.10.1) 95 | nio4r (1.2.1) 96 | nokogiri (1.7.1) 97 | mini_portile2 (~> 2.1.0) 98 | parser (2.4.0.0) 99 | ast (~> 2.2) 100 | powerpack (0.1.1) 101 | pry (0.10.4) 102 | coderay (~> 1.1.0) 103 | method_source (~> 0.8.1) 104 | slop (~> 3.4) 105 | pry-byebug (3.4.2) 106 | byebug (~> 9.0) 107 | pry (~> 0.10) 108 | rack (2.0.1) 109 | rack-test (0.6.3) 110 | rack (>= 1.0) 111 | rails (5.0.1) 112 | actioncable (= 5.0.1) 113 | actionmailer (= 5.0.1) 114 | actionpack (= 5.0.1) 115 | actionview (= 5.0.1) 116 | activejob (= 5.0.1) 117 | activemodel (= 5.0.1) 118 | activerecord (= 5.0.1) 119 | activesupport (= 5.0.1) 120 | bundler (>= 1.3.0, < 2.0) 121 | railties (= 5.0.1) 122 | sprockets-rails (>= 2.0.0) 123 | rails-dom-testing (2.0.2) 124 | activesupport (>= 4.2.0, < 6.0) 125 | nokogiri (~> 1.6) 126 | rails-html-sanitizer (1.0.3) 127 | loofah (~> 2.0) 128 | railties (5.0.1) 129 | actionpack (= 5.0.1) 130 | activesupport (= 5.0.1) 131 | method_source 132 | rake (>= 0.8.7) 133 | thor (>= 0.18.1, < 2.0) 134 | rainbow (2.2.1) 135 | rake (10.5.0) 136 | rspec (3.5.0) 137 | rspec-core (~> 3.5.0) 138 | rspec-expectations (~> 3.5.0) 139 | rspec-mocks (~> 3.5.0) 140 | rspec-core (3.5.4) 141 | rspec-support (~> 3.5.0) 142 | rspec-expectations (3.5.0) 143 | diff-lcs (>= 1.2.0, < 2.0) 144 | rspec-support (~> 3.5.0) 145 | rspec-mocks (3.5.0) 146 | diff-lcs (>= 1.2.0, < 2.0) 147 | rspec-support (~> 3.5.0) 148 | rspec-rails (3.5.2) 149 | actionpack (>= 3.0) 150 | activesupport (>= 3.0) 151 | railties (>= 3.0) 152 | rspec-core (~> 3.5.0) 153 | rspec-expectations (~> 3.5.0) 154 | rspec-mocks (~> 3.5.0) 155 | rspec-support (~> 3.5.0) 156 | rspec-support (3.5.0) 157 | rubocop (0.48.1) 158 | parser (>= 2.3.3.1, < 3.0) 159 | powerpack (~> 0.1) 160 | rainbow (>= 1.99.1, < 3.0) 161 | ruby-progressbar (~> 1.7) 162 | unicode-display_width (~> 1.0, >= 1.0.1) 163 | ruby-progressbar (1.8.1) 164 | sass (3.4.23) 165 | sass-rails (5.0.6) 166 | railties (>= 4.0.0, < 6) 167 | sass (~> 3.1) 168 | sprockets (>= 2.8, < 4.0) 169 | sprockets-rails (>= 2.0, < 4.0) 170 | tilt (>= 1.1, < 3) 171 | simplecov (0.13.0) 172 | docile (~> 1.1.0) 173 | json (>= 1.8, < 3) 174 | simplecov-html (~> 0.10.0) 175 | simplecov-html (0.10.0) 176 | slop (3.6.0) 177 | sprockets (3.7.1) 178 | concurrent-ruby (~> 1.0) 179 | rack (> 1, < 3) 180 | sprockets-rails (3.2.0) 181 | actionpack (>= 4.0) 182 | activesupport (>= 4.0) 183 | sprockets (>= 3.0.0) 184 | sqlite3 (1.3.13) 185 | thor (0.19.4) 186 | thread_safe (0.3.6) 187 | tilt (2.0.7) 188 | tzinfo (1.2.3) 189 | thread_safe (~> 0.1) 190 | uglifier (3.2.0) 191 | execjs (>= 0.3.0, < 3) 192 | unicode-display_width (1.2.1) 193 | websocket-driver (0.6.5) 194 | websocket-extensions (>= 0.1.0) 195 | websocket-extensions (0.1.2) 196 | 197 | PLATFORMS 198 | ruby 199 | 200 | DEPENDENCIES 201 | appraisal 202 | bundler (~> 1.10) 203 | codeclimate-test-reporter 204 | nokogiri 205 | progressive_render! 206 | pry-byebug 207 | rails (= 5.0.1) 208 | rake (~> 10.0) 209 | rspec 210 | rspec-rails 211 | rubocop (~> 0.48) 212 | sqlite3 213 | 214 | BUNDLED WITH 215 | 1.13.6 216 | -------------------------------------------------------------------------------- /gemfiles/rails_5_0_2.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "appraisal" 6 | gem "rails", "5.0.2" 7 | gem "nokogiri" 8 | 9 | gemspec :path => "../" 10 | -------------------------------------------------------------------------------- /gemfiles/rails_5_0_2.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | progressive_render (0.7.0) 5 | coffee-rails 6 | jquery-rails 7 | nokogiri 8 | rails (>= 4.1) 9 | railties 10 | sass 11 | sass-rails 12 | uglifier 13 | 14 | GEM 15 | remote: https://rubygems.org/ 16 | specs: 17 | actioncable (5.0.2) 18 | actionpack (= 5.0.2) 19 | nio4r (>= 1.2, < 3.0) 20 | websocket-driver (~> 0.6.1) 21 | actionmailer (5.0.2) 22 | actionpack (= 5.0.2) 23 | actionview (= 5.0.2) 24 | activejob (= 5.0.2) 25 | mail (~> 2.5, >= 2.5.4) 26 | rails-dom-testing (~> 2.0) 27 | actionpack (5.0.2) 28 | actionview (= 5.0.2) 29 | activesupport (= 5.0.2) 30 | rack (~> 2.0) 31 | rack-test (~> 0.6.3) 32 | rails-dom-testing (~> 2.0) 33 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 34 | actionview (5.0.2) 35 | activesupport (= 5.0.2) 36 | builder (~> 3.1) 37 | erubis (~> 2.7.0) 38 | rails-dom-testing (~> 2.0) 39 | rails-html-sanitizer (~> 1.0, >= 1.0.3) 40 | activejob (5.0.2) 41 | activesupport (= 5.0.2) 42 | globalid (>= 0.3.6) 43 | activemodel (5.0.2) 44 | activesupport (= 5.0.2) 45 | activerecord (5.0.2) 46 | activemodel (= 5.0.2) 47 | activesupport (= 5.0.2) 48 | arel (~> 7.0) 49 | activesupport (5.0.2) 50 | concurrent-ruby (~> 1.0, >= 1.0.2) 51 | i18n (~> 0.7) 52 | minitest (~> 5.1) 53 | tzinfo (~> 1.1) 54 | appraisal (2.1.0) 55 | bundler 56 | rake 57 | thor (>= 0.14.0) 58 | arel (7.1.4) 59 | ast (2.3.0) 60 | builder (3.2.3) 61 | byebug (9.0.6) 62 | codeclimate-test-reporter (1.0.8) 63 | simplecov (<= 0.13) 64 | coderay (1.1.1) 65 | coffee-rails (4.2.1) 66 | coffee-script (>= 2.2.0) 67 | railties (>= 4.0.0, < 5.2.x) 68 | coffee-script (2.4.1) 69 | coffee-script-source 70 | execjs 71 | coffee-script-source (1.12.2) 72 | concurrent-ruby (1.0.5) 73 | diff-lcs (1.3) 74 | docile (1.1.5) 75 | erubis (2.7.0) 76 | execjs (2.7.0) 77 | globalid (0.3.7) 78 | activesupport (>= 4.1.0) 79 | i18n (0.8.1) 80 | jquery-rails (4.3.1) 81 | rails-dom-testing (>= 1, < 3) 82 | railties (>= 4.2.0) 83 | thor (>= 0.14, < 2.0) 84 | json (2.0.4) 85 | loofah (2.0.3) 86 | nokogiri (>= 1.5.9) 87 | mail (2.6.4) 88 | mime-types (>= 1.16, < 4) 89 | method_source (0.8.2) 90 | mime-types (3.1) 91 | mime-types-data (~> 3.2015) 92 | mime-types-data (3.2016.0521) 93 | mini_portile2 (2.1.0) 94 | minitest (5.10.1) 95 | nio4r (2.0.0) 96 | nokogiri (1.7.1) 97 | mini_portile2 (~> 2.1.0) 98 | parser (2.4.0.0) 99 | ast (~> 2.2) 100 | powerpack (0.1.1) 101 | pry (0.10.4) 102 | coderay (~> 1.1.0) 103 | method_source (~> 0.8.1) 104 | slop (~> 3.4) 105 | pry-byebug (3.4.2) 106 | byebug (~> 9.0) 107 | pry (~> 0.10) 108 | rack (2.0.1) 109 | rack-test (0.6.3) 110 | rack (>= 1.0) 111 | rails (5.0.2) 112 | actioncable (= 5.0.2) 113 | actionmailer (= 5.0.2) 114 | actionpack (= 5.0.2) 115 | actionview (= 5.0.2) 116 | activejob (= 5.0.2) 117 | activemodel (= 5.0.2) 118 | activerecord (= 5.0.2) 119 | activesupport (= 5.0.2) 120 | bundler (>= 1.3.0, < 2.0) 121 | railties (= 5.0.2) 122 | sprockets-rails (>= 2.0.0) 123 | rails-dom-testing (2.0.2) 124 | activesupport (>= 4.2.0, < 6.0) 125 | nokogiri (~> 1.6) 126 | rails-html-sanitizer (1.0.3) 127 | loofah (~> 2.0) 128 | railties (5.0.2) 129 | actionpack (= 5.0.2) 130 | activesupport (= 5.0.2) 131 | method_source 132 | rake (>= 0.8.7) 133 | thor (>= 0.18.1, < 2.0) 134 | rainbow (2.2.1) 135 | rake (10.5.0) 136 | rspec (3.5.0) 137 | rspec-core (~> 3.5.0) 138 | rspec-expectations (~> 3.5.0) 139 | rspec-mocks (~> 3.5.0) 140 | rspec-core (3.5.4) 141 | rspec-support (~> 3.5.0) 142 | rspec-expectations (3.5.0) 143 | diff-lcs (>= 1.2.0, < 2.0) 144 | rspec-support (~> 3.5.0) 145 | rspec-mocks (3.5.0) 146 | diff-lcs (>= 1.2.0, < 2.0) 147 | rspec-support (~> 3.5.0) 148 | rspec-rails (3.5.2) 149 | actionpack (>= 3.0) 150 | activesupport (>= 3.0) 151 | railties (>= 3.0) 152 | rspec-core (~> 3.5.0) 153 | rspec-expectations (~> 3.5.0) 154 | rspec-mocks (~> 3.5.0) 155 | rspec-support (~> 3.5.0) 156 | rspec-support (3.5.0) 157 | rubocop (0.48.1) 158 | parser (>= 2.3.3.1, < 3.0) 159 | powerpack (~> 0.1) 160 | rainbow (>= 1.99.1, < 3.0) 161 | ruby-progressbar (~> 1.7) 162 | unicode-display_width (~> 1.0, >= 1.0.1) 163 | ruby-progressbar (1.8.1) 164 | sass (3.4.23) 165 | sass-rails (5.0.6) 166 | railties (>= 4.0.0, < 6) 167 | sass (~> 3.1) 168 | sprockets (>= 2.8, < 4.0) 169 | sprockets-rails (>= 2.0, < 4.0) 170 | tilt (>= 1.1, < 3) 171 | simplecov (0.13.0) 172 | docile (~> 1.1.0) 173 | json (>= 1.8, < 3) 174 | simplecov-html (~> 0.10.0) 175 | simplecov-html (0.10.0) 176 | slop (3.6.0) 177 | sprockets (3.7.1) 178 | concurrent-ruby (~> 1.0) 179 | rack (> 1, < 3) 180 | sprockets-rails (3.2.0) 181 | actionpack (>= 4.0) 182 | activesupport (>= 4.0) 183 | sprockets (>= 3.0.0) 184 | sqlite3 (1.3.13) 185 | thor (0.19.4) 186 | thread_safe (0.3.6) 187 | tilt (2.0.7) 188 | tzinfo (1.2.3) 189 | thread_safe (~> 0.1) 190 | uglifier (3.2.0) 191 | execjs (>= 0.3.0, < 3) 192 | unicode-display_width (1.2.1) 193 | websocket-driver (0.6.5) 194 | websocket-extensions (>= 0.1.0) 195 | websocket-extensions (0.1.2) 196 | 197 | PLATFORMS 198 | ruby 199 | 200 | DEPENDENCIES 201 | appraisal 202 | bundler (~> 1.10) 203 | codeclimate-test-reporter 204 | nokogiri 205 | progressive_render! 206 | pry-byebug 207 | rails (= 5.0.2) 208 | rake (~> 10.0) 209 | rspec 210 | rspec-rails 211 | rubocop (~> 0.48) 212 | sqlite3 213 | 214 | BUNDLED WITH 215 | 1.13.6 216 | -------------------------------------------------------------------------------- /lib/progressive_render.rb: -------------------------------------------------------------------------------- 1 | require 'progressive_render/rack' 2 | 3 | require 'progressive_render/fragment_name_iterator' 4 | 5 | # Root namespace for the gem 6 | module ProgressiveRender 7 | if defined?(::Rails) && Gem::Requirement.new('>= 3.1').satisfied_by?(Gem::Version.new(::Rails.version)) 8 | require 'progressive_render/rails' 9 | else 10 | logger.warn 'progressive_render gem has not been installed due to missing dependencies' 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /lib/progressive_render/fragment_name_iterator.rb: -------------------------------------------------------------------------------- 1 | module ProgressiveRender 2 | # Generates a prefix for a given progressive_render section in a stable manner. 3 | # This way on each load we assign the outer most progressive_render block with 4 | # the same name. Nested progressive_render blocks are not supported, this approach 5 | # may need to be re-evaluated for that use case. 6 | class FragmentNameIterator 7 | def initialize 8 | @current = 0 9 | end 10 | 11 | def next! 12 | @current += 1 13 | 14 | @current.to_s 15 | end 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /lib/progressive_render/rack.rb: -------------------------------------------------------------------------------- 1 | require 'progressive_render/rack/request_handler' 2 | 3 | module ProgressiveRender 4 | # Rack specific functionality 5 | module Rack 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /lib/progressive_render/rack/request_handler.rb: -------------------------------------------------------------------------------- 1 | require 'uri' 2 | require 'rack/utils' 3 | 4 | module ProgressiveRender 5 | module Rack 6 | # Wraps a given rack request to determine what sort of request we're dealing with 7 | # and what specific fragment the request is for when it's a progressive request. 8 | class RequestHandler 9 | FRAGMENT_KEY = 'load_partial'.freeze 10 | 11 | def initialize(request) 12 | @request = request 13 | end 14 | 15 | def main_load? 16 | fragment_name.nil? || fragment_name == '' 17 | end 18 | 19 | def fragment_name 20 | @request.GET[FRAGMENT_KEY] 21 | end 22 | 23 | def should_render_fragment?(user_fragment_name) 24 | !main_load? && fragment_name == user_fragment_name 25 | end 26 | 27 | def load_path(fragment_name) 28 | return nil unless main_load? 29 | 30 | # Ensure we get a fresh copy of the request and aren't modifying it 31 | query = @request.GET.clone 32 | query[FRAGMENT_KEY] = fragment_name 33 | 34 | URI::HTTP.build(path: @request.path, query: ::Rack::Utils.build_nested_query(query)).request_uri 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/progressive_render/rails.rb: -------------------------------------------------------------------------------- 1 | require 'progressive_render/rails/path_resolver' 2 | require 'progressive_render/rails/view_renderer' 3 | require 'progressive_render/rails/engine' 4 | 5 | require 'progressive_render/rails/helpers' 6 | require 'progressive_render/rails/view' 7 | require 'progressive_render/rails/controller' 8 | 9 | module ProgressiveRender 10 | # Rails specific functionality 11 | module Rails 12 | end 13 | end 14 | -------------------------------------------------------------------------------- /lib/progressive_render/rails/controller.rb: -------------------------------------------------------------------------------- 1 | require 'progressive_render/rails/helpers' 2 | 3 | module ProgressiveRender 4 | module Rails 5 | # Rails controller methods, this module is installed into ActionController 6 | # These methods should not generally be called by user code besides 'render' 7 | module Controller 8 | include Helpers 9 | 10 | def progressive_render(template = nil) 11 | logger.warn %(DEPRECATED: calling 'progressive_render' directly in the controller 12 | is deprecated and will be removed in future versions. 13 | It is no longer necessary to explicitly call the render method.) 14 | render template 15 | end 16 | 17 | def render(options = nil, extra_options = {}, &block) 18 | # Fall back to the ActionView renderer if we're on the main page load 19 | # OR we are being called from inside our own code (in_progressive_render?) 20 | if progressive_request.main_load? || in_progressive_render? 21 | super 22 | else 23 | in_progressive_render do 24 | # To preserve legacy behavior pass options through to resolve_path if it's a string 25 | # ActiveRecord more properly handles the path so use that when possible. 26 | template = options if options.is_a? String 27 | progressive_renderer.render_fragment resolve_path(template), progressive_request.fragment_name 28 | end 29 | end 30 | end 31 | 32 | private 33 | 34 | def resolve_path(template) 35 | tc = Rails::PathResolver::TemplateContext.new 36 | tc.type = :controller 37 | tc.controller = request.params['controller'] 38 | tc.action = request.params['action'] 39 | 40 | pr = Rails::PathResolver.new(tc) 41 | 42 | pr.path_for(template) 43 | end 44 | 45 | def in_progressive_render? 46 | @in_progressive_render 47 | end 48 | 49 | # To prevent the render call from reentrancy we need to remember if we're in our own render path. 50 | # Our rendering code calls 'render' to access the real view renderer so we need a way to fall back to it. 51 | def in_progressive_render 52 | @in_progressive_render = true 53 | yield 54 | @in_progressive_render = false 55 | end 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /lib/progressive_render/rails/engine.rb: -------------------------------------------------------------------------------- 1 | module ProgressiveRender 2 | module Rails 3 | # Rails uses this class to install progressive_render into an application 4 | # It is responsible for any setup needed for the gem to function 5 | class Engine < ::Rails::Engine 6 | initializer 'progressive_render.assets.precompile' do |app| 7 | app.config.assets.precompile += %w[progressive_render.gif 8 | progressive_render.js.coffee 9 | progressive_render.css.scss] 10 | end 11 | 12 | initializer 'progressive_render.install' do 13 | ActionController::Base.class_eval do 14 | prepend ProgressiveRender::Rails::Controller 15 | end 16 | 17 | ActionView::Base.class_eval do 18 | prepend ProgressiveRender::Rails::View 19 | end 20 | end 21 | end 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/progressive_render/rails/helpers.rb: -------------------------------------------------------------------------------- 1 | module ProgressiveRender 2 | module Rails 3 | # Shortcuts to object creation used in the view and controller 4 | module Helpers 5 | def progressive_request 6 | @rh ||= Rack::RequestHandler.new(request) 7 | end 8 | 9 | def progressive_renderer 10 | Rails::ViewRenderer.new(self) 11 | end 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /lib/progressive_render/rails/path_resolver.rb: -------------------------------------------------------------------------------- 1 | module ProgressiveRender 2 | module Rails 3 | # Resolve set of request parameters to a full path to a template file 4 | class PathResolver 5 | # Holds the request parameters. 6 | # Used to decouple the ProgressiveRequest from the renderer. 7 | class TemplateContext 8 | attr_accessor :controller, :action, :type 9 | 10 | def valid? 11 | valid_type? && valid_controller? && valid_action? 12 | end 13 | 14 | private 15 | 16 | def valid_type? 17 | type == :view || type == :controller 18 | end 19 | 20 | def valid_controller? 21 | !controller.nil? && !controller.empty? 22 | end 23 | 24 | def valid_action? 25 | !action.nil? && !action.empty? 26 | end 27 | end 28 | 29 | class InvalidTemplateContextException < RuntimeError 30 | end 31 | 32 | class InvalidPathException < RuntimeError 33 | end 34 | 35 | def initialize(template_context) 36 | @context = template_context 37 | end 38 | 39 | def path_for(view_name = nil) 40 | raise InvalidTemplateContextException unless @context && @context.valid? 41 | raise InvalidPathException if (view_name.nil? || view_name.empty?) && view_action? 42 | 43 | "#{@context.controller.downcase}/#{path_suffix_for(view_name)}" 44 | end 45 | 46 | private 47 | 48 | def path_suffix_for(view_name) 49 | if view_name.nil? || view_name.empty? 50 | @context.action.to_s 51 | else 52 | view_name.to_s 53 | end 54 | end 55 | 56 | def view_action? 57 | @context.type == :view 58 | end 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /lib/progressive_render/rails/view.rb: -------------------------------------------------------------------------------- 1 | require 'progressive_render/rails/helpers' 2 | 3 | module ProgressiveRender 4 | module Rails 5 | # Provides methods for application view 6 | module View 7 | include Helpers 8 | 9 | # Mark a section of content to be loaded after initial view of the page. 10 | # 11 | # == Usage 12 | # <%= progressive_render do %> 13 | #

Content!

14 | # <% end %> 15 | # 16 | # == Specify a custom placeholder 17 | # The progressive_render method puts a simple spinner on the page by default but 18 | # that can be customized per section by passing a path to a partial via `placeholder` 19 | # 20 | # <%= progressive_render placeholder: 'shared/custom_placehodler' do %> 21 | #

More Content!

22 | # <% end %> 23 | def progressive_render(deprecated_fragment_name = nil, 24 | placeholder: 'progressive_render/placeholder') 25 | if deprecated_fragment_name 26 | logger.warn %(DEPRECATED (progressive_render): Literal fragment names are deprecated and will be removed 27 | in v1.0. The fragment name (#{deprecated_fragment_name}) will be ignored.") 28 | end 29 | 30 | progressive_render_impl(placeholder: placeholder) do 31 | yield 32 | end 33 | end 34 | 35 | private 36 | 37 | def progressive_render_impl(placeholder: 'progressive_render/placeholder') 38 | fragment_name = fragment_name_iterator.next! 39 | 40 | progressive_render_content(fragment_name, progressive_request.main_load?) do 41 | if progressive_request.main_load? 42 | progressive_renderer.render_partial placeholder 43 | elsif progressive_request.should_render_fragment?(fragment_name) 44 | yield 45 | end 46 | end 47 | end 48 | 49 | def progressive_render_content(fragment_name, placeholder = true) 50 | data = { progressive_render_placeholder: placeholder, 51 | progressive_render_path: progressive_request.load_path(fragment_name) }.reject { |_k, v| v.nil? } 52 | 53 | content_tag(:div, id: "#{fragment_name}_progressive_render", 54 | data: data) do 55 | yield 56 | end 57 | end 58 | 59 | def fragment_name_iterator 60 | @fni ||= FragmentNameIterator.new 61 | end 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /lib/progressive_render/rails/view_renderer.rb: -------------------------------------------------------------------------------- 1 | require 'nokogiri' 2 | 3 | module ProgressiveRender 4 | module Rails 5 | # Responsible for rendering a full page and extracting fragments for a progressive render. 6 | class ViewRenderer 7 | attr_accessor :context 8 | def initialize(view_context) 9 | self.context = view_context 10 | end 11 | 12 | def render_partial(path) 13 | context.render partial: path 14 | end 15 | 16 | def render_view(path) 17 | context.render path 18 | end 19 | 20 | def render_fragment(path, fragment_name) 21 | content = context.render_to_string template: path, layout: false 22 | stripped = Nokogiri::HTML(content).at_css("div##{fragment_name}_progressive_render") 23 | context.render plain: stripped.to_html 24 | end 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /lib/progressive_render/version.rb: -------------------------------------------------------------------------------- 1 | module ProgressiveRender 2 | VERSION = '0.7.0'.freeze 3 | end 4 | -------------------------------------------------------------------------------- /progressive_load.gemspec: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | lib = File.expand_path('../lib', __FILE__) 4 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 5 | require 'progressive_render/version' 6 | 7 | Gem::Specification.new do |spec| 8 | spec.name = 'progressive_render' 9 | spec.version = ProgressiveRender::VERSION 10 | spec.authors = ['Jeff Johnson'] 11 | spec.email = ['johnsonjeff@gmail.com'] 12 | 13 | spec.summary = 'Progressively load static or dynamic content on page load' 14 | spec.description = %(For large or expensive pages, use this gem to load less critical portions of the page. 15 | Especially useful for large queries or content that's hidden from the user on load. 16 | The best solution may be to optimize your content, but there's not always time for that.) 17 | spec.homepage = 'https://github.com/johnsonj/progressive_render' 18 | spec.license = 'MIT' 19 | 20 | spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } 21 | spec.bindir = 'exe' 22 | spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } 23 | spec.require_paths = ['lib'] 24 | 25 | spec.add_development_dependency 'bundler', '~> 1.10' 26 | spec.add_development_dependency 'rake', '~> 10.0' 27 | spec.add_development_dependency 'rspec' 28 | spec.add_development_dependency 'codeclimate-test-reporter' 29 | spec.add_development_dependency 'rspec-rails' 30 | spec.add_development_dependency 'sqlite3' 31 | spec.add_development_dependency 'pry-byebug' 32 | spec.add_development_dependency 'rubocop', '~> 0.48' 33 | 34 | spec.add_dependency 'sass' 35 | spec.add_dependency 'sass-rails' 36 | spec.add_dependency 'uglifier' 37 | spec.add_dependency 'coffee-rails' 38 | spec.add_dependency 'railties' 39 | spec.add_dependency 'jquery-rails' 40 | spec.add_dependency 'rails', '>= 4.1' 41 | spec.add_dependency 'nokogiri' 42 | end 43 | -------------------------------------------------------------------------------- /spec/.rubocop.yml: -------------------------------------------------------------------------------- 1 | inherit_from: '../.rubocop.yml' 2 | 3 | # RSpec tests can be very long, and that's ok 4 | Metrics/BlockLength: 5 | Max: 10000 6 | 7 | # For methods that perform tests 8 | Metrics/MethodLength: 9 | Max: 50 10 | Metrics/AbcSize: 11 | Max: 50 12 | -------------------------------------------------------------------------------- /spec/controller_request_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | def load_test_endpoint(endpoint, name: "Testing #{endpoint}", sections: [], assert_preloaded: nil, assert_loaded: nil) 4 | describe name do 5 | it 'renders the placeholder and can resolve the real partial' do 6 | get endpoint 7 | expect(response.body).to include('progressive-render-placeholder') 8 | 9 | main_request_doc = Nokogiri::HTML(response.body) 10 | sections.each_with_index do |s, i| 11 | section_placeholder_selector = "##{s}_progressive_render" 12 | section_content_selector = assert_loaded[i] if assert_loaded 13 | section_preloaded_selector = assert_preloaded[i] if assert_preloaded 14 | 15 | # Extract the new request URL 16 | path = main_request_doc.css(section_placeholder_selector)[0]['data-progressive-render-path'] 17 | # It hasn't loaded the content 18 | expect(main_request_doc.css(section_content_selector)).to be_empty 19 | # The preloaded content is in the main response 20 | expect(main_request_doc.css(section_preloaded_selector)).to_not be_empty if section_preloaded_selector 21 | 22 | get path 23 | partial_request_doc = Nokogiri::HTML(response.body) 24 | # Find the result 25 | replacement = partial_request_doc.css(section_content_selector)[0] 26 | expect(replacement).to_not be nil 27 | 28 | # The placeholder is not in the partial request 29 | placeholder_content = partial_request_doc.css(section_placeholder_selector)[0] 30 | expect(placeholder_content['data-progressive-render-placeholder']).to eql('false') 31 | expect(placeholder_content['data-progressive-render-path']).to be_nil 32 | # The preloaded content is not in the partial request 33 | expect(partial_request_doc.css(section_preloaded_selector)).to be_empty if section_preloaded_selector 34 | end 35 | end 36 | end 37 | end 38 | 39 | # rubocop:disable Metrics/LineLength 40 | RSpec.describe LoadTestController, type: :request do 41 | # Basic examples 42 | load_test_endpoint '/load_test/block', name: 'With a single block', sections: [1], assert_loaded: ['#world'] 43 | load_test_endpoint '/load_test/multiple_blocks', name: 'With multiple blocks', sections: [1, 2, 3], assert_loaded: ['#first', '#second', '#third'] 44 | load_test_endpoint '/load_test/custom_placeholder', name: 'With a custom placeholder', sections: [1], assert_preloaded: ['#custom_placeholder'], assert_loaded: ['#first'] 45 | load_test_endpoint '/load_test/render_params', name: 'With custom render params', sections: [1], assert_preloaded: ['#custom_layout'], assert_loaded: ['#world'] 46 | 47 | # Deprecated usage 48 | load_test_endpoint '/load_test/deprecated_explicit_call', name: 'Deprecated: Explicit call in controller', sections: [1], assert_loaded: ['#world'] 49 | load_test_endpoint '/load_test/deprecated_explicit_call_with_template', name: 'Deprecated: Explicit call in controller with template path', sections: [1], assert_loaded: ['#world'] 50 | 51 | # Specific bugs 52 | load_test_endpoint '/load_test/atom_repro', name: 'With an atom format', sections: [1], assert_preloaded: ['#outside'], assert_loaded: ['#inside'] 53 | end 54 | # rubocop:enable Metrics/LineLength 55 | -------------------------------------------------------------------------------- /spec/dummy/.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 the default SQLite database. 11 | /db/*.sqlite3 12 | /db/*.sqlite3-journal 13 | 14 | # Ignore all logfiles and tempfiles. 15 | /log/* 16 | !/log/.keep 17 | /tmp 18 | -------------------------------------------------------------------------------- /spec/dummy/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'coffee-rails' 4 | gem 'progressive_render', path: '../../' 5 | gem 'pry-byebug' 6 | gem 'rails', '4.2.2' 7 | gem 'sass' 8 | gem 'sass-rails' 9 | gem 'sqlite3' 10 | gem 'uglifier' 11 | -------------------------------------------------------------------------------- /spec/dummy/Gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../../ 3 | specs: 4 | progressive_render (0.7.0) 5 | coffee-rails 6 | jquery-rails 7 | nokogiri 8 | rails (>= 4.1) 9 | railties 10 | sass 11 | sass-rails 12 | uglifier 13 | 14 | GEM 15 | remote: https://rubygems.org/ 16 | specs: 17 | actionmailer (4.2.2) 18 | actionpack (= 4.2.2) 19 | actionview (= 4.2.2) 20 | activejob (= 4.2.2) 21 | mail (~> 2.5, >= 2.5.4) 22 | rails-dom-testing (~> 1.0, >= 1.0.5) 23 | actionpack (4.2.2) 24 | actionview (= 4.2.2) 25 | activesupport (= 4.2.2) 26 | rack (~> 1.6) 27 | rack-test (~> 0.6.2) 28 | rails-dom-testing (~> 1.0, >= 1.0.5) 29 | rails-html-sanitizer (~> 1.0, >= 1.0.1) 30 | actionview (4.2.2) 31 | activesupport (= 4.2.2) 32 | builder (~> 3.1) 33 | erubis (~> 2.7.0) 34 | rails-dom-testing (~> 1.0, >= 1.0.5) 35 | rails-html-sanitizer (~> 1.0, >= 1.0.1) 36 | activejob (4.2.2) 37 | activesupport (= 4.2.2) 38 | globalid (>= 0.3.0) 39 | activemodel (4.2.2) 40 | activesupport (= 4.2.2) 41 | builder (~> 3.1) 42 | activerecord (4.2.2) 43 | activemodel (= 4.2.2) 44 | activesupport (= 4.2.2) 45 | arel (~> 6.0) 46 | activesupport (4.2.2) 47 | i18n (~> 0.7) 48 | json (~> 1.7, >= 1.7.7) 49 | minitest (~> 5.1) 50 | thread_safe (~> 0.3, >= 0.3.4) 51 | tzinfo (~> 1.1) 52 | arel (6.0.0) 53 | builder (3.2.2) 54 | byebug (5.0.0) 55 | columnize (= 0.9.0) 56 | coderay (1.1.0) 57 | coffee-rails (4.1.0) 58 | coffee-script (>= 2.2.0) 59 | railties (>= 4.0.0, < 5.0) 60 | coffee-script (2.4.1) 61 | coffee-script-source 62 | execjs 63 | coffee-script-source (1.9.1.1) 64 | columnize (0.9.0) 65 | erubis (2.7.0) 66 | execjs (2.5.2) 67 | globalid (0.3.5) 68 | activesupport (>= 4.1.0) 69 | i18n (0.7.0) 70 | jquery-rails (4.3.1) 71 | rails-dom-testing (>= 1, < 3) 72 | railties (>= 4.2.0) 73 | thor (>= 0.14, < 2.0) 74 | json (1.8.3) 75 | loofah (2.0.2) 76 | nokogiri (>= 1.5.9) 77 | mail (2.6.3) 78 | mime-types (>= 1.16, < 3) 79 | method_source (0.8.2) 80 | mime-types (2.6.1) 81 | mini_portile (0.6.2) 82 | minitest (5.7.0) 83 | nokogiri (1.6.6.2) 84 | mini_portile (~> 0.6.0) 85 | pry (0.10.1) 86 | coderay (~> 1.1.0) 87 | method_source (~> 0.8.1) 88 | slop (~> 3.4) 89 | pry-byebug (3.2.0) 90 | byebug (~> 5.0) 91 | pry (~> 0.10) 92 | rack (1.6.4) 93 | rack-test (0.6.3) 94 | rack (>= 1.0) 95 | rails (4.2.2) 96 | actionmailer (= 4.2.2) 97 | actionpack (= 4.2.2) 98 | actionview (= 4.2.2) 99 | activejob (= 4.2.2) 100 | activemodel (= 4.2.2) 101 | activerecord (= 4.2.2) 102 | activesupport (= 4.2.2) 103 | bundler (>= 1.3.0, < 2.0) 104 | railties (= 4.2.2) 105 | sprockets-rails 106 | rails-deprecated_sanitizer (1.0.3) 107 | activesupport (>= 4.2.0.alpha) 108 | rails-dom-testing (1.0.6) 109 | activesupport (>= 4.2.0.beta, < 5.0) 110 | nokogiri (~> 1.6.0) 111 | rails-deprecated_sanitizer (>= 1.0.1) 112 | rails-html-sanitizer (1.0.2) 113 | loofah (~> 2.0) 114 | railties (4.2.2) 115 | actionpack (= 4.2.2) 116 | activesupport (= 4.2.2) 117 | rake (>= 0.8.7) 118 | thor (>= 0.18.1, < 2.0) 119 | rake (10.4.2) 120 | sass (3.4.16) 121 | sass-rails (5.0.3) 122 | railties (>= 4.0.0, < 5.0) 123 | sass (~> 3.1) 124 | sprockets (>= 2.8, < 4.0) 125 | sprockets-rails (>= 2.0, < 4.0) 126 | tilt (~> 1.1) 127 | slop (3.6.0) 128 | sprockets (3.2.0) 129 | rack (~> 1.0) 130 | sprockets-rails (2.3.2) 131 | actionpack (>= 3.0) 132 | activesupport (>= 3.0) 133 | sprockets (>= 2.8, < 4.0) 134 | sqlite3 (1.3.10) 135 | thor (0.19.1) 136 | thread_safe (0.3.5) 137 | tilt (1.4.1) 138 | tzinfo (1.2.2) 139 | thread_safe (~> 0.1) 140 | uglifier (2.7.1) 141 | execjs (>= 0.3.0) 142 | json (>= 1.8.0) 143 | 144 | PLATFORMS 145 | ruby 146 | 147 | DEPENDENCIES 148 | coffee-rails 149 | progressive_render! 150 | pry-byebug 151 | rails (= 4.2.2) 152 | sass 153 | sass-rails 154 | sqlite3 155 | uglifier 156 | 157 | BUNDLED WITH 158 | 1.13.6 159 | -------------------------------------------------------------------------------- /spec/dummy/README.rdoc: -------------------------------------------------------------------------------- 1 | == README 2 | 3 | This README would normally document whatever steps are necessary to get the 4 | application up and running. 5 | 6 | Things you may want to cover: 7 | 8 | * Ruby version 9 | 10 | * System dependencies 11 | 12 | * Configuration 13 | 14 | * Database creation 15 | 16 | * Database initialization 17 | 18 | * How to run the test suite 19 | 20 | * Services (job queues, cache servers, search engines, etc.) 21 | 22 | * Deployment instructions 23 | 24 | * ... 25 | 26 | 27 | Please feel free to use a different markup language if you do not plan to run 28 | rake doc:app. 29 | -------------------------------------------------------------------------------- /spec/dummy/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 File.expand_path('../config/application', __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/images/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/app/assets/images/.keep -------------------------------------------------------------------------------- /spec/dummy/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. 9 | // 10 | // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details 11 | // about supported directives. 12 | // 13 | //= require jquery 14 | //= require progressive_render 15 | //= require_tree . -------------------------------------------------------------------------------- /spec/dummy/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 styles 10 | * defined in the other CSS/SCSS files in this directory. It is generally better to create a new 11 | * file per style scope. 12 | * 13 | *= require_tree . 14 | *= require progressive_render 15 | *= require_self 16 | */ 17 | -------------------------------------------------------------------------------- /spec/dummy/app/assets/stylesheets/load_test.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the LoadTest controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/app/controllers/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/app/controllers/concerns/.keep -------------------------------------------------------------------------------- /spec/dummy/app/controllers/load_test_controller.rb: -------------------------------------------------------------------------------- 1 | class LoadTestController < ApplicationController 2 | def example; end 3 | 4 | def index; end 5 | 6 | def block; end 7 | 8 | def multiple_blocks; end 9 | 10 | def custom_placeholder; end 11 | 12 | def render_params 13 | render layout: 'custom_layout' 14 | end 15 | 16 | def deprecated_explicit_call 17 | progressive_render 18 | end 19 | 20 | def deprecated_explicit_call_with_template 21 | progressive_render 'block' 22 | end 23 | 24 | def atom_repro 25 | respond_to do |format| 26 | # https://github.com/johnsonj/progressive_render/issues/19#issuecomment-236450508 27 | # Without this format.js call, rails tries to render the 'atom' format on the progressive_load 28 | format.js {} 29 | format.atom { raise 'atom' } 30 | format.html { render layout: 'custom_layout' } 31 | format.rss { raise 'RSS' } 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /spec/dummy/app/helpers/application_helper.rb: -------------------------------------------------------------------------------- 1 | module ApplicationHelper 2 | end 3 | -------------------------------------------------------------------------------- /spec/dummy/app/helpers/load_test_helper.rb: -------------------------------------------------------------------------------- 1 | module LoadTestHelper 2 | end 3 | -------------------------------------------------------------------------------- /spec/dummy/app/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/app/mailers/.keep -------------------------------------------------------------------------------- /spec/dummy/app/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/app/models/.keep -------------------------------------------------------------------------------- /spec/dummy/app/models/concerns/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/app/models/concerns/.keep -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/application.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Progressive Render Example 5 | <%= stylesheet_link_tag 'application' %> 6 | <%= javascript_include_tag 'application' %> 7 | <%= csrf_meta_tags %> 8 | 9 | 10 | 11 | <%= yield %> 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /spec/dummy/app/views/layouts/custom_layout.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Progressive Render Custom Layout 5 | <%= stylesheet_link_tag 'application' %> 6 | <%= javascript_include_tag 'application' %> 7 | <%= csrf_meta_tags %> 8 | 13 | 14 | 15 |

Custom Layout

16 | 17 | <%= yield %> 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/_placeholder.html.erb: -------------------------------------------------------------------------------- 1 |
2 | Loading... 3 |
-------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/_slow_load.html.erb: -------------------------------------------------------------------------------- 1 | <% 2 | # Don't perform the actual sleep if we're running as part of automated tests 3 | # This sleep is for demonstration purposes of a slpw section of code. 4 | %> 5 | <% sleep 1 unless Rails.env.test? %> 6 |

World!

-------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/atom_repro.html.erb: -------------------------------------------------------------------------------- 1 |
2 |

Outside

3 | <%= progressive_render do %> 4 |

Inside

5 | <% end %> 6 |
-------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/block.html.erb: -------------------------------------------------------------------------------- 1 |

Main Page

2 | 3 | <%=progressive_render do %> 4 | <%=render partial: 'slow_load' %> 5 | <% end %> -------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/custom_placeholder.html.erb: -------------------------------------------------------------------------------- 1 |

Main Page

2 | 3 | <%=progressive_render placeholder: 'load_test/placeholder' do %> 4 |
5 | Content has arrived 6 |
7 | <% sleep 1 unless Rails.env.test? %> 8 | <% end %> 9 | -------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/deprecated_explicit_call.html.erb: -------------------------------------------------------------------------------- 1 |

Deprecated: Explicit Controller Call

2 | 3 | <%=progressive_render do %> 4 | <%=render partial: 'slow_load' %> 5 | <% end %> -------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/example.html.erb: -------------------------------------------------------------------------------- 1 |

Hello World

2 | 3 | Welcome to my website, we have a lot to load.
4 |
5 |
6 | <%=progressive_render do %> 7 | <% sleep 2 %> 8 | No more waiting! 9 | <% end %> -------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/index.html.erb: -------------------------------------------------------------------------------- 1 |

Welcome!

2 | 3 | This is the ProgressiveRender sample application. Use for integration testing as a reference for clients.
4 |
5 |

Examples

6 | -------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/multiple_blocks.html.erb: -------------------------------------------------------------------------------- 1 |

Main Page

2 | 3 | <%=progressive_render do %> 4 |
5 | First 6 |
7 | <% sleep 1 unless Rails.env.test? %> 8 | <% end %> 9 | 10 | <%=progressive_render do %> 11 |
12 | Second 13 |
14 | <% sleep 2 unless Rails.env.test? %> 15 | <% end %> 16 | 17 | <%=progressive_render do %> 18 |
19 | Third 20 |
21 | <% sleep 3 unless Rails.env.test? %> 22 | <% end %> 23 | -------------------------------------------------------------------------------- /spec/dummy/app/views/load_test/render_params.html.erb: -------------------------------------------------------------------------------- 1 |

Render Params

2 | 3 | <%=progressive_render do %> 4 | <%=render partial: 'slow_load' %> 5 | <% end %> -------------------------------------------------------------------------------- /spec/dummy/bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /spec/dummy/bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError 5 | end 6 | APP_PATH = File.expand_path('../../config/application', __FILE__) 7 | require_relative '../config/boot' 8 | require 'rails/commands' 9 | -------------------------------------------------------------------------------- /spec/dummy/bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | begin 3 | load File.expand_path('../spring', __FILE__) 4 | rescue LoadError 5 | end 6 | require_relative '../config/boot' 7 | require 'rake' 8 | Rake.application.run 9 | -------------------------------------------------------------------------------- /spec/dummy/bin/setup: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require 'pathname' 3 | 4 | # path to your application root. 5 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) 6 | 7 | Dir.chdir APP_ROOT do 8 | # This script is a starting point to setup your application. 9 | # Add necessary setup steps to this file: 10 | 11 | puts '== Installing dependencies ==' 12 | system 'gem install bundler --conservative' 13 | system 'bundle check || bundle install' 14 | 15 | # puts "\n== Copying sample files ==" 16 | # unless File.exist?("config/database.yml") 17 | # system "cp config/database.yml.sample config/database.yml" 18 | # end 19 | 20 | puts "\n== Preparing database ==" 21 | system 'bin/rake db:setup' 22 | 23 | puts "\n== Removing old logs and tempfiles ==" 24 | system 'rm -f log/*' 25 | system 'rm -rf tmp/cache' 26 | 27 | puts "\n== Restarting application server ==" 28 | system 'touch tmp/restart.txt' 29 | end 30 | -------------------------------------------------------------------------------- /spec/dummy/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 | match = Bundler.default_lockfile.read.match(/^GEM$.*?^ (?: )*spring \((.*?)\)$.*?^$/m) 11 | if match 12 | Gem.paths = { 'GEM_PATH' => [Bundler.bundle_path.to_s, *Gem.path].uniq } 13 | gem 'spring', match[1] 14 | require 'spring/binstub' 15 | end 16 | end 17 | -------------------------------------------------------------------------------- /spec/dummy/config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path('../config/environment', __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /spec/dummy/config/application.rb: -------------------------------------------------------------------------------- 1 | require File.expand_path('../boot', __FILE__) 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 Dummy 10 | class Application < Rails::Application 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/dummy/config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 2 | 3 | require 'bundler/setup' # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /spec/dummy/config/database.yml: -------------------------------------------------------------------------------- 1 | # SQLite version 3.x 2 | # gem install sqlite3 3 | # 4 | # Ensure the SQLite 3 gem is defined in your Gemfile 5 | # gem 'sqlite3' 6 | # 7 | default: &default 8 | adapter: sqlite3 9 | pool: 5 10 | timeout: 5000 11 | 12 | development: 13 | <<: *default 14 | database: db/development.sqlite3 15 | 16 | # Warning: The database defined as "test" will be erased and 17 | # re-generated from your development database when you run "rake". 18 | # Do not set this db to the same as development or production. 19 | test: 20 | <<: *default 21 | database: db/test.sqlite3 22 | 23 | production: 24 | <<: *default 25 | database: db/production.sqlite3 26 | -------------------------------------------------------------------------------- /spec/dummy/config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path('../application', __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 6 | -------------------------------------------------------------------------------- /spec/dummy/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 and disable caching. 13 | config.consider_all_requests_local = true 14 | config.action_controller.perform_caching = false 15 | 16 | # Don't care if the mailer can't send. 17 | config.action_mailer.raise_delivery_errors = false 18 | 19 | # Print deprecation notices to the Rails logger. 20 | config.active_support.deprecation = :log 21 | 22 | # Raise an error on page load if there are pending migrations. 23 | config.active_record.migration_error = :page_load 24 | 25 | # Debug mode disables concatenation and preprocessing of assets. 26 | # This option may cause significant delays in view rendering with a large 27 | # number of complex assets. 28 | config.assets.debug = true 29 | 30 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 31 | # yet still be able to expire them through the digest params. 32 | config.assets.digest = true 33 | 34 | # Adds additional error checking when serving assets at runtime. 35 | # Checks for improperly declared sprockets dependencies. 36 | # Raises helpful error messages. 37 | config.assets.raise_runtime_errors = true 38 | 39 | # Raises error for missing translations 40 | # config.action_view.raise_on_missing_translations = true 41 | end 42 | -------------------------------------------------------------------------------- /spec/dummy/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 | # Enable Rack::Cache to put a simple HTTP cache in front of your application 18 | # Add `rack-cache` to your Gemfile before enabling this. 19 | # For large-scale production use, consider using a caching reverse proxy like 20 | # NGINX, varnish or squid. 21 | # config.action_dispatch.rack_cache = true 22 | 23 | # Disable serving static files from the `/public` folder by default since 24 | # Apache or NGINX already handles this. 25 | config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 26 | 27 | # Compress JavaScripts and CSS. 28 | config.assets.js_compressor = :uglifier 29 | # config.assets.css_compressor = :sass 30 | 31 | # Do not fallback to assets pipeline if a precompiled asset is missed. 32 | config.assets.compile = false 33 | 34 | # Asset digests allow you to set far-future HTTP expiration dates on all assets, 35 | # yet still be able to expire them through the digest params. 36 | config.assets.digest = true 37 | 38 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 39 | 40 | # Specifies the header that your server uses for sending files. 41 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 42 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 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 = [ :subdomain, :uuid ] 53 | 54 | # Use a different logger for distributed setups. 55 | # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 56 | 57 | # Use a different cache store in production. 58 | # config.cache_store = :mem_cache_store 59 | 60 | # Enable serving of images, stylesheets, and JavaScripts from an asset server. 61 | # config.action_controller.asset_host = 'http://assets.example.com' 62 | 63 | # Ignore bad email addresses and do not raise email delivery errors. 64 | # Set this to true and configure the email server for immediate delivery to raise delivery errors. 65 | # config.action_mailer.raise_delivery_errors = false 66 | 67 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 68 | # the I18n.default_locale when a translation cannot be found). 69 | config.i18n.fallbacks = true 70 | 71 | # Send deprecation notices to registered listeners. 72 | config.active_support.deprecation = :notify 73 | 74 | # Use default logging formatter so that PID and timestamp are not suppressed. 75 | config.log_formatter = ::Logger::Formatter.new 76 | 77 | # Do not dump schema after migrations. 78 | config.active_record.dump_schema_after_migration = false 79 | end 80 | -------------------------------------------------------------------------------- /spec/dummy/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 | # Show full error reports and disable caching. 16 | config.consider_all_requests_local = true 17 | config.action_controller.perform_caching = false 18 | 19 | # Raise exceptions instead of rendering exception templates. 20 | config.action_dispatch.show_exceptions = false 21 | 22 | # Disable request forgery protection in test environment. 23 | config.action_controller.allow_forgery_protection = false 24 | 25 | # Tell Action Mailer not to deliver emails to the real world. 26 | # The :test delivery method accumulates sent emails in the 27 | # ActionMailer::Base.deliveries array. 28 | config.action_mailer.delivery_method = :test 29 | 30 | # Randomize the order test cases are executed. 31 | config.active_support.test_order = :random 32 | 33 | # Print deprecation notices to the stderr. 34 | config.active_support.deprecation = :stderr 35 | 36 | # Raises error for missing translations 37 | # config.action_view.raise_on_missing_translations = true 38 | end 39 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/config/initializers/cookies_serializer.rb: -------------------------------------------------------------------------------- 1 | # Be sure to restart your server when you modify this file. 2 | 3 | Rails.application.config.action_dispatch.cookies_serializer = :json 4 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/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: '_test_pl_session' 4 | -------------------------------------------------------------------------------- /spec/dummy/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] if respond_to?(:wrap_parameters) 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 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | root 'load_test#index' 3 | 4 | scope '/load_test' do 5 | %w[block multiple_blocks custom_placeholder example render_params 6 | deprecated_explicit_call deprecated_explicit_call_with_template 7 | atom_repro].each do |endpoint| 8 | get endpoint => "load_test##{endpoint}", as: "load_test_#{endpoint}" 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /spec/dummy/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 `rake 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: e5904feba2c020627b89e961b4d98c5c81c856ce2199603761fc26a7151df07979fe426d13f45568f80c4ce08f932623e8343654c09b41b039419c86c32966d4 15 | 16 | test: 17 | secret_key_base: 7f4ac7688e5c1de3f9d0704ba8012880d228a43eae3917d7310878e819f5bd3d1e3180fa48088d81270fbcc59e5e0d306f59710ea6ea3de17c02d7c87bce1bea 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 | -------------------------------------------------------------------------------- /spec/dummy/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 rake db:seed (or created alongside the db with db:setup). 3 | # 4 | # Examples: 5 | # 6 | # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }]) 7 | # Mayor.create(name: 'Emanuel', city: cities.first) 8 | -------------------------------------------------------------------------------- /spec/dummy/lib/assets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/lib/assets/.keep -------------------------------------------------------------------------------- /spec/dummy/lib/tasks/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/lib/tasks/.keep -------------------------------------------------------------------------------- /spec/dummy/log/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/log/.keep -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/public/favicon.ico -------------------------------------------------------------------------------- /spec/dummy/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 | -------------------------------------------------------------------------------- /spec/dummy/test/controllers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/test/controllers/.keep -------------------------------------------------------------------------------- /spec/dummy/test/controllers/load_test_controller_test.rb: -------------------------------------------------------------------------------- 1 | require 'test_helper' 2 | 3 | class LoadTestControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /spec/dummy/test/fixtures/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/test/fixtures/.keep -------------------------------------------------------------------------------- /spec/dummy/test/helpers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/test/helpers/.keep -------------------------------------------------------------------------------- /spec/dummy/test/integration/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/test/integration/.keep -------------------------------------------------------------------------------- /spec/dummy/test/mailers/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/test/mailers/.keep -------------------------------------------------------------------------------- /spec/dummy/test/models/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/test/models/.keep -------------------------------------------------------------------------------- /spec/dummy/test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV['RAILS_ENV'] ||= 'test' 2 | require File.expand_path('../../config/environment', __FILE__) 3 | require 'rails/test_help' 4 | 5 | module ActiveSupport 6 | class TestCase 7 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 8 | fixtures :all 9 | 10 | # Add more helper methods to be used by all tests here... 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /spec/dummy/vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/vendor/assets/javascripts/.keep -------------------------------------------------------------------------------- /spec/dummy/vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/spec/dummy/vendor/assets/stylesheets/.keep -------------------------------------------------------------------------------- /spec/lib/fragment_name_iterator_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | require 'progressive_render/fragment_name_iterator' 3 | 4 | describe ProgressiveRender::FragmentNameIterator do 5 | let(:iter) { ProgressiveRender::FragmentNameIterator.new } 6 | 7 | it 'produces new values' do 8 | expect(iter.next!).to_not be iter.next! 9 | end 10 | 11 | describe 'with multiple iterators' do 12 | let(:iter1) { ProgressiveRender::FragmentNameIterator.new } 13 | let(:iter2) { ProgressiveRender::FragmentNameIterator.new } 14 | 15 | it 'produces equal values' do 16 | 10.times do 17 | expect(iter1.next!).to eq(iter2.next!) 18 | end 19 | end 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /spec/lib/rack/request_handler_spec.rb: -------------------------------------------------------------------------------- 1 | require 'progressive_render/rack/request_handler' 2 | 3 | FRAGMENT_KEY = ProgressiveRender::Rack::RequestHandler::FRAGMENT_KEY 4 | 5 | describe ProgressiveRender::Rack::RequestHandler do 6 | it 'can parse the main load' do 7 | req = double 8 | allow(req).to receive(:GET).and_return({}) 9 | allow(req).to receive(:path).and_return('/foo') 10 | 11 | rh = ProgressiveRender::Rack::RequestHandler.new(req) 12 | expect(rh.main_load?).to eq(true) 13 | expect(rh.should_render_fragment?('foo')).to eq(false) 14 | expect(rh.fragment_name).to eq(nil) 15 | expect(rh.load_path('bar')).to eq("/foo?#{FRAGMENT_KEY}=bar") 16 | end 17 | 18 | it 'can parse the name of a partial on progressive load' do 19 | req = double 20 | allow(req).to receive(:GET).and_return(FRAGMENT_KEY.to_s => 'my_partial') 21 | allow(req).to receive(:path).and_return('/bar/baz') 22 | 23 | rh = ProgressiveRender::Rack::RequestHandler.new(req) 24 | expect(rh.main_load?).to eq(false) 25 | expect(rh.fragment_name).to eq('my_partial') 26 | expect(rh.should_render_fragment?('foo')).to eq(false) 27 | expect(rh.should_render_fragment?('my_partial')).to eq(true) 28 | expect(rh.load_path('bar')).to eq(nil) 29 | end 30 | 31 | it 'does not modify the request object' do 32 | get_request = {} 33 | get_clone = get_request.clone 34 | req = double 35 | allow(req).to receive(:GET).and_return(get_request) 36 | allow(req).to receive(:path).and_return('/bar/baz') 37 | 38 | rh = ProgressiveRender::Rack::RequestHandler.new(req) 39 | rh.load_path('bar') 40 | 41 | expect(get_request[FRAGMENT_KEY]).to be_nil 42 | expect(get_request).to eq(get_request) 43 | expect(get_clone).to eq(get_request) 44 | end 45 | 46 | it 'handles nested params' do 47 | get_request = { foo: { bar: 'baz' } } 48 | req = double 49 | allow(req).to receive(:GET).and_return(get_request) 50 | allow(req).to receive(:path).and_return('/endpoint') 51 | 52 | rh = ProgressiveRender::Rack::RequestHandler.new(req) 53 | expect(rh.load_path('bar')).to eq("/endpoint?foo[bar]=baz&#{FRAGMENT_KEY}=bar") 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /spec/lib/rails/path_resolver_spec.rb: -------------------------------------------------------------------------------- 1 | require 'progressive_render/rails/path_resolver' 2 | 3 | describe ProgressiveRender::Rails::PathResolver do 4 | describe 'with an empty template context' do 5 | it 'throws when resolving paths' do 6 | pr = ProgressiveRender::Rails::PathResolver.new(nil) 7 | expect { pr.path_for }.to raise_error(ProgressiveRender::Rails::PathResolver::InvalidTemplateContextException) 8 | end 9 | end 10 | 11 | describe 'with a controller context' do 12 | let(:tc) { ProgressiveRender::Rails::PathResolver::TemplateContext.new } 13 | before do 14 | tc.type = :controller 15 | tc.controller = 'Foo' 16 | tc.action = 'index' 17 | end 18 | let(:pr) { ProgressiveRender::Rails::PathResolver.new(tc) } 19 | it 'resolves the default view' do 20 | expect(pr.path_for).to eq('foo/index') 21 | end 22 | it 'resolves a view within the controller' do 23 | expect(pr.path_for('action')).to eq('foo/action') 24 | end 25 | end 26 | 27 | describe 'with a view context' do 28 | let(:tc) { ProgressiveRender::Rails::PathResolver::TemplateContext.new } 29 | before do 30 | tc.type = :view 31 | tc.controller = 'Foo' 32 | tc.action = 'index' 33 | end 34 | let(:pr) { ProgressiveRender::Rails::PathResolver.new(tc) } 35 | it 'does not allow default view' do 36 | expect { pr.path_for }.to raise_error(ProgressiveRender::Rails::PathResolver::InvalidPathException) 37 | end 38 | it 'resolves a partial within the view' do 39 | expect(pr.path_for('partial')).to eq('foo/partial') 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /spec/lib/rails/view_renderer_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | require 'progressive_render/rails/view_renderer' 3 | 4 | describe ProgressiveRender::Rails::ViewRenderer do 5 | specify '#render_partial' do 6 | context = double 7 | allow(context).to receive(:render).and_return(true) 8 | 9 | vr = ProgressiveRender::Rails::ViewRenderer.new(context) 10 | expect(vr.render_partial('')).to eq(true) 11 | end 12 | 13 | specify '#render_view' do 14 | context = double 15 | allow(context).to receive(:render).and_return(true) 16 | 17 | vr = ProgressiveRender::Rails::ViewRenderer.new(context) 18 | expect(vr.render_view('')).to eq(true) 19 | end 20 | 21 | specify '#render_fragment' do 22 | context = double 23 | body = '
Hello World
' 24 | allow(context).to receive(:render_to_string).and_return("

Hey Now

#{body}") 25 | allow(context).to receive(:render) 26 | 27 | vr = ProgressiveRender::Rails::ViewRenderer.new(context) 28 | vr.render_fragment('', 'example') 29 | 30 | expect(context).to have_received(:render).with(plain: body) 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /spec/mock_rails_app.rb: -------------------------------------------------------------------------------- 1 | require 'action_controller/railtie' 2 | 3 | module MockRailsApp 4 | class Application < Rails::Application 5 | config.secret_token = '2442e998905e6cdad842eb483e64641a' 6 | end 7 | 8 | class ApplicationController < ActionController::Base 9 | end 10 | end 11 | -------------------------------------------------------------------------------- /spec/progressive_render_spec.rb: -------------------------------------------------------------------------------- 1 | require 'rails_helper' 2 | 3 | describe ProgressiveRender do 4 | it 'has a version number' do 5 | expect(ProgressiveRender::VERSION).not_to be nil 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/rails_helper.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | # Load rails and the entire gem 4 | require 'rails/all' 5 | require 'rspec/rails' 6 | require 'progressive_render' 7 | 8 | # Debugging doesn't have to be hard 9 | require 'pry-byebug' 10 | 11 | # Set the application into the test enviornment 12 | ENV['RAILS_ENV'] = 'test' 13 | 14 | # Load the dummy rails app 15 | require File.expand_path('../dummy/config/environment', __FILE__) 16 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # spec_helper: base for testing suite. Should be kept 3 | # as light weight as possible. Use rails_helper for 4 | # specs that require the kitchen sink. 5 | # 6 | 7 | require 'simplecov' 8 | SimpleCov.start 9 | 10 | $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__) 11 | require 'rspec' 12 | -------------------------------------------------------------------------------- /vendor/assets/images/progressive_render.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/johnsonj/progressive_render/3cf39fe16485e2fd2e21b50120c4f2cb50df8508/vendor/assets/images/progressive_render.gif -------------------------------------------------------------------------------- /vendor/assets/javascripts/progressive_render.js.coffee: -------------------------------------------------------------------------------- 1 | # TODO: API for load missing content or binding to page events 2 | $ -> 3 | setup_listener() 4 | load_missing_content() 5 | 6 | setup_listener = -> 7 | $(document).on 'progressive_render:end', load_missing_content 8 | $(document).on 'ajax:end', load_missing_content 9 | $(document).on 'turbolinks:load', load_missing_content if window.Turbolinks 10 | 11 | load_missing_content = -> 12 | $('[data-progressive-render-placeholder=true]').each -> 13 | $this = $(this) 14 | # Remove the designation on this partial from the DOM so we don't attempt to re-load it later. 15 | $this.attr('data-progressive-render-placeholder', false) 16 | 17 | # Start the load 18 | $.ajax url: $this.data('progressive-render-path'), cache: false, success: (response) -> 19 | $this.html(response); 20 | $(document).trigger('progressive_render:end') 21 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/progressive_render.scss: -------------------------------------------------------------------------------- 1 | #progressive-render-placeholder { 2 | height: 40px; 3 | width: 40px; 4 | background-image: asset-data-url('progressive_render.gif'); 5 | } 6 | --------------------------------------------------------------------------------