Skip to content

Commit

Permalink
Change project name to Ytrbium
Browse files Browse the repository at this point in the history
  • Loading branch information
nicksieger committed Mar 17, 2021
1 parent 2e7df26 commit b02ffa1
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .standard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fix: true

ignore:
- ytrb.gemspec
- ytrbium.gemspec
- Rakefile
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
source "https://rubygems.org"

# Specify your gem's dependencies in ytrb.gemspec
# Specify your gem's dependencies in ytrbium.gemspec
gemspec

gem "rake", "~> 12.0"
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ytrb
# Ytrbium

Ytrb is a simple YAML+ERB templating library in Ruby. With Ytrb:
Ytrbium is a simple YAML+ERB templating library in Ruby. With Ytrbium:

- Generate large, verbose YAML files from reusable templates.
- Collect and organize reusable template methods in multiple files and `import` them into each template.
Expand All @@ -11,7 +11,7 @@ Ytrb is a simple YAML+ERB templating library in Ruby. With Ytrb:
Add this line to your application's Gemfile:

```ruby
gem 'ytrb'
gem 'ytrbium'
```

And then execute:
Expand All @@ -20,7 +20,7 @@ And then execute:

Or install it yourself as:

$ gem install ytrb
$ gem install ytrbium

## Usage

Expand All @@ -34,12 +34,12 @@ To install this gem onto your local machine, run `bundle exec rake install`. To

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nicksieger/ytrb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nicksieger/ytrb/blob/master/CODE_OF_CONDUCT.md).
Bug reports and pull requests are welcome on GitHub at https://github.com/nicksieger/ytrbium. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/nicksieger/ytrbium/blob/master/CODE_OF_CONDUCT.md).

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the Ytrb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nicksieger/ytrb/blob/master/CODE_OF_CONDUCT.md).
Everyone interacting in the Ytrbium project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/nicksieger/ytrbium/blob/master/CODE_OF_CONDUCT.md).
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env ruby

require "bundler/setup"
require "ytrb"
require "ytrbium"

# 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.
Expand Down
16 changes: 0 additions & 16 deletions lib/ytrb.rb

This file was deleted.

16 changes: 16 additions & 0 deletions lib/ytrbium.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
require "yaml"
require "erubi"
require "erubi/capture_end"

module Ytrbium
def self.expand(template, binding: nil)
Ytrbium::Engine.new(template).result(binding)
end
end

require "ytrbium/core_ext"
require "ytrbium/dsl"
require "ytrbium/engine"
require "ytrbium/file_resolver"
require "ytrbium/string"
require "ytrbium/version"
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/ytrb/dsl.rb → lib/ytrbium/dsl.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Ytrb
module Ytrbium
module DSL
def _file_resolver
@_file_resolver ||= FileResolver.new
Expand Down
6 changes: 3 additions & 3 deletions lib/ytrb/engine.rb → lib/ytrbium/engine.rb
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
class Ytrb::Engine < Erubi::CaptureEndEngine
class Ytrbium::Engine < Erubi::CaptureEndEngine
def initialize(input, options = {})
@template_module = options[:module] || Module.new
stack_var = @defstack = "@_ybuf_stack"
engine = self
@template_module.module_eval do
include Ytrb::DSL
include Ytrbium::DSL
extend self
instance_variable_set(:@_engine, engine)
instance_variable_set(stack_var.to_sym, [])
end
bufvar = "@_ybuf"
bufval = "Ytrb::String.new"
bufval = "Ytrbium::String.new"
super(input, options.merge(bufval: bufval,
bufvar: bufvar,
preamble: "options ||= {}; #{bufvar} = #{bufval};",
Expand Down
2 changes: 1 addition & 1 deletion lib/ytrb/file_resolver.rb → lib/ytrbium/file_resolver.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
require "pathname"

class Ytrb::FileResolver
class Ytrbium::FileResolver
def initialize(root = Dir.getwd)
@paths = [root, *$LOAD_PATH].map { |p| Pathname.new(p) }
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ytrb/string.rb → lib/ytrbium/string.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class Ytrb::String < ::String
class Ytrbium::String < ::String
def initialize
super
@indent = 0
Expand Down
2 changes: 1 addition & 1 deletion lib/ytrb/version.rb → lib/ytrbium/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Ytrb
module Ytrbium
VERSION = "1.0.0"
end
2 changes: 1 addition & 1 deletion spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
require "bundler/setup"
require "ytrb"
require "ytrbium"

Dir[File.expand_path("../support/*.rb", __FILE__)].each { |f| require f }

Expand Down
4 changes: 2 additions & 2 deletions spec/support/matchers.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
RSpec::Matchers.define :expand_to do |expected, &block|
match do |template|
@actual = Ytrb.expand template
@actual = Ytrbium.expand template
values_match? expected, @actual
end

Expand All @@ -9,7 +9,7 @@

RSpec::Matchers.define :expand_to_with_binding do |expected, binding, &block|
match do |template|
@actual = Ytrb.expand template, binding: binding
@actual = Ytrbium.expand template, binding: binding
values_match? expected, @actual
end

Expand Down
14 changes: 7 additions & 7 deletions spec/ytrb_spec.rb → spec/ytrbium_spec.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
require "spec_helper"

require "ytrb"
require "ytrbium"

def get_binding(a, b)
c = true
binding
end

RSpec.describe Ytrb do
RSpec.describe Ytrbium do
expect_template "", -> { eq("---\n") }

expect_template({"a" => true}.bare_yaml, -> { eq("---\na: true\n") })
Expand Down Expand Up @@ -152,13 +152,13 @@ def get_binding(a, b)
end

it "parses to the expected object" do
expect(YAML.safe_load(Ytrb.expand(template))).to eq(expected)
expect(YAML.safe_load(Ytrbium.expand(template))).to eq(expected)
end

describe "with extra whitespace" do
let(:template) { template.gsub(/-%>/, "%>") }
it "parses to the expected object" do
expect(YAML.safe_load(Ytrb.expand(template))).to eq(expected)
expect(YAML.safe_load(Ytrbium.expand(template))).to eq(expected)
end
end
end
Expand Down Expand Up @@ -187,7 +187,7 @@ def get_binding(a, b)
TEMPL

before do
allow_any_instance_of(Ytrb::FileResolver).to receive(:load).and_yield(StringIO.new(import_template), "address.template.yaml")
allow_any_instance_of(Ytrbium::FileResolver).to receive(:load).and_yield(StringIO.new(import_template), "address.template.yaml")
end

expect_template template, -> do
Expand Down Expand Up @@ -219,7 +219,7 @@ def get_binding(a, b)
TEMPL

before do
allow_any_instance_of(Ytrb::FileResolver).to receive(:load).and_yield(StringIO.new(import_template), "address.template.yaml")
allow_any_instance_of(Ytrbium::FileResolver).to receive(:load).and_yield(StringIO.new(import_template), "address.template.yaml")
end

expect_template template, -> do
Expand Down Expand Up @@ -249,7 +249,7 @@ def get_binding(a, b)
TEMPL

before do
allow_any_instance_of(Ytrb::FileResolver).to receive(:load).and_yield(StringIO.new(import_template), "address.template.yaml")
allow_any_instance_of(Ytrbium::FileResolver).to receive(:load).and_yield(StringIO.new(import_template), "address.template.yaml")
end

expect_template template, -> do
Expand Down
8 changes: 4 additions & 4 deletions ytrb.gemspec → ytrbium.gemspec
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
require_relative 'lib/ytrb/version'
require_relative 'lib/ytrbium/version'

Gem::Specification.new do |spec|
spec.name = "ytrb"
spec.version = Ytrb::VERSION
spec.name = "ytrbium"
spec.version = Ytrbium::VERSION
spec.authors = ["Nick Sieger"]
spec.email = ["[email protected]"]

spec.summary = %q{Simple YAML+ERB templating in Ruby}
spec.description = %q{Make YAML+ERB templating DWIM and reusable.}
spec.homepage = "https://github.com/nicksieger/ytrb"
spec.homepage = "https://github.com/nicksieger/ytrbium"
spec.license = "MIT"
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")

Expand Down

0 comments on commit b02ffa1

Please sign in to comment.