├── spec ├── internal │ ├── log │ │ └── .gitignore │ ├── app │ │ ├── views │ │ │ ├── nestive │ │ │ │ ├── index.html.erb │ │ │ │ ├── extended_one.html.erb │ │ │ │ ├── extended_two.html.erb │ │ │ │ ├── extended_three.html.erb │ │ │ │ ├── extended_without_yield.html.erb │ │ │ │ ├── purge_single.html.erb │ │ │ │ ├── purge_multiple.html.erb │ │ │ │ ├── replace.html.erb │ │ │ │ ├── append.html.erb │ │ │ │ └── prepend.html.erb │ │ │ └── layouts │ │ │ │ ├── extend_without_yield.html.erb │ │ │ │ ├── extend_two.html.erb │ │ │ │ ├── extend_one.html.erb │ │ │ │ └── nestive.html.erb │ │ └── controllers │ │ │ ├── application_controller.rb │ │ │ └── nestive_controller.rb │ └── config │ │ └── routes.rb ├── spec_helper.rb └── controllers │ └── nestive_spec.rb ├── .gitignore ├── lib ├── nestive │ ├── version.rb │ ├── railtie.rb │ └── layout_helper.rb └── nestive.rb ├── Rakefile ├── Gemfile ├── config.ru ├── .yardopts ├── gemfiles ├── rails_5_0.gemfile ├── rails_3_1.gemfile ├── rails_3_2.gemfile ├── rails_4_0.gemfile ├── rails_4_1.gemfile ├── rails_4_2.gemfile ├── rails_4_0.gemfile.lock ├── rails_4_1.gemfile.lock ├── rails_3_1.gemfile.lock ├── rails_3_2.gemfile.lock ├── rails_4_2.gemfile.lock └── rails_5_0.gemfile.lock ├── Appraisals ├── .travis.yml ├── nestive.gemspec ├── MIT-LICENSE └── README.md /spec/internal/log/.gitignore: -------------------------------------------------------------------------------- 1 | *.log -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .rvmrc 2 | doc 3 | .yardoc 4 | pkg 5 | Gemfile.lock 6 | -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/index.html.erb: -------------------------------------------------------------------------------- 1 |

Hello World

-------------------------------------------------------------------------------- /lib/nestive/version.rb: -------------------------------------------------------------------------------- 1 | module Nestive 2 | VERSION = '0.6.0' 3 | end 4 | -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/extended_one.html.erb: -------------------------------------------------------------------------------- 1 |

extended: one

-------------------------------------------------------------------------------- /spec/internal/app/views/nestive/extended_two.html.erb: -------------------------------------------------------------------------------- 1 |

extended: two

-------------------------------------------------------------------------------- /spec/internal/app/views/nestive/extended_three.html.erb: -------------------------------------------------------------------------------- 1 | <% append :title, 'lol' %> -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/extended_without_yield.html.erb: -------------------------------------------------------------------------------- 1 |

extended: without_yield

2 | -------------------------------------------------------------------------------- /spec/internal/config/routes.rb: -------------------------------------------------------------------------------- 1 | Rails.application.routes.draw do 2 | get ':controller/:action' 3 | end 4 | -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/purge_single.html.erb: -------------------------------------------------------------------------------- 1 |

single purge area

2 | 3 | <% purge :title %> 4 | -------------------------------------------------------------------------------- /spec/internal/app/controllers/application_controller.rb: -------------------------------------------------------------------------------- 1 | class ApplicationController < ActionController::Base 2 | end -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/purge_multiple.html.erb: -------------------------------------------------------------------------------- 1 |

multiple purge area

2 | 3 | <% purge :title, :some_area %> 4 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | require "bundler/gem_tasks" 2 | require "rspec/core/rake_task" 3 | 4 | RSpec::Core::RakeTask.new(:spec) 5 | task default: :spec 6 | -------------------------------------------------------------------------------- /lib/nestive.rb: -------------------------------------------------------------------------------- 1 | require 'nestive/version' 2 | require 'nestive/layout_helper' 3 | require 'nestive/railtie' 4 | 5 | module Nestive 6 | end 7 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gemspec 4 | 5 | gem "combustion", "~> 0.5.4" 6 | gem "rspec-rails", "~> 3.5" 7 | gem "appraisal", "~> 2.1" 8 | -------------------------------------------------------------------------------- /spec/internal/app/views/layouts/extend_without_yield.html.erb: -------------------------------------------------------------------------------- 1 | <%= extends :nestive do %> 2 | <% replace :title, 'extended: without_yield' %> 3 | <% end %> 4 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | require 'rubygems' 2 | require 'bundler' 3 | 4 | Bundler.require :default, :development 5 | 6 | Combustion.initialize! 7 | run Combustion::Application 8 | -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/replace.html.erb: -------------------------------------------------------------------------------- 1 |

replacing areas

2 | 3 | <% replace :title, 'Lolwut' %> 4 | 5 | <%= replace :some_area do %> 6 | replaced 7 | <% end %> -------------------------------------------------------------------------------- /spec/internal/app/views/layouts/extend_two.html.erb: -------------------------------------------------------------------------------- 1 | <%= extends :extend_one do %> 2 | <%= replace :some_area do %> 3 | extended: two 4 | <% end %> 5 | <%= yield %> 6 | <% end %> -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | --no-private 2 | --markup markdown 3 | --title "Nestive — Nested Layouts Plugin for Rails" 4 | --main "README.md" 5 | --files MIT-LICENSE 6 | --no-highlight 7 | app/**/*.rb 8 | lib/**/*.rb -------------------------------------------------------------------------------- /spec/internal/app/views/layouts/extend_one.html.erb: -------------------------------------------------------------------------------- 1 | <%= extends :nestive do %> 2 | <% replace :title, 'extended: one' %> 3 | 4 |

extended: one

5 | 6 | <%= yield %> 7 | <% end %> -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/append.html.erb: -------------------------------------------------------------------------------- 1 |

here we'll be appending to areas

2 | 3 | <% append :title, ' is awesome' %> 4 | <% append :some_area do %> 5 | Another content 6 | <% end %> -------------------------------------------------------------------------------- /spec/internal/app/views/nestive/prepend.html.erb: -------------------------------------------------------------------------------- 1 |

here we'll be prepending stuff to areas

2 | 3 | <% prepend :title, 'Awesome ' %> 4 | <% prepend :some_area do %> 5 | Prepended 6 | <% end %> -------------------------------------------------------------------------------- /gemfiles/rails_5_0.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "combustion", "~> 0.5.4" 6 | gem "rspec-rails", "~> 3.5" 7 | gem "appraisal", "~> 2.1" 8 | gem "rails", "~> 5.0.0" 9 | 10 | gemspec :path => "../" 11 | -------------------------------------------------------------------------------- /lib/nestive/railtie.rb: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | 3 | module Nestive 4 | class Railtie < Rails::Railtie 5 | initializer 'nestive.initialize' do 6 | ActiveSupport.on_load(:action_view) do 7 | include Nestive::LayoutHelper 8 | end 9 | end 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /gemfiles/rails_3_1.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "combustion", "~> 0.5.4" 6 | gem "rspec-rails", "~> 3.5" 7 | gem "appraisal", "~> 2.1" 8 | gem "test-unit" 9 | gem "rails", "~> 3.1.0" 10 | 11 | gemspec :path => "../" 12 | -------------------------------------------------------------------------------- /gemfiles/rails_3_2.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "combustion", "~> 0.5.4" 6 | gem "rspec-rails", "~> 3.5" 7 | gem "appraisal", "~> 2.1" 8 | gem "test-unit" 9 | gem "rails", "~> 3.2.0" 10 | 11 | gemspec :path => "../" 12 | -------------------------------------------------------------------------------- /gemfiles/rails_4_0.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "combustion", "~> 0.5.4" 6 | gem "rspec-rails", "~> 3.5" 7 | gem "appraisal", "~> 2.1" 8 | gem "mime-types", "~> 2.99" 9 | gem "rails", "~> 4.0.0" 10 | 11 | gemspec :path => "../" 12 | -------------------------------------------------------------------------------- /gemfiles/rails_4_1.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "combustion", "~> 0.5.4" 6 | gem "rspec-rails", "~> 3.5" 7 | gem "appraisal", "~> 2.1" 8 | gem "mime-types", "~> 2.99" 9 | gem "rails", "~> 4.1.0" 10 | 11 | gemspec :path => "../" 12 | -------------------------------------------------------------------------------- /gemfiles/rails_4_2.gemfile: -------------------------------------------------------------------------------- 1 | # This file was generated by Appraisal 2 | 3 | source "https://rubygems.org" 4 | 5 | gem "combustion", "~> 0.5.4" 6 | gem "rspec-rails", "~> 3.5" 7 | gem "appraisal", "~> 2.1" 8 | gem "mime-types", "~> 2.99" 9 | gem "rails", "~> 4.2.0" 10 | 11 | gemspec :path => "../" 12 | -------------------------------------------------------------------------------- /spec/spec_helper.rb: -------------------------------------------------------------------------------- 1 | require 'bundler' 2 | 3 | Bundler.setup 4 | 5 | require 'rails' 6 | require 'combustion' 7 | require 'nestive' 8 | 9 | Combustion.initialize! :action_controller 10 | 11 | require 'rspec/rails' 12 | 13 | RSpec.configure do |config| 14 | config.infer_spec_type_from_file_location! 15 | end 16 | -------------------------------------------------------------------------------- /spec/internal/app/views/layouts/nestive.html.erb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | <%= area :title, 'Nestive' %> 5 | 6 | 7 | <%= yield %> 8 |
9 | <%= area :some_area do -%> 10 | Some content 11 | <%- end -%> 12 |
13 |
<%= area :empty_area %>
14 | 15 | -------------------------------------------------------------------------------- /spec/internal/app/controllers/nestive_controller.rb: -------------------------------------------------------------------------------- 1 | class NestiveController < ApplicationController 2 | def extended_one 3 | render layout: 'extend_one' 4 | end 5 | 6 | def extended_two 7 | render layout: 'extend_two' 8 | end 9 | 10 | def extended_three 11 | render layout: 'extend_one' 12 | end 13 | 14 | def extended_without_yield 15 | render layout: 'extend_without_yield' 16 | end 17 | end 18 | -------------------------------------------------------------------------------- /Appraisals: -------------------------------------------------------------------------------- 1 | appraise "rails-3-1" do 2 | gem "test-unit" 3 | gem "rails", "~> 3.1.0" 4 | end 5 | 6 | appraise "rails-3-2" do 7 | gem "test-unit" 8 | gem "rails", "~> 3.2.0" 9 | end 10 | 11 | appraise "rails-4-0" do 12 | gem "mime-types", "~> 2.99" 13 | gem "rails", "~> 4.0.0" 14 | end 15 | 16 | appraise "rails-4-1" do 17 | gem "mime-types", "~> 2.99" 18 | gem "rails", "~> 4.1.0" 19 | end 20 | 21 | appraise "rails-4-2" do 22 | gem "mime-types", "~> 2.99" 23 | gem "rails", "~> 4.2.0" 24 | end 25 | 26 | appraise "rails-5-0" do 27 | gem "rails", "~> 5.0.0" 28 | end 29 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: ruby 2 | cache: bundler 3 | sudo: false 4 | 5 | gemfile: 6 | - gemfiles/rails_3_1.gemfile 7 | - gemfiles/rails_3_2.gemfile 8 | - gemfiles/rails_4_0.gemfile 9 | - gemfiles/rails_4_1.gemfile 10 | - gemfiles/rails_4_2.gemfile 11 | - gemfiles/rails_5_0.gemfile 12 | 13 | rvm: 14 | - 2.3.1 15 | - 2.2 16 | - 2.1 17 | - 2.0 18 | - 1.9 19 | 20 | matrix: 21 | fast_finish: true 22 | exclude: 23 | - rvm: 1.9 24 | gemfile: gemfiles/rails_5_0.gemfile 25 | - rvm: 2.0 26 | gemfile: gemfiles/rails_5_0.gemfile 27 | - rvm: 2.1 28 | gemfile: gemfiles/rails_5_0.gemfile 29 | - rvm: 2.2 30 | gemfile: gemfiles/rails_5_0.gemfile 31 | - rvm: 2.2 32 | gemfile: gemfiles/rails_3_1.gemfile 33 | - rvm: 2.3.1 34 | gemfile: gemfiles/rails_3_1.gemfile 35 | -------------------------------------------------------------------------------- /nestive.gemspec: -------------------------------------------------------------------------------- 1 | require File.expand_path("../lib/nestive/version", __FILE__) 2 | 3 | Gem::Specification.new do |s| 4 | s.name = "nestive" 5 | s.version = Nestive::VERSION 6 | s.platform = Gem::Platform::RUBY 7 | s.authors = ["Justin French", "Pavel Pravosud"] 8 | s.email = ["justin@indent.com.au", "pavel@pravosud.com"] 9 | s.homepage = "https://github.com/rwz/nestive" 10 | s.summary = "A Rails gem for awesome nested templates and layouts" 11 | s.description = "A Rails plugin/gem for awesome nested templates and layouts" 12 | s.licenses = ["MIT"] 13 | 14 | s.files = Dir["README.md", "MIT-LICENSE", "lib/**/*"] 15 | s.require_path = "lib" 16 | 17 | s.required_ruby_version = ">= 1.9.3" 18 | 19 | s.add_dependency "actionview", ">= 3.1.0" 20 | s.add_dependency "activesupport", ">= 3.1.0" 21 | s.add_dependency "railties", ">= 3.1.0" 22 | end 23 | -------------------------------------------------------------------------------- /MIT-LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Justin French 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /spec/controllers/nestive_spec.rb: -------------------------------------------------------------------------------- 1 | require 'spec_helper' 2 | 3 | describe NestiveController do 4 | render_views 5 | 6 | context '#area' do 7 | it 'is empty by default' do 8 | get :index 9 | assert_select '#empty-area', '' 10 | end 11 | 12 | it 'shows initial value if any' do 13 | get :index 14 | assert_select 'title', 'Nestive' 15 | end 16 | 17 | it 'can accept blocks as initial value' do 18 | get :index 19 | assert_select '#some-area', 'Some content' 20 | end 21 | end 22 | 23 | context '#append' do 24 | it 'appends content to area as a string' do 25 | get :append 26 | assert_select 'title', 'Nestive is awesome' 27 | end 28 | 29 | it 'appends content to area as a block' do 30 | get :append 31 | assert_select '#some-area', "Some content\n Another content" 32 | end 33 | end 34 | 35 | context '#prepend' do 36 | it 'prepends content to area as a string' do 37 | get :prepend 38 | assert_select 'title', 'Awesome Nestive' 39 | end 40 | 41 | it 'prepends content to area as a block' do 42 | get :prepend 43 | assert_select '#some-area', "Prepended\n Some content" 44 | end 45 | end 46 | 47 | context '#replace' do 48 | it 'replaces area content with string' do 49 | get :replace 50 | assert_select 'title', 'Lolwut' 51 | end 52 | 53 | it 'replaces area content with block' do 54 | get :replace 55 | assert_select '#some-area', 'replaced' 56 | end 57 | end 58 | 59 | context '#purge' do 60 | it 'purge single area content' do 61 | get :purge_single 62 | assert_select 'title' 63 | end 64 | 65 | it 'purge few areas content' do 66 | get :purge_multiple 67 | assert_select 'title' 68 | assert_select '#some-area' 69 | end 70 | end 71 | 72 | context '#extends' do 73 | it 'extends layouts' do 74 | get :extended_one 75 | assert_select 'p', 'extended: one' 76 | assert_select 'title', 'extended: one' 77 | assert_select 'h2', 'extended: one' 78 | end 79 | 80 | it 'can extend already extended layouts' do 81 | get :extended_two 82 | assert_select 'p', 'extended: two' 83 | assert_select 'title', 'extended: one' 84 | assert_select '#some-area', 'extended: two' 85 | assert_select 'h2', 'extended: one' 86 | end 87 | 88 | it 'extends empty layout' do 89 | get :extended_three 90 | end 91 | 92 | it 'extends layout without yield' do 93 | get :extended_without_yield 94 | assert_select 'title', 'extended: without_yield' 95 | end 96 | end 97 | end 98 | -------------------------------------------------------------------------------- /gemfiles/rails_4_0.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | nestive (0.6.0) 5 | rails (>= 3.0.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | actionmailer (4.0.13) 11 | actionpack (= 4.0.13) 12 | mail (~> 2.5, >= 2.5.4) 13 | actionpack (4.0.13) 14 | activesupport (= 4.0.13) 15 | builder (~> 3.1.0) 16 | erubis (~> 2.7.0) 17 | rack (~> 1.5.2) 18 | rack-test (~> 0.6.2) 19 | activemodel (4.0.13) 20 | activesupport (= 4.0.13) 21 | builder (~> 3.1.0) 22 | activerecord (4.0.13) 23 | activemodel (= 4.0.13) 24 | activerecord-deprecated_finders (~> 1.0.2) 25 | activesupport (= 4.0.13) 26 | arel (~> 4.0.0) 27 | activerecord-deprecated_finders (1.0.4) 28 | activesupport (4.0.13) 29 | i18n (~> 0.6, >= 0.6.9) 30 | minitest (~> 4.2) 31 | multi_json (~> 1.3) 32 | thread_safe (~> 0.1) 33 | tzinfo (~> 0.3.37) 34 | appraisal (2.1.0) 35 | bundler 36 | rake 37 | thor (>= 0.14.0) 38 | arel (4.0.2) 39 | builder (3.1.4) 40 | combustion (0.5.4) 41 | activesupport (>= 3.0.0) 42 | railties (>= 3.0.0) 43 | thor (>= 0.14.6) 44 | concurrent-ruby (1.0.2) 45 | diff-lcs (1.2.5) 46 | erubis (2.7.0) 47 | i18n (0.7.0) 48 | mail (2.6.4) 49 | mime-types (>= 1.16, < 4) 50 | mime-types (2.99.1) 51 | minitest (4.7.5) 52 | multi_json (1.12.1) 53 | rack (1.5.5) 54 | rack-test (0.6.3) 55 | rack (>= 1.0) 56 | rails (4.0.13) 57 | actionmailer (= 4.0.13) 58 | actionpack (= 4.0.13) 59 | activerecord (= 4.0.13) 60 | activesupport (= 4.0.13) 61 | bundler (>= 1.3.0, < 2.0) 62 | railties (= 4.0.13) 63 | sprockets-rails (~> 2.0) 64 | railties (4.0.13) 65 | actionpack (= 4.0.13) 66 | activesupport (= 4.0.13) 67 | rake (>= 0.8.7) 68 | thor (>= 0.18.1, < 2.0) 69 | rake (11.2.2) 70 | rspec-core (3.5.1) 71 | rspec-support (~> 3.5.0) 72 | rspec-expectations (3.5.0) 73 | diff-lcs (>= 1.2.0, < 2.0) 74 | rspec-support (~> 3.5.0) 75 | rspec-mocks (3.5.0) 76 | diff-lcs (>= 1.2.0, < 2.0) 77 | rspec-support (~> 3.5.0) 78 | rspec-rails (3.5.1) 79 | actionpack (>= 3.0) 80 | activesupport (>= 3.0) 81 | railties (>= 3.0) 82 | rspec-core (~> 3.5.0) 83 | rspec-expectations (~> 3.5.0) 84 | rspec-mocks (~> 3.5.0) 85 | rspec-support (~> 3.5.0) 86 | rspec-support (3.5.0) 87 | sprockets (3.6.3) 88 | concurrent-ruby (~> 1.0) 89 | rack (> 1, < 3) 90 | sprockets-rails (2.3.3) 91 | actionpack (>= 3.0) 92 | activesupport (>= 3.0) 93 | sprockets (>= 2.8, < 4.0) 94 | thor (0.19.1) 95 | thread_safe (0.3.5) 96 | tzinfo (0.3.51) 97 | 98 | PLATFORMS 99 | ruby 100 | 101 | DEPENDENCIES 102 | appraisal (~> 2.1) 103 | combustion (~> 0.5.4) 104 | mime-types (~> 2.99) 105 | nestive! 106 | rails (~> 4.0.0) 107 | rspec-rails (~> 3.5) 108 | 109 | BUNDLED WITH 110 | 1.12.3 111 | -------------------------------------------------------------------------------- /gemfiles/rails_4_1.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | nestive (0.6.0) 5 | rails (>= 3.0.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | actionmailer (4.1.15) 11 | actionpack (= 4.1.15) 12 | actionview (= 4.1.15) 13 | mail (~> 2.5, >= 2.5.4) 14 | actionpack (4.1.15) 15 | actionview (= 4.1.15) 16 | activesupport (= 4.1.15) 17 | rack (~> 1.5.2) 18 | rack-test (~> 0.6.2) 19 | actionview (4.1.15) 20 | activesupport (= 4.1.15) 21 | builder (~> 3.1) 22 | erubis (~> 2.7.0) 23 | activemodel (4.1.15) 24 | activesupport (= 4.1.15) 25 | builder (~> 3.1) 26 | activerecord (4.1.15) 27 | activemodel (= 4.1.15) 28 | activesupport (= 4.1.15) 29 | arel (~> 5.0.0) 30 | activesupport (4.1.15) 31 | i18n (~> 0.6, >= 0.6.9) 32 | json (~> 1.7, >= 1.7.7) 33 | minitest (~> 5.1) 34 | thread_safe (~> 0.1) 35 | tzinfo (~> 1.1) 36 | appraisal (2.1.0) 37 | bundler 38 | rake 39 | thor (>= 0.14.0) 40 | arel (5.0.1.20140414130214) 41 | builder (3.2.2) 42 | combustion (0.5.4) 43 | activesupport (>= 3.0.0) 44 | railties (>= 3.0.0) 45 | thor (>= 0.14.6) 46 | concurrent-ruby (1.0.2) 47 | diff-lcs (1.2.5) 48 | erubis (2.7.0) 49 | i18n (0.7.0) 50 | json (1.8.3) 51 | mail (2.6.4) 52 | mime-types (>= 1.16, < 4) 53 | mime-types (2.99.1) 54 | minitest (5.9.0) 55 | rack (1.5.5) 56 | rack-test (0.6.3) 57 | rack (>= 1.0) 58 | rails (4.1.15) 59 | actionmailer (= 4.1.15) 60 | actionpack (= 4.1.15) 61 | actionview (= 4.1.15) 62 | activemodel (= 4.1.15) 63 | activerecord (= 4.1.15) 64 | activesupport (= 4.1.15) 65 | bundler (>= 1.3.0, < 2.0) 66 | railties (= 4.1.15) 67 | sprockets-rails (~> 2.0) 68 | railties (4.1.15) 69 | actionpack (= 4.1.15) 70 | activesupport (= 4.1.15) 71 | rake (>= 0.8.7) 72 | thor (>= 0.18.1, < 2.0) 73 | rake (11.2.2) 74 | rspec-core (3.5.1) 75 | rspec-support (~> 3.5.0) 76 | rspec-expectations (3.5.0) 77 | diff-lcs (>= 1.2.0, < 2.0) 78 | rspec-support (~> 3.5.0) 79 | rspec-mocks (3.5.0) 80 | diff-lcs (>= 1.2.0, < 2.0) 81 | rspec-support (~> 3.5.0) 82 | rspec-rails (3.5.1) 83 | actionpack (>= 3.0) 84 | activesupport (>= 3.0) 85 | railties (>= 3.0) 86 | rspec-core (~> 3.5.0) 87 | rspec-expectations (~> 3.5.0) 88 | rspec-mocks (~> 3.5.0) 89 | rspec-support (~> 3.5.0) 90 | rspec-support (3.5.0) 91 | sprockets (3.6.3) 92 | concurrent-ruby (~> 1.0) 93 | rack (> 1, < 3) 94 | sprockets-rails (2.3.3) 95 | actionpack (>= 3.0) 96 | activesupport (>= 3.0) 97 | sprockets (>= 2.8, < 4.0) 98 | thor (0.19.1) 99 | thread_safe (0.3.5) 100 | tzinfo (1.2.2) 101 | thread_safe (~> 0.1) 102 | 103 | PLATFORMS 104 | ruby 105 | 106 | DEPENDENCIES 107 | appraisal (~> 2.1) 108 | combustion (~> 0.5.4) 109 | mime-types (~> 2.99) 110 | nestive! 111 | rails (~> 4.1.0) 112 | rspec-rails (~> 3.5) 113 | 114 | BUNDLED WITH 115 | 1.12.3 116 | -------------------------------------------------------------------------------- /gemfiles/rails_3_1.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | nestive (0.6.0) 5 | rails (>= 3.0.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | actionmailer (3.1.12) 11 | actionpack (= 3.1.12) 12 | mail (~> 2.4.4) 13 | actionpack (3.1.12) 14 | activemodel (= 3.1.12) 15 | activesupport (= 3.1.12) 16 | builder (~> 3.0.0) 17 | erubis (~> 2.7.0) 18 | i18n (~> 0.6) 19 | rack (~> 1.3.6) 20 | rack-cache (~> 1.2) 21 | rack-mount (~> 0.8.2) 22 | rack-test (~> 0.6.1) 23 | sprockets (~> 2.0.4) 24 | activemodel (3.1.12) 25 | activesupport (= 3.1.12) 26 | builder (~> 3.0.0) 27 | i18n (~> 0.6) 28 | activerecord (3.1.12) 29 | activemodel (= 3.1.12) 30 | activesupport (= 3.1.12) 31 | arel (~> 2.2.3) 32 | tzinfo (~> 0.3.29) 33 | activeresource (3.1.12) 34 | activemodel (= 3.1.12) 35 | activesupport (= 3.1.12) 36 | activesupport (3.1.12) 37 | multi_json (~> 1.0) 38 | appraisal (2.1.0) 39 | bundler 40 | rake 41 | thor (>= 0.14.0) 42 | arel (2.2.3) 43 | builder (3.0.4) 44 | combustion (0.5.4) 45 | activesupport (>= 3.0.0) 46 | railties (>= 3.0.0) 47 | thor (>= 0.14.6) 48 | diff-lcs (1.2.5) 49 | erubis (2.7.0) 50 | hike (1.2.3) 51 | i18n (0.7.0) 52 | json (1.8.3) 53 | mail (2.4.4) 54 | i18n (>= 0.4.0) 55 | mime-types (~> 1.16) 56 | treetop (~> 1.4.8) 57 | mime-types (1.25.1) 58 | multi_json (1.12.1) 59 | polyglot (0.3.5) 60 | power_assert (0.2.6) 61 | rack (1.3.10) 62 | rack-cache (1.6.1) 63 | rack (>= 0.4) 64 | rack-mount (0.8.3) 65 | rack (>= 1.0.0) 66 | rack-ssl (1.3.4) 67 | rack 68 | rack-test (0.6.3) 69 | rack (>= 1.0) 70 | rails (3.1.12) 71 | actionmailer (= 3.1.12) 72 | actionpack (= 3.1.12) 73 | activerecord (= 3.1.12) 74 | activeresource (= 3.1.12) 75 | activesupport (= 3.1.12) 76 | bundler (~> 1.0) 77 | railties (= 3.1.12) 78 | railties (3.1.12) 79 | actionpack (= 3.1.12) 80 | activesupport (= 3.1.12) 81 | rack-ssl (~> 1.3.2) 82 | rake (>= 0.8.7) 83 | rdoc (~> 3.4) 84 | thor (~> 0.14.6) 85 | rake (11.2.2) 86 | rdoc (3.12.2) 87 | json (~> 1.4) 88 | rspec-core (3.5.1) 89 | rspec-support (~> 3.5.0) 90 | rspec-expectations (3.5.0) 91 | diff-lcs (>= 1.2.0, < 2.0) 92 | rspec-support (~> 3.5.0) 93 | rspec-mocks (3.5.0) 94 | diff-lcs (>= 1.2.0, < 2.0) 95 | rspec-support (~> 3.5.0) 96 | rspec-rails (3.5.1) 97 | actionpack (>= 3.0) 98 | activesupport (>= 3.0) 99 | railties (>= 3.0) 100 | rspec-core (~> 3.5.0) 101 | rspec-expectations (~> 3.5.0) 102 | rspec-mocks (~> 3.5.0) 103 | rspec-support (~> 3.5.0) 104 | rspec-support (3.5.0) 105 | sprockets (2.0.5) 106 | hike (~> 1.2) 107 | rack (~> 1.0) 108 | tilt (~> 1.1, != 1.3.0) 109 | test-unit (3.1.5) 110 | power_assert 111 | thor (0.14.6) 112 | tilt (1.4.1) 113 | treetop (1.4.15) 114 | polyglot 115 | polyglot (>= 0.3.1) 116 | tzinfo (0.3.51) 117 | 118 | PLATFORMS 119 | ruby 120 | 121 | DEPENDENCIES 122 | appraisal (~> 2.1) 123 | combustion (~> 0.5.4) 124 | nestive! 125 | rails (~> 3.1.0) 126 | rspec-rails (~> 3.5) 127 | test-unit 128 | 129 | BUNDLED WITH 130 | 1.12.3 131 | -------------------------------------------------------------------------------- /gemfiles/rails_3_2.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | nestive (0.6.0) 5 | rails (>= 3.0.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | actionmailer (3.2.22.2) 11 | actionpack (= 3.2.22.2) 12 | mail (~> 2.5.4) 13 | actionpack (3.2.22.2) 14 | activemodel (= 3.2.22.2) 15 | activesupport (= 3.2.22.2) 16 | builder (~> 3.0.0) 17 | erubis (~> 2.7.0) 18 | journey (~> 1.0.4) 19 | rack (~> 1.4.5) 20 | rack-cache (~> 1.2) 21 | rack-test (~> 0.6.1) 22 | sprockets (~> 2.2.1) 23 | activemodel (3.2.22.2) 24 | activesupport (= 3.2.22.2) 25 | builder (~> 3.0.0) 26 | activerecord (3.2.22.2) 27 | activemodel (= 3.2.22.2) 28 | activesupport (= 3.2.22.2) 29 | arel (~> 3.0.2) 30 | tzinfo (~> 0.3.29) 31 | activeresource (3.2.22.2) 32 | activemodel (= 3.2.22.2) 33 | activesupport (= 3.2.22.2) 34 | activesupport (3.2.22.2) 35 | i18n (~> 0.6, >= 0.6.4) 36 | multi_json (~> 1.0) 37 | appraisal (2.1.0) 38 | bundler 39 | rake 40 | thor (>= 0.14.0) 41 | arel (3.0.3) 42 | builder (3.0.4) 43 | combustion (0.5.4) 44 | activesupport (>= 3.0.0) 45 | railties (>= 3.0.0) 46 | thor (>= 0.14.6) 47 | diff-lcs (1.2.5) 48 | erubis (2.7.0) 49 | hike (1.2.3) 50 | i18n (0.7.0) 51 | journey (1.0.4) 52 | json (1.8.3) 53 | mail (2.5.4) 54 | mime-types (~> 1.16) 55 | treetop (~> 1.4.8) 56 | mime-types (1.25.1) 57 | multi_json (1.12.1) 58 | polyglot (0.3.5) 59 | power_assert (0.2.6) 60 | rack (1.4.7) 61 | rack-cache (1.6.1) 62 | rack (>= 0.4) 63 | rack-ssl (1.3.4) 64 | rack 65 | rack-test (0.6.3) 66 | rack (>= 1.0) 67 | rails (3.2.22.2) 68 | actionmailer (= 3.2.22.2) 69 | actionpack (= 3.2.22.2) 70 | activerecord (= 3.2.22.2) 71 | activeresource (= 3.2.22.2) 72 | activesupport (= 3.2.22.2) 73 | bundler (~> 1.0) 74 | railties (= 3.2.22.2) 75 | railties (3.2.22.2) 76 | actionpack (= 3.2.22.2) 77 | activesupport (= 3.2.22.2) 78 | rack-ssl (~> 1.3.2) 79 | rake (>= 0.8.7) 80 | rdoc (~> 3.4) 81 | thor (>= 0.14.6, < 2.0) 82 | rake (11.2.2) 83 | rdoc (3.12.2) 84 | json (~> 1.4) 85 | rspec-core (3.5.1) 86 | rspec-support (~> 3.5.0) 87 | rspec-expectations (3.5.0) 88 | diff-lcs (>= 1.2.0, < 2.0) 89 | rspec-support (~> 3.5.0) 90 | rspec-mocks (3.5.0) 91 | diff-lcs (>= 1.2.0, < 2.0) 92 | rspec-support (~> 3.5.0) 93 | rspec-rails (3.5.1) 94 | actionpack (>= 3.0) 95 | activesupport (>= 3.0) 96 | railties (>= 3.0) 97 | rspec-core (~> 3.5.0) 98 | rspec-expectations (~> 3.5.0) 99 | rspec-mocks (~> 3.5.0) 100 | rspec-support (~> 3.5.0) 101 | rspec-support (3.5.0) 102 | sprockets (2.2.3) 103 | hike (~> 1.2) 104 | multi_json (~> 1.0) 105 | rack (~> 1.0) 106 | tilt (~> 1.1, != 1.3.0) 107 | test-unit (3.1.5) 108 | power_assert 109 | thor (0.19.1) 110 | tilt (1.4.1) 111 | treetop (1.4.15) 112 | polyglot 113 | polyglot (>= 0.3.1) 114 | tzinfo (0.3.51) 115 | 116 | PLATFORMS 117 | ruby 118 | 119 | DEPENDENCIES 120 | appraisal (~> 2.1) 121 | combustion (~> 0.5.4) 122 | nestive! 123 | rails (~> 3.2.0) 124 | rspec-rails (~> 3.5) 125 | test-unit 126 | 127 | BUNDLED WITH 128 | 1.12.3 129 | -------------------------------------------------------------------------------- /gemfiles/rails_4_2.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | nestive (0.6.0) 5 | rails (>= 3.0.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | actionmailer (4.2.6) 11 | actionpack (= 4.2.6) 12 | actionview (= 4.2.6) 13 | activejob (= 4.2.6) 14 | mail (~> 2.5, >= 2.5.4) 15 | rails-dom-testing (~> 1.0, >= 1.0.5) 16 | actionpack (4.2.6) 17 | actionview (= 4.2.6) 18 | activesupport (= 4.2.6) 19 | rack (~> 1.6) 20 | rack-test (~> 0.6.2) 21 | rails-dom-testing (~> 1.0, >= 1.0.5) 22 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 23 | actionview (4.2.6) 24 | activesupport (= 4.2.6) 25 | builder (~> 3.1) 26 | erubis (~> 2.7.0) 27 | rails-dom-testing (~> 1.0, >= 1.0.5) 28 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 29 | activejob (4.2.6) 30 | activesupport (= 4.2.6) 31 | globalid (>= 0.3.0) 32 | activemodel (4.2.6) 33 | activesupport (= 4.2.6) 34 | builder (~> 3.1) 35 | activerecord (4.2.6) 36 | activemodel (= 4.2.6) 37 | activesupport (= 4.2.6) 38 | arel (~> 6.0) 39 | activesupport (4.2.6) 40 | i18n (~> 0.7) 41 | json (~> 1.7, >= 1.7.7) 42 | minitest (~> 5.1) 43 | thread_safe (~> 0.3, >= 0.3.4) 44 | tzinfo (~> 1.1) 45 | appraisal (2.1.0) 46 | bundler 47 | rake 48 | thor (>= 0.14.0) 49 | arel (6.0.3) 50 | builder (3.2.2) 51 | combustion (0.5.4) 52 | activesupport (>= 3.0.0) 53 | railties (>= 3.0.0) 54 | thor (>= 0.14.6) 55 | concurrent-ruby (1.0.2) 56 | diff-lcs (1.2.5) 57 | erubis (2.7.0) 58 | globalid (0.3.6) 59 | activesupport (>= 4.1.0) 60 | i18n (0.7.0) 61 | json (1.8.3) 62 | loofah (2.0.3) 63 | nokogiri (>= 1.5.9) 64 | mail (2.6.4) 65 | mime-types (>= 1.16, < 4) 66 | mime-types (2.99.1) 67 | mini_portile2 (2.1.0) 68 | minitest (5.9.0) 69 | nokogiri (1.6.8) 70 | mini_portile2 (~> 2.1.0) 71 | pkg-config (~> 1.1.7) 72 | pkg-config (1.1.7) 73 | rack (1.6.4) 74 | rack-test (0.6.3) 75 | rack (>= 1.0) 76 | rails (4.2.6) 77 | actionmailer (= 4.2.6) 78 | actionpack (= 4.2.6) 79 | actionview (= 4.2.6) 80 | activejob (= 4.2.6) 81 | activemodel (= 4.2.6) 82 | activerecord (= 4.2.6) 83 | activesupport (= 4.2.6) 84 | bundler (>= 1.3.0, < 2.0) 85 | railties (= 4.2.6) 86 | sprockets-rails 87 | rails-deprecated_sanitizer (1.0.3) 88 | activesupport (>= 4.2.0.alpha) 89 | rails-dom-testing (1.0.7) 90 | activesupport (>= 4.2.0.beta, < 5.0) 91 | nokogiri (~> 1.6.0) 92 | rails-deprecated_sanitizer (>= 1.0.1) 93 | rails-html-sanitizer (1.0.3) 94 | loofah (~> 2.0) 95 | railties (4.2.6) 96 | actionpack (= 4.2.6) 97 | activesupport (= 4.2.6) 98 | rake (>= 0.8.7) 99 | thor (>= 0.18.1, < 2.0) 100 | rake (11.2.2) 101 | rspec-core (3.5.1) 102 | rspec-support (~> 3.5.0) 103 | rspec-expectations (3.5.0) 104 | diff-lcs (>= 1.2.0, < 2.0) 105 | rspec-support (~> 3.5.0) 106 | rspec-mocks (3.5.0) 107 | diff-lcs (>= 1.2.0, < 2.0) 108 | rspec-support (~> 3.5.0) 109 | rspec-rails (3.5.1) 110 | actionpack (>= 3.0) 111 | activesupport (>= 3.0) 112 | railties (>= 3.0) 113 | rspec-core (~> 3.5.0) 114 | rspec-expectations (~> 3.5.0) 115 | rspec-mocks (~> 3.5.0) 116 | rspec-support (~> 3.5.0) 117 | rspec-support (3.5.0) 118 | sprockets (3.6.3) 119 | concurrent-ruby (~> 1.0) 120 | rack (> 1, < 3) 121 | sprockets-rails (3.1.1) 122 | actionpack (>= 4.0) 123 | activesupport (>= 4.0) 124 | sprockets (>= 3.0.0) 125 | thor (0.19.1) 126 | thread_safe (0.3.5) 127 | tzinfo (1.2.2) 128 | thread_safe (~> 0.1) 129 | 130 | PLATFORMS 131 | ruby 132 | 133 | DEPENDENCIES 134 | appraisal (~> 2.1) 135 | combustion (~> 0.5.4) 136 | mime-types (~> 2.99) 137 | nestive! 138 | rails (~> 4.2.0) 139 | rspec-rails (~> 3.5) 140 | 141 | BUNDLED WITH 142 | 1.12.3 143 | -------------------------------------------------------------------------------- /gemfiles/rails_5_0.gemfile.lock: -------------------------------------------------------------------------------- 1 | PATH 2 | remote: ../ 3 | specs: 4 | nestive (0.6.0) 5 | rails (>= 3.0.0) 6 | 7 | GEM 8 | remote: https://rubygems.org/ 9 | specs: 10 | actioncable (5.0.0) 11 | actionpack (= 5.0.0) 12 | nio4r (~> 1.2) 13 | websocket-driver (~> 0.6.1) 14 | actionmailer (5.0.0) 15 | actionpack (= 5.0.0) 16 | actionview (= 5.0.0) 17 | activejob (= 5.0.0) 18 | mail (~> 2.5, >= 2.5.4) 19 | rails-dom-testing (~> 2.0) 20 | actionpack (5.0.0) 21 | actionview (= 5.0.0) 22 | activesupport (= 5.0.0) 23 | rack (~> 2.0) 24 | rack-test (~> 0.6.3) 25 | rails-dom-testing (~> 2.0) 26 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 27 | actionview (5.0.0) 28 | activesupport (= 5.0.0) 29 | builder (~> 3.1) 30 | erubis (~> 2.7.0) 31 | rails-dom-testing (~> 2.0) 32 | rails-html-sanitizer (~> 1.0, >= 1.0.2) 33 | activejob (5.0.0) 34 | activesupport (= 5.0.0) 35 | globalid (>= 0.3.6) 36 | activemodel (5.0.0) 37 | activesupport (= 5.0.0) 38 | activerecord (5.0.0) 39 | activemodel (= 5.0.0) 40 | activesupport (= 5.0.0) 41 | arel (~> 7.0) 42 | activesupport (5.0.0) 43 | concurrent-ruby (~> 1.0, >= 1.0.2) 44 | i18n (~> 0.7) 45 | minitest (~> 5.1) 46 | tzinfo (~> 1.1) 47 | appraisal (2.1.0) 48 | bundler 49 | rake 50 | thor (>= 0.14.0) 51 | arel (7.0.0) 52 | builder (3.2.2) 53 | combustion (0.5.4) 54 | activesupport (>= 3.0.0) 55 | railties (>= 3.0.0) 56 | thor (>= 0.14.6) 57 | concurrent-ruby (1.0.2) 58 | diff-lcs (1.2.5) 59 | erubis (2.7.0) 60 | globalid (0.3.6) 61 | activesupport (>= 4.1.0) 62 | i18n (0.7.0) 63 | loofah (2.0.3) 64 | nokogiri (>= 1.5.9) 65 | mail (2.6.4) 66 | mime-types (>= 1.16, < 4) 67 | method_source (0.8.2) 68 | mime-types (3.1) 69 | mime-types-data (~> 3.2015) 70 | mime-types-data (3.2016.0521) 71 | mini_portile2 (2.1.0) 72 | minitest (5.9.0) 73 | nio4r (1.2.1) 74 | nokogiri (1.6.8) 75 | mini_portile2 (~> 2.1.0) 76 | pkg-config (~> 1.1.7) 77 | pkg-config (1.1.7) 78 | rack (2.0.1) 79 | rack-test (0.6.3) 80 | rack (>= 1.0) 81 | rails (5.0.0) 82 | actioncable (= 5.0.0) 83 | actionmailer (= 5.0.0) 84 | actionpack (= 5.0.0) 85 | actionview (= 5.0.0) 86 | activejob (= 5.0.0) 87 | activemodel (= 5.0.0) 88 | activerecord (= 5.0.0) 89 | activesupport (= 5.0.0) 90 | bundler (>= 1.3.0, < 2.0) 91 | railties (= 5.0.0) 92 | sprockets-rails (>= 2.0.0) 93 | rails-dom-testing (2.0.1) 94 | activesupport (>= 4.2.0, < 6.0) 95 | nokogiri (~> 1.6.0) 96 | rails-html-sanitizer (1.0.3) 97 | loofah (~> 2.0) 98 | railties (5.0.0) 99 | actionpack (= 5.0.0) 100 | activesupport (= 5.0.0) 101 | method_source 102 | rake (>= 0.8.7) 103 | thor (>= 0.18.1, < 2.0) 104 | rake (11.2.2) 105 | rspec-core (3.5.1) 106 | rspec-support (~> 3.5.0) 107 | rspec-expectations (3.5.0) 108 | diff-lcs (>= 1.2.0, < 2.0) 109 | rspec-support (~> 3.5.0) 110 | rspec-mocks (3.5.0) 111 | diff-lcs (>= 1.2.0, < 2.0) 112 | rspec-support (~> 3.5.0) 113 | rspec-rails (3.5.1) 114 | actionpack (>= 3.0) 115 | activesupport (>= 3.0) 116 | railties (>= 3.0) 117 | rspec-core (~> 3.5.0) 118 | rspec-expectations (~> 3.5.0) 119 | rspec-mocks (~> 3.5.0) 120 | rspec-support (~> 3.5.0) 121 | rspec-support (3.5.0) 122 | sprockets (3.6.3) 123 | concurrent-ruby (~> 1.0) 124 | rack (> 1, < 3) 125 | sprockets-rails (3.1.1) 126 | actionpack (>= 4.0) 127 | activesupport (>= 4.0) 128 | sprockets (>= 3.0.0) 129 | thor (0.19.1) 130 | thread_safe (0.3.5) 131 | tzinfo (1.2.2) 132 | thread_safe (~> 0.1) 133 | websocket-driver (0.6.4) 134 | websocket-extensions (>= 0.1.0) 135 | websocket-extensions (0.1.2) 136 | 137 | PLATFORMS 138 | ruby 139 | 140 | DEPENDENCIES 141 | appraisal (~> 2.1) 142 | combustion (~> 0.5.4) 143 | nestive! 144 | rails (~> 5.0.0) 145 | rspec-rails (~> 3.5) 146 | 147 | BUNDLED WITH 148 | 1.12.3 149 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nestive [![Build Status](https://travis-ci.org/rwz/nestive.svg?branch=master)](https://travis-ci.org/rwz/nestive) [![Code Climate](https://codeclimate.com/github/rwz/nestive.svg)](https://codeclimate.com/github/rwz/nestive) 2 | ## A Nested Inheritable Layouts Helpers for Rails 3 | 4 | 5 | Nestive adds powerful layout and view helpers to your Rails app. It's similar 6 | to the nested layout technique [already documented in the Rails 7 | guides](http://guides.rubyonrails.org/layouts_and_rendering.html#using-nested-layouts) 8 | and found in many other nested layout plugins (a technique using `content_for` 9 | and rendering the parent layout at the end of the child layout). There's a 10 | bunch of problems with this technique, including: 11 | 12 | * you can only *append* content to the content buffer with `content_for` (you 13 | can't prepend to content, you can't replace it) 14 | * when combined with this nested layout technique, `content_for` actually 15 | *prepends* new content to the buffer, because each parent layout is rendered 16 | *after* it's child 17 | 18 | Nestive is *better* because it addresses these problems. 19 | 20 | ## Just six methods (so far) 21 | 22 | ### Declaring an area of content with `area`: 23 | 24 | The `area` helper is a lot like Rails' own `<%= yield :foo %>`, and is used in 25 | layouts to define and render a chunk of content in your layout: 26 | 27 | ```erb 28 | <%= area :sidebar %> 29 | ``` 30 | 31 | Unlike `yield`, `area` will allow your parent layouts to add content to the 32 | area at the same time using either a String or a block: 33 | 34 | ```erb 35 | <%= area :sidebar, "Some Content Here" %> 36 | 37 | <%= area :sidebar do %> 38 | Some Content Here 39 | <% end %> 40 | ``` 41 | 42 | It's important to note that this isn't *default* content, it *is* the content 43 | (unless a child changes it). 44 | 45 | ### Appending content to an area with `append`: 46 | 47 | The implementation details are quite different, but the `append` helper works 48 | much like Rails' built-in `content_for`. It will work with either a String or 49 | block, adding the new content onto the end of any content previously provided 50 | by parent layouts: 51 | 52 | ```erb 53 | <%= extends :application do %> 54 | <% append :sidebar, "More content." %> 55 | <% append :sidebar do %> 56 | More content. 57 | <% end %> 58 | <% end %> 59 | ``` 60 | 61 | ### Prepending content to an area with `prepend`: 62 | 63 | Exactly what you think it is. The reverse of `append` (duh), adding the new 64 | content at the start of any content previously provided by parent layouts: 65 | 66 | ``` erb 67 | <%= extends :application do %> 68 | <%= prepend :sidebar, "Content." %> 69 | <%= prepend :sidebar do %> 70 | Content. 71 | <% end %> 72 | <% end %> 73 | ``` 74 | 75 | ### Replacing content with `replace` 76 | 77 | You can also replace any content provided by parent layouts: 78 | 79 | ``` erb 80 | <%= extends :application do %> 81 | <%= replace :sidebar, "New content." %> 82 | <%= replace :sidebar do %> 83 | New content. 84 | <% end %> 85 | <% end %> 86 | ``` 87 | 88 | ### Removing content with `purge` 89 | 90 | You can remove the content in the single or in multiple areas 91 | 92 | ``` erb 93 | <% purge :sidebar %> 94 | <% purge :sidebar, :banner %> 95 | ``` 96 | 97 | ... which is equal to: 98 | 99 | ``` erb 100 | <% replace :sidebar, nil %> 101 | ``` 102 | 103 | ### Extending a layout in a child layout (or view) with `extends` 104 | 105 | Any layout (or view) can declare that it wants to inherit from and extend a 106 | parent layout, in this case we're extending 107 | `app/views/layouts/application.html.erb`: 108 | 109 | ``` erb 110 | <%= extends :application do %> 111 | ... 112 | <% end %> 113 | ``` 114 | 115 | You can nest many levels deep: 116 | 117 | `app/views/layouts/application.html.erb`: 118 | 119 | ``` erb 120 | 121 | 122 | 123 | <%= area :head do %> 124 | <%= area :title, 'Nestive' %> 125 | <% end %> 126 | 127 | 128 | <%= yield %> 129 | 130 | 131 | ``` 132 | 133 | `app/views/layouts/with_sidebar.html.erb`: 134 | 135 | ``` erb 136 | <%= extends :application do %> 137 | 140 | <%= yield -%> 141 | <% end %> 142 | ``` 143 | 144 | `app/views/layouts/blog_posts.html.erb`: 145 | 146 | ``` erb 147 | <%= extends :with_sidebar do %> 148 | <% append :sidebar do %> 149 | Blog archive: 150 | <%= render_blog_archive %> 151 | <% end %> 152 | 153 | <% append :head do %> 154 | <%= javascript_include_tag 'fancy_blog_archive_tag_cloud' %> 155 | <% end %> 156 | 157 | <%= yield %> 158 | <% end %> 159 | ``` 160 | 161 | ## The token blog example 162 | 163 | Set-up a global layout defining some content areas. 164 | 165 | `app/views/layouts/application.html.erb`: 166 | 167 | ``` erb 168 | 169 | 170 | 171 | 172 | <%= area :title, "JustinFrench.com" %> 173 | "> 174 | "> 175 | 176 | 177 |
178 |
179 | <%= area :content do %> 180 |

Default content goes here.

181 | <% end %> 182 |
183 | 189 |
190 | <%= yield %> 191 | 192 | 193 | ``` 194 | 195 | Next, we set-up a `blog` layout that extends `application`, replacing, 196 | appending & prepending content to the areas we defined earlier. 197 | 198 | `app/views/layouts/blog.html.erb`: 199 | 200 | ``` erb 201 | <%= extends :application do %> 202 | <% replace :title, "My Blog – " %> 203 | <% replace :description, "Justin French blogs here on Ruby, Rails, Design, Formtastic, etc" %> 204 | <% prepend :keywords, "blog, weblog, design links, ruby links, formtastic release notes, " %> 205 | <%= yield %> 206 | <% end %> 207 | ``` 208 | 209 | Now in our blog index view we can use `blog` layout and fill in the areas with 210 | content specific to the index action. 211 | 212 | 213 | `app/views/posts/index.html.erb`: 214 | 215 | ``` erb 216 | <% replace :content do %> 217 |

My Blog

218 | <%= render @articles %> 219 | <% end %> 220 | 221 | <% append :sidebar do %> 222 |

Blog Roll

223 | <%= render @links %> 224 | <% end %> 225 | ``` 226 | 227 | We also need to instruct the `PostsController` to use this `blog` layout: 228 | 229 | `app/controllers/posts_controller.rb`: 230 | 231 | ``` ruby 232 | class PostsController < ApplicationController 233 | layout 'blog' 234 | end 235 | ``` 236 | 237 | ## Caching 238 | Nestive works the same way `content_for` does and has the same caching 239 | drawbacks. That means that nestive helpers are completely ignored when called 240 | from within cached block. You probably don't want to use fragment caching 241 | around dynamic nestive areas and have to be extra careful what and how you 242 | cache to avoid unpleasant surprises. 243 | 244 | ## Installation 245 | 246 | * add `gem 'nestive', '~> 0.5'` to your Gemfile 247 | * run `bundle` 248 | 249 | ## Compatibility 250 | 251 | Nestive should work properly with any Rails 3 and 4. Since version 0.5 only 252 | Ruby 1.9.3 and newer are supported. For 1.8 compatibility use version 0.4. 253 | 254 | 255 | *Nestive doesn't monkey patch or fiddle with any default behaviors in Rails.* Use it when you want to, don't when you don't. 256 | 257 | ## You can help with... 258 | 259 | * feedback 260 | * reporting issues 261 | * fixing issues with pull requests 262 | * performance testing 263 | 264 | ## Twitter 265 | 266 | * [@rwz](https://twitter.com/rwz) — current maintainer 267 | * [@justinfrench](http://twitter.com/justinfrench) — author 268 | -------------------------------------------------------------------------------- /lib/nestive/layout_helper.rb: -------------------------------------------------------------------------------- 1 | module Nestive 2 | 3 | # The Nestive LayoutHelper provides a handful of helper methods for use in your layouts and views. 4 | # 5 | # See the documentation for each individual method for detailed information, but at a high level, 6 | # your parent layouts define `area`s of content. You can define an area and optionally add content 7 | # to it at the same time using either a String, or a block: 8 | # 9 | # # app/views/layouts/global.html.erb 10 | # 11 | # 12 | # <%= area :title, "MySite.com" %> 13 | # 14 | # 15 | #
16 | # <%= area :content %> 17 | #
18 | # 24 | # 25 | # 26 | # 27 | # Your child layouts (or views) inherit and modify the parent by wrapping in an `extends` block 28 | # helper. You can then either `append`, `prepend` or `replace` the content that has previously 29 | # been assigned to each area by parent layouts. 30 | # 31 | # The `append`, `prepend` or `replace` helpers are *similar* to Rails' own `content_for`, which 32 | # accepts content for the named area with either a String or with a block). They're different to 33 | # `content_for` because they're only used modify the content assigned to the area, not retrieve it: 34 | # 35 | # # app/views/layouts/admin.html.erb 36 | # <%= extends :global do %> 37 | # <% prepend :title, "Admin :: " %> 38 | # <% replace :sidebar do %> 39 | #

Quick Links

40 | # 43 | # <% end %> 44 | # <% end %> 45 | # 46 | # # app/views/admin/posts/index.html.erb 47 | # <%= extends :admin do %> 48 | # <% prepend :title, "Posts ::" %> 49 | # <% replace :content do %> 50 | # Normal view stuff goes here. 51 | # <% end %> 52 | # <% end %> 53 | module LayoutHelper 54 | 55 | # Declares that the current layour (or view) is inheriting from and extending another layout. 56 | # 57 | # @param [String] layout 58 | # The base name of the file in `layouts/` that you wish to extend (eg `application` for `layouts/application.html.erb`) 59 | # 60 | # @example Extending the `application` layout to create an `admin` layout 61 | # 62 | # # app/views/layouts/admin.html.erb 63 | # <%= extends :application do %> 64 | # ... 65 | # <% end %> 66 | # 67 | # @example Extending the `admin` layout in a view (you'll need to render the view with `layout: nil`) 68 | # 69 | # # app/controllers/admin/posts_controller.rb 70 | # class Admin::PostsController < ApplicationController 71 | # # You can disable Rails' layout rendering for all actions 72 | # layout nil 73 | # 74 | # # Or disable Rails' layout rendering per-controller 75 | # def index 76 | # render layout: nil 77 | # end 78 | # end 79 | # 80 | # # app/views/admin/posts/index.html.erb 81 | # <%= extends :admin do %> 82 | # ... 83 | # <% end %> 84 | def extends(layout, &block) 85 | # Make sure it's a string 86 | layout = layout.to_s 87 | 88 | # If there's no directory component, presume a plain layout name 89 | layout = "layouts/#{layout}" unless layout.include?('/') 90 | 91 | # Capture the content to be placed inside the extended layout 92 | @view_flow.get(:layout).replace capture(&block).to_s 93 | 94 | render file: layout 95 | end 96 | 97 | # Defines an area of content in your layout that can be modified or replaced by child layouts 98 | # that extend it. You can optionally add content to an area using either a String, or a block. 99 | # 100 | # Areas are declared in a parent layout and modified by a child layout, but since Nestive 101 | # allows for multiple levels of inheritance, a child layout can also declare an area for it's 102 | # children to modify. 103 | # 104 | # @example Define an area without adding content to it: 105 | # <%= area :sidebar %> 106 | # 107 | # @example Define an area and add a String of content to it: 108 | # <%= area :sidebar, "Some content." %> 109 | # 110 | # @example Define an area and add content to it with a block: 111 | # <%= area :sidebar do %> 112 | # Some content. 113 | # <% end %> 114 | # 115 | # @example Define an area in a child layout: 116 | # <%= extends :global do %> 117 | # <%= area :sidebar do %> 118 | # Some content. 119 | # <% end %> 120 | # <% end %> 121 | # 122 | # @param [Symbol] name 123 | # A unique name to identify this area of content. 124 | # 125 | # @param [String] content 126 | # An optional String of content to add to the area as you declare it. 127 | def area(name, content=nil, &block) 128 | content = capture(&block) if block_given? 129 | append name, content 130 | render_area name 131 | end 132 | 133 | # Appends content to an area previously defined or modified in parent layout(s). You can provide 134 | # the content using either a String, or a block. 135 | # 136 | # @example Appending content with a String 137 | # <% append :sidebar, "Some content." %> 138 | # 139 | # @example Appending content with a block: 140 | # <% append :sidebar do %> 141 | # Some content. 142 | # <% end %> 143 | # 144 | # @param [Symbol] name 145 | # A name to identify the area of content you wish to append to 146 | # 147 | # @param [String] content 148 | # Optionally provide a String of content, instead of a block. A block will take precedence. 149 | def append(name, content=nil, &block) 150 | content = capture(&block) if block_given? 151 | add_instruction_to_area name, :push, content 152 | end 153 | 154 | # Prepends content to an area previously declared or modified in parent layout(s). You can 155 | # provide the content using either a String, or a block. 156 | # 157 | # @example Prepending content with a String 158 | # <% prepend :sidebar, "Some content." %> 159 | # 160 | # @example Prepending content with a block: 161 | # <% prepend :sidebar do %> 162 | # Some content. 163 | # <% end %> 164 | # 165 | # @param [Symbol] name 166 | # A name to identify the area of content you wish to prepend to 167 | # 168 | # @param [String] content 169 | # Optionally provide a String of content, instead of a block. A block will take precedence. 170 | def prepend(name, content=nil, &block) 171 | content = capture(&block) if block_given? 172 | add_instruction_to_area name, :unshift, content 173 | end 174 | 175 | # Replaces the content of an area previously declared or modified in parent layout(s). You can 176 | # provide the content using either a String, or a block. 177 | # 178 | # @example Replacing content with a String 179 | # <% replace :sidebar, "New content." %> 180 | # 181 | # @example Replacing content with a block: 182 | # <% replace :sidebar do %> 183 | # New content. 184 | # <% end %> 185 | # 186 | # @param [Symbol] name 187 | # A name to identify the area of content you wish to replace 188 | # 189 | # @param [String] content 190 | # Optionally provide a String of content, instead of a block. A block will take precedence. 191 | def replace(name, content=nil, &block) 192 | content = capture(&block) if block_given? 193 | add_instruction_to_area name, :replace, [content] 194 | end 195 | 196 | # Purge the content of an area previously declared or modified in parent layout(s). 197 | # 198 | # @example Purge content 199 | # <% purge :sidebar %> 200 | # 201 | # @param names 202 | # A list of area names to purge 203 | def purge(*names) 204 | names.each{ |name| replace(name, nil)} 205 | end 206 | 207 | private 208 | 209 | # We record the instructions (declaring, appending, prepending and replacing) for an area of 210 | # content into an array that we can later retrieve and replay. Instructions are stored in an 211 | # instance variable Hash `@_area_for`, with each key representing an area name, and each value 212 | # an Array of instructions. Each instruction is a two element array containing a instruction 213 | # method (eg `:push`, `:unshift`, `:replace`) and a value (content String). 214 | # 215 | # @_area_for[:sidebar] # => [ [:push,"World"], [:unshift,"Hello"] ] 216 | # 217 | # Due to the way we extend layouts (render the parent layout after the child), the instructions 218 | # are captured in reverse order. `render_area` reversed them and plays them back at rendering 219 | # time. 220 | # 221 | # @example 222 | # add_instruction_to_area(:sidebar, :push, "More content.") 223 | def add_instruction_to_area(name, instruction, value) 224 | @_area_for ||= {} 225 | @_area_for[name] ||= [] 226 | @_area_for[name] << [instruction, value] 227 | nil 228 | end 229 | 230 | # Take the instructions we've gathered for the area and replay them one after the other on 231 | # an empty array. These instructions will push, unshift or replace items into our output array, 232 | # which we then join and mark as html_safe. 233 | # 234 | # These instructions are reversed and replayed when we render the block (rather than as they 235 | # happen) due to the way they are gathered by the layout extension process (in reverse). 236 | def render_area(name) 237 | [].tap do |output| 238 | @_area_for.fetch(name, []).reverse_each do |method_name, content| 239 | output.public_send method_name, content 240 | end 241 | end.join.html_safe 242 | end 243 | 244 | end 245 | end 246 | --------------------------------------------------------------------------------