pax_global_header00006660000000000000000000000064150724600230014511gustar00rootroot0000000000000052 comment=3d773f75a653e8ff6c6ce4eaa62d9e41b04731a7 activeadmin-arbre-35697e3/000077500000000000000000000000001507246002300153555ustar00rootroot00000000000000activeadmin-arbre-35697e3/.github/000077500000000000000000000000001507246002300167155ustar00rootroot00000000000000activeadmin-arbre-35697e3/.github/FUNDING.yml000066400000000000000000000000361507246002300205310ustar00rootroot00000000000000--- tidelift: rubygems/arbre activeadmin-arbre-35697e3/.github/dependabot.yml000066400000000000000000000031341507246002300215460ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: github-actions directory: / schedule: interval: daily groups: github_actions: patterns: - "*" - package-ecosystem: bundler directory: / schedule: interval: monthly versioning-strategy: lockfile-only groups: rails_default: patterns: - "*" - package-ecosystem: bundler directory: /gemfiles/rails_70 schedule: interval: monthly versioning-strategy: lockfile-only groups: rails_70: patterns: - "*" ignore: - dependency-name: rails versions: ">= 7.1.0" - dependency-name: railties versions: ">= 7.1.0" - dependency-name: rspec-rails versions: ">= 8.0.0" - package-ecosystem: bundler directory: /gemfiles/rails_71 schedule: interval: monthly versioning-strategy: lockfile-only groups: rails_71: patterns: - "*" ignore: - dependency-name: erb versions: ">= 5" - dependency-name: rails versions: ">= 7.2.0" - dependency-name: railties versions: ">= 7.2.0" - dependency-name: rspec-rails versions: ">= 8.0.0" - package-ecosystem: bundler directory: /gemfiles/rails_72 schedule: interval: monthly versioning-strategy: lockfile-only groups: rails_72: patterns: - "*" ignore: - dependency-name: erb versions: ">= 5" - dependency-name: rails versions: ">= 8.0.0" - dependency-name: railties versions: ">= 8.0.0" activeadmin-arbre-35697e3/.github/release.yml000066400000000000000000000000661507246002300210620ustar00rootroot00000000000000changelog: exclude: authors: - dependabot activeadmin-arbre-35697e3/.github/workflows/000077500000000000000000000000001507246002300207525ustar00rootroot00000000000000activeadmin-arbre-35697e3/.github/workflows/ci.yml000066400000000000000000000034551507246002300220770ustar00rootroot00000000000000name: ci on: pull_request: push: branches: - master jobs: test: runs-on: ubuntu-latest timeout-minutes: 15 strategy: fail-fast: false matrix: ruby: - "3.1" - "3.2" - "3.3" - "3.4" rails: - rails_70 - rails_71 - rails_72 - rails_80 exclude: - ruby: "3.1" rails: rails_80 - ruby: "3.4" rails: rails_70 steps: - uses: actions/checkout@v5 - name: Configure bundler (default) run: | echo "BUNDLE_GEMFILE=Gemfile" >> "$GITHUB_ENV" if: matrix.rails == 'rails_80' - name: Configure bundler (alternative) run: | echo "BUNDLE_GEMFILE=gemfiles/${{ matrix.rails }}/Gemfile" >> "$GITHUB_ENV" if: matrix.rails != 'rails_80' - uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby }} bundler-cache: true - name: Run tests env: COVERAGE: true run: | bundle exec rspec mv coverage/coverage.xml coverage/coverage-ruby-${{ matrix.ruby }}-${{ matrix.rails }}.xml - uses: actions/upload-artifact@v4 with: name: coverage-ruby-${{ matrix.ruby }}-${{ matrix.rails }} path: coverage if-no-files-found: error upload_coverage: name: Upload Coverage runs-on: ubuntu-latest needs: - test steps: - uses: actions/checkout@v5 - uses: actions/download-artifact@v5 with: pattern: coverage-ruby-* path: coverage merge-multiple: true - uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} directory: coverage fail_ci_if_error: true activeadmin-arbre-35697e3/.github/workflows/github-actions-lint.yml000066400000000000000000000012301507246002300253550ustar00rootroot00000000000000name: GitHub Actions Lint on: pull_request: jobs: github_actions_lint: name: Run actionlint runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: tj-actions/changed-files@v47 id: changed-files with: files: | .github/workflows/*.yaml .github/workflows/*.yml - uses: reviewdog/action-actionlint@v1 if: steps.changed-files.outputs.any_changed == 'true' with: fail_level: any filter_mode: nofilter # added (default), diff_context, file, nofilter github_token: ${{ secrets.GITHUB_TOKEN }} reporter: github-pr-check activeadmin-arbre-35697e3/.github/workflows/rubocop.yml000066400000000000000000000021751507246002300231530ustar00rootroot00000000000000name: Rubocop on: pull_request: env: RUBY_VERSION: ${{ vars.RUBOCOP_RUBY_VERSION || '3.4' }} jobs: rubocop: name: Run rubocop runs-on: ubuntu-latest env: BUNDLE_ONLY: ${{ vars.RUBOCOP_BUNDLE_ONLY || 'rubocop' }} steps: - uses: actions/checkout@v5 - uses: tj-actions/changed-files@v47 id: changed-files with: files: | .github/workflows/rubocop.yml .rubocop.yml **.rb **.arb bin/* docs/Gemfile gemfiles/**/Gemfile Gemfile* Rakefile *.gemspec - uses: ruby/setup-ruby@v1 if: steps.changed-files.outputs.any_changed == 'true' with: ruby-version: ${{ env.RUBY_VERSION }} bundler-cache: true - uses: reviewdog/action-rubocop@v2 if: steps.changed-files.outputs.any_changed == 'true' with: fail_level: any filter_mode: nofilter # added (default), diff_context, file, nofilter github_token: ${{ secrets.GITHUB_TOKEN }} skip_install: true use_bundler: true activeadmin-arbre-35697e3/.github/workflows/yaml-lint.yml000066400000000000000000000011361507246002300234040ustar00rootroot00000000000000name: YAML Lint on: pull_request: jobs: yaml_lint: name: Run yamllint runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 - uses: tj-actions/changed-files@v47 id: changed-files with: files: | **.yaml **.yml - uses: reviewdog/action-yamllint@v1 if: steps.changed-files.outputs.any_changed == 'true' with: fail_level: any filter_mode: nofilter # added (default), diff_context, file, nofilter github_token: ${{ secrets.GITHUB_TOKEN }} reporter: github-pr-check activeadmin-arbre-35697e3/.gitignore000066400000000000000000000001451507246002300173450ustar00rootroot00000000000000*.gem .bundle pkg/* benchmarks .rvmrc .ruby-version .ruby-gemset tags .DS_Store docs/_site coverage/ activeadmin-arbre-35697e3/.rubocop.yml000066400000000000000000000207561507246002300176410ustar00rootroot00000000000000--- plugins: - rubocop-capybara - rubocop-packaging - rubocop-performance - rubocop-rspec AllCops: DisabledByDefault: true DisplayCopNames: true DisplayStyleGuide: true TargetRubyVersion: 3.1 Capybara: Enabled: true Capybara/ClickLinkOrButtonStyle: Enabled: true Capybara/CurrentPathExpectation: Enabled: true Capybara/FindAllFirst: Enabled: true Capybara/MatchStyle: Enabled: true Capybara/NegationMatcher: Enabled: true Capybara/NegationMatcherAfterVisit: Enabled: true Capybara/RedundantWithinFind: Enabled: true Capybara/RSpec/HaveSelector: Enabled: true Capybara/RSpec/PredicateMatcher: Enabled: true Capybara/SpecificActions: Enabled: true Capybara/SpecificFinders: Enabled: true Capybara/SpecificMatcher: Enabled: true Capybara/VisibilityMatcher: Enabled: true Metrics: Enabled: false Layout/CommentIndentation: Enabled: true Layout/EmptyLines: Enabled: true Layout/EmptyLinesAroundAccessModifier: Enabled: true Layout/EmptyLinesAroundClassBody: Enabled: true Layout/ExtraSpacing: Enabled: true Layout/HeredocIndentation: Enabled: true Layout/IndentationConsistency: Enabled: true Layout/IndentationWidth: Enabled: true Layout/IndentationStyle: Enabled: true Layout/TrailingWhitespace: Enabled: true Layout/TrailingEmptyLines: Enabled: true Lint/AmbiguousOperator: Enabled: true Lint/AmbiguousRegexpLiteral: Enabled: true Lint/UselessAssignment: Enabled: true Packaging/BundlerSetupInTests: Enabled: true Packaging/GemspecGit: Enabled: true Packaging/RequireHardcodingLib: Enabled: true Packaging/RequireRelativeHardcodingLib: Enabled: true Performance: Enabled: true Performance/AncestorsInclude: Enabled: false Performance/ArraySemiInfiniteRangeSlice: Enabled: false Performance/BigDecimalWithNumericArgument: Enabled: true Performance/BindCall: Enabled: true Performance/BlockGivenWithExplicitBlock: Enabled: true Performance/Caller: Enabled: true Performance/CaseWhenSplat: Enabled: true Performance/Casecmp: Enabled: false Performance/ChainArrayAllocation: Enabled: false Performance/CollectionLiteralInLoop: Enabled: true Exclude: - spec/**/* Performance/CompareWithBlock: Enabled: true Performance/ConcurrentMonotonicTime: Enabled: true Performance/ConstantRegexp: Enabled: true Performance/Count: Enabled: true Performance/DeletePrefix: Enabled: true Performance/DeleteSuffix: Enabled: true Performance/Detect: Enabled: true Performance/DoubleStartEndWith: Enabled: true IncludeActiveSupportAliases: true Performance/EndWith: Enabled: true Performance/FixedSize: Enabled: true Performance/FlatMap: Enabled: true EnabledForFlattenWithoutParams: false Performance/InefficientHashSearch: Enabled: true Performance/IoReadlines: Enabled: true Performance/MapCompact: Enabled: false Performance/MapMethodChain: Enabled: false Performance/MethodObjectAsBlock: Enabled: true Performance/OpenStruct: Enabled: true Performance/RangeInclude: Enabled: true Performance/RedundantBlockCall: Enabled: false Performance/RedundantEqualityComparisonBlock: Enabled: false Performance/RedundantMatch: Enabled: true Performance/RedundantMerge: Enabled: true MaxKeyValuePairs: 2 Performance/RedundantSortBlock: Enabled: true Performance/RedundantSplitRegexpArgument: Enabled: true Performance/RedundantStringChars: Enabled: true Performance/RegexpMatch: Enabled: true Performance/ReverseEach: Enabled: true Performance/ReverseFirst: Enabled: true Performance/SelectMap: Enabled: false Performance/Size: Enabled: true Performance/SortReverse: Enabled: true Performance/Squeeze: Enabled: true Performance/StartWith: Enabled: true Performance/StringBytesize: Enabled: true Performance/StringIdentifierArgument: Enabled: true Performance/StringInclude: Enabled: true Performance/StringReplacement: Enabled: true Performance/Sum: Enabled: false Performance/TimesMap: Enabled: true Performance/UnfreezeString: Enabled: true Performance/UriDefaultParser: Enabled: true Performance/ZipWithoutBlock: Enabled: true RSpec: Enabled: true RSpec/AlignLeftLetBrace: Enabled: false RSpec/AlignRightLetBrace: Enabled: false RSpec/AnyInstance: Enabled: true RSpec/AroundBlock: Enabled: true RSpec/Be: Enabled: true RSpec/BeEmpty: Enabled: true RSpec/BeEq: Enabled: true RSpec/BeEql: Enabled: true RSpec/BeNil: Enabled: true RSpec/BeforeAfterAll: Enabled: true RSpec/ChangeByZero: Enabled: true RSpec/ClassCheck: Enabled: true RSpec/ContainExactly: Enabled: true RSpec/ContextMethod: Enabled: true RSpec/ContextWording: Enabled: true RSpec/DescribeClass: Enabled: true RSpec/DescribeMethod: Enabled: false RSpec/DescribeSymbol: Enabled: true RSpec/DescribedClass: Enabled: true RSpec/DescribedClassModuleWrapping: Enabled: true RSpec/Dialect: Enabled: true RSpec/DuplicatedMetadata: Enabled: true RSpec/EmptyExampleGroup: Enabled: true RSpec/EmptyHook: Enabled: true RSpec/EmptyLineAfterExample: Enabled: true RSpec/EmptyLineAfterExampleGroup: Enabled: true RSpec/EmptyLineAfterFinalLet: Enabled: true RSpec/EmptyLineAfterHook: Enabled: true RSpec/EmptyLineAfterSubject: Enabled: true RSpec/EmptyMetadata: Enabled: true RSpec/Eq: Enabled: true RSpec/ExampleLength: Enabled: false RSpec/ExampleWithoutDescription: Enabled: true RSpec/ExampleWording: Enabled: true RSpec/ExcessiveDocstringSpacing: Enabled: true RSpec/ExpectActual: Enabled: true RSpec/ExpectChange: Enabled: true RSpec/ExpectInHook: Enabled: true RSpec/ExpectOutput: Enabled: true RSpec/Focus: Enabled: true RSpec/HookArgument: Enabled: true RSpec/HooksBeforeExamples: Enabled: true RSpec/IdenticalEqualityAssertion: Enabled: true RSpec/ImplicitBlockExpectation: Enabled: true RSpec/ImplicitExpect: Enabled: true RSpec/ImplicitSubject: Enabled: true RSpec/IncludeExamples: Enabled: true RSpec/IndexedLet: Enabled: true RSpec/InstanceSpy: Enabled: true RSpec/InstanceVariable: Enabled: true RSpec/IsExpectedSpecify: Enabled: true RSpec/ItBehavesLike: Enabled: true RSpec/IteratedExpectation: Enabled: true RSpec/LeadingSubject: Enabled: true RSpec/LeakyConstantDeclaration: Enabled: true RSpec/LetBeforeExamples: Enabled: true RSpec/LetSetup: Enabled: true RSpec/MatchArray: Enabled: true RSpec/MessageChain: Enabled: true RSpec/MessageExpectation: Enabled: false RSpec/MessageSpies: Enabled: false RSpec/MetadataStyle: Enabled: true RSpec/MissingExampleGroupArgument: Enabled: true RSpec/MultipleDescribes: Enabled: true RSpec/MultipleExpectations: Enabled: false RSpec/MultipleMemoizedHelpers: Enabled: true RSpec/MultipleSubjects: Enabled: true RSpec/NamedSubject: Enabled: true RSpec/NestedGroups: Enabled: false RSpec/NoExpectationExample: Enabled: true RSpec/NotToNot: Enabled: true RSpec/OverwritingSetup: Enabled: true RSpec/Pending: Enabled: true RSpec/PendingWithoutReason: Enabled: true RSpec/PredicateMatcher: Enabled: true RSpec/ReceiveCounts: Enabled: true RSpec/ReceiveMessages: Enabled: true RSpec/ReceiveNever: Enabled: true RSpec/RedundantAround: Enabled: true RSpec/RedundantPredicateMatcher: Enabled: true RSpec/RemoveConst: Enabled: true RSpec/RepeatedDescription: Enabled: true RSpec/RepeatedExample: Enabled: true RSpec/RepeatedExampleGroupBody: Enabled: true RSpec/RepeatedExampleGroupDescription: Enabled: true RSpec/RepeatedIncludeExample: Enabled: true RSpec/RepeatedSubjectCall: Enabled: true RSpec/ReturnFromStub: Enabled: true RSpec/ScatteredLet: Enabled: true RSpec/ScatteredSetup: Enabled: true RSpec/SharedContext: Enabled: true RSpec/SharedExamples: Enabled: true RSpec/SingleArgumentMessageChain: Enabled: true RSpec/SkipBlockInsideExample: Enabled: true RSpec/SortMetadata: Enabled: true RSpec/SpecFilePathFormat: Enabled: false RSpec/SpecFilePathSuffix: Enabled: true RSpec/StubbedMock: Enabled: false RSpec/SubjectDeclaration: Enabled: true RSpec/SubjectStub: Enabled: true RSpec/UnspecifiedException: Enabled: true RSpec/VariableDefinition: Enabled: true RSpec/VariableName: Enabled: true RSpec/VerifiedDoubleReference: Enabled: true RSpec/VerifiedDoubles: Enabled: true RSpec/VoidExpect: Enabled: true RSpec/Yield: Enabled: true Style/Encoding: Enabled: true Style/FrozenStringLiteralComment: Enabled: true Exclude: - bin/console - '**/*.arb' Style/HashSyntax: Enabled: true activeadmin-arbre-35697e3/.yamllint.yml000066400000000000000000000006131507246002300200070ustar00rootroot00000000000000# https://yamllint.readthedocs.io/en/stable/configuration.html extends: default ignore: | node_modules/ tmp/ vendor/ spec/**/config/database.yml rules: # https://yamllint.readthedocs.io/en/stable/rules.html comments: min-spaces-from-content: 1 document-start: disable line-length: disable truthy: allowed-values: - "true" - "false" - "on" - "off" activeadmin-arbre-35697e3/CHANGELOG.md000066400000000000000000000204561507246002300171750ustar00rootroot00000000000000# Changelog ## 2.2.1 [☰](https://github.com/activeadmin/arbre/compare/v2.2.0...v2.2.1) * Ensure Arbre context is properly reset after rendering [#700][] by [@drcapulet][] ## 2.2.0 [☰](https://github.com/activeadmin/arbre/compare/v2.1.0...v2.2.0) * Add some missing HTML5 elements [#655][] by [@tagliala][] ## 2.1.0 [☰](https://github.com/activeadmin/arbre/compare/v2.0.2...v2.1.0) * Add support for ViewComponent. [#644][] by [@budu][] * Remove support for Ruby `< 3.1` * Remove support for Rails `< 7.0` * Test against Rails 8.0 ## 2.0.2 [☰](https://github.com/activeadmin/arbre/compare/v2.0.1...v2.0.2) * Prefer `require_relative` for internal requires. [#622][] by [@tagliala][] ## 2.0.1 [☰](https://github.com/activeadmin/arbre/compare/v2.0.0...v2.0.1) * Drop dependency on ruby2_keywords. [#578][] by [@Earlopain][] * Performance improvements in HTML generation. [#562][], [#617][] by [@tagliala][] ## 2.0.0 [☰](https://github.com/activeadmin/arbre/compare/v1.7.0...v2.0.0) * Include empty attributes in HTML output. [#543][] by [@javierjulio][] * Remove table tag defaults. [#542][] by [@javierjulio][] * Remove component CSS class name default. [#545][] by [@javierjulio][] ## 1.7.0 [☰](https://github.com/activeadmin/arbre/compare/v1.6.0...v1.7.0) * Remove upper bound dependency limits from gemspec. [#539][] by [@javierjulio][] * Allow ActiveSupport 7.1. [#537][] by [@tomascco][] ## 1.6.0 [☰](https://github.com/activeadmin/arbre/compare/v1.5.0...v1.6.0) * Drop support for Ruby 2.6. [#345][] by [@alejandroperea][] * Add 'main' to HTML5 elements. [#270][] by [@mynnx][] * Support nested attribute hashes rendered as hyphenated attributes. [#451][] [@Ikariusrb][] * Lazy-load rails interactions. [#456][] [@ngan][] ## 1.5.0 [☰](https://github.com/activeadmin/arbre/compare/v1.4.0...v1.5.0) * Avoid mutating string literals. [#292][] by [@tomgilligan][] * Allow activesupport 7.0. [#314][] by [@tagliala][] * Drop ruby 2.5 support. [#315][] by [@alejandroperea][] * Fix keyword delegation in form component. [#318][] by [@deivid-rodriguez][] ## 1.4.0 [☰](https://github.com/activeadmin/arbre/compare/v1.3.0...v1.4.0) * Allow activesupport 6.1 prereleases. [#242][] by [@deivid-rodriguez][] ## 1.3.0 [☰](https://github.com/activeadmin/arbre/compare/v1.2.1...v1.3.0) * Drop ruby 2.3 support. [#152][] by [@deivid-rodriguez][] * Drop ruby 2.4 support. [#177][] by [@deivid-rodriguez][] * Fix ruby 2.7 kwargs warnings. [#202][] and [#205][] by [@deivid-rodriguez][] ## 1.2.1 [☰](https://github.com/activeadmin/arbre/compare/v1.2.0...v1.2.1) * Revert [#64][] to fix several regressions, at the cost of reintroducing [#46][]. [#121][] by [@deivid-rodriguez][] ## 1.2.0 [☰](https://github.com/activeadmin/arbre/compare/v1.2.0.rc1...v1.2.0) _No changes_. ## 1.2.0.rc1 [☰](https://github.com/activeadmin/arbre/compare/v1.1.1...v1.2.0.rc1) * Fix deprecation warning about single arity template handlers on Rails 6. [#110][] by [@aramvisser][] * Fix rendering `link_to` with a block in a arbre template. [#64][] by [@varyonic][] * Drop support for EOL'd rubies (under 2.3). [#78][] by [@deivid-rodriguez][] ## 1.1.1 [☰](https://github.com/activeadmin/arbre/compare/v1.1.0...v1.1.1) * Use mime-types 2.x for Ruby 1.9 by [@timoschilling][] * Verify Ruby 2.3 support. [#59][] by [@dlackty][] ## 1.1.0 [☰](https://github.com/activeadmin/arbre/compare/v1.0.3...v1.1.0) * Tag option `for` sets the attribute when value is a string or symbol [#49][] by [@ramontayag][] ## 1.0.3 [☰](https://github.com/activeadmin/arbre/compare/v1.0.2...v1.0.3) * Performance improvements [#40][] by [@alexesDev][] * Added all void elements as self-closing tags [#39][] by [@OscarBarrett][] * Missing tags added [#36][] / [#39][] by [@dtaniwaki][] and [@OscarBarrett][] ## 1.0.2 [☰](https://github.com/activeadmin/arbre/compare/v1.0.1...v1.0.2) * make `Element#inspect` behave correctly in Ruby 2.0 [#16][] by [@seanlinsley][] * prevent `Arbre::Element#flatten` infinite recursion [#32][] by [@seanlinsley][] * make `find_by_class` correctly find children by class [#33][] by [@kaapa][] ## 1.0.1 [☰](https://github.com/activeadmin/arbre/compare/v1.0.0...v1.0.1) * Template handler converts to string to satisfy Rack::Lint [#6][] by [@jpmckinney][] * Fix to `Tag#add_class` when passing a string of classes to Tag build method [#4][] by [@gregbell][] * Not longer uses the default separator [#7][] by [@LTe][] ## 1.0.0 [☰](https://github.com/activeadmin/arbre/compare/v1.0.0.rc4...v1.0.0) * Added support for the use of `:for` with non Active Model objects ## 1.0.0.rc4 [☰](https://github.com/activeadmin/arbre/compare/v1.0.0.rc3...v1.0.0.rc4) * Fix issue where user could call `symbolize_keys!` on a HashWithIndifferentAccess which doesn't implement the method ## 1.0.0.rc3 [☰](https://github.com/activeadmin/arbre/compare/v1.0.0.rc2...v1.0.0.rc3) * Implemented `Arbre::HTML::Tag#default_id_for_prefix` ## 1.0.0.rc2 [☰](https://github.com/activeadmin/arbre/compare/v1.0.0.rc1...v1.0.0.rc2) * Fixed bug where Component's build methods were being rendered within the parent context. ## 1.0.0.rc1 Initial release and extraction from Active Admin [#4]: https://github.com/activeadmin/arbre/issues/4 [#6]: https://github.com/activeadmin/arbre/issues/6 [#7]: https://github.com/activeadmin/arbre/issues/7 [#16]: https://github.com/activeadmin/arbre/issues/16 [#32]: https://github.com/activeadmin/arbre/issues/32 [#33]: https://github.com/activeadmin/arbre/issues/33 [#36]: https://github.com/activeadmin/arbre/issues/36 [#39]: https://github.com/activeadmin/arbre/issues/39 [#40]: https://github.com/activeadmin/arbre/issues/40 [#46]: https://github.com/activeadmin/arbre/issues/46 [#49]: https://github.com/activeadmin/arbre/issues/49 [#59]: https://github.com/activeadmin/arbre/issues/59 [#64]: https://github.com/activeadmin/arbre/pull/64 [#78]: https://github.com/activeadmin/arbre/pull/78 [#110]: https://github.com/activeadmin/arbre/pull/110 [#121]: https://github.com/activeadmin/arbre/pull/121 [#152]: https://github.com/activeadmin/arbre/pull/152 [#177]: https://github.com/activeadmin/arbre/pull/177 [#202]: https://github.com/activeadmin/arbre/pull/202 [#205]: https://github.com/activeadmin/arbre/pull/205 [#242]: https://github.com/activeadmin/arbre/pull/242 [#270]: https://github.com/activeadmin/arbre/pull/270 [#292]: https://github.com/activeadmin/arbre/pull/292 [#314]: https://github.com/activeadmin/arbre/pull/314 [#315]: https://github.com/activeadmin/arbre/pull/315 [#318]: https://github.com/activeadmin/arbre/pull/318 [#345]: https://github.com/activeadmin/arbre/pull/345 [#451]: https://github.com/activeadmin/arbre/pull/451 [#456]: https://github.com/activeadmin/arbre/pull/456 [#537]: https://github.com/activeadmin/arbre/pull/537 [#539]: https://github.com/activeadmin/arbre/pull/539 [#542]: https://github.com/activeadmin/arbre/pull/542 [#543]: https://github.com/activeadmin/arbre/pull/543 [#545]: https://github.com/activeadmin/arbre/pull/545 [#562]: https://github.com/activeadmin/arbre/pull/562 [#578]: https://github.com/activeadmin/arbre/pull/578 [#617]: https://github.com/activeadmin/arbre/pull/617 [#622]: https://github.com/activeadmin/arbre/pull/622 [#644]: https://github.com/activeadmin/arbre/pull/644 [#655]: https://github.com/activeadmin/arbre/pull/655 [#700]: https://github.com/activeadmin/arbre/pull/700 [@aramvisser]: https://github.com/aramvisser [@LTe]: https://github.com/LTe [@OscarBarrett]: https://github.com/OscarBarrett [@alejandroperea]: https://github.com/alejandroperea [@alexesDev]: https://github.com/alexesDev [@deivid-rodriguez]: https://github.com/deivid-rodriguez [@dlackty]: https://github.com/dlackty [@dtaniwaki]: https://github.com/dtaniwaki [@gregbell]: https://github.com/gregbell [@jpmckinney]: https://github.com/jpmckinney [@kaapa]: https://github.com/kaapa [@ramontayag]: https://github.com/ramontayag [@seanlinsley]: https://github.com/seanlinsley [@timoschilling]: https://github.com/timoschilling [@varyonic]: https://github.com/varyonic [@tagliala]: https://github.com/tagliala [@tomgilligan]: https://github.com/tomgilligan [@mynnx]: https://github.com/mynnx [@Ikariusrb]: https://github.com/Ikariusrb [@ngan]: https://github.com/ngan [@tomascco]: https://github.com/tomascco [@javierjulio]: https://github.com/javierjulio [@Earlopain]: https://github.com/Earlopain [@budu]: https://github.com/budu [@drcapulet]: https://github.com/drcapulet activeadmin-arbre-35697e3/Gemfile000066400000000000000000000006571507246002300166600ustar00rootroot00000000000000# frozen_string_literal: true source 'http://rubygems.org' gemspec gem 'rake' group :test do gem 'rspec' gem 'simplecov', require: false gem 'simplecov-cobertura' gem 'pry' end group :rubocop do gem 'rubocop' gem 'rubocop-capybara' gem 'rubocop-packaging' gem 'rubocop-performance' gem 'rubocop-rspec' end group :rails do gem 'rails', '~> 8.0.0' gem 'rspec-rails' gem 'combustion' gem 'capybara' end activeadmin-arbre-35697e3/Gemfile.lock000066400000000000000000000172271507246002300176100ustar00rootroot00000000000000PATH remote: . specs: arbre (2.2.1) activesupport (>= 7.0) GEM remote: http://rubygems.org/ specs: actioncable (8.0.3) actionpack (= 8.0.3) activesupport (= 8.0.3) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) actionmailbox (8.0.3) actionpack (= 8.0.3) activejob (= 8.0.3) activerecord (= 8.0.3) activestorage (= 8.0.3) activesupport (= 8.0.3) mail (>= 2.8.0) actionmailer (8.0.3) actionpack (= 8.0.3) actionview (= 8.0.3) activejob (= 8.0.3) activesupport (= 8.0.3) mail (>= 2.8.0) rails-dom-testing (~> 2.2) actionpack (8.0.3) actionview (= 8.0.3) activesupport (= 8.0.3) nokogiri (>= 1.8.5) rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) actiontext (8.0.3) actionpack (= 8.0.3) activerecord (= 8.0.3) activestorage (= 8.0.3) activesupport (= 8.0.3) globalid (>= 0.6.0) nokogiri (>= 1.8.5) actionview (8.0.3) activesupport (= 8.0.3) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) activejob (8.0.3) activesupport (= 8.0.3) globalid (>= 0.3.6) activemodel (8.0.3) activesupport (= 8.0.3) activerecord (8.0.3) activemodel (= 8.0.3) activesupport (= 8.0.3) timeout (>= 0.4.0) activestorage (8.0.3) actionpack (= 8.0.3) activejob (= 8.0.3) activerecord (= 8.0.3) activesupport (= 8.0.3) marcel (~> 1.0) activesupport (8.0.3) base64 benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) uri (>= 0.13.1) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) ast (2.4.3) base64 (0.3.0) benchmark (0.4.1) bigdecimal (3.3.1) builder (3.3.0) capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) coderay (1.1.3) combustion (1.5.0) activesupport (>= 3.0.0) railties (>= 3.0.0) thor (>= 0.14.6) concurrent-ruby (1.3.5) connection_pool (2.5.4) crass (1.0.6) date (3.4.1) diff-lcs (1.6.2) docile (1.4.1) drb (2.2.3) erb (5.0.3) erubi (1.13.1) globalid (1.3.0) activesupport (>= 6.1) i18n (1.14.7) concurrent-ruby (~> 1.0) io-console (0.8.1) irb (1.15.2) pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) json (2.15.1) language_server-protocol (3.17.0.5) lint_roller (1.1.0) logger (1.7.0) loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop net-smtp marcel (1.1.0) matrix (0.4.3) method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.9) minitest (5.26.0) net-imap (0.5.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout net-smtp (0.5.1) net-protocol nio4r (2.7.4) nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) nokogiri (1.18.10-aarch64-linux-gnu) racc (~> 1.4) nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) parallel (1.27.0) parser (3.3.9.0) ast (~> 2.4.1) racc pp (0.6.3) prettyprint prettyprint (0.2.0) prism (1.5.2) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) psych (5.2.6) date stringio public_suffix (6.0.2) racc (1.8.1) rack (3.2.3) rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) rackup (2.2.1) rack (>= 3) rails (8.0.3) actioncable (= 8.0.3) actionmailbox (= 8.0.3) actionmailer (= 8.0.3) actionpack (= 8.0.3) actiontext (= 8.0.3) actionview (= 8.0.3) activejob (= 8.0.3) activemodel (= 8.0.3) activerecord (= 8.0.3) activestorage (= 8.0.3) activesupport (= 8.0.3) bundler (>= 1.15.0) railties (= 8.0.3) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (8.0.3) actionpack (= 8.0.3) activesupport (= 8.0.3) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) tsort (>= 0.2) zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.3.0) rdoc (6.15.0) erb psych (>= 4.0.0) tsort regexp_parser (2.11.3) reline (0.6.2) io-console (~> 0.5) rexml (3.4.4) rspec (3.13.1) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) rspec-core (3.13.5) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (8.0.2) actionpack (>= 7.2) activesupport (>= 7.2) railties (>= 7.2) rspec-core (~> 3.13) rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.6) rubocop (1.81.1) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) parallel (~> 1.10) parser (>= 3.3.0.2) rainbow (>= 2.2.2, < 4.0) regexp_parser (>= 2.9.3, < 3.0) rubocop-ast (>= 1.47.1, < 2.0) ruby-progressbar (~> 1.7) unicode-display_width (>= 2.4.0, < 4.0) rubocop-ast (1.47.1) parser (>= 3.3.7.2) prism (~> 1.4) rubocop-capybara (2.22.1) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) rubocop-packaging (0.6.0) lint_roller (~> 1.1.0) rubocop (>= 1.72.1, < 2.0) rubocop-performance (1.26.0) lint_roller (~> 1.1) rubocop (>= 1.75.0, < 2.0) rubocop-ast (>= 1.44.0, < 2.0) rubocop-rspec (3.7.0) lint_roller (~> 1.1) rubocop (~> 1.72, >= 1.72.1) ruby-progressbar (1.13.0) securerandom (0.4.1) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-cobertura (3.1.0) rexml simplecov (~> 0.19) simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) stringio (3.1.7) thor (1.4.0) timeout (0.4.3) tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) unicode-display_width (3.2.0) unicode-emoji (~> 4.1) unicode-emoji (4.1.0) uri (1.0.4) useragent (0.16.11) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.7.3) PLATFORMS aarch64-linux arm64-darwin ruby x86_64-darwin x86_64-linux DEPENDENCIES arbre! capybara combustion pry rails (~> 8.0.0) rake rspec rspec-rails rubocop rubocop-capybara rubocop-packaging rubocop-performance rubocop-rspec simplecov simplecov-cobertura BUNDLED WITH 2.7.2 activeadmin-arbre-35697e3/LICENSE000066400000000000000000000020351507246002300163620ustar00rootroot00000000000000Copyright (c) 2013 Greg Bell Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. activeadmin-arbre-35697e3/README.md000066400000000000000000000033121507246002300166330ustar00rootroot00000000000000# Arbre - HTML Views in Ruby [Arbre][docs] makes it easy to generate HTML directly in Ruby. This gem was extracted from [Active Admin](https://github.com/activeadmin/activeadmin). [![Version ][rubygems_badge]][rubygems] [![Github Actions ][actions_badge]][actions] [![Tidelift ][tidelift_badge]][tidelift] ## Goals The purpose of Arbre is to leave the view as ruby objects as long as possible. This allows OO Design to be used to implement the view layer. ## Getting started * Check out [the docs][docs]. ## Need help? Please use [StackOverflow][stackoverflow] for help requests and how-to questions. Please open GitHub issues for bugs and enhancements only, not general help requests. Please search previous issues (and Google and StackOverflow) before creating a new issue. ## Want to support us? Subscribe to [Tidelift][tidelift] to support Arbre and get licensing assurances and timely security notifications. ## Security contact information Please use the Tidelift security contact to [report a security vulnerability][Tidelift security contact]. Tidelift will coordinate the fix and disclosure. [rubygems_badge]: https://img.shields.io/gem/v/arbre.svg [rubygems]: https://rubygems.org/gems/arbre [actions_badge]: https://github.com/activeadmin/arbre/workflows/ci/badge.svg [actions]: https://github.com/activeadmin/arbre/actions [tidelift_badge]: https://tidelift.com/badges/github/activeadmin/arbre [tidelift]: https://tidelift.com/subscription/pkg/rubygems-arbre?utm_source=rubygems-arbre&utm_medium=referral&utm_campaign=readme [docs]: https://activeadmin.github.io/arbre/ [stackoverflow]: https://stackoverflow.com/questions/tagged/arbre [Tidelift security contact]: https://tidelift.com/security activeadmin-arbre-35697e3/Rakefile000066400000000000000000000004151507246002300170220ustar00rootroot00000000000000# frozen_string_literal: true require 'bundler/gem_tasks' require 'rspec/core/rake_task' RSpec::Core::RakeTask.new(:spec) task default: :spec task :console do require 'irb' require 'irb/completion' require 'pry' require 'arbre' ARGV.clear IRB.start end activeadmin-arbre-35697e3/arbre.gemspec000066400000000000000000000015021507246002300200130ustar00rootroot00000000000000# frozen_string_literal: true $:.push File.expand_path("../lib", __FILE__) require "arbre/version" Gem::Specification.new do |s| s.name = "arbre" s.version = Arbre::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Greg Bell"] s.email = ["gregdbell@gmail.com"] s.homepage = "https://github.com/activeadmin/arbre" s.summary = %q{An Object Oriented DOM Tree in Ruby} s.description = %q{Arbre makes it easy to generate HTML directly in Ruby} s.license = "MIT" s.files = Dir['docs/**/*', 'lib/**/*', 'LICENSE'].reject { |f| File.directory?(f) } s.extra_rdoc_files = %w[CHANGELOG.md README.md] s.require_paths = ["lib"] s.metadata = { "rubygems_mfa_required" => "true" } s.required_ruby_version = '>= 3.1' s.add_dependency("activesupport", ">= 7.0") end activeadmin-arbre-35697e3/bin/000077500000000000000000000000001507246002300161255ustar00rootroot00000000000000activeadmin-arbre-35697e3/bin/bundle000077500000000000000000000002011507246002300173150ustar00rootroot00000000000000#!/bin/bash ( set -x; bundle $@ ) for gemfile in gemfiles/*/Gemfile; do ( set -x; BUNDLE_GEMFILE="$gemfile" bundle $@ ) done activeadmin-arbre-35697e3/bin/console000077500000000000000000000005241507246002300175160ustar00rootroot00000000000000#!/usr/bin/env ruby require "bundler/setup" require "arbre" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. # (If you use this, don't forget to add pry to your Gemfile!) # require "pry" # Pry.start require "irb" IRB.start(__FILE__) activeadmin-arbre-35697e3/codecov.yml000066400000000000000000000001111507246002300175130ustar00rootroot00000000000000coverage: status: project: default: threshold: 0.05% activeadmin-arbre-35697e3/docs/000077500000000000000000000000001507246002300163055ustar00rootroot00000000000000activeadmin-arbre-35697e3/docs/Gemfile000066400000000000000000000001141507246002300175740ustar00rootroot00000000000000# frozen_string_literal: true gem 'github-pages' gem 'jekyll-redirect-from' activeadmin-arbre-35697e3/docs/_config.yml000066400000000000000000000001251507246002300204320ustar00rootroot00000000000000plugins: - jekyll-redirect-from defaults: - values: layout: "default" activeadmin-arbre-35697e3/docs/_includes/000077500000000000000000000000001507246002300202525ustar00rootroot00000000000000activeadmin-arbre-35697e3/docs/_includes/footer.html000066400000000000000000000004171507246002300224400ustar00rootroot00000000000000
Copyright 2011 Greg Bell and VersaPay
Tweet

activeadmin-arbre-35697e3/docs/_includes/google-analytics.html000066400000000000000000000010121507246002300243730ustar00rootroot00000000000000 activeadmin-arbre-35697e3/docs/_includes/head.html000066400000000000000000000007501507246002300220430ustar00rootroot00000000000000 Arbre | HTML Views in Ruby activeadmin-arbre-35697e3/docs/_includes/toc.html000066400000000000000000000011721507246002300217260ustar00rootroot00000000000000
  1. Contents
    1. Introduction
    2. Installation
    3. Tags
    4. Components
    5. Contexts
    6. Background
activeadmin-arbre-35697e3/docs/_includes/top-menu.html000066400000000000000000000004341507246002300227050ustar00rootroot00000000000000 activeadmin-arbre-35697e3/docs/_layouts/000077500000000000000000000000001507246002300201445ustar00rootroot00000000000000activeadmin-arbre-35697e3/docs/_layouts/default.html000066400000000000000000000007551507246002300224650ustar00rootroot00000000000000 {% include head.html %}
{% include top-menu.html %}
{% include toc.html %}
{{ content }}
{% include footer.html %}
{% include google-analytics.html %} activeadmin-arbre-35697e3/docs/index.md000066400000000000000000000070101507246002300177340ustar00rootroot00000000000000--- redirect_from: /docs/documentation.html --- # Arbre HTML Views in Ruby ### Introduction Arbre is a alternate template system for [Ruby on Rails Action View](http://guides.rubyonrails.org/action_view_overview.html). Arbre expresses HTML using a Ruby DSL, which makes it similar to the [Builder](https://github.com/tenderlove/builder) gem for XML. Arbre was extracted from [Active Admin](https://activeadmin.info/). An example `index.html.arb`: ```ruby html { head { title "Welcome page" } body { para "Hello, world" } } ``` The purpose of Arbre is to leave the view as Ruby objects as long as possible, which allows an object-oriented approach including inheritance, composition, and encapsulation. ### Installation Add gem `arbre` to your `Gemfile` and `bundle install`. Arbre registers itself as a Rails template handler for files with an extension `.arb`. ### Tags Arbre DSL is composed of HTML tags. Tag attributes including `id` and HTML classes are passed as a hash parameter and the tag body is passed as a block. Most HTML5 tags are implemented, including `script`, `embed` and `video`. A special case is the paragraph tag,

, which is mapped to `para`. JavaScript can be included by using `script { raw ... }` To include text that is not immediately part of a tag use `text_node`. ### Components Arbre DSL can be extended by defining new tags composed of other, simpler tags. This provides a simpler alternative to nesting partials. The recommended approach is to subclass Arbre::Component and implement a new builder method. The builder_method defines the method that will be called to build this component when using the DSL. The arguments passed into the builder_method will be passed into the #build method for you. For example: ```ruby class Panel < Arbre::Component builder_method :panel def build(title, attributes = {}) super(attributes) h3(title, class: "panel-title") end end ``` By default, components are `div` tags. This can be overridden by redefining the `tag_name` method. Several examples of Arbre components are [included in Active Admin](https://activeadmin.info/12-arbre-components.html) ### Contexts An [Arbre::Context](http://www.rubydoc.info/gems/arbre/Arbre/Context) is an object in which Arbre DSL is interpreted, providing a root for the Ruby DOM that can be [searched and manipulated](http://www.rubydoc.info/gems/arbre/Arbre/Element). A context is automatically provided when a `.arb` template or partial is loaded. Contexts can be used when developing or testing a component. Contexts are rendered by calling to_s. ```ruby html = Arbre::Context.new do panel "Hello World", class: "panel", id: "my-panel" do span "Inside the panel" text_node "Plain text" end end puts html.to_s # => ``` ```html

Hello World

Inside the panel Plain text
``` A context allows you to specify Rails template assigns, aka. 'locals' and helper methods. Templates loaded by Action View have access to all [Action View helper methods](http://guides.rubyonrails.org/action_view_overview.html#overview-of-helpers-provided-by-action-view) ### Background Similar projects include: - [Markaby](http://markaby.github.io/), written by \_why the luck stiff. - [Erector](http://erector.github.io/), developed at PivotalLabs. - [Fortitude](https://github.com/ageweke/fortitude), developed at Scribd. - [Inesita](https://inesita.fazibear.me/) (Opal) - [html_builder](https://github.com/crystal-lang/html_builder) (Crystal) activeadmin-arbre-35697e3/docs/stylesheets/000077500000000000000000000000001507246002300206615ustar00rootroot00000000000000activeadmin-arbre-35697e3/docs/stylesheets/main.css000066400000000000000000000410621507246002300223220ustar00rootroot00000000000000html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video { margin: 0; padding: 0; border: 0; font-size: 100%; font: inherit; vertical-align: baseline; } body { line-height: 1; } ol, ul { list-style: none; } table { border-collapse: collapse; border-spacing: 0; } caption, th, td { text-align: left; font-weight: normal; vertical-align: middle; } q, blockquote { quotes: none; } q:before, q:after, blockquote:before, blockquote:after { content: ""; content: none; } a img { border: none; } article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; } #dsl { /* Comment */ /* Error */ /* Keyword */ /* Literal */ /* Name */ /* Operator */ /* Punctuation */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Emph */ /* Generic.Strong */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Namespace */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Date */ /* Literal.Number */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Decorator */ /* Name.Entity */ /* Name.Exception */ /* Name.Function */ /* Name.Label */ /* Name.Namespace */ /* Name.Other */ /* Name.Property */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } #dsl .highlight .hll { background-color: #49483e; } #dsl .highlight { background: #272822; color: #f8f8f2; } #dsl .highlight .c { color: #75715e; } #dsl .highlight .err { color: #960050; background-color: #1e0010; } #dsl .highlight .k { color: #66d9ef; } #dsl .highlight .l { color: #ae81ff; } #dsl .highlight .n { color: #f8f8f2; } #dsl .highlight .o { color: #f92672; } #dsl .highlight .p { color: #f8f8f2; } #dsl .highlight .cm { color: #75715e; } #dsl .highlight .cp { color: #75715e; } #dsl .highlight .c1 { color: #75715e; } #dsl .highlight .cs { color: #75715e; } #dsl .highlight .ge { font-style: italic; } #dsl .highlight .gs { font-weight: bold; } #dsl .highlight .kc { color: #66d9ef; } #dsl .highlight .kd { color: #66d9ef; } #dsl .highlight .kn { color: #f92672; } #dsl .highlight .kp { color: #66d9ef; } #dsl .highlight .kr { color: #66d9ef; } #dsl .highlight .kt { color: #66d9ef; } #dsl .highlight .ld { color: #e6db74; } #dsl .highlight .m { color: #ae81ff; } #dsl .highlight .s { color: #e6db74; } #dsl .highlight .na { color: #a6e22e; } #dsl .highlight .nb { color: #f8f8f2; } #dsl .highlight .nc { color: #a6e22e; } #dsl .highlight .no { color: #66d9ef; } #dsl .highlight .nd { color: #a6e22e; } #dsl .highlight .ni { color: #f8f8f2; } #dsl .highlight .ne { color: #a6e22e; } #dsl .highlight .nf { color: #a6e22e; } #dsl .highlight .nl { color: #f8f8f2; } #dsl .highlight .nn { color: #f8f8f2; } #dsl .highlight .nx { color: #a6e22e; } #dsl .highlight .py { color: #f8f8f2; } #dsl .highlight .nt { color: #f92672; } #dsl .highlight .nv { color: #f8f8f2; } #dsl .highlight .ow { color: #f92672; } #dsl .highlight .w { color: #f8f8f2; } #dsl .highlight .mf { color: #ae81ff; } #dsl .highlight .mh { color: #ae81ff; } #dsl .highlight .mi { color: #ae81ff; } #dsl .highlight .mo { color: #ae81ff; } #dsl .highlight .sb { color: #e6db74; } #dsl .highlight .sc { color: #e6db74; } #dsl .highlight .sd { color: #e6db74; } #dsl .highlight .s2 { color: #e6db74; } #dsl .highlight .se { color: #ae81ff; } #dsl .highlight .sh { color: #e6db74; } #dsl .highlight .si { color: #e6db74; } #dsl .highlight .sx { color: #e6db74; } #dsl .highlight .sr { color: #e6db74; } #dsl .highlight .s1 { color: #e6db74; } #dsl .highlight .ss { color: #AE81FF; } #dsl .highlight .bp { color: #f8f8f2; } #dsl .highlight .vc { color: #f8f8f2; } #dsl .highlight .vg { color: #f8f8f2; } #dsl .highlight .vi { color: #f8f8f2; } #dsl .highlight .il { color: #ae81ff; } body { line-height: 1.5; font-family: "Helvetica Neue", Arial, Helvetica, sans-serif; color: #333333; font-size: 75%; } h1, h2, h3, h4, h5, h6 { font-weight: normal; color: #222222; } h1 img, h2 img, h3 img, h4 img, h5 img, h6 img { margin: 0; } h1 { font-size: 3em; line-height: 1; margin-bottom: 0.50em; } h2 { font-size: 2em; margin-bottom: 0.75em; } h3 { font-size: 1.5em; line-height: 1; margin-bottom: 1.00em; } h4 { font-size: 1.2em; line-height: 1.25; margin-bottom: 1.25em; } h5 { font-size: 1em; font-weight: bold; margin-bottom: 1.50em; } h6 { font-size: 1em; font-weight: bold; } p { margin: 0 0 1.5em; } p .left { display: inline; float: left; margin: 1.5em 1.5em 1.5em 0; padding: 0; } p .right { display: inline; float: right; margin: 1.5em 0 1.5em 1.5em; padding: 0; } a { text-decoration: underline; color: #0066cc; } a:visited { color: #004c99; } a:focus { color: #0099ff; } a:hover { color: #0099ff; } a:active { color: #bf00ff; } blockquote { margin: 1.5em; color: #666666; font-style: italic; } strong, dfn { font-weight: bold; } em, dfn { font-style: italic; } sup, sub { line-height: 0; } abbr, acronym { border-bottom: 1px dotted #666666; } address { margin: 0 0 1.5em; font-style: italic; } del { color: #666666; } pre { margin: 1.5em 0; white-space: pre; } pre, code, tt { font: 1em "andale mono", "lucida console", monospace; line-height: 1.5; } li ul, li ol { margin: 0; } ul, ol { margin: 0 1.5em 1.5em 0; padding-left: 1.5em; } ul { list-style-type: disc; } ol { list-style-type: decimal; } dl { margin: 0 0 1.5em 0; } dl dt { font-weight: bold; } dd { margin-left: 1.5em; } table { margin-bottom: 1.4em; width: 100%; } th { font-weight: bold; } thead th { background: #c3d9ff; } th, td, caption { padding: 4px 10px 4px 5px; } table.striped tr:nth-child(even) td, table tr.even td { background: #e5ecf9; } tfoot { font-style: italic; } caption { background: #eeeeee; } .quiet { color: #666666; } .loud { color: #111111; } body { background: #f6f4f1; color: #676767; width: 676px; padding: 0 20px; font-size: 95%; margin: 25px auto; font-family: 'Georgia'; } body #wrapper { position: relative; } body a, body a:hover, body a:link, body a:visited { color: #407985; } body h1, body h2, body h3, body h4, body h5, body h6 { color: #595959; font-family: 'Yanone Kaffeesatz', 'Helvetica Neue', Arial, Helvetica, sans-serif; } body h1 a { background: url("../images/activeadmin.png") 0 0 no-repeat; display: block; width: 257px; height: 55px; } body h1 a span { display: none; } body #header { margin: 40px 0; } body .clear { clear: both; } body .intro { color: #595959; font-family: 'Yanone Kaffeesatz', 'Helvetica Neue', Arial, Helvetica, sans-serif; font-size: 3.2em; font-weight: 300; line-height: 1em; margin-bottom: 0.3em; padding-top: 35px; background: url("../images/divider.png") 0 0 repeat-x; } body .intro strong { font-weight: 400; } body h2 { margin: 50px 0 10px 0; padding-top: 35px; background: url("../images/divider.png") 0 0 repeat-x; font-size: 2.5em; font-weight: 200; line-height: 105%; } body h3 { margin-top: 30px; margin-bottom: 10px; font-size: 1.7em; font-weight: 300; } body #nav { font-family: 'Yanone Kaffeesatz', 'Helvetica Neue', Arial, Helvetica, sans-serif; font-weight: 400; font-size: 1.2em; text-transform: uppercase; position: absolute; right: 0; top: 20px; text-align: right; } body #nav a { text-decoration: none; color: #8b9091; margin-left: 20px; } body #features { padding-top: 0; clear: both; background: url("../images/features.png") 0 0 no-repeat; margin: 0 -35px; overflow: visible; min-height: 569px; font-size: 1.0em; line-height: 1.2em; font-weight: 300; font-family: 'Yanone Kaffeesatz', 'Helvetica Neue', Arial, Helvetica, sans-serif; } body #features #features-left { float: left; width: 150px; margin-left: -150px; } body #features #features-right { float: right; width: 150px; margin-right: -150px; } body #features h3 { font-size: 1.2em; padding-bottom: 0; margin-bottom: 5px; } body #features h3.first { margin-top: 10px; } body.with-sidebar { width: 976px; } body .toc { font-family: Helvetica, Arial, sans-serif; padding-top: 35px; width: 270px; float: right; font-size: 0.9em; background: url("../images/divider.png") top left repeat-x; } body .toc ol li { list-style: none; } body .toc a, body .toc a:link, body .toc a:hover, body .toc a:visited { text-decoration: none; color: #595959; } body .toc ol.level-1 > li { font-size: 1.0em; font-weight: bold; margin-top: 20px; } body .toc ol.level-1 > ol { padding-left: 0; font-size: 0.95em; margin: 0; } body .toc ol.level-2 > ol { display: none; } body .toc-content { width: 676px; } body #dsl { margin-top: 20px; } body #dsl .highlight { font-size: 0.82em; background: #292929 url("../images/code-header.png") 0 0 no-repeat; padding: 40px 15px 20px 15px !important; -moz-box-shadow: 0 8px 20px #444444; -webkit-box-shadow: 0 8px 20px #444444; -o-box-shadow: 0 8px 20px #444444; box-shadow: 0 8px 20px #444444; } body .getting-started { font-size: 2em; text-align: center; } body .getting-started a { margin-right: 15px; display: block; } body .getting-started-heading { text-align: center; } body .left { float: left; } body .right { float: right; } body .highlight { background-color: #333; font-family: "Droid Sans Mono", Monaco, monospace; padding: 10px 5px; font-size: 0.9em; -moz-border-radius: 2px; -webkit-border-radius: 2px; -o-border-radius: 2px; -ms-border-radius: 2px; -khtml-border-radius: 2px; border-radius: 2px; margin-bottom: 1.5em; } body .highlight > pre, body .highlight code, body .highlight span { line-height: 1.3em; margin: 0; padding: 0; } body #footer { margin-top: 50px; margin-bottom: 20px; background: url("../images/divider.png") 0 0 repeat-x; clear: both; padding-top: 20px; font-size: 0.9em; } body .post .post-date, body .post .post-meta { font-size: 0.7em; } body .post .post-date { display: inline-block; width: 100px; } body .post .post-meta { font-size: 0.6em; padding-left: 40px; } span.breadcrumb { display: block; font-size: 45%; font-weight: 200; margin: 0; padding: 0; } h2.in-docs { font-weight: 400; } .docs-content { /* Comment */ /* Error */ /* Keyword */ /* Comment.Multiline */ /* Comment.Preproc */ /* Comment.Single */ /* Comment.Special */ /* Generic.Deleted */ /* Generic.Emph */ /* Generic.Error */ /* Generic.Heading */ /* Generic.Inserted */ /* Generic.Output */ /* Generic.Prompt */ /* Generic.Strong */ /* Generic.Subheading */ /* Generic.Traceback */ /* Keyword.Constant */ /* Keyword.Declaration */ /* Keyword.Namespace */ /* Keyword.Pseudo */ /* Keyword.Reserved */ /* Keyword.Type */ /* Literal.Number */ /* Name */ /* Name */ /* Literal.String */ /* Name.Attribute */ /* Name.Builtin */ /* Name.Class */ /* Name.Constant */ /* Name.Decorator */ /* Name.Entity */ /* Name.Function */ /* Name.Namespace */ /* Name.Tag */ /* Name.Variable */ /* Operator.Word */ /* Text.Whitespace */ /* Literal.Number.Float */ /* Literal.Number.Hex */ /* Literal.Number.Integer */ /* Literal.Number.Oct */ /* Literal.String.Backtick */ /* Literal.String.Char */ /* Literal.String.Doc */ /* Literal.String.Double */ /* Literal.String.Escape */ /* Literal.String.Heredoc */ /* Literal.String.Interpol */ /* Literal.String.Other */ /* Literal.String.Regex */ /* Literal.String.Single */ /* Literal.String.Symbol */ /* Name.Builtin.Pseudo */ /* Name.Variable.Class */ /* Name.Variable.Global */ /* Name.Variable.Instance */ /* Literal.Number.Integer.Long */ } .docs-content h3 { margin-top: 50px; margin-bottom: 10px; font-size: 2em; font-weight: 400; } .docs-content h4 { font-size: 1.5em; font-weight: 400; margin-bottom: 0; } .docs-content p, .docs-content li { font-family: Helvetica, Arial, sans-serif; font-size: 0.9em; } .docs-content .highlight { font-size: 0.85em; background-color: #ece8e1; color: #000000; } .docs-content .highlight .hll { background-color: #ffffcc; } .docs-content .highlight .c { color: #aaaaaa; font-style: italic; } .docs-content .highlight .err { color: #F00000; background-color: #F0A0A0; } .docs-content .highlight .k { color: #0000aa; } .docs-content .highlight .cm { color: #aaaaaa; font-style: italic; } .docs-content .highlight .cp { color: #4c8317; } .docs-content .highlight .c1 { color: #aaaaaa; font-style: italic; } .docs-content .highlight .cs { color: #0000aa; font-style: italic; } .docs-content .highlight .gd { color: #aa0000; } .docs-content .highlight .ge { font-style: italic; } .docs-content .highlight .gr { color: #aa0000; } .docs-content .highlight .gh { color: #000080; font-weight: bold; } .docs-content .highlight .gi { color: #00aa00; } .docs-content .highlight .go { color: #888888; } .docs-content .highlight .gp { color: #555555; } .docs-content .highlight .gs { font-weight: bold; } .docs-content .highlight .gu { color: #800080; font-weight: bold; } .docs-content .highlight .gt { color: #aa0000; } .docs-content .highlight .kc { color: #0000aa; } .docs-content .highlight .kd { color: #0000aa; } .docs-content .highlight .kn { color: #0000aa; } .docs-content .highlight .kp { color: #0000aa; } .docs-content .highlight .kr { color: #0000aa; } .docs-content .highlight .kt { color: #00aaaa; } .docs-content .highlight .m { color: #009999; } .docs-content .highlight .n { color: #000000; } .docs-content .highlight .p { color: #000000; } .docs-content .highlight .s { color: #aa5500; } .docs-content .highlight .na { color: #1e90ff; } .docs-content .highlight .nb { color: #00aaaa; } .docs-content .highlight .nc { color: #00aa00; text-decoration: underline; } .docs-content .highlight .no { color: #aa0000; } .docs-content .highlight .nd { color: #888888; } .docs-content .highlight .ni { color: #800000; font-weight: bold; } .docs-content .highlight .nf { color: #00aa00; } .docs-content .highlight .nn { color: #00aaaa; text-decoration: underline; } .docs-content .highlight .nt { color: #1e90ff; font-weight: bold; } .docs-content .highlight .nv { color: #aa0000; } .docs-content .highlight .ow { color: #0000aa; } .docs-content .highlight .w { color: #bbbbbb; } .docs-content .highlight .mf { color: #009999; } .docs-content .highlight .mh { color: #009999; } .docs-content .highlight .mi { color: #009999; } .docs-content .highlight .mo { color: #009999; } .docs-content .highlight .sb { color: #aa5500; } .docs-content .highlight .sc { color: #aa5500; } .docs-content .highlight .sd { color: #aa5500; } .docs-content .highlight .s2 { color: #aa5500; } .docs-content .highlight .se { color: #aa5500; } .docs-content .highlight .sh { color: #aa5500; } .docs-content .highlight .si { color: #aa5500; } .docs-content .highlight .sx { color: #aa5500; } .docs-content .highlight .sr { color: #009999; } .docs-content .highlight .s1 { color: #aa5500; } .docs-content .highlight .ss { color: #0000aa; } .docs-content .highlight .bp { color: #00aaaa; } .docs-content .highlight .vc { color: #aa0000; } .docs-content .highlight .vg { color: #aa0000; } .docs-content .highlight .vi { color: #aa0000; } .docs-content .highlight .il { color: #009999; } activeadmin-arbre-35697e3/gemfiles/000077500000000000000000000000001507246002300171505ustar00rootroot00000000000000activeadmin-arbre-35697e3/gemfiles/rails_70/000077500000000000000000000000001507246002300205705ustar00rootroot00000000000000activeadmin-arbre-35697e3/gemfiles/rails_70/Gemfile000066400000000000000000000007221507246002300220640ustar00rootroot00000000000000# frozen_string_literal: true source 'http://rubygems.org' gem 'rake' group :test do gem 'rspec' gem 'simplecov', require: false gem 'simplecov-cobertura' gem 'pry' end group :rails do gem 'rails', '~> 7.0.0' gem 'rspec-rails' gem 'combustion' gem 'capybara' gem "concurrent-ruby", "1.3.4" # Ref: rails/rails#54260 # FIXME: relax this dependency when Ruby 3.1 support will be dropped gem "zeitwerk", "~> 2.6.18" end gemspec path: "../.." activeadmin-arbre-35697e3/gemfiles/rails_70/Gemfile.lock000066400000000000000000000133731507246002300230210ustar00rootroot00000000000000PATH remote: ../.. specs: arbre (2.2.1) activesupport (>= 7.0) GEM remote: http://rubygems.org/ specs: actioncable (7.0.8.7) actionpack (= 7.0.8.7) activesupport (= 7.0.8.7) nio4r (~> 2.0) websocket-driver (>= 0.6.1) actionmailbox (7.0.8.7) actionpack (= 7.0.8.7) activejob (= 7.0.8.7) activerecord (= 7.0.8.7) activestorage (= 7.0.8.7) activesupport (= 7.0.8.7) mail (>= 2.7.1) net-imap net-pop net-smtp actionmailer (7.0.8.7) actionpack (= 7.0.8.7) actionview (= 7.0.8.7) activejob (= 7.0.8.7) activesupport (= 7.0.8.7) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.0) actionpack (7.0.8.7) actionview (= 7.0.8.7) activesupport (= 7.0.8.7) rack (~> 2.0, >= 2.2.4) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.2.0) actiontext (7.0.8.7) actionpack (= 7.0.8.7) activerecord (= 7.0.8.7) activestorage (= 7.0.8.7) activesupport (= 7.0.8.7) globalid (>= 0.6.0) nokogiri (>= 1.8.5) actionview (7.0.8.7) activesupport (= 7.0.8.7) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.1, >= 1.2.0) activejob (7.0.8.7) activesupport (= 7.0.8.7) globalid (>= 0.3.6) activemodel (7.0.8.7) activesupport (= 7.0.8.7) activerecord (7.0.8.7) activemodel (= 7.0.8.7) activesupport (= 7.0.8.7) activestorage (7.0.8.7) actionpack (= 7.0.8.7) activejob (= 7.0.8.7) activerecord (= 7.0.8.7) activesupport (= 7.0.8.7) marcel (~> 1.0) mini_mime (>= 1.1.0) activesupport (7.0.8.7) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 1.6, < 2) minitest (>= 5.1) tzinfo (~> 2.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.3.0) builder (3.3.0) capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) coderay (1.1.3) combustion (1.5.0) activesupport (>= 3.0.0) railties (>= 3.0.0) thor (>= 0.14.6) concurrent-ruby (1.3.4) crass (1.0.6) date (3.4.1) diff-lcs (1.6.2) docile (1.4.1) erubi (1.13.1) globalid (1.3.0) activesupport (>= 6.1) i18n (1.14.7) concurrent-ruby (~> 1.0) loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop net-smtp marcel (1.1.0) matrix (0.4.3) method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.9) minitest (5.26.0) net-imap (0.5.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout net-smtp (0.5.1) net-protocol nio4r (2.7.4) nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) nokogiri (1.18.10-aarch64-linux-gnu) racc (~> 1.4) nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) public_suffix (6.0.2) racc (1.8.1) rack (2.2.20) rack-test (2.2.0) rack (>= 1.3) rails (7.0.8.7) actioncable (= 7.0.8.7) actionmailbox (= 7.0.8.7) actionmailer (= 7.0.8.7) actionpack (= 7.0.8.7) actiontext (= 7.0.8.7) actionview (= 7.0.8.7) activejob (= 7.0.8.7) activemodel (= 7.0.8.7) activerecord (= 7.0.8.7) activestorage (= 7.0.8.7) activesupport (= 7.0.8.7) bundler (>= 1.15.0) railties (= 7.0.8.7) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (7.0.8.7) actionpack (= 7.0.8.7) activesupport (= 7.0.8.7) method_source rake (>= 12.2) thor (~> 1.0) zeitwerk (~> 2.5) rake (13.3.0) regexp_parser (2.11.3) rexml (3.4.4) rspec (3.13.1) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) rspec-core (3.13.5) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (7.1.1) actionpack (>= 7.0) activesupport (>= 7.0) railties (>= 7.0) rspec-core (~> 3.13) rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.6) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-cobertura (3.1.0) rexml simplecov (~> 0.19) simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) thor (1.4.0) timeout (0.4.3) tzinfo (2.0.6) concurrent-ruby (~> 1.0) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.6.18) PLATFORMS aarch64-linux arm64-darwin ruby x86_64-darwin x86_64-linux DEPENDENCIES arbre! capybara combustion concurrent-ruby (= 1.3.4) pry rails (~> 7.0.0) rake rspec rspec-rails simplecov simplecov-cobertura zeitwerk (~> 2.6.18) BUNDLED WITH 2.6.9 activeadmin-arbre-35697e3/gemfiles/rails_71/000077500000000000000000000000001507246002300205715ustar00rootroot00000000000000activeadmin-arbre-35697e3/gemfiles/rails_71/Gemfile000066400000000000000000000007661507246002300220750ustar00rootroot00000000000000# frozen_string_literal: true source 'http://rubygems.org' gem 'rake' group :test do gem 'rspec' gem 'simplecov', require: false gem 'simplecov-cobertura' gem 'pry' end group :rails do gem 'rails', '~> 7.1.0' gem 'rspec-rails' gem 'combustion' gem 'capybara' # FIXME: remove this dependency when Ruby 3.1 support will be dropped gem "erb", "~> 4.0" # FIXME: relax this dependency when Ruby 3.1 support will be dropped gem "zeitwerk", "~> 2.6.18" end gemspec path: "../.." activeadmin-arbre-35697e3/gemfiles/rails_71/Gemfile.lock000066400000000000000000000152031507246002300230140ustar00rootroot00000000000000PATH remote: ../.. specs: arbre (2.2.1) activesupport (>= 7.0) GEM remote: http://rubygems.org/ specs: actioncable (7.1.5.2) actionpack (= 7.1.5.2) activesupport (= 7.1.5.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) actionmailbox (7.1.5.2) actionpack (= 7.1.5.2) activejob (= 7.1.5.2) activerecord (= 7.1.5.2) activestorage (= 7.1.5.2) activesupport (= 7.1.5.2) mail (>= 2.7.1) net-imap net-pop net-smtp actionmailer (7.1.5.2) actionpack (= 7.1.5.2) actionview (= 7.1.5.2) activejob (= 7.1.5.2) activesupport (= 7.1.5.2) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) actionpack (7.1.5.2) actionview (= 7.1.5.2) activesupport (= 7.1.5.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) actiontext (7.1.5.2) actionpack (= 7.1.5.2) activerecord (= 7.1.5.2) activestorage (= 7.1.5.2) activesupport (= 7.1.5.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) actionview (7.1.5.2) activesupport (= 7.1.5.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) activejob (7.1.5.2) activesupport (= 7.1.5.2) globalid (>= 0.3.6) activemodel (7.1.5.2) activesupport (= 7.1.5.2) activerecord (7.1.5.2) activemodel (= 7.1.5.2) activesupport (= 7.1.5.2) timeout (>= 0.4.0) activestorage (7.1.5.2) actionpack (= 7.1.5.2) activejob (= 7.1.5.2) activerecord (= 7.1.5.2) activesupport (= 7.1.5.2) marcel (~> 1.0) activesupport (7.1.5.2) base64 benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) mutex_m securerandom (>= 0.3) tzinfo (~> 2.0) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.3.0) benchmark (0.4.1) bigdecimal (3.3.1) builder (3.3.0) capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) cgi (0.5.0) coderay (1.1.3) combustion (1.5.0) activesupport (>= 3.0.0) railties (>= 3.0.0) thor (>= 0.14.6) concurrent-ruby (1.3.5) connection_pool (2.5.4) crass (1.0.6) date (3.4.1) diff-lcs (1.6.2) docile (1.4.1) drb (2.2.3) erb (4.0.4) cgi (>= 0.3.3) erubi (1.13.1) globalid (1.3.0) activesupport (>= 6.1) i18n (1.14.7) concurrent-ruby (~> 1.0) io-console (0.8.1) irb (1.15.2) pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) logger (1.7.0) loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop net-smtp marcel (1.1.0) matrix (0.4.3) method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.9) minitest (5.26.0) mutex_m (0.3.0) net-imap (0.5.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout net-smtp (0.5.1) net-protocol nio4r (2.7.4) nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) nokogiri (1.18.10-aarch64-linux-gnu) racc (~> 1.4) nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) pp (0.6.3) prettyprint prettyprint (0.2.0) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) psych (5.2.6) date stringio public_suffix (6.0.2) racc (1.8.1) rack (3.2.3) rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) rackup (2.2.1) rack (>= 3) rails (7.1.5.2) actioncable (= 7.1.5.2) actionmailbox (= 7.1.5.2) actionmailer (= 7.1.5.2) actionpack (= 7.1.5.2) actiontext (= 7.1.5.2) actionview (= 7.1.5.2) activejob (= 7.1.5.2) activemodel (= 7.1.5.2) activerecord (= 7.1.5.2) activestorage (= 7.1.5.2) activesupport (= 7.1.5.2) bundler (>= 1.15.0) railties (= 7.1.5.2) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (7.1.5.2) actionpack (= 7.1.5.2) activesupport (= 7.1.5.2) irb rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.3.0) rdoc (6.15.0) erb psych (>= 4.0.0) tsort regexp_parser (2.11.3) reline (0.6.2) io-console (~> 0.5) rexml (3.4.4) rspec (3.13.1) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) rspec-core (3.13.5) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (7.1.1) actionpack (>= 7.0) activesupport (>= 7.0) railties (>= 7.0) rspec-core (~> 3.13) rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.6) securerandom (0.4.1) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-cobertura (3.1.0) rexml simplecov (~> 0.19) simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) stringio (3.1.7) thor (1.4.0) timeout (0.4.3) tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.6.18) PLATFORMS aarch64-linux arm64-darwin ruby x86_64-darwin x86_64-linux DEPENDENCIES arbre! capybara combustion erb (~> 4.0) pry rails (~> 7.1.0) rake rspec rspec-rails simplecov simplecov-cobertura zeitwerk (~> 2.6.18) BUNDLED WITH 2.6.9 activeadmin-arbre-35697e3/gemfiles/rails_72/000077500000000000000000000000001507246002300205725ustar00rootroot00000000000000activeadmin-arbre-35697e3/gemfiles/rails_72/Gemfile000066400000000000000000000007661507246002300220760ustar00rootroot00000000000000# frozen_string_literal: true source 'http://rubygems.org' gem 'rake' group :test do gem 'rspec' gem 'simplecov', require: false gem 'simplecov-cobertura' gem 'pry' end group :rails do gem 'rails', '~> 7.2.0' gem 'rspec-rails' gem 'combustion' gem 'capybara' # FIXME: remove this dependency when Ruby 3.1 support will be dropped gem "erb", "~> 4.0" # FIXME: relax this dependency when Ruby 3.1 support will be dropped gem "zeitwerk", "~> 2.6.18" end gemspec path: "../.." activeadmin-arbre-35697e3/gemfiles/rails_72/Gemfile.lock000066400000000000000000000151171507246002300230210ustar00rootroot00000000000000PATH remote: ../.. specs: arbre (2.2.1) activesupport (>= 7.0) GEM remote: http://rubygems.org/ specs: actioncable (7.2.2.2) actionpack (= 7.2.2.2) activesupport (= 7.2.2.2) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) actionmailbox (7.2.2.2) actionpack (= 7.2.2.2) activejob (= 7.2.2.2) activerecord (= 7.2.2.2) activestorage (= 7.2.2.2) activesupport (= 7.2.2.2) mail (>= 2.8.0) actionmailer (7.2.2.2) actionpack (= 7.2.2.2) actionview (= 7.2.2.2) activejob (= 7.2.2.2) activesupport (= 7.2.2.2) mail (>= 2.8.0) rails-dom-testing (~> 2.2) actionpack (7.2.2.2) actionview (= 7.2.2.2) activesupport (= 7.2.2.2) nokogiri (>= 1.8.5) racc rack (>= 2.2.4, < 3.2) rack-session (>= 1.0.1) rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) useragent (~> 0.16) actiontext (7.2.2.2) actionpack (= 7.2.2.2) activerecord (= 7.2.2.2) activestorage (= 7.2.2.2) activesupport (= 7.2.2.2) globalid (>= 0.6.0) nokogiri (>= 1.8.5) actionview (7.2.2.2) activesupport (= 7.2.2.2) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) activejob (7.2.2.2) activesupport (= 7.2.2.2) globalid (>= 0.3.6) activemodel (7.2.2.2) activesupport (= 7.2.2.2) activerecord (7.2.2.2) activemodel (= 7.2.2.2) activesupport (= 7.2.2.2) timeout (>= 0.4.0) activestorage (7.2.2.2) actionpack (= 7.2.2.2) activejob (= 7.2.2.2) activerecord (= 7.2.2.2) activesupport (= 7.2.2.2) marcel (~> 1.0) activesupport (7.2.2.2) base64 benchmark (>= 0.3) bigdecimal concurrent-ruby (~> 1.0, >= 1.3.1) connection_pool (>= 2.2.5) drb i18n (>= 1.6, < 2) logger (>= 1.4.2) minitest (>= 5.1) securerandom (>= 0.3) tzinfo (~> 2.0, >= 2.0.5) addressable (2.8.7) public_suffix (>= 2.0.2, < 7.0) base64 (0.3.0) benchmark (0.4.1) bigdecimal (3.3.1) builder (3.3.0) capybara (3.40.0) addressable matrix mini_mime (>= 0.1.3) nokogiri (~> 1.11) rack (>= 1.6.0) rack-test (>= 0.6.3) regexp_parser (>= 1.5, < 3.0) xpath (~> 3.2) cgi (0.5.0) coderay (1.1.3) combustion (1.5.0) activesupport (>= 3.0.0) railties (>= 3.0.0) thor (>= 0.14.6) concurrent-ruby (1.3.5) connection_pool (2.5.4) crass (1.0.6) date (3.4.1) diff-lcs (1.6.2) docile (1.4.1) drb (2.2.3) erb (4.0.4) cgi (>= 0.3.3) erubi (1.13.1) globalid (1.3.0) activesupport (>= 6.1) i18n (1.14.7) concurrent-ruby (~> 1.0) io-console (0.8.1) irb (1.15.2) pp (>= 0.6.0) rdoc (>= 4.0.0) reline (>= 0.4.2) logger (1.7.0) loofah (2.24.1) crass (~> 1.0.2) nokogiri (>= 1.12.0) mail (2.8.1) mini_mime (>= 0.1.1) net-imap net-pop net-smtp marcel (1.1.0) matrix (0.4.3) method_source (1.1.0) mini_mime (1.1.5) mini_portile2 (2.8.9) minitest (5.26.0) net-imap (0.5.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout net-smtp (0.5.1) net-protocol nio4r (2.7.4) nokogiri (1.18.10) mini_portile2 (~> 2.8.2) racc (~> 1.4) nokogiri (1.18.10-aarch64-linux-gnu) racc (~> 1.4) nokogiri (1.18.10-arm64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-darwin) racc (~> 1.4) nokogiri (1.18.10-x86_64-linux-gnu) racc (~> 1.4) pp (0.6.3) prettyprint prettyprint (0.2.0) pry (0.15.2) coderay (~> 1.1) method_source (~> 1.0) psych (5.2.6) date stringio public_suffix (6.0.2) racc (1.8.1) rack (3.1.18) rack-session (2.1.1) base64 (>= 0.1.0) rack (>= 3.0.0) rack-test (2.2.0) rack (>= 1.3) rackup (2.2.1) rack (>= 3) rails (7.2.2.2) actioncable (= 7.2.2.2) actionmailbox (= 7.2.2.2) actionmailer (= 7.2.2.2) actionpack (= 7.2.2.2) actiontext (= 7.2.2.2) actionview (= 7.2.2.2) activejob (= 7.2.2.2) activemodel (= 7.2.2.2) activerecord (= 7.2.2.2) activestorage (= 7.2.2.2) activesupport (= 7.2.2.2) bundler (>= 1.15.0) railties (= 7.2.2.2) rails-dom-testing (2.3.0) activesupport (>= 5.0.0) minitest nokogiri (>= 1.6) rails-html-sanitizer (1.6.2) loofah (~> 2.21) nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0) railties (7.2.2.2) actionpack (= 7.2.2.2) activesupport (= 7.2.2.2) irb (~> 1.13) rackup (>= 1.0.0) rake (>= 12.2) thor (~> 1.0, >= 1.2.2) zeitwerk (~> 2.6) rake (13.3.0) rdoc (6.15.0) erb psych (>= 4.0.0) tsort regexp_parser (2.11.3) reline (0.6.2) io-console (~> 0.5) rexml (3.4.4) rspec (3.13.1) rspec-core (~> 3.13.0) rspec-expectations (~> 3.13.0) rspec-mocks (~> 3.13.0) rspec-core (3.13.5) rspec-support (~> 3.13.0) rspec-expectations (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-mocks (3.13.5) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (8.0.2) actionpack (>= 7.2) activesupport (>= 7.2) railties (>= 7.2) rspec-core (~> 3.13) rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) rspec-support (3.13.6) securerandom (0.4.1) simplecov (0.22.0) docile (~> 1.1) simplecov-html (~> 0.11) simplecov_json_formatter (~> 0.1) simplecov-cobertura (3.1.0) rexml simplecov (~> 0.19) simplecov-html (0.13.2) simplecov_json_formatter (0.1.4) stringio (3.1.7) thor (1.4.0) timeout (0.4.3) tsort (0.2.0) tzinfo (2.0.6) concurrent-ruby (~> 1.0) useragent (0.16.11) websocket-driver (0.8.0) base64 websocket-extensions (>= 0.1.0) websocket-extensions (0.1.5) xpath (3.2.0) nokogiri (~> 1.8) zeitwerk (2.6.18) PLATFORMS aarch64-linux arm64-darwin ruby x86_64-darwin x86_64-linux DEPENDENCIES arbre! capybara combustion erb (~> 4.0) pry rails (~> 7.2.0) rake rspec rspec-rails simplecov simplecov-cobertura zeitwerk (~> 2.6.18) BUNDLED WITH 2.6.9 activeadmin-arbre-35697e3/lib/000077500000000000000000000000001507246002300161235ustar00rootroot00000000000000activeadmin-arbre-35697e3/lib/arbre.rb000066400000000000000000000011211507246002300175360ustar00rootroot00000000000000# frozen_string_literal: true require 'active_support/core_ext/string/output_safety' require 'active_support/hash_with_indifferent_access' require 'active_support/inflector' module Arbre end require_relative 'arbre/element' require_relative 'arbre/context' require_relative 'arbre/html/attributes' require_relative 'arbre/html/class_list' require_relative 'arbre/html/tag' require_relative 'arbre/html/text_node' require_relative 'arbre/html/document' require_relative 'arbre/html/html5_elements' require_relative 'arbre/component' if defined?(Rails) require_relative 'arbre/railtie' end activeadmin-arbre-35697e3/lib/arbre/000077500000000000000000000000001507246002300172165ustar00rootroot00000000000000activeadmin-arbre-35697e3/lib/arbre/component.rb000066400000000000000000000002501507246002300215420ustar00rootroot00000000000000# frozen_string_literal: true module Arbre class Component < Arbre::HTML::Div # By default components render a div def tag_name 'div' end end end activeadmin-arbre-35697e3/lib/arbre/context.rb000066400000000000000000000055211507246002300212320ustar00rootroot00000000000000# frozen_string_literal: true require_relative 'element' module Arbre # The Arbre::Context class is the frontend for using Arbre. # # The simplest example possible: # # html = Arbre::Context.new do # h1 "Hello World" # end # # html.to_s #=> "

Hello World

" # # The contents of the block are instance eval'd within the Context # object. This means that you lose context to the outside world from # within the block. To pass local variables into the Context, use the # assigns param. # # html = Arbre::Context.new({one: 1}) do # h1 "Your number #{one}" # end # # html.to_s #=> "Your number 1" # class Context < Element # Initialize a new Arbre::Context # # @param [Hash] assigns A hash of objects that you would like to be # available as local variables within the Context # # @param [Object] helpers An object that has methods on it which will become # instance methods within the context. # # @yield [] The block that will get instance eval'd in the context def initialize(assigns = {}, helpers = nil, &block) assigns = assigns || {} @_assigns = assigns.symbolize_keys @_helpers = helpers @_current_arbre_element_buffer = [self] super(self) instance_eval(&block) if block end def arbre_context self end def assigns @_assigns end def helpers @_helpers end def indent_level # A context does not increment the indent_level super - 1 end def bytesize cached_html.bytesize end alias :length :bytesize def respond_to_missing?(method, include_all) super || cached_html.respond_to?(method, include_all) end # Webservers treat Arbre::Context as a string. We override # method_missing to delegate to the string representation # of the html. ruby2_keywords def method_missing(method, *args, &block) if cached_html.respond_to? method cached_html.send method, *args, &block else super end end def current_arbre_element @_current_arbre_element_buffer.last end def with_current_arbre_element(tag) raise ArgumentError, "Can't be in the context of nil. #{@_current_arbre_element_buffer.inspect}" unless tag @_current_arbre_element_buffer.push tag yield ensure @_current_arbre_element_buffer.pop end alias_method :within, :with_current_arbre_element private # Caches the rendered HTML so that we don't re-render just to # get the content length or to delegate a method to the HTML def cached_html if defined?(@cached_html) @cached_html else html = to_s @cached_html = html if html.length > 0 html end end end end activeadmin-arbre-35697e3/lib/arbre/element.rb000066400000000000000000000076411507246002300212040ustar00rootroot00000000000000# frozen_string_literal: true require 'arbre/element/builder_methods' require 'arbre/element/proxy' require 'arbre/element_collection' module Arbre class Element include BuilderMethods attr_reader :parent attr_reader :children, :arbre_context def initialize(arbre_context = Arbre::Context.new) @arbre_context = arbre_context @children = ElementCollection.new @parent = nil end def assigns arbre_context.assigns end def helpers arbre_context.helpers end def tag_name @tag_name ||= self.class.name.demodulize.downcase end def build(*args, &block) # Render the block passing ourselves in append_return_block(block.call(self)) if block end def add_child(child) return unless child if child.is_a?(Array) child.each{|item| add_child(item) } return @children end # If its not an element, wrap it in a TextNode unless child.is_a?(Element) child = Arbre::HTML::TextNode.from_string(child) end if child.respond_to?(:parent) # Remove the child child.parent.remove_child(child) if child.parent && child.parent != self # Set ourselves as the parent child.parent = self end @children << child end def remove_child(child) child.parent = nil if child.respond_to?(:parent=) @children.delete(child) end def <<(child) add_child(child) end def children? @children.any? end def parent=(parent) @parent = parent end def parent? !@parent.nil? end def ancestors if parent? [parent] + parent.ancestors else [] end end # TODO: Shouldn't grab whole tree def find_first_ancestor(type) ancestors.find{|a| a.is_a?(type) } end def content=(contents) clear_children! add_child(contents) end def get_elements_by_tag_name(tag_name) elements = ElementCollection.new children.each do |child| elements << child if child.tag_name == tag_name elements.concat(child.get_elements_by_tag_name(tag_name)) end elements end alias_method :find_by_tag, :get_elements_by_tag_name def get_elements_by_class_name(class_name) elements = ElementCollection.new children.each do |child| elements << child if child.class_list.include?(class_name) elements.concat(child.get_elements_by_class_name(class_name)) end elements end alias_method :find_by_class, :get_elements_by_class_name def content children.to_s end def html_safe to_s end def indent_level parent? ? parent.indent_level + 1 : 0 end def each(&block) [to_s].each(&block) end def inspect to_s end def to_str to_s end def to_s content end def +(element) case element when Element, ElementCollection else element = Arbre::HTML::TextNode.from_string(element) end to_ary + element end def to_ary ElementCollection.new [Proxy.new(self)] end alias_method :to_a, :to_ary private # Resets the Elements children def clear_children! @children.clear end # Implements the method lookup chain. When you call a method that # doesn't exist, we: # # 1. Try to call the method on the current DOM context # 2. Return an assigned variable of the same name # 3. Call the method on the helper object # 4. Call super # ruby2_keywords def method_missing(name, *args, &block) if current_arbre_element.respond_to?(name) current_arbre_element.send name, *args, &block elsif assigns && assigns.has_key?(name) assigns[name] elsif helpers.respond_to?(name) helpers.send(name, *args, &block) else super end end end end activeadmin-arbre-35697e3/lib/arbre/element/000077500000000000000000000000001507246002300206475ustar00rootroot00000000000000activeadmin-arbre-35697e3/lib/arbre/element/builder_methods.rb000066400000000000000000000042431507246002300243500ustar00rootroot00000000000000# frozen_string_literal: true module Arbre class Element module BuilderMethods def self.included(klass) klass.extend ClassMethods end module ClassMethods def builder_method(method_name) BuilderMethods.class_eval <<-EOF, __FILE__, __LINE__ def #{method_name}(*args, &block) insert_tag ::#{self.name}, *args, &block end EOF end end def build_tag(klass, *args, &block) tag = klass.new(arbre_context) tag.parent = current_arbre_element with_current_arbre_element tag do if block && block.arity > 0 tag.build(*args, &block) else tag.build(*args) append_return_block(yield) if block end end tag end def insert_tag(klass, *args, &block) tag = build_tag(klass, *args, &block) current_arbre_element.add_child(tag) tag end def current_arbre_element arbre_context.current_arbre_element end def with_current_arbre_element(tag, &block) arbre_context.with_current_arbre_element(tag, &block) end alias_method :within, :with_current_arbre_element private # Appends the value to the current DOM element if there are no # existing DOM Children and it responds to #to_s def append_return_block(tag) return nil if current_arbre_element.children? if appendable_tag?(tag) current_arbre_element << Arbre::HTML::TextNode.from_string(tag.to_s) end end # Returns true if the object should be converted into a text node # and appended into the DOM. def appendable_tag?(tag) # Array.new.to_s prints out an empty array ("[]"). In # Arbre, we append the return value of blocks to the output, which # can cause empty arrays to show up within the output. To get # around this, we check if the object responds to #empty? if tag.respond_to?(:empty?) && tag.empty? false else !tag.is_a?(Arbre::Element) && tag.respond_to?(:to_s) end end end end end activeadmin-arbre-35697e3/lib/arbre/element/proxy.rb000066400000000000000000000011411507246002300223520ustar00rootroot00000000000000# frozen_string_literal: true module Arbre class Element class Proxy < BasicObject undef_method :== undef_method :equal? def initialize(element) @element = element end def respond_to?(method, include_all = false) if method.to_s == 'to_ary' false else super || @element.respond_to?(method, include_all) end end def method_missing(method, *args, &block) if method.to_s == 'to_ary' super else @element.__send__ method, *args, &block end end end end end activeadmin-arbre-35697e3/lib/arbre/element_collection.rb000066400000000000000000000006151507246002300234110ustar00rootroot00000000000000# frozen_string_literal: true module Arbre # Stores a collection of Element objects class ElementCollection < Array def +(other) self.class.new(super) end def -(other) self.class.new(super) end def &(other) self.class.new(super) end def to_s self.collect do |element| element.to_s end.join('').html_safe end end end activeadmin-arbre-35697e3/lib/arbre/html/000077500000000000000000000000001507246002300201625ustar00rootroot00000000000000activeadmin-arbre-35697e3/lib/arbre/html/attributes.rb000066400000000000000000000012541507246002300226770ustar00rootroot00000000000000# frozen_string_literal: true module Arbre module HTML class Attributes < Hash def to_s flatten_hash.compact.map do |name, value| "#{html_escape(name)}=\"#{html_escape(value)}\"" end.join ' ' end protected def flatten_hash(hash = self, old_path = [], accumulator = {}) hash.each do |key, value| path = old_path + [key] if value.is_a? Hash flatten_hash(value, path, accumulator) else accumulator[path.join('-')] = value end end accumulator end def html_escape(s) ERB::Util.html_escape(s) end end end end activeadmin-arbre-35697e3/lib/arbre/html/class_list.rb000066400000000000000000000007021507246002300226460ustar00rootroot00000000000000# frozen_string_literal: true require 'set' module Arbre module HTML # Holds a set of classes class ClassList < Set def self.build_from_string(class_names) new.add(class_names) end def add(class_names) class_names.to_s.split(" ").each do |class_name| super(class_name) end self end alias :<< :add def to_s to_a.join(" ") end end end end activeadmin-arbre-35697e3/lib/arbre/html/document.rb000066400000000000000000000011411507246002300223220ustar00rootroot00000000000000# frozen_string_literal: true module Arbre module HTML class Document < Tag def build(*args) super build_head build_body end def document self end def tag_name 'html' end def doctype ''.html_safe end def to_s doctype + super end protected def build_head @head = head do meta "http-equiv": "Content-type", content: "text/html; charset=utf-8" end end def build_body @body = body end end end end activeadmin-arbre-35697e3/lib/arbre/html/html5_elements.rb000066400000000000000000000036201507246002300234350ustar00rootroot00000000000000# frozen_string_literal: true module Arbre module HTML AUTO_BUILD_ELEMENTS = [ :a, :abbr, :address, :area, :article, :aside, :audio, :b, :base, :bdi, :bdo, :blockquote, :body, :br, :button, :canvas, :caption, :cite, :code, :col, :colgroup, :command, :data, :datalist, :dd, :del, :details, :dfn, :dialog, :div, :dl, :dt, :em, :embed, :fieldset, :figcaption, :figure, :footer, :form, :h1, :h2, :h3, :h4, :h5, :h6, :head, :header, :hgroup, :hr, :html, :i, :iframe, :img, :input, :ins, :kbd, :keygen, :label, :legend, :li, :link, :main, :map, :mark, :menu, :menuitem, :meta, :meter, :nav, :noscript, :object, :ol, :optgroup, :option, :output, :param, :picture, :pre, :progress, :q, :rp, :rt, :ruby, :s, :samp, :script, :search, :section, :select, :slot, :small, :source, :span, :strong, :style, :sub, :summary, :sup, :svg, :table, :tbody, :td, :template, :textarea, :tfoot, :th, :thead, :time, :title, :tr, :track, :u, :ul, :var, :video, :wbr ] HTML5_ELEMENTS = [ :p ] + AUTO_BUILD_ELEMENTS AUTO_BUILD_ELEMENTS.each do |name| class_eval <<-EOF class #{name.to_s.capitalize} < Tag builder_method :#{name} end EOF end class P < Tag builder_method :para end end end activeadmin-arbre-35697e3/lib/arbre/html/tag.rb000066400000000000000000000103711507246002300212640ustar00rootroot00000000000000# frozen_string_literal: true require 'erb' module Arbre module HTML class Tag < Element attr_reader :attributes # See: https://html.spec.whatwg.org/multipage/syntax.html#void-elements SELF_CLOSING_ELEMENTS = [ :area, :base, :br, :col, :embed, :hr, :img, :input, :keygen, :link, :menuitem, :meta, :param, :source, :track, :wbr ] def initialize(*) super @attributes = Attributes.new end def build(*args) super attributes = extract_arguments(args) self.content = args.first if args.first for_value = attributes[:for] unless for_value.is_a?(String) || for_value.is_a?(Symbol) set_for_attribute(attributes.delete(:for)) end attributes.each do |key, value| set_attribute(key, value) end end def extract_arguments(args) if args.last.is_a?(Hash) args.pop else {} end end def set_attribute(name, value) @attributes[name.to_sym] = value end def get_attribute(name) @attributes[name.to_sym] end alias :attr :get_attribute def has_attribute?(name) @attributes.has_key?(name.to_sym) end def remove_attribute(name) @attributes.delete(name.to_sym) end def id get_attribute(:id) end # Generates and id for the object if it doesn't exist already def id! return id if id self.id = object_id.to_s id end def id=(id) set_attribute(:id, id) end def add_class(class_names) class_list.add class_names end def remove_class(class_names) class_list.delete(class_names) end # Returns a string of classes def class_names class_list.to_s end def class_list list = get_attribute(:class) case list when ClassList list when String set_attribute(:class, ClassList.build_from_string(list)) else set_attribute(:class, ClassList.new) end end def to_s indent(opening_tag, content, closing_tag).html_safe end private def opening_tag "<#{tag_name}#{attributes_html}>" end def closing_tag "" end INDENT_SIZE = 2 def indent(open_tag, child_content, close_tag) spaces = ' ' * indent_level * INDENT_SIZE html = +"" if no_child? || child_is_text? if self_closing_tag? html << spaces << open_tag.sub( />$/, '/>' ) else # one line html << spaces << open_tag << child_content << close_tag end else # multiple lines html << spaces << open_tag << "\n" html << child_content # the child takes care of its own spaces html << spaces << close_tag end html << "\n" end def self_closing_tag? SELF_CLOSING_ELEMENTS.include?(tag_name.to_sym) end def no_child? children.empty? end def child_is_text? children.size == 1 && children.first.is_a?(TextNode) end def attributes_html " #{attributes}" if attributes.any? end def set_for_attribute(record) return unless record # set_attribute :id, ActionController::RecordIdentifier.dom_id(record, default_id_for_prefix) # add_class ActionController::RecordIdentifier.dom_class(record) set_attribute :id, dom_id_for(record) add_class dom_class_name_for(record) end def dom_class_name_for(record) if record.class.respond_to?(:model_name) record.class.model_name.singular else record.class.name.underscore.tr("/", "_") end end def dom_id_for(record) id = if record.respond_to?(:to_key) record.to_key elsif record.respond_to?(:id) record.id else record.object_id end [default_id_for_prefix, dom_class_name_for(record), id].compact.join("_") end def default_id_for_prefix nil end end end end activeadmin-arbre-35697e3/lib/arbre/html/text_node.rb000066400000000000000000000011311507246002300224740ustar00rootroot00000000000000# frozen_string_literal: true require 'erb' module Arbre module HTML class TextNode < Element builder_method :text_node # Builds a text node from a string def self.from_string(string) node = new node.build(string) node end def add_child(*args) raise "TextNodes do not have children" end def build(string) @content = string end def class_list [] end def tag_name nil end def to_s ERB::Util.html_escape(@content.to_s) end end end end activeadmin-arbre-35697e3/lib/arbre/rails/000077500000000000000000000000001507246002300203305ustar00rootroot00000000000000activeadmin-arbre-35697e3/lib/arbre/rails/forms.rb000066400000000000000000000042241507246002300220050ustar00rootroot00000000000000# frozen_string_literal: true module Arbre module Rails module Forms class FormBuilderProxy < Arbre::Component attr_reader :form_builder # Since label and select are Arbre Elements already, we must # override it here instead of letting method_missing # deal with it def label(*args) proxy_call_to_form :label, *args end def select(*args) proxy_call_to_form :select, *args end def respond_to_missing?(method, include_all) if form_builder && form_builder.respond_to?(method, include_all) true else super end end private def proxy_call_to_form(method, *args, &block) text_node form_builder.send(method, *args, &block) end ruby2_keywords def method_missing(method, *args, &block) if form_builder && form_builder.respond_to?(method) proxy_call_to_form(method, *args, &block) else super end end end class FormForProxy < FormBuilderProxy builder_method :form_for def build(resource, form_options = {}, &block) form_string = helpers.form_for(resource, form_options) do |f| @form_builder = f end @opening_tag, @closing_tag = split_string_on(form_string, "") super(&block) end def fields_for(*args, &block) insert_tag FieldsForProxy, form_builder, *args, &block end def split_string_on(string, match) return "" unless string && match part_1 = string.split(Regexp.new("#{match}\\z")).first [part_1, match] end def opening_tag @opening_tag || "" end def closing_tag @closing_tag || "" end end class FieldsForProxy < FormBuilderProxy def build(form_builder, *args, &block) form_builder.fields_for(*args) do |f| @form_builder = f end super(&block) end def to_s children.to_s end end end end end activeadmin-arbre-35697e3/lib/arbre/rails/rendering.rb000066400000000000000000000005301507246002300226300ustar00rootroot00000000000000# frozen_string_literal: true module Arbre module Rails module Rendering def render(*args, &block) rendered = helpers.render(*args, &block) case rendered when Arbre::Context current_arbre_element.add_child rendered else text_node rendered end end end end end activeadmin-arbre-35697e3/lib/arbre/rails/template_handler.rb000066400000000000000000000004611507246002300241660ustar00rootroot00000000000000# frozen_string_literal: true module Arbre module Rails class TemplateHandler def call(template, source = nil) source = template.source unless source <<-END Arbre::Context.new(assigns, self) { #{source} }.to_s END end end end end activeadmin-arbre-35697e3/lib/arbre/railtie.rb000066400000000000000000000006771507246002300212060ustar00rootroot00000000000000# frozen_string_literal: true require_relative 'rails/template_handler' require_relative 'rails/forms' require_relative 'rails/rendering' require 'rails' Arbre::Element.include(Arbre::Rails::Rendering) module Arbre class Railtie < ::Rails::Railtie initializer "arbre" do ActiveSupport.on_load(:action_view) do ActionView::Template.register_template_handler :arb, Arbre::Rails::TemplateHandler.new end end end end activeadmin-arbre-35697e3/lib/arbre/version.rb000066400000000000000000000001031507246002300212220ustar00rootroot00000000000000# frozen_string_literal: true module Arbre VERSION = "2.2.1" end activeadmin-arbre-35697e3/spec/000077500000000000000000000000001507246002300163075ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/arbre/000077500000000000000000000000001507246002300174025ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/arbre/integration/000077500000000000000000000000001507246002300217255ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/arbre/integration/html_spec.rb000066400000000000000000000110061507246002300242260ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre do let(:helpers){ nil } let(:assigns){ {} } it "renders a single element" do expect(arbre { span "Hello World" }.to_s).to eq("Hello World\n") end it "renders a child element" do expect(arbre { span do span "Hello World" end }.to_s).to eq <<~HTML Hello World HTML end it "renders an unordered list" do expect(arbre { ul do li "First" li "Second" li "Third" end }.to_s).to eq <<~HTML HTML end it "allows local variables inside the tags" do expect(arbre { first = "First" second = "Second" ul do li first li second end }.to_s).to eq <<~HTML HTML end it "adds children and nested" do expect(arbre { div do ul li do li end end }.to_s).to eq <<~HTML
  • HTML end it "passes the element in to the block if asked for" do expect(arbre { div do |d| d.ul do li end end }.to_s).to eq <<~HTML
    HTML end it "moves content tags between parents" do expect(arbre { div do span(ul(li)) end }.to_s).to eq <<~HTML
    HTML end it "adds content to the parent if the element is passed into block" do expect(arbre { div do |d| d.id = "my-tag" ul do li end end }.to_s).to eq <<~HTML
    HTML end it "has the parent set on it" do list, item = nil arbre { list = ul do li "Hello" item = li "World" end } expect(item.parent).to eq list end it "sets a string content return value with no children" do expect(arbre { li do "Hello World" end }.to_s).to eq <<~HTML
  • Hello World
  • HTML end it "turns string return values into text nodes" do node = nil arbre { list = li do "Hello World" end node = list.children.first } expect(node).to be_a described_class::HTML::TextNode end it "does not render blank arrays" do expect(arbre { tbody do [] end }.to_s).to eq <<~HTML HTML end describe "self-closing nodes" do it "does not self-close script tags" do expect(arbre { script type: 'text/javascript' }.to_s).to eq("\n") end it "self-closes meta tags" do expect(arbre { meta content: "text/html; charset=utf-8" }.to_s).to eq("\n") end it "self-closes link tags" do expect(arbre { link rel: "stylesheet" }.to_s).to eq("\n") end described_class::HTML::Tag::SELF_CLOSING_ELEMENTS.each do |tag| it "self-closes #{tag} tags" do expect(arbre { send(tag) }.to_s).to eq("<#{tag}/>\n") end end end describe "html safe" do it "escapes the contents" do expect(arbre { span("
    ") }.to_s).to eq <<~HTML <br /> HTML end it "returns html safe strings" do expect(arbre { span("
    ") }.to_s).to be_html_safe end it "does not escape html passed in" do expect(arbre { span(span("
    ")) }.to_s).to eq <<~HTML <br /> HTML end it "escapes string contents when passed in block" do expect(arbre { span { span { "
    " } } }.to_s).to eq <<~HTML <br /> HTML end it "escapes the contents of attributes" do expect(arbre { span(class: "
    ") }.to_s).to eq <<~HTML HTML end end end activeadmin-arbre-35697e3/spec/arbre/unit/000077500000000000000000000000001507246002300203615ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/arbre/unit/component_spec.rb000066400000000000000000000016251507246002300237260ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' # A mock subclass to play with class MockComponent < Arbre::Component builder_method :mock_component def build h2 "Hello World" end end describe Arbre::Component do let(:assigns) { {} } let(:helpers) { nil } let(:component_class) { MockComponent } let(:component) { component_class.new } it "is a subclass of an html div" do expect(described_class.ancestors).to include(Arbre::HTML::Div) end it "renders to a div, even as a subclass" do expect(component.tag_name).to eq('div') end it "does not have a class list" do expect(component.class_list.to_s).to eq("") expect(component.class_list.empty?).to be(true) end it "renders the object using the builder method name" do expect(arbre { mock_component }.to_s).to eq <<~HTML

    Hello World

    HTML end end activeadmin-arbre-35697e3/spec/arbre/unit/context_spec.rb000066400000000000000000000024221507246002300234040ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::Context do let(:context) do described_class.new do h1 "札幌市北区" # Add some HTML to the context end end it "does not increment the indent_level" do expect(context.indent_level).to eq(-1) end it "returns a bytesize" do expect(context.bytesize).to eq(25) end it "returns a length" do expect(context.length).to eq(25) end it "delegates missing methods to the html string" do expect(context).to respond_to(:index) expect(context.index('<')).to eq(0) end it "uses a cached version of the HTML for method delegation" do expect(context).to receive(:to_s).once.and_return("

    札幌市北区

    ") expect(context.index('<')).to eq(0) expect(context.index('<')).to eq(0) end context "when an error is raised in a nested block" do let(:context) do described_class.new do ul do li do 'item one' end li do raise 'error talking to the db' end end rescue StandardError para 'Uh oh! DB call failed' end end it "properly resets the element buffer" do expect(context.current_arbre_element).to be_a(described_class) end end end activeadmin-arbre-35697e3/spec/arbre/unit/element_finder_methods_spec.rb000066400000000000000000000061111507246002300264220ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::Element, "Finder Methods" do let(:assigns){ {} } let(:helpers){ {} } describe "finding elements by tag name" do it "returns 0 when no elements exist" do expect(arbre { div }.get_elements_by_tag_name("li").size).to eq(0) end it "returns a child element" do html = arbre do ul li ul end elements = html.get_elements_by_tag_name("li") expect(elements.size).to eq(1) expect(elements[0]).to be_instance_of(Arbre::HTML::Li) end it "returns multiple child elements" do html = arbre do ul li ul li end elements = html.get_elements_by_tag_name("li") expect(elements.size).to eq(2) expect(elements[0]).to be_instance_of(Arbre::HTML::Li) expect(elements[1]).to be_instance_of(Arbre::HTML::Li) end it "returns children's child elements" do html = arbre do ul li do li end end elements = html.get_elements_by_tag_name("li") expect(elements.size).to eq(2) expect(elements[0]).to be_instance_of(Arbre::HTML::Li) expect(elements[1]).to be_instance_of(Arbre::HTML::Li) expect(elements[1].parent).to eq(elements[0]) end end #TODO: describe "finding an element by id" describe "finding an element by a class name" do it "returns 0 when no elements exist" do expect(arbre { div }.get_elements_by_class_name("my_class").size).to eq(0) end it "allows text nodes on tree" do expect(arbre { text_node "text" }.get_elements_by_class_name("my_class").size).to eq(0) end it "returns a child element" do html = arbre do div class: "some_class" div class: "my_class" end elements = html.get_elements_by_class_name("my_class") expect(elements.size).to eq(1) expect(elements[0]).to be_instance_of(Arbre::HTML::Div) end it "returns multiple child elements" do html = arbre do div class: "some_class" div class: "my_class" div class: "my_class" end elements = html.get_elements_by_class_name("my_class") expect(elements.size).to eq(2) expect(elements[0]).to be_instance_of(Arbre::HTML::Div) expect(elements[1]).to be_instance_of(Arbre::HTML::Div) end it "returns elements that match one of several classes" do html = arbre do div class: "some_class this_class" div class: "some_class" div class: "other_class" end elements = html.get_elements_by_class_name("this_class") expect(elements.size).to eq(1) expect(elements[0]).to be_instance_of(Arbre::HTML::Div) end it "returns a grandchild element" do html = arbre do div class: "some_class" do div class: "my_class" end end elements = html.get_elements_by_class_name("my_class") expect(elements.size).to eq(1) expect(elements[0]).to be_instance_of(Arbre::HTML::Div) end end end activeadmin-arbre-35697e3/spec/arbre/unit/element_spec.rb000066400000000000000000000163471507246002300233640ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::Element do let(:element){ described_class.new } context "when initialized" do it "has no children" do expect(element.children).to be_empty end it "has no parent" do expect(element.parent).to be_nil end it "responds to the HTML builder methods" do expect(element).to respond_to(:span) end it "has a set of local assigns" do context = Arbre::Context.new hello: "World" element = described_class.new(context) expect(element.assigns[:hello]).to eq("World") end it "has an empty hash with no local assigns" do expect(element.assigns).to eq({}) end end describe "passing in a helper object" do let(:helper) do Class.new do def helper_method "helper method" end end end let(:element){ described_class.new(Arbre::Context.new(nil, helper.new)) } it "calls methods on the helper object and return TextNode objects" do expect(element.helper_method).to eq("helper method") end it "raises a NoMethodError if not found" do expect { element.a_method_that_doesnt_exist }.to raise_error(NoMethodError) end end describe "passing in assigns" do let(:post) { double } let(:assigns){ {post: post} } it "is accessible via a method call" do element = described_class.new(Arbre::Context.new(assigns)) expect(element.post).to eq(post) end end it "to_a.flatten should not infinitely recurse" do expect { Timeout.timeout(1) do element.to_a.flatten end }.not_to raise_error end describe "adding a child" do let(:child){ described_class.new } before do element.add_child child end it "adds the child to the parent" do expect(element.children.first).to eq(child) end it "sets the parent of the child" do expect(child.parent).to eq(element) end context "when the child is nil" do let(:child){ nil } it "does not add the child" do expect(element.children).to be_empty end end context "when the child is a string" do let(:child){ "Hello World" } it "adds as a TextNode" do expect(element.children.first).to be_instance_of(Arbre::HTML::TextNode) expect(element.children.first.to_s).to eq("Hello World") end end end describe "setting the content" do context "when a string" do before do element.add_child "Hello World" element.content = "Goodbye" end it "clears the existing children" do expect(element.children.size).to eq(1) end it "adds the string as a child" do expect(element.children.first.to_s).to eq("Goodbye") end it "htmls escape the string" do string = "Goodbye
    " element.content = string expect(element.content.to_s).to eq("Goodbye <br />") end end context "when an element" do let(:content_element){ described_class.new } before do element.content = content_element end it "sets the content tag" do expect(element.children.first).to eq(content_element) end it "sets the tags parent" do expect(content_element.parent).to eq(element) end end context "when an array of tags" do let(:first){ described_class.new } let(:second){ described_class.new } before do element.content = [first, second] end it "sets the content tag" do expect(element.children.first).to eq(first) end it "sets the tags parent" do expect(element.children.first.parent).to eq(element) end end end describe "rendering to html" do before { @separator = $, } after { $, = @separator } # rubocop:disable RSpec/InstanceVariable let(:collection){ element + "hello world" } it "renders the children collection" do expect(element.children).to receive(:to_s).and_return("content") expect(element.to_s).to eq("content") end it "renders collection when is set the default separator" do suppressing_27_warning { $, = "_" } expect(collection.to_s).to eq("hello world") end it "renders collection when is not set the default separator" do expect(collection.to_s).to eq("hello world") end private def suppressing_27_warning return yield unless Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.7.a") begin old_verbose = $VERBOSE $VERBOSE = nil yield ensure $VERBOSE = old_verbose end end end describe "adding elements together" do context "when both elements are tags" do let(:first){ described_class.new } let(:second){ described_class.new } let(:collection){ first + second } it "returns an instance of Collection" do expect(collection).to be_an_instance_of(Arbre::ElementCollection) end it "returns the elements in the collection" do expect(collection.size).to eq(2) expect(collection.first).to eq(first) expect(collection[1]).to eq(second) end end context "when the left is a collection and the right is a tag" do let(:first){ described_class.new } let(:second){ described_class.new } let(:third){ described_class.new } let(:collection){ Arbre::ElementCollection.new([first, second]) + third } it "returns an instance of Collection" do expect(collection).to be_an_instance_of(Arbre::ElementCollection) end it "returns the elements in the collection flattened" do expect(collection.size).to eq(3) expect(collection[0]).to eq(first) expect(collection[1]).to eq(second) expect(collection[2]).to eq(third) end end context "when the right is a collection and the left is a tag" do let(:first){ described_class.new } let(:second){ described_class.new } let(:third){ described_class.new } let(:collection){ first + Arbre::ElementCollection.new([second,third]) } it "returns an instance of Collection" do expect(collection).to be_an_instance_of(Arbre::ElementCollection) end it "returns the elements in the collection flattened" do expect(collection.size).to eq(3) expect(collection[0]).to eq(first) expect(collection[1]).to eq(second) expect(collection[2]).to eq(third) end end context "when the left is a tag and the right is a string" do let(:element){ described_class.new } let(:collection){ element + "Hello World"} it "returns an instance of Collection" do expect(collection).to be_an_instance_of(Arbre::ElementCollection) end it "returns the elements in the collection" do expect(collection.size).to eq(2) expect(collection[0]).to eq(element) expect(collection[1]).to be_an_instance_of(Arbre::HTML::TextNode) end end context "when the left is a string and the right is a tag" do let(:collection){ "hello World" + described_class.new} it "returns a string" do expect(collection.strip.chomp).to eq("hello World") end end end end activeadmin-arbre-35697e3/spec/arbre/unit/html/000077500000000000000000000000001507246002300213255ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/arbre/unit/html/class_list_spec.rb000066400000000000000000000005351507246002300250270ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::HTML::ClassList do describe ".build_from_string" do it "builds a new list from a string of classes" do list = described_class.build_from_string("first second") expect(list.size).to eq(2) expect(list).to match_array(%w{first second}) end end end activeadmin-arbre-35697e3/spec/arbre/unit/html/document_spec.rb000066400000000000000000000004511507246002300245020ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::HTML::Document do let(:document){ described_class.new } describe "#to_s" do subject { document.to_s } before do document.build end it { is_expected.to eq "\n" } end end activeadmin-arbre-35697e3/spec/arbre/unit/html/tag_attributes_spec.rb000066400000000000000000000063711507246002300257140ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::HTML::Tag, "Attributes" do let(:tag){ described_class.new } describe "attributes" do before { tag.build id: "my_id" } it "has an attributes hash" do expect(tag.attributes).to eq({id: "my_id"}) end describe "#to_s" do it "renders the attributes to html" do expect(tag.to_s).to eq "\n" end it "renders attributes that are empty but not nil" do tag.class_list # initializes an empty ClassList tag.set_attribute :foo, '' tag.set_attribute :bar, nil expect(tag.to_s).to eq "\n" end context "with hyphenated attributes" do before { tag.build id: "my_id", "data-method" => "get", "data-remote" => true } it "renders the attributes to html" do expect(tag.to_s).to eq "\n" end end context "when there is a nested attribute" do before { tag.build id: "my_id", data: { action: 'some_action' } } it "flattens the attributes when rendering to html" do expect(tag.to_s).to eq "\n" end it "renders attributes that are empty but not nil" do tag.class_list # initializes an empty ClassList tag.set_attribute :foo, { bar: '' } tag.set_attribute :bar, { baz: nil } expect(tag.to_s).to eq "\n" end end context "when there is a deeply nested attribute" do before { tag.build id: "my_id", foo: { bar: { bat: nil, baz: 'foozle' } } } it "flattens the attributes when rendering to html" do expect(tag.to_s).to eq "\n" end end context "when there are multiple nested attributes" do before { tag.build id: "my_id", foo: { bar: 'foozle1', bat: nil, baz: '' } } it "flattens the attributes when rendering to html" do expect(tag.to_s).to eq "\n" end end end it "gets an attribute value" do expect(tag.attr(:id)).to eq("my_id") end describe "#has_attribute?" do context "when the attribute exists" do it "returns true" do expect(tag.has_attribute?(:id)).to be(true) end end context "when the attribute does not exist" do it "returns false" do expect(tag.has_attribute?(:class)).to be(false) end end end it "removes an attribute" do expect(tag.attributes).to eq({id: "my_id"}) expect(tag.remove_attribute(:id)).to eq("my_id") expect(tag.attributes).to eq({}) end end describe "rendering attributes" do it "escapes attribute values" do tag.set_attribute(:class, '">bad things!') expect(tag.to_s).to eq "\n" end it "escapes attribute names" do tag.set_attribute(">bad", "things") expect(tag.to_s).to eq "\n" end end end activeadmin-arbre-35697e3/spec/arbre/unit/html/tag_spec.rb000066400000000000000000000056611507246002300234470ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::HTML::Tag do let(:tag){ described_class.new } describe "building a new tag" do before { tag.build "Hello World", id: "my_id" } it "sets the contents to a string" do expect(tag.content).to eq("Hello World") end it "sets the hash of options to the attributes" do expect(tag.attributes).to eq({ id: "my_id" }) end end describe "creating a tag 'for' an object" do # rubocop:disable RSpec/VerifiedDoubles let(:model_name){ double(singular: "resource_class")} let(:resource_class){ double(model_name: model_name) } let(:resource){ double(class: resource_class, to_key: ['5'])} # rubocop:enable RSpec/VerifiedDoubles before do tag.build for: resource end it "sets the id to the type and id" do expect(tag.id).to eq("resource_class_5") end it "adds a class name" do expect(tag.class_list).to include("resource_class") end describe "for an object that doesn't have a model_name" do let(:resource_class){ double(name: 'ResourceClass') } # rubocop:disable RSpec/VerifiedDoubles before do tag.build for: resource end it "sets the id to the type and id" do expect(tag.id).to eq("resource_class_5") end it "adds a class name" do expect(tag.class_list).to include("resource_class") end end describe "with a default_id_for_prefix" do let(:tag) do Class.new(Arbre::HTML::Tag) do def default_id_for_prefix "a_prefix" end end.new end it "sets the id to the type and id" do expect(tag.id).to eq("a_prefix_resource_class_5") end end end describe "creating a tag with a for attribute" do it "sets the `for` attribute when a string is given" do tag.build for: "email" expect(tag.attributes[:for]).to eq "email" end it "sets the `for` attribute when a symbol is given" do tag.build for: :email expect(tag.attributes[:for]).to eq :email end end describe "css class names" do it "adds a class" do tag.add_class "hello_world" expect(tag.class_names).to eq("hello_world") end it "removes classes" do tag.add_class "hello_world" expect(tag.class_names).to eq("hello_world") tag.remove_class "hello_world" expect(tag.class_names).to eq("") end it "does not add a class if it already exists" do tag.add_class "hello_world" tag.add_class "hello_world" expect(tag.class_names).to eq("hello_world") end it "separates classes with space" do tag.add_class "hello world" expect(tag.class_list.size).to eq(2) end it "creates a class list from a string" do tag = described_class.new tag.build(class: "first-class") tag.add_class "second-class" expect(tag.class_list.size).to eq(2) end end end activeadmin-arbre-35697e3/spec/arbre/unit/html/text_node_spec.rb000066400000000000000000000007051507246002300246570ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' describe Arbre::HTML::TextNode do let(:text_node){ described_class.new } describe '#class_list' do subject { text_node.class_list } it { is_expected.to be_empty } end describe '#tag_name' do subject { text_node.tag_name } it { is_expected.to be_nil } end describe '#to_s' do subject { text_node.build('Test').to_s } it { is_expected.to eq 'Test' } end end activeadmin-arbre-35697e3/spec/changelog_spec.rb000066400000000000000000000012471507246002300216010ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' RSpec.describe "Changelog" do subject(:changelog) do path = File.join(File.dirname(__dir__), "CHANGELOG.md") File.read(path) end it 'has definitions for all implicit links' do implicit_link_names = changelog.scan(/\[([^\]]+)\]\[\]/).flatten.uniq implicit_link_names.each do |name| expect(changelog).to include("[#{name}]: https") end end describe 'entry' do subject(:entries) { lines.grep(/^\*/) } let(:lines) { changelog.each_line } it 'does not end with a punctuation' do entries.each do |entry| expect(entry).not_to match(/\.$/) end end end end activeadmin-arbre-35697e3/spec/gemspec_spec.rb000066400000000000000000000005431507246002300212730ustar00rootroot00000000000000# frozen_string_literal: true require "spec_helper" require "open3" require "arbre/version" RSpec.describe "Gemspec" do after do File.delete("arbre-#{Arbre::VERSION}.gem") end let(:build) do Bundler.with_original_env do Open3.capture3("gem build arbre") end end it "succeeds" do expect(build[2]).to be_success end end activeadmin-arbre-35697e3/spec/rails/000077500000000000000000000000001507246002300174215ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/integration/000077500000000000000000000000001507246002300217445ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/integration/forms_spec.rb000066400000000000000000000045101507246002300244310ustar00rootroot00000000000000# frozen_string_literal: true require 'rails/rails_spec_helper' RSpec.describe "Forms" do let(:assigns){ {} } let(:helpers){ mock_action_view } let(:html) { form.to_s } describe "building a simple form for" do let(:form) do arbre do form_for MockPerson.new, url: "/" do |f| f.label :name f.text_field :name end end end it "builds a form" do expect(html).to have_css("form") end it "includes the hidden authenticity token" do expect(html).to have_field("authenticity_token", type: :hidden, with: "AUTH_TOKEN") end it "creates a label" do expect(html).to have_css("form label[for=mock_person_name]") end it "creates a text field" do expect(html).to have_css("form input[type=text]") end end describe "building a form with fields for" do let(:form) do arbre do form_for MockPerson.new, url: "/" do |f| f.label :name f.text_field :name f.fields_for :permission do |pf| pf.label :admin pf.check_box :admin end end end end it "renders nested label" do expect(html).to have_css("form label[for=mock_person_permission_admin]", text: "Admin") end it "renders nested input" do expect(html).to have_css("form input[type=checkbox][name='mock_person[permission][admin]']") end it "does not render a div for the proxy" do expect(html).to have_no_css("form div.fields_for_proxy") end end describe "forms with other elements" do let(:form) do arbre do form_for MockPerson.new, url: "/" do |f| div do f.label :name f.text_field :name end para do f.label :name f.text_field :name end div class: "permissions" do f.fields_for :permission do |pf| div class: "permissions_label" do pf.label :admin end pf.check_box :admin end end end end end it "nests elements" do expect(html).to have_css("form > p > label") end it "nests elements within fields for" do expect(html).to have_css("form > div.permissions > div.permissions_label label") end end end activeadmin-arbre-35697e3/spec/rails/integration/rendering_spec.rb000066400000000000000000000057121507246002300252650ustar00rootroot00000000000000# frozen_string_literal: true require 'rails/rails_spec_helper' ARBRE_VIEWS_PATH = File.expand_path("../../templates", __FILE__) class TestController < ActionController::Base append_view_path ARBRE_VIEWS_PATH def render_empty render "arbre/empty" end def render_simple_page render "arbre/simple_page" end def render_partial render "arbre/page_with_partial" end def render_erb_partial render "arbre/page_with_erb_partial" end def render_with_instance_variable @my_instance_var = "From Instance Var" render "arbre/page_with_assignment" end def render_partial_with_instance_variable @my_instance_var = "From Instance Var" render "arbre/page_with_arb_partial_and_assignment" end def render_with_block render "arbre/page_with_render_with_block" end end RSpec.describe TestController, "Rendering with Arbre", type: :request do let(:body){ response.body } before do Rails.application.routes.draw do get 'test/render_empty', controller: "test" get 'test/render_simple_page', controller: "test" get 'test/render_partial', controller: "test" get 'test/render_erb_partial', controller: "test" get 'test/render_with_instance_variable', controller: "test" get 'test/render_partial_with_instance_variable', controller: "test" get 'test/render_page_with_helpers', controller: "test" get 'test/render_with_block', controller: "test" end end after do Rails.application.reload_routes! end it "renders the empty template" do get "/test/render_empty" expect(response).to be_successful end it "renders a simple page" do get "/test/render_simple_page" expect(response).to be_successful expect(body).to have_css("h1", text: "Hello World") expect(body).to have_css("p", text: "Hello again!") end it "renders an arb partial" do get "/test/render_partial" expect(response).to be_successful expect(body).to eq <<~HTML

    Before Partial

    Hello from a partial

    After Partial

    HTML end it "renders an erb (or other) partial" do get "/test/render_erb_partial" expect(response).to be_successful expect(body).to eq <<~HTML

    Before Partial

    Hello from an erb partial

    After Partial

    HTML end it "renders with instance variables" do get "/test/render_with_instance_variable" expect(response).to be_successful expect(body).to have_css("h1", text: "From Instance Var") end it "renders an arbre partial with assignments" do get "/test/render_partial_with_instance_variable" expect(response).to be_successful expect(body).to have_css("p", text: "Partial: From Instance Var") end it "renders with a block" do get "/test/render_with_block" expect(response).to be_successful expect(body).to eq <<~HTML

    Before Render

    Hello from a render block

    After Render

    HTML end end activeadmin-arbre-35697e3/spec/rails/rails_spec_helper.rb000066400000000000000000000021021507246002300234240ustar00rootroot00000000000000# frozen_string_literal: true require 'spec_helper' Combustion.path = 'spec/rails/stub_app' Combustion.initialize! :action_controller, :action_view do if Rails.gem_version >= Gem::Version.new("7.1.0") config.active_support.cache_format_version = 7.1 end end require 'rspec/rails' require 'capybara/rspec' require 'capybara/rails' require 'rails/support/mock_person' module AdditionalHelpers def protect_against_forgery? true end def form_authenticity_token(form_options: {}) "AUTH_TOKEN" end end def mock_action_view(assigns = {}) controller = ActionView::TestCase::TestController.new ActionView::Base.include(ActionView::Helpers) ActionView::Base.include(AdditionalHelpers) context = ActionView::LookupContext.new(ActionController::Base.view_paths) ActionView::Base.new(context, assigns, controller) end RSpec.configure do |config| config.include Capybara::RSpecMatchers config.mock_with :rspec do |mocks| mocks.verify_partial_doubles = true end config.disable_monkey_patching! config.order = :random Kernel.srand config.seed end activeadmin-arbre-35697e3/spec/rails/stub_app/000077500000000000000000000000001507246002300212365ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/stub_app/config/000077500000000000000000000000001507246002300225035ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/stub_app/config/database.yml000066400000000000000000000001001507246002300247610ustar00rootroot00000000000000test: adapter: sqlite3 database: db/combustion_test.sqlite activeadmin-arbre-35697e3/spec/rails/stub_app/config/routes.rb000066400000000000000000000001071507246002300243470ustar00rootroot00000000000000# frozen_string_literal: true Rails.application.routes.draw do # end activeadmin-arbre-35697e3/spec/rails/stub_app/db/000077500000000000000000000000001507246002300216235ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/stub_app/db/schema.rb000066400000000000000000000001131507246002300234030ustar00rootroot00000000000000# frozen_string_literal: true # ActiveRecord::Schema.define do # # # end activeadmin-arbre-35697e3/spec/rails/stub_app/log/000077500000000000000000000000001507246002300220175ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/stub_app/log/.gitignore000066400000000000000000000000061507246002300240030ustar00rootroot00000000000000*.log activeadmin-arbre-35697e3/spec/rails/stub_app/public/000077500000000000000000000000001507246002300225145ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/stub_app/public/favicon.ico000066400000000000000000000000001507246002300246230ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/support/000077500000000000000000000000001507246002300211355ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/support/mock_person.rb000066400000000000000000000002741507246002300240040ustar00rootroot00000000000000# frozen_string_literal: true require 'active_model' class MockPerson extend ActiveModel::Naming attr_accessor :name def persisted? false end def to_key [] end end activeadmin-arbre-35697e3/spec/rails/templates/000077500000000000000000000000001507246002300214175ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/templates/arbre/000077500000000000000000000000001507246002300225125ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/templates/arbre/_partial.arb000066400000000000000000000000341507246002300247700ustar00rootroot00000000000000para "Hello from a partial" activeadmin-arbre-35697e3/spec/rails/templates/arbre/_partial_with_assignment.arb000066400000000000000000000000431507246002300302530ustar00rootroot00000000000000para "Partial: #{my_instance_var}" activeadmin-arbre-35697e3/spec/rails/templates/arbre/empty.arb000066400000000000000000000000001507246002300243240ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/templates/arbre/page_with_arb_partial_and_assignment.arb000066400000000000000000000001161507246002300325570ustar00rootroot00000000000000h1 "Before Partial" render "arbre/partial_with_assignment" h2 "After Partial" activeadmin-arbre-35697e3/spec/rails/templates/arbre/page_with_assignment.arb000066400000000000000000000000231507246002300273720ustar00rootroot00000000000000h1 my_instance_var activeadmin-arbre-35697e3/spec/rails/templates/arbre/page_with_erb_partial.arb000066400000000000000000000000741507246002300275140ustar00rootroot00000000000000h1 "Before Partial" render "erb/partial" h2 "After Partial" activeadmin-arbre-35697e3/spec/rails/templates/arbre/page_with_partial.arb000066400000000000000000000000761507246002300266660ustar00rootroot00000000000000h1 "Before Partial" render "arbre/partial" h2 "After Partial" activeadmin-arbre-35697e3/spec/rails/templates/arbre/page_with_render_with_block.arb000066400000000000000000000002751507246002300307170ustar00rootroot00000000000000render_in_object = Class.new do def render_in(_, &block) block.call end end.new h1 "Before Render" render render_in_object do "Hello from a render block\n" end h2 "After Render" activeadmin-arbre-35697e3/spec/rails/templates/arbre/simple_page.arb000066400000000000000000000001311507246002300254600ustar00rootroot00000000000000html do head do end body do h1 "Hello World" para "Hello again!" end end activeadmin-arbre-35697e3/spec/rails/templates/erb/000077500000000000000000000000001507246002300221675ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/rails/templates/erb/_partial.erb000066400000000000000000000000411507246002300244470ustar00rootroot00000000000000

    Hello from an erb partial

    activeadmin-arbre-35697e3/spec/spec_helper.rb000066400000000000000000000006401507246002300211250ustar00rootroot00000000000000# frozen_string_literal: true if ENV.fetch('COVERAGE', false) require 'simplecov' require 'simplecov-cobertura' SimpleCov.start do add_filter %r{^/spec/} minimum_coverage 90 maximum_coverage_drop 0.2 formatter SimpleCov::Formatter::CoberturaFormatter end end require 'support/bundle' require 'combustion' require 'arbre' def arbre(&block) Arbre::Context.new assigns, helpers, &block end activeadmin-arbre-35697e3/spec/support/000077500000000000000000000000001507246002300200235ustar00rootroot00000000000000activeadmin-arbre-35697e3/spec/support/bundle.rb000066400000000000000000000001701507246002300216170ustar00rootroot00000000000000# frozen_string_literal: true $LOAD_PATH.unshift(File.expand_path("../../", __FILE__)) require "bundler" Bundler.setup