arbre 1.0.0.rc4 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
 - data/.gitignore +6 -3
 - data/.rubocop.yml +15 -0
 - data/.travis.yml +16 -0
 - data/CHANGELOG.md +86 -3
 - data/Gemfile +17 -5
 - data/Gemfile.lock +224 -0
 - data/LICENSE +20 -0
 - data/README.md +43 -0
 - data/Rakefile +19 -0
 - data/arbre.gemspec +3 -0
 - data/docs/Gemfile +2 -0
 - data/docs/_config.yml +7 -0
 - data/docs/_includes/footer.html +8 -0
 - data/docs/_includes/google-analytics.html +16 -0
 - data/docs/_includes/head.html +7 -0
 - data/docs/_includes/toc.html +12 -0
 - data/docs/_includes/top-menu.html +8 -0
 - data/docs/_layouts/default.html +21 -0
 - data/docs/index.md +106 -0
 - data/docs/stylesheets/main.css +1152 -0
 - data/lib/arbre/context.rb +34 -3
 - data/lib/arbre/element/builder_methods.rb +4 -5
 - data/lib/arbre/element/proxy.rb +28 -0
 - data/lib/arbre/element.rb +12 -6
 - data/lib/arbre/element_collection.rb +1 -1
 - data/lib/arbre/html/attributes.rb +11 -2
 - data/lib/arbre/html/class_list.rb +4 -0
 - data/lib/arbre/html/document.rb +1 -1
 - data/lib/arbre/html/html5_elements.rb +4 -4
 - data/lib/arbre/html/tag.rb +24 -9
 - data/lib/arbre/html/text_node.rb +4 -0
 - data/lib/arbre/rails/forms.rb +70 -67
 - data/lib/arbre/rails/template_handler.rb +7 -5
 - data/lib/arbre/version.rb +1 -1
 - data/spec/arbre/integration/html_spec.rb +118 -110
 - data/spec/arbre/unit/component_spec.rb +9 -9
 - data/spec/arbre/unit/context_spec.rb +8 -8
 - data/spec/arbre/unit/element_finder_methods_spec.rb +44 -29
 - data/spec/arbre/unit/element_spec.rb +64 -45
 - data/spec/arbre/unit/html/class_list_spec.rb +16 -0
 - data/spec/arbre/unit/html/tag_attributes_spec.rb +20 -18
 - data/spec/arbre/unit/html/tag_spec.rb +51 -15
 - data/spec/changelog_spec.rb +27 -0
 - data/spec/rails/integration/forms_spec.rb +14 -30
 - data/spec/rails/integration/rendering_spec.rb +46 -20
 - data/spec/rails/rails_spec_helper.rb +8 -11
 - data/spec/rails/stub_app/log/.gitignore +1 -1
 - data/spec/rails/support/mock_person.rb +15 -0
 - data/spec/rails/templates/arbre/_partial_with_assignment.arb +1 -0
 - data/spec/rails/templates/arbre/page_with_arb_partial_and_assignment.arb +3 -0
 - data/tasks/lint.rake +69 -0
 - data/tasks/release.rake +6 -0
 - metadata +43 -47
 - data/.DS_Store +0 -0
 - data/README.rdoc +0 -69
 - data/lib/.DS_Store +0 -0
 
| 
         @@ -25,49 +25,75 @@ class TestController < ActionController::Base 
     | 
|
| 
       25 
25 
     | 
    
         
             
                @my_instance_var = "From Instance Var"
         
     | 
| 
       26 
26 
     | 
    
         
             
                render "arbre/page_with_assignment"
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              def render_partial_with_instance_variable
         
     | 
| 
      
 30 
     | 
    
         
            +
                @my_instance_var = "From Instance Var"
         
     | 
| 
      
 31 
     | 
    
         
            +
                render "arbre/page_with_arb_partial_and_assignment"
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
       28 
33 
     | 
    
         
             
            end
         
     | 
| 
       29 
34 
     | 
    
         | 
| 
       30 
35 
     | 
    
         | 
| 
       31 
     | 
    
         
            -
            describe TestController, "Rendering with Arbre", : 
     | 
| 
      
 36 
     | 
    
         
            +
            describe TestController, "Rendering with Arbre", type: :request do
         
     | 
| 
       32 
37 
     | 
    
         
             
              let(:body){ response.body }
         
     | 
| 
       33 
38 
     | 
    
         | 
| 
      
 39 
     | 
    
         
            +
              before do
         
     | 
| 
      
 40 
     | 
    
         
            +
                Rails.application.routes.draw do
         
     | 
| 
      
 41 
     | 
    
         
            +
                  get 'test/render_empty', controller: "test"
         
     | 
| 
      
 42 
     | 
    
         
            +
                  get 'test/render_simple_page', controller: "test"
         
     | 
| 
      
 43 
     | 
    
         
            +
                  get 'test/render_partial', controller: "test"
         
     | 
| 
      
 44 
     | 
    
         
            +
                  get 'test/render_erb_partial', controller: "test"
         
     | 
| 
      
 45 
     | 
    
         
            +
                  get 'test/render_with_instance_variable', controller: "test"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  get 'test/render_partial_with_instance_variable', controller: "test"
         
     | 
| 
      
 47 
     | 
    
         
            +
                  get 'test/render_page_with_helpers', controller: "test"
         
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              after do
         
     | 
| 
      
 52 
     | 
    
         
            +
                Rails.application.reload_routes!
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
       34 
55 
     | 
    
         
             
              it "should render the empty template" do
         
     | 
| 
       35 
56 
     | 
    
         
             
                get "/test/render_empty"
         
     | 
| 
       36 
     | 
    
         
            -
                response. 
     | 
| 
      
 57 
     | 
    
         
            +
                expect(response).to be_successful
         
     | 
| 
       37 
58 
     | 
    
         
             
              end
         
     | 
| 
       38 
59 
     | 
    
         | 
| 
       39 
60 
     | 
    
         
             
              it "should render a simple page" do
         
     | 
| 
       40 
61 
     | 
    
         
             
                get "/test/render_simple_page"
         
     | 
| 
       41 
     | 
    
         
            -
                response. 
     | 
| 
       42 
     | 
    
         
            -
                body. 
     | 
| 
       43 
     | 
    
         
            -
                body. 
     | 
| 
      
 62 
     | 
    
         
            +
                expect(response).to be_successful
         
     | 
| 
      
 63 
     | 
    
         
            +
                expect(body).to have_selector("h1", text: "Hello World")
         
     | 
| 
      
 64 
     | 
    
         
            +
                expect(body).to have_selector("p", text: "Hello again!")
         
     | 
| 
       44 
65 
     | 
    
         
             
              end
         
     | 
| 
       45 
66 
     | 
    
         | 
| 
       46 
67 
     | 
    
         
             
              it "should render an arb partial" do
         
     | 
| 
       47 
68 
     | 
    
         
             
                get "/test/render_partial"
         
     | 
| 
       48 
     | 
    
         
            -
                response. 
     | 
| 
       49 
     | 
    
         
            -
                body. 
     | 
| 
       50 
     | 
    
         
            -
            <h1>Before Partial</h1>
         
     | 
| 
       51 
     | 
    
         
            -
            <p>Hello from a partial</p>
         
     | 
| 
       52 
     | 
    
         
            -
            <h2>After Partial</h2>
         
     | 
| 
       53 
     | 
    
         
            -
             
     | 
| 
      
 69 
     | 
    
         
            +
                expect(response).to be_successful
         
     | 
| 
      
 70 
     | 
    
         
            +
                expect(body).to eq <<~HTML
         
     | 
| 
      
 71 
     | 
    
         
            +
                  <h1>Before Partial</h1>
         
     | 
| 
      
 72 
     | 
    
         
            +
                  <p>Hello from a partial</p>
         
     | 
| 
      
 73 
     | 
    
         
            +
                  <h2>After Partial</h2>
         
     | 
| 
      
 74 
     | 
    
         
            +
                HTML
         
     | 
| 
       54 
75 
     | 
    
         
             
              end
         
     | 
| 
       55 
76 
     | 
    
         | 
| 
       56 
77 
     | 
    
         
             
              it "should render an erb (or other) partial" do
         
     | 
| 
       57 
78 
     | 
    
         
             
                get "/test/render_erb_partial"
         
     | 
| 
       58 
     | 
    
         
            -
                response. 
     | 
| 
       59 
     | 
    
         
            -
                body. 
     | 
| 
       60 
     | 
    
         
            -
            <h1>Before Partial</h1>
         
     | 
| 
       61 
     | 
    
         
            -
            <p>Hello from an erb partial</p>
         
     | 
| 
       62 
     | 
    
         
            -
            <h2>After Partial</h2>
         
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
      
 79 
     | 
    
         
            +
                expect(response).to be_successful
         
     | 
| 
      
 80 
     | 
    
         
            +
                expect(body).to eq <<~HTML
         
     | 
| 
      
 81 
     | 
    
         
            +
                  <h1>Before Partial</h1>
         
     | 
| 
      
 82 
     | 
    
         
            +
                  <p>Hello from an erb partial</p>
         
     | 
| 
      
 83 
     | 
    
         
            +
                  <h2>After Partial</h2>
         
     | 
| 
      
 84 
     | 
    
         
            +
                HTML
         
     | 
| 
       64 
85 
     | 
    
         
             
              end
         
     | 
| 
       65 
86 
     | 
    
         | 
| 
       66 
87 
     | 
    
         
             
              it "should render with instance variables" do
         
     | 
| 
       67 
     | 
    
         
            -
                get "test/render_with_instance_variable"
         
     | 
| 
       68 
     | 
    
         
            -
                response. 
     | 
| 
       69 
     | 
    
         
            -
                body. 
     | 
| 
      
 88 
     | 
    
         
            +
                get "/test/render_with_instance_variable"
         
     | 
| 
      
 89 
     | 
    
         
            +
                expect(response).to be_successful
         
     | 
| 
      
 90 
     | 
    
         
            +
                expect(body).to have_selector("h1", text: "From Instance Var")
         
     | 
| 
       70 
91 
     | 
    
         
             
              end
         
     | 
| 
       71 
92 
     | 
    
         | 
| 
      
 93 
     | 
    
         
            +
              it "should render an arbre partial with assignments" do
         
     | 
| 
      
 94 
     | 
    
         
            +
                get "/test/render_partial_with_instance_variable"
         
     | 
| 
      
 95 
     | 
    
         
            +
                expect(response).to be_successful
         
     | 
| 
      
 96 
     | 
    
         
            +
                expect(body).to have_selector("p", text: "Partial: From Instance Var")
         
     | 
| 
      
 97 
     | 
    
         
            +
              end
         
     | 
| 
       72 
98 
     | 
    
         | 
| 
       73 
99 
     | 
    
         
             
            end
         
     | 
| 
         @@ -1,33 +1,30 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            require ' 
     | 
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
       2 
3 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            require 'capybara/rspec'
         
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
            # Combustion
         
     | 
| 
       6 
4 
     | 
    
         
             
            require 'combustion'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
       7 
6 
     | 
    
         
             
            Combustion.path = 'spec/rails/stub_app'
         
     | 
| 
       8 
7 
     | 
    
         
             
            Combustion.initialize! :action_controller,
         
     | 
| 
       9 
     | 
    
         
            -
                                   :action_view 
     | 
| 
       10 
     | 
    
         
            -
                                   :sprockets
         
     | 
| 
      
 8 
     | 
    
         
            +
                                   :action_view
         
     | 
| 
       11 
9 
     | 
    
         | 
| 
       12 
10 
     | 
    
         
             
            require 'rspec/rails'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'capybara/rspec'
         
     | 
| 
       13 
12 
     | 
    
         
             
            require 'capybara/rails'
         
     | 
| 
       14 
13 
     | 
    
         | 
| 
       15 
14 
     | 
    
         
             
            require 'spec_helper'
         
     | 
| 
       16 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
            require 'rails/support/mock_person'
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
       17 
18 
     | 
    
         
             
            # Ensure that the rails plugin is installed
         
     | 
| 
       18 
19 
     | 
    
         
             
            require 'arbre/rails'
         
     | 
| 
       19 
20 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
            Rails.application.routes.draw do
         
     | 
| 
       21 
     | 
    
         
            -
              match 'test/:action', :controller => "test"
         
     | 
| 
       22 
     | 
    
         
            -
            end
         
     | 
| 
       23 
     | 
    
         
            -
             
     | 
| 
       24 
21 
     | 
    
         
             
            module AdditionalHelpers
         
     | 
| 
       25 
22 
     | 
    
         | 
| 
       26 
23 
     | 
    
         
             
              def protect_against_forgery?
         
     | 
| 
       27 
24 
     | 
    
         
             
                true
         
     | 
| 
       28 
25 
     | 
    
         
             
              end
         
     | 
| 
       29 
26 
     | 
    
         | 
| 
       30 
     | 
    
         
            -
              def form_authenticity_token
         
     | 
| 
      
 27 
     | 
    
         
            +
              def form_authenticity_token(form_options: {})
         
     | 
| 
       31 
28 
     | 
    
         
             
                "AUTH_TOKEN"
         
     | 
| 
       32 
29 
     | 
    
         
             
              end
         
     | 
| 
       33 
30 
     | 
    
         | 
| 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            *.log
         
     | 
| 
      
 1 
     | 
    
         
            +
            *.log
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            para "Partial: #{my_instance_var}"
         
     | 
    
        data/tasks/lint.rake
    ADDED
    
    | 
         @@ -0,0 +1,69 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require "open3"
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            #
         
     | 
| 
      
 4 
     | 
    
         
            +
            # Common stuff for a linter
         
     | 
| 
      
 5 
     | 
    
         
            +
            #
         
     | 
| 
      
 6 
     | 
    
         
            +
            module LinterMixin
         
     | 
| 
      
 7 
     | 
    
         
            +
              def run
         
     | 
| 
      
 8 
     | 
    
         
            +
                offenses = []
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                applicable_files.each do |file|
         
     | 
| 
      
 11 
     | 
    
         
            +
                  if clean?(file)
         
     | 
| 
      
 12 
     | 
    
         
            +
                    print "."
         
     | 
| 
      
 13 
     | 
    
         
            +
                  else
         
     | 
| 
      
 14 
     | 
    
         
            +
                    offenses << file
         
     | 
| 
      
 15 
     | 
    
         
            +
                    print "F"
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                print "\n"
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                return if offenses.empty?
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                raise failure_message_for(offenses)
         
     | 
| 
      
 24 
     | 
    
         
            +
              end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
              private
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
              def applicable_files
         
     | 
| 
      
 29 
     | 
    
         
            +
                Open3.capture2("git grep -Il ''")[0].split
         
     | 
| 
      
 30 
     | 
    
         
            +
              end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
              def failure_message_for(offenses)
         
     | 
| 
      
 33 
     | 
    
         
            +
                msg = "#{self.class.name} detected offenses. "
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                msg += if respond_to?(:fixing_cmd)
         
     | 
| 
      
 36 
     | 
    
         
            +
                         "Run `#{fixing_cmd(offenses)}` to fix them."
         
     | 
| 
      
 37 
     | 
    
         
            +
                       else
         
     | 
| 
      
 38 
     | 
    
         
            +
                         "Affected files: #{offenses.join(' ')}"
         
     | 
| 
      
 39 
     | 
    
         
            +
                       end
         
     | 
| 
      
 40 
     | 
    
         
            +
             
     | 
| 
      
 41 
     | 
    
         
            +
                msg
         
     | 
| 
      
 42 
     | 
    
         
            +
              end
         
     | 
| 
      
 43 
     | 
    
         
            +
            end
         
     | 
| 
      
 44 
     | 
    
         
            +
             
     | 
| 
      
 45 
     | 
    
         
            +
            #
         
     | 
| 
      
 46 
     | 
    
         
            +
            # Checks trailing new lines in files
         
     | 
| 
      
 47 
     | 
    
         
            +
            #
         
     | 
| 
      
 48 
     | 
    
         
            +
            class MissingTrailingCarriageReturn
         
     | 
| 
      
 49 
     | 
    
         
            +
              include LinterMixin
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
              def clean?(file)
         
     | 
| 
      
 52 
     | 
    
         
            +
                File.read(file) =~ /\n\Z/m
         
     | 
| 
      
 53 
     | 
    
         
            +
              end
         
     | 
| 
      
 54 
     | 
    
         
            +
            end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            require 'rubocop/rake_task'
         
     | 
| 
      
 57 
     | 
    
         
            +
            RuboCop::RakeTask.new
         
     | 
| 
      
 58 
     | 
    
         
            +
             
     | 
| 
      
 59 
     | 
    
         
            +
            desc "Lints ActiveAdmin code base"
         
     | 
| 
      
 60 
     | 
    
         
            +
            task lint: ["rubocop", "lint:missing_trailing_carriage_return"]
         
     | 
| 
      
 61 
     | 
    
         
            +
             
     | 
| 
      
 62 
     | 
    
         
            +
            namespace :lint do
         
     | 
| 
      
 63 
     | 
    
         
            +
              desc "Check for missing trailing new lines"
         
     | 
| 
      
 64 
     | 
    
         
            +
              task :missing_trailing_carriage_return do
         
     | 
| 
      
 65 
     | 
    
         
            +
                puts "Checking for missing trailing carriage returns..."
         
     | 
| 
      
 66 
     | 
    
         
            +
             
     | 
| 
      
 67 
     | 
    
         
            +
                MissingTrailingCarriageReturn.new.run
         
     | 
| 
      
 68 
     | 
    
         
            +
              end
         
     | 
| 
      
 69 
     | 
    
         
            +
            end
         
     | 
    
        data/tasks/release.rake
    ADDED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,27 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: arbre
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
       5 
     | 
    
         
            -
              prerelease: 6
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.2.1
         
     | 
| 
       6 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       8 
7 
     | 
    
         
             
            - Greg Bell
         
     | 
| 
       9 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2019-04-12 00:00:00.000000000 Z
         
     | 
| 
       13 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
       16 
     | 
    
         
            -
              requirement:  
     | 
| 
       17 
     | 
    
         
            -
                none: false
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
       18 
16 
     | 
    
         
             
                requirements:
         
     | 
| 
       19 
     | 
    
         
            -
                - -  
     | 
| 
      
 17 
     | 
    
         
            +
                - - ">="
         
     | 
| 
       20 
18 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       21 
19 
     | 
    
         
             
                    version: 3.0.0
         
     | 
| 
       22 
20 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       23 
21 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       24 
     | 
    
         
            -
              version_requirements:  
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: 3.0.0
         
     | 
| 
       25 
27 
     | 
    
         
             
            description: An Object Oriented DOM Tree in Ruby
         
     | 
| 
       26 
28 
     | 
    
         
             
            email:
         
     | 
| 
       27 
29 
     | 
    
         
             
            - gregdbell@gmail.com
         
     | 
| 
         @@ -29,19 +31,32 @@ executables: [] 
     | 
|
| 
       29 
31 
     | 
    
         
             
            extensions: []
         
     | 
| 
       30 
32 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       31 
33 
     | 
    
         
             
            files:
         
     | 
| 
       32 
     | 
    
         
            -
            - . 
     | 
| 
       33 
     | 
    
         
            -
            - . 
     | 
| 
      
 34 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 35 
     | 
    
         
            +
            - ".rubocop.yml"
         
     | 
| 
      
 36 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
       34 
37 
     | 
    
         
             
            - CHANGELOG.md
         
     | 
| 
       35 
38 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       36 
     | 
    
         
            -
            -  
     | 
| 
      
 39 
     | 
    
         
            +
            - Gemfile.lock
         
     | 
| 
      
 40 
     | 
    
         
            +
            - LICENSE
         
     | 
| 
      
 41 
     | 
    
         
            +
            - README.md
         
     | 
| 
       37 
42 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       38 
43 
     | 
    
         
             
            - arbre.gemspec
         
     | 
| 
       39 
     | 
    
         
            -
            -  
     | 
| 
      
 44 
     | 
    
         
            +
            - docs/Gemfile
         
     | 
| 
      
 45 
     | 
    
         
            +
            - docs/_config.yml
         
     | 
| 
      
 46 
     | 
    
         
            +
            - docs/_includes/footer.html
         
     | 
| 
      
 47 
     | 
    
         
            +
            - docs/_includes/google-analytics.html
         
     | 
| 
      
 48 
     | 
    
         
            +
            - docs/_includes/head.html
         
     | 
| 
      
 49 
     | 
    
         
            +
            - docs/_includes/toc.html
         
     | 
| 
      
 50 
     | 
    
         
            +
            - docs/_includes/top-menu.html
         
     | 
| 
      
 51 
     | 
    
         
            +
            - docs/_layouts/default.html
         
     | 
| 
      
 52 
     | 
    
         
            +
            - docs/index.md
         
     | 
| 
      
 53 
     | 
    
         
            +
            - docs/stylesheets/main.css
         
     | 
| 
       40 
54 
     | 
    
         
             
            - lib/arbre.rb
         
     | 
| 
       41 
55 
     | 
    
         
             
            - lib/arbre/component.rb
         
     | 
| 
       42 
56 
     | 
    
         
             
            - lib/arbre/context.rb
         
     | 
| 
       43 
57 
     | 
    
         
             
            - lib/arbre/element.rb
         
     | 
| 
       44 
58 
     | 
    
         
             
            - lib/arbre/element/builder_methods.rb
         
     | 
| 
      
 59 
     | 
    
         
            +
            - lib/arbre/element/proxy.rb
         
     | 
| 
       45 
60 
     | 
    
         
             
            - lib/arbre/element_collection.rb
         
     | 
| 
       46 
61 
     | 
    
         
             
            - lib/arbre/html/attributes.rb
         
     | 
| 
       47 
62 
     | 
    
         
             
            - lib/arbre/html/class_list.rb
         
     | 
| 
         @@ -59,9 +74,11 @@ files: 
     | 
|
| 
       59 
74 
     | 
    
         
             
            - spec/arbre/unit/context_spec.rb
         
     | 
| 
       60 
75 
     | 
    
         
             
            - spec/arbre/unit/element_finder_methods_spec.rb
         
     | 
| 
       61 
76 
     | 
    
         
             
            - spec/arbre/unit/element_spec.rb
         
     | 
| 
      
 77 
     | 
    
         
            +
            - spec/arbre/unit/html/class_list_spec.rb
         
     | 
| 
       62 
78 
     | 
    
         
             
            - spec/arbre/unit/html/tag_attributes_spec.rb
         
     | 
| 
       63 
79 
     | 
    
         
             
            - spec/arbre/unit/html/tag_spec.rb
         
     | 
| 
       64 
80 
     | 
    
         
             
            - spec/arbre/unit/html/text_node_spec.rb
         
     | 
| 
      
 81 
     | 
    
         
            +
            - spec/changelog_spec.rb
         
     | 
| 
       65 
82 
     | 
    
         
             
            - spec/rails/integration/forms_spec.rb
         
     | 
| 
       66 
83 
     | 
    
         
             
            - spec/rails/integration/rendering_spec.rb
         
     | 
| 
       67 
84 
     | 
    
         
             
            - spec/rails/rails_spec_helper.rb
         
     | 
| 
         @@ -70,8 +87,11 @@ files: 
     | 
|
| 
       70 
87 
     | 
    
         
             
            - spec/rails/stub_app/db/schema.rb
         
     | 
| 
       71 
88 
     | 
    
         
             
            - spec/rails/stub_app/log/.gitignore
         
     | 
| 
       72 
89 
     | 
    
         
             
            - spec/rails/stub_app/public/favicon.ico
         
     | 
| 
      
 90 
     | 
    
         
            +
            - spec/rails/support/mock_person.rb
         
     | 
| 
       73 
91 
     | 
    
         
             
            - spec/rails/templates/arbre/_partial.arb
         
     | 
| 
      
 92 
     | 
    
         
            +
            - spec/rails/templates/arbre/_partial_with_assignment.arb
         
     | 
| 
       74 
93 
     | 
    
         
             
            - spec/rails/templates/arbre/empty.arb
         
     | 
| 
      
 94 
     | 
    
         
            +
            - spec/rails/templates/arbre/page_with_arb_partial_and_assignment.arb
         
     | 
| 
       75 
95 
     | 
    
         
             
            - spec/rails/templates/arbre/page_with_assignment.arb
         
     | 
| 
       76 
96 
     | 
    
         
             
            - spec/rails/templates/arbre/page_with_erb_partial.arb
         
     | 
| 
       77 
97 
     | 
    
         
             
            - spec/rails/templates/arbre/page_with_partial.arb
         
     | 
| 
         @@ -79,53 +99,29 @@ files: 
     | 
|
| 
       79 
99 
     | 
    
         
             
            - spec/rails/templates/erb/_partial.erb
         
     | 
| 
       80 
100 
     | 
    
         
             
            - spec/spec_helper.rb
         
     | 
| 
       81 
101 
     | 
    
         
             
            - spec/support/bundle.rb
         
     | 
| 
      
 102 
     | 
    
         
            +
            - tasks/lint.rake
         
     | 
| 
      
 103 
     | 
    
         
            +
            - tasks/release.rake
         
     | 
| 
       82 
104 
     | 
    
         
             
            homepage: ''
         
     | 
| 
       83 
     | 
    
         
            -
            licenses: 
     | 
| 
      
 105 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 106 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 107 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
       84 
108 
     | 
    
         
             
            post_install_message: 
         
     | 
| 
       85 
109 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       86 
110 
     | 
    
         
             
            require_paths:
         
     | 
| 
       87 
111 
     | 
    
         
             
            - lib
         
     | 
| 
       88 
112 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       89 
     | 
    
         
            -
              none: false
         
     | 
| 
       90 
113 
     | 
    
         
             
              requirements:
         
     | 
| 
       91 
     | 
    
         
            -
              - -  
     | 
| 
      
 114 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       92 
115 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       93 
     | 
    
         
            -
                  version: ' 
     | 
| 
      
 116 
     | 
    
         
            +
                  version: '2.3'
         
     | 
| 
       94 
117 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       95 
     | 
    
         
            -
              none: false
         
     | 
| 
       96 
118 
     | 
    
         
             
              requirements:
         
     | 
| 
       97 
     | 
    
         
            -
              - -  
     | 
| 
      
 119 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       98 
120 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       99 
     | 
    
         
            -
                  version:  
     | 
| 
      
 121 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       100 
122 
     | 
    
         
             
            requirements: []
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
       102 
     | 
    
         
            -
            rubygems_version: 1.8.10
         
     | 
| 
      
 123 
     | 
    
         
            +
            rubygems_version: 3.0.3
         
     | 
| 
       103 
124 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       104 
     | 
    
         
            -
            specification_version:  
     | 
| 
      
 125 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
       105 
126 
     | 
    
         
             
            summary: An Object Oriented DOM Tree in Ruby
         
     | 
| 
       106 
     | 
    
         
            -
            test_files:
         
     | 
| 
       107 
     | 
    
         
            -
            - spec/arbre/integration/html_spec.rb
         
     | 
| 
       108 
     | 
    
         
            -
            - spec/arbre/unit/component_spec.rb
         
     | 
| 
       109 
     | 
    
         
            -
            - spec/arbre/unit/context_spec.rb
         
     | 
| 
       110 
     | 
    
         
            -
            - spec/arbre/unit/element_finder_methods_spec.rb
         
     | 
| 
       111 
     | 
    
         
            -
            - spec/arbre/unit/element_spec.rb
         
     | 
| 
       112 
     | 
    
         
            -
            - spec/arbre/unit/html/tag_attributes_spec.rb
         
     | 
| 
       113 
     | 
    
         
            -
            - spec/arbre/unit/html/tag_spec.rb
         
     | 
| 
       114 
     | 
    
         
            -
            - spec/arbre/unit/html/text_node_spec.rb
         
     | 
| 
       115 
     | 
    
         
            -
            - spec/rails/integration/forms_spec.rb
         
     | 
| 
       116 
     | 
    
         
            -
            - spec/rails/integration/rendering_spec.rb
         
     | 
| 
       117 
     | 
    
         
            -
            - spec/rails/rails_spec_helper.rb
         
     | 
| 
       118 
     | 
    
         
            -
            - spec/rails/stub_app/config/database.yml
         
     | 
| 
       119 
     | 
    
         
            -
            - spec/rails/stub_app/config/routes.rb
         
     | 
| 
       120 
     | 
    
         
            -
            - spec/rails/stub_app/db/schema.rb
         
     | 
| 
       121 
     | 
    
         
            -
            - spec/rails/stub_app/log/.gitignore
         
     | 
| 
       122 
     | 
    
         
            -
            - spec/rails/stub_app/public/favicon.ico
         
     | 
| 
       123 
     | 
    
         
            -
            - spec/rails/templates/arbre/_partial.arb
         
     | 
| 
       124 
     | 
    
         
            -
            - spec/rails/templates/arbre/empty.arb
         
     | 
| 
       125 
     | 
    
         
            -
            - spec/rails/templates/arbre/page_with_assignment.arb
         
     | 
| 
       126 
     | 
    
         
            -
            - spec/rails/templates/arbre/page_with_erb_partial.arb
         
     | 
| 
       127 
     | 
    
         
            -
            - spec/rails/templates/arbre/page_with_partial.arb
         
     | 
| 
       128 
     | 
    
         
            -
            - spec/rails/templates/arbre/simple_page.arb
         
     | 
| 
       129 
     | 
    
         
            -
            - spec/rails/templates/erb/_partial.erb
         
     | 
| 
       130 
     | 
    
         
            -
            - spec/spec_helper.rb
         
     | 
| 
       131 
     | 
    
         
            -
            - spec/support/bundle.rb
         
     | 
| 
      
 127 
     | 
    
         
            +
            test_files: []
         
     | 
    
        data/.DS_Store
    DELETED
    
    | 
         Binary file 
     | 
    
        data/README.rdoc
    DELETED
    
    | 
         @@ -1,69 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            = Arbre - Ruby Object Oriented HTML Views
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
            Arbre is the DOM implemented in Ruby. This project is primarily used as
         
     | 
| 
       4 
     | 
    
         
            -
            the object oriented view layer in Active Admin.
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
            == Simple Usage
         
     | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
            A simple example of setting up an Arbre context and creating some html
         
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
                html = Arbre::Context.new do
         
     | 
| 
       11 
     | 
    
         
            -
                  h2 "Why Arbre is awesome?"
         
     | 
| 
       12 
     | 
    
         
            -
             
     | 
| 
       13 
     | 
    
         
            -
                  ul do
         
     | 
| 
       14 
     | 
    
         
            -
                    li "The DOM is implemented in ruby"
         
     | 
| 
       15 
     | 
    
         
            -
                    li "You can create object oriented views"
         
     | 
| 
       16 
     | 
    
         
            -
                    li "Templates suck"
         
     | 
| 
       17 
     | 
    
         
            -
                  end
         
     | 
| 
       18 
     | 
    
         
            -
                end
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
                puts html.to_s #=> <h2>Why</h2><ul><li></li></ul>
         
     | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
       22 
     | 
    
         
            -
             
     | 
| 
       23 
     | 
    
         
            -
            == The DOM in Ruby
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
       25 
     | 
    
         
            -
            The purpose of Arbre is to leave the view as ruby objects as long
         
     | 
| 
       26 
     | 
    
         
            -
            as possible. This allows OO Design to be used to implement the view layer.
         
     | 
| 
       27 
     | 
    
         
            -
             
     | 
| 
       28 
     | 
    
         
            -
             
     | 
| 
       29 
     | 
    
         
            -
                html = Arbre::Context.new do
         
     | 
| 
       30 
     | 
    
         
            -
                  h2 "Why Arbre is awesome?"
         
     | 
| 
       31 
     | 
    
         
            -
                end
         
     | 
| 
       32 
     | 
    
         
            -
             
     | 
| 
       33 
     | 
    
         
            -
                html.children.size #=> 1
         
     | 
| 
       34 
     | 
    
         
            -
                html.children.first #=> #<Arbre::HTML::H2>
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
            == Components
         
     | 
| 
       37 
     | 
    
         
            -
             
     | 
| 
       38 
     | 
    
         
            -
            The purpose of Arbre is to be able to create shareable and extendable HTML
         
     | 
| 
       39 
     | 
    
         
            -
            components. To do this, you create a subclass of Arbre::Component.
         
     | 
| 
       40 
     | 
    
         
            -
             
     | 
| 
       41 
     | 
    
         
            -
            For example:
         
     | 
| 
       42 
     | 
    
         
            -
             
     | 
| 
       43 
     | 
    
         
            -
                class Panel < Arbre::Component
         
     | 
| 
       44 
     | 
    
         
            -
                  builder_method :panel
         
     | 
| 
       45 
     | 
    
         
            -
             
     | 
| 
       46 
     | 
    
         
            -
                  def build(title, attributes = {})
         
     | 
| 
       47 
     | 
    
         
            -
                    super(attributes)
         
     | 
| 
       48 
     | 
    
         
            -
             
     | 
| 
       49 
     | 
    
         
            -
                    h3(title, :class => "panel-title")
         
     | 
| 
       50 
     | 
    
         
            -
                  end
         
     | 
| 
       51 
     | 
    
         
            -
                end
         
     | 
| 
       52 
     | 
    
         
            -
             
     | 
| 
       53 
     | 
    
         
            -
            The builder_method defines the method that will be called to build this component
         
     | 
| 
       54 
     | 
    
         
            -
            when using the DSL. The arguments passed into the builder_method will be passed 
         
     | 
| 
       55 
     | 
    
         
            -
            into the #build method for you.
         
     | 
| 
       56 
     | 
    
         
            -
             
     | 
| 
       57 
     | 
    
         
            -
            You can now use this panel in any Arbre context:
         
     | 
| 
       58 
     | 
    
         
            -
             
     | 
| 
       59 
     | 
    
         
            -
                html = Arbre::Context.new do
         
     | 
| 
       60 
     | 
    
         
            -
                  panel "Hello World", :id => "my-panel" do
         
     | 
| 
       61 
     | 
    
         
            -
                    span "Inside the panel"
         
     | 
| 
       62 
     | 
    
         
            -
                  end
         
     | 
| 
       63 
     | 
    
         
            -
                end
         
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
       65 
     | 
    
         
            -
                html.to_s #=>
         
     | 
| 
       66 
     | 
    
         
            -
                  # <div class='panel' id="my-panel">
         
     | 
| 
       67 
     | 
    
         
            -
                  #   <h3 class='panel-title'>Hello World</h3>
         
     | 
| 
       68 
     | 
    
         
            -
                  #   <span>Inside the panel</span>
         
     | 
| 
       69 
     | 
    
         
            -
                  # </div>
         
     | 
    
        data/lib/.DS_Store
    DELETED
    
    | 
         Binary file 
     |