Skip to content

Commit 65638f7

Browse files
committed
Rename project fork to arbo.
1 parent 8710693 commit 65638f7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+246
-251
lines changed

README.md

+9-14
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
This is a fork of the original Arbre project starting when I stepped down from maintaining Active Admin in 2018.
2-
Google 'why fork open source' for relevant articles.
3-
4-
# Arbre - HTML Views in Ruby
1+
# Arbo - HTML Views in Ruby
52

6-
[Arbre](https://www.activeadmin.info/arbre) makes it easy to generate HTML directly in Ruby. This gem was extracted from [Active Admin](https://github.com/activeadmin/active_admin).
3+
[Arbo](https://github.com/varyonic/arbo) makes it easy to generate HTML directly in Ruby. This gem was forked from [Arbre](https://github.com/activeadmin/arbre),
4+
starting when the author stepped down from maintaining Active Admin in 2018.
5+
Google 'why fork open source' for relevant articles.
76

87
[![Version ][rubygems_badge]][rubygems]
9-
[![Travis CI ][travis_badge]][travis]
108

119
## Goals
1210

13-
The purpose of Arbre is to leave the view as ruby objects as long
14-
as possible. This allows OO Design to be used to implement the view layer.
11+
The purpose of Arbo is to support Varyonic's fork of ActiveAdmin.
1512

1613
## Getting started
1714

@@ -25,10 +22,8 @@ Please open GitHub issues for bugs and enhancements only, not general help reque
2522
Please search previous issues (and Google and StackOverflow) before creating a new issue.
2623

2724

28-
[rubygems_badge]: http://img.shields.io/gem/v/arbre.svg
29-
[rubygems]: https://rubygems.org/gems/arbre
30-
[travis_badge]: http://img.shields.io/travis/activeadmin/arbre/master.svg
31-
[travis]: https://travis-ci.org/activeadmin/arbre
25+
[rubygems_badge]: http://img.shields.io/gem/v/arbo.svg
26+
[rubygems]: https://rubygems.org/gems/arbo
3227

33-
[docs]: https://activeadmin.github.io/arbre/
34-
[stackoverflow]: http://stackoverflow.com/questions/tagged/arbre
28+
[docs]: https://varyonic.github.io/arbo/
29+
[stackoverflow]: http://stackoverflow.com/questions/tagged/arbo

Rakefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ task :console do
1111
require 'irb/completion'
1212

1313
require 'pry'
14-
require 'arbre'
14+
require 'arbo'
1515

1616
ARGV.clear
1717
IRB.start

arbre.gemspec arbo.gemspec

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# -*- encoding: utf-8 -*-
22
$:.push File.expand_path("../lib", __FILE__)
3-
require "arbre/version"
3+
require "arbo/version"
44

55
Gem::Specification.new do |s|
6-
s.name = "arbre"
7-
s.version = Arbre::VERSION
6+
s.name = "arbo"
7+
s.version = Arbo::VERSION
88
s.platform = Gem::Platform::RUBY
9-
s.authors = ["Greg Bell"]
10-
s.email = ["gregdbell@gmail.com"]
9+
s.authors = ["Piers Chambers"]
10+
s.email = ["piers@varyonic.com"]
1111
s.homepage = ""
12-
s.summary = %q{An Object Oriented DOM Tree in Ruby}
13-
s.description = %q{An Object Oriented DOM Tree in Ruby}
12+
s.summary = %q{Forked from Greg Bell's 'Arbre', An Object Oriented DOM Tree in Ruby}
13+
s.description = %q{Forked from Greg Bell's 'Arbre', An Object Oriented DOM Tree in Ruby}
1414
s.license = "MIT"
1515

1616
s.files = `git ls-files`.split("\n")

docs/_includes/head.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<head>
2-
<title>Arbre | HTML Views in Ruby</title>
2+
<title>Arbo | HTML Views in Ruby</title>
33
<link href='//fonts.googleapis.com/css?family=Yanone+Kaffeesatz:extralight,light,regular,bold' rel='stylesheet' type='text/css'>
44
<link href='//fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
55
<link href="{{ site.baseurl }}/stylesheets/main.css" media="screen" rel="stylesheet" type="text/css" />

docs/_includes/top-menu.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<div id="header">
2-
<h1><a href="{{ site.baseurl }}/index.html"><span>Arbre</span></a></h1>
2+
<h1><a href="{{ site.baseurl }}/index.html"><span>Arbo</span></a></h1>
33

44
<div id="nav">
55
<!-- a href="{{ site.baseurl }}/documentation.html">Documentation</a -->
6-
<a href="http://github.com/activeadmin/arbre">Get the Code</a>
6+
<a href="http://github.com/varyonic/arbo">Get the Code</a>
77
</div>
88
</div>

docs/index.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
redirect_from: /docs/documentation.html
33
---
4-
# Arbre
4+
# Arbo
55
HTML Views in Ruby
66

77
### Introduction
88

9-
Arbre is a alternate template system for [Ruby on Rails Action View](http://guides.rubyonrails.org/action_view_overview.html).
10-
Arbre expresses HTML using a Ruby DSL, which makes it similar to the [Builder](https://github.com/tenderlove/builder) gem for XML.
11-
Arbre was extracted from [Active Admin](https://activeadmin.info/).
9+
Arbo is a alternate template system for [Ruby on Rails Action View](http://guides.rubyonrails.org/action_view_overview.html).
10+
Arbo expresses HTML using a Ruby DSL, which makes it similar to the [Builder](https://github.com/tenderlove/builder) gem for XML.
11+
Arbo is a fork of Arbre, which was extracted from [Active Admin](https://activeadmin.info/).
1212

1313
An example `index.html.arb`:
1414

@@ -23,18 +23,18 @@ html {
2323
}
2424
```
2525

26-
The purpose of Arbre is to leave the view as Ruby objects as long as possible,
26+
The purpose of Arbo is to leave the view as Ruby objects as long as possible,
2727
which allows an object-oriented approach including inheritance, composition, and encapsulation.
2828

2929
### Installation
3030

31-
Add gem `arbre` to your `Gemfile` and `bundle install`.
31+
Add gem `arbo` to your `Gemfile` and `bundle install`.
3232

33-
Arbre registers itself as a Rails template handler for files with an extension `.arb`.
33+
Arbo registers itself as a Rails template handler for files with an extension `.arb`.
3434

3535
### Tags
3636

37-
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`.
37+
Arbo 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`.
3838

3939
A special case is the paragraph tag, <p>, which is mapped to `para`.
4040

@@ -44,9 +44,9 @@ To include text that is not immediately part of a tag use `text_node`.
4444

4545
### Components
4646

47-
Arbre DSL can be extended by defining new tags composed of other, simpler tags.
47+
Arbo DSL can be extended by defining new tags composed of other, simpler tags.
4848
This provides a simpler alternative to nesting partials.
49-
The recommended approach is to subclass Arbre::Component and implement a new builder method.
49+
The recommended approach is to subclass Arbo::Component and implement a new builder method.
5050

5151
The builder_method defines the method that will be called to build this component
5252
when using the DSL. The arguments passed into the builder_method will be passed
@@ -55,7 +55,7 @@ into the #build method for you.
5555
For example:
5656

5757
```ruby
58-
class Panel < Arbre::Component
58+
class Panel < Arbo::Component
5959
builder_method :panel
6060

6161
def build(title, attributes = {})
@@ -68,14 +68,14 @@ end
6868

6969
By default components are `div` tags with an HTML class corresponding to the component class name. This can be overridden by redefining the `tag_name` method.
7070

71-
Several examples of Arbre components are [included in Active Admin](https://activeadmin.info/12-arbre-components.html)
71+
Several examples of Arbo components are [included in Active Admin](https://activeadmin.info/12-arbo-components.html)
7272

7373
### Contexts
7474

75-
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.
75+
An [Arbo::Context](http://www.rubydoc.info/gems/arbo/Arbo/Context) is an object in which Arbo DSL is interpreted, providing a root for the Ruby DOM that can be [searched and manipulated](http://www.rubydoc.info/gems/arbo/Arbo/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.
7676

7777
```ruby
78-
html = Arbre::Context.new do
78+
html = Arbo::Context.new do
7979
panel "Hello World", id: "my-panel" do
8080
span "Inside the panel"
8181
text_node "Plain text"

lib/arbo.rb

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
require 'active_support/core_ext/string/output_safety'
2+
require 'active_support/deprecation'
3+
require 'active_support/hash_with_indifferent_access'
4+
require 'active_support/inflector'
5+
6+
module Arbo
7+
end
8+
9+
require 'arbo/element'
10+
require 'arbo/context'
11+
require 'arbo/html/attributes'
12+
require 'arbo/html/class_list'
13+
require 'arbo/html/tag'
14+
require 'arbo/html/text_node'
15+
require 'arbo/html/document'
16+
require 'arbo/html/html5_elements'
17+
require 'arbo/component'
18+
19+
if defined?(Rails)
20+
require 'arbo/rails'
21+
end

lib/arbre/component.rb lib/arbo/component.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
module Arbre
2-
class Component < Arbre::HTML::Div
1+
module Arbo
2+
class Component < Arbo::HTML::Div
33

44
# By default components render a div
55
def tag_name

lib/arbre/context.rb lib/arbo/context.rb

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
require 'arbre/element'
1+
require 'arbo/element'
22
require 'ruby2_keywords'
33

4-
module Arbre
4+
module Arbo
55

6-
# The Arbre::Context class is the frontend for using Arbre.
6+
# The Arbo::Context class is the frontend for using Arbo.
77
#
88
# The simplest example possible:
99
#
10-
# html = Arbre::Context.new do
10+
# html = Arbo::Context.new do
1111
# h1 "Hello World"
1212
# end
1313
#
@@ -18,15 +18,15 @@ module Arbre
1818
# within the block. To pass local variables into the Context, use the
1919
# assigns param.
2020
#
21-
# html = Arbre::Context.new({one: 1}) do
21+
# html = Arbo::Context.new({one: 1}) do
2222
# h1 "Your number #{one}"
2323
# end
2424
#
2525
# html.to_s #=> "Your number 1"
2626
#
2727
class Context < Element
2828

29-
# Initialize a new Arbre::Context
29+
# Initialize a new Arbo::Context
3030
#
3131
# @param [Hash] assigns A hash of objecs that you would like to be
3232
# availble as local variables within the Context
@@ -40,13 +40,13 @@ def initialize(assigns = {}, helpers = nil, &block)
4040
@_assigns = assigns.symbolize_keys
4141

4242
@_helpers = helpers
43-
@_current_arbre_element_buffer = [self]
43+
@_current_arbo_element_buffer = [self]
4444

4545
super(self)
4646
instance_eval(&block) if block_given?
4747
end
4848

49-
def arbre_context
49+
def arbo_context
5050
self
5151
end
5252

@@ -72,7 +72,7 @@ def respond_to_missing?(method, include_all)
7272
super || cached_html.respond_to?(method, include_all)
7373
end
7474

75-
# Webservers treat Arbre::Context as a string. We override
75+
# Webservers treat Arbo::Context as a string. We override
7676
# method_missing to delegate to the string representation
7777
# of the html.
7878
ruby2_keywords def method_missing(method, *args, &block)
@@ -83,17 +83,17 @@ def respond_to_missing?(method, include_all)
8383
end
8484
end
8585

86-
def current_arbre_element
87-
@_current_arbre_element_buffer.last
86+
def current_arbo_element
87+
@_current_arbo_element_buffer.last
8888
end
8989

90-
def with_current_arbre_element(tag)
91-
raise ArgumentError, "Can't be in the context of nil. #{@_current_arbre_element_buffer.inspect}" unless tag
92-
@_current_arbre_element_buffer.push tag
90+
def with_current_arbo_element(tag)
91+
raise ArgumentError, "Can't be in the context of nil. #{@_current_arbo_element_buffer.inspect}" unless tag
92+
@_current_arbo_element_buffer.push tag
9393
yield
94-
@_current_arbre_element_buffer.pop
94+
@_current_arbo_element_buffer.pop
9595
end
96-
alias_method :within, :with_current_arbre_element
96+
alias_method :within, :with_current_arbo_element
9797

9898
def output_buffer
9999
@output_buffer ||= ActiveSupport::SafeBuffer.new

lib/arbre/element.rb lib/arbo/element.rb

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
require 'arbre/element/builder_methods'
2-
require 'arbre/element/proxy'
3-
require 'arbre/element_collection'
1+
require 'arbo/element/builder_methods'
2+
require 'arbo/element/proxy'
3+
require 'arbo/element_collection'
44
require 'ruby2_keywords'
55

6-
module Arbre
6+
module Arbo
77

88
class Element
99
include BuilderMethods
1010

1111
attr_reader :parent
12-
attr_reader :children, :arbre_context
12+
attr_reader :children, :arbo_context
1313

14-
def initialize(arbre_context = Arbre::Context.new)
15-
@arbre_context = arbre_context
14+
def initialize(arbo_context = Arbo::Context.new)
15+
@arbo_context = arbo_context
1616
@children = ElementCollection.new
1717
@parent = nil
1818
end
1919

2020
def assigns
21-
arbre_context.assigns
21+
arbo_context.assigns
2222
end
2323

2424
def helpers
25-
arbre_context.helpers
25+
arbo_context.helpers
2626
end
2727

2828
def tag_name
@@ -44,7 +44,7 @@ def add_child(child)
4444

4545
# If its not an element, wrap it in a TextNode
4646
unless child.is_a?(Element)
47-
child = Arbre::HTML::TextNode.from_string(child)
47+
child = Arbo::HTML::TextNode.from_string(child)
4848
end
4949

5050
if child.respond_to?(:parent)
@@ -147,7 +147,7 @@ def to_s
147147
end
148148

149149
# Rendering strategy that visits all elements and appends output to a buffer.
150-
def render_in(context = arbre_context)
150+
def render_in(context = arbo_context)
151151
children.collect do |element|
152152
element.render_in_or_to_s(context)
153153
end.join('')
@@ -167,7 +167,7 @@ def +(element)
167167
case element
168168
when Element, ElementCollection
169169
else
170-
element = Arbre::HTML::TextNode.from_string(element)
170+
element = Arbo::HTML::TextNode.from_string(element)
171171
end
172172
to_ary + element
173173
end
@@ -193,8 +193,8 @@ def clear_children!
193193
# 4. Call super
194194
#
195195
ruby2_keywords def method_missing(name, *args, &block)
196-
if current_arbre_element.respond_to?(name)
197-
current_arbre_element.send name, *args, &block
196+
if current_arbo_element.respond_to?(name)
197+
current_arbo_element.send name, *args, &block
198198
elsif assigns && assigns.has_key?(name)
199199
assigns[name]
200200
elsif helpers.respond_to?(name)
@@ -204,10 +204,10 @@ def clear_children!
204204
end
205205
end
206206

207-
# The helper might have a block that builds Arbre elements
207+
# The helper might have a block that builds Arbo elements
208208
# which will be rendered (#to_s) inside ActionView::Base#capture.
209209
# We do not want such elements added to self, so we push a dummy
210-
# current_arbre_element.
210+
# current_arbo_element.
211211
ruby2_keywords def helper_capture(name, *args, &block)
212212
s = ""
213213
within(Element.new) { s = helpers.send(name, *args, &block) }

0 commit comments

Comments
 (0)