-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e364805
commit 16a542d
Showing
44 changed files
with
808 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,47 @@ | ||
/.bundle/ | ||
/.yardoc | ||
/_yardoc/ | ||
/coverage/ | ||
/doc/ | ||
*.gem | ||
*.rbc | ||
.ruby-version | ||
/.config | ||
/coverage/assets | ||
/coverage/index.html | ||
/coverage/*.json | ||
/coverage/*.json.lock | ||
/InstalledFiles | ||
/pkg/ | ||
/spec/reports/ | ||
/spec/examples.txt | ||
/test/tmp/ | ||
/test/version_tmp/ | ||
/tmp/ | ||
/test/log/* | ||
/test/sandbox/tmp/* | ||
/test/sandbox/log/* | ||
/test/tmp/* | ||
/.yardoc | ||
|
||
## Specific to RubyMotion: | ||
.dat* | ||
.repl_history | ||
build/ | ||
*.bridgesupport | ||
build-iPhoneOS/ | ||
build-iPhoneSimulator/ | ||
|
||
## Documentation cache and generated files: | ||
/doc/ | ||
/rdoc/ | ||
|
||
## Environment normalization: | ||
/.bundle/ | ||
/vendor/bundle | ||
/lib/bundler/man/ | ||
|
||
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this: | ||
.rvmrc | ||
|
||
# Sample bug replication repo | ||
/replicate-bug | ||
|
||
# Appraisal | ||
/gemfiles/*.gemfile.lock | ||
/gemfiles/.bundle/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
appraise "rails-7.0" do | ||
gem "rails", "~> 7.0" | ||
gem "view_component", "~> 3.13.0" | ||
end | ||
|
||
appraise "rails-7.1" do | ||
gem "rails", "~> 7.1" | ||
gem "view_component", "~> 3.13.0" | ||
end | ||
|
||
appraise "rails-7.2" do | ||
gem "rails", "~> 7.2" | ||
gem "view_component", "~> 3.13.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
render_kit (0.1.0) | ||
|
||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
appraisal (2.5.0) | ||
bundler | ||
rake | ||
thor (>= 0.14.0) | ||
ast (2.4.2) | ||
json (2.7.2) | ||
language_server-protocol (3.17.0.3) | ||
lint_roller (1.1.0) | ||
minitest (5.25.0) | ||
nio4r (2.7.3) | ||
parallel (1.26.2) | ||
parser (3.3.4.2) | ||
ast (~> 2.4.1) | ||
racc | ||
puma (6.4.2) | ||
nio4r (~> 2.0) | ||
racc (1.8.1) | ||
rainbow (3.1.1) | ||
rake (13.2.1) | ||
regexp_parser (2.9.2) | ||
rexml (3.3.5) | ||
strscan | ||
rubocop (1.65.1) | ||
json (~> 2.3) | ||
language_server-protocol (>= 3.17.0) | ||
parallel (~> 1.10) | ||
parser (>= 3.3.0.2) | ||
rainbow (>= 2.2.2, < 4.0) | ||
regexp_parser (>= 2.4, < 3.0) | ||
rexml (>= 3.2.5, < 4.0) | ||
rubocop-ast (>= 1.31.1, < 2.0) | ||
ruby-progressbar (~> 1.7) | ||
unicode-display_width (>= 2.4.0, < 3.0) | ||
rubocop-ast (1.32.0) | ||
parser (>= 3.3.1.0) | ||
rubocop-performance (1.21.1) | ||
rubocop (>= 1.48.1, < 2.0) | ||
rubocop-ast (>= 1.31.1, < 2.0) | ||
ruby-progressbar (1.13.0) | ||
standard (1.34.0) | ||
language_server-protocol (~> 3.17.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.60) | ||
standard-custom (~> 1.0.0) | ||
standard-performance (~> 1.3) | ||
standard-custom (1.0.2) | ||
lint_roller (~> 1.0) | ||
rubocop (~> 1.50) | ||
standard-performance (1.4.0) | ||
lint_roller (~> 1.1) | ||
rubocop-performance (~> 1.21.0) | ||
strscan (3.1.0) | ||
thor (1.3.1) | ||
unicode-display_width (2.5.0) | ||
|
||
PLATFORMS | ||
aarch64-linux | ||
arm-linux | ||
arm64-darwin | ||
x86-linux | ||
x86_64-darwin | ||
x86_64-linux | ||
|
||
DEPENDENCIES | ||
appraisal | ||
bundler (~> 2) | ||
minitest (~> 5.16) | ||
puma (~> 6) | ||
rake (~> 13.0) | ||
render_kit! | ||
rubocop (~> 1.21) | ||
standard (~> 1) | ||
|
||
BUNDLED WITH | ||
2.5.13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
require "bundler/gem_tasks" | ||
require "minitest/test_task" | ||
require "rake/testtask" | ||
|
||
Minitest::TestTask.create | ||
Rake::TestTask.new(:test) do |t| | ||
t.libs << "test" | ||
t.libs << "lib" | ||
t.test_files = FileList["test/**/*_test.rb"] | ||
end | ||
|
||
require "rubocop/rake_task" | ||
|
||
RuboCop::RakeTask.new | ||
|
||
task default: %i[test rubocop] | ||
task default: %i[test] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rake", "~> 13.0" | ||
gem "minitest", "~> 5.16" | ||
gem "rubocop", "~> 1.21" | ||
gem "rails", "~> 7.0" | ||
gem "view_component", "~> 3.13.0" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rake", "~> 13.0" | ||
gem "minitest", "~> 5.16" | ||
gem "rubocop", "~> 1.21" | ||
gem "rails", "~> 7.1" | ||
gem "view_component", "~> 3.13.0" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# This file was generated by Appraisal | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "rake", "~> 13.0" | ||
gem "minitest", "~> 5.16" | ||
gem "rubocop", "~> 1.21" | ||
gem "rails", "~> 7.2" | ||
gem "view_component", "~> 3.13.0" | ||
|
||
gemspec path: "../" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
require_relative "render_kit/version" | ||
|
||
require "render_kit/version" | ||
require "active_support/dependencies/autoload" | ||
require "render_kit/engine" | ||
module RenderKit | ||
class Error < StandardError; end | ||
# Your code goes here... | ||
extend ActiveSupport::Autoload | ||
|
||
autoload :RenderableRegistry | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
require "rails" | ||
|
||
require "render_kit/view_paths_monkey_patch" | ||
require "render_kit/rendering_helper_monkey_patch" | ||
|
||
module RenderKit | ||
class Engine < ::Rails::Engine # :nodoc: | ||
initializer "render_kit.action_view" do |app| | ||
ActiveSupport.on_load(:action_view) do | ||
ActionView::LookupContext.include RenderKit::ViewPathsMonkeyPatch | ||
ActionView::Base.include RenderKit::ViewPathsMonkeyPatch | ||
ActionView::Base.prepend RenderKit::RenderingHelperMonkeyPatch | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen_string_literal: true | ||
|
||
module RenderKit | ||
module RenderableRegistry # :nodoc: | ||
@renderables = Hash.new {} | ||
|
||
def self.get_renderables(path) | ||
@renderables[path] | ||
end | ||
|
||
def self.set_renderable(path, renderable_klass) | ||
@renderables[path] = renderable_klass | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen string literal: true | ||
|
||
require "active_support/concern" | ||
|
||
module RenderKit | ||
module RenderingHelperMonkeyPatch | ||
def render(options = {}, locals = {}, &) | ||
if renderable = RenderKit::RenderableRegistry.get_renderables(options) | ||
renderable.new(locals).render_in(self, &) | ||
else | ||
super | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# frozen string literal: true | ||
|
||
require "active_support/concern" | ||
|
||
module RenderKit | ||
module ViewPathsMonkeyPatch | ||
extend ActiveSupport::Concern | ||
|
||
module ClassMethods | ||
def register_renderable(path, renderable_klass) | ||
RenderKit::RenderableRegistry.set_renderable(path, renderable_klass) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,16 +8,16 @@ Gem::Specification.new do |spec| | |
spec.authors = ["Reegan Viljoen"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = "TODO: Write a short summary, because RubyGems requires one." | ||
spec.description = "TODO: Write a longer description or delete this line." | ||
spec.homepage = "TODO: Put your gem's website or public repo URL here." | ||
spec.summary = "A small library to allow claases to be rendered oike partials in Rails" | ||
spec.description = "A small library to allow claases to be rendered oike partials in Rails" | ||
# spec.homepage = "TODO: Put your gem's website or public repo URL here." | ||
spec.required_ruby_version = ">= 3.0.0" | ||
|
||
spec.metadata["allowed_push_host"] = "TODO: Set to your gem server 'https://example.com'" | ||
|
||
spec.metadata["homepage_uri"] = spec.homepage | ||
spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." | ||
spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." | ||
# spec.metadata["homepage_uri"] = spec.homepage | ||
# spec.metadata["source_code_uri"] = "TODO: Put your gem's public repo URL here." | ||
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here." | ||
|
||
# Specify which files should be added to the gem when it is released. | ||
# The `git ls-files -z` loads the files in the RubyGem that have been added into git. | ||
|
@@ -32,9 +32,9 @@ Gem::Specification.new do |spec| | |
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) } | ||
spec.require_paths = ["lib"] | ||
|
||
# Uncomment to register a new dependency of your gem | ||
# spec.add_dependency "example-gem", "~> 1.0" | ||
|
||
# For more information and examples about making a new gem, check out our | ||
# guide at: https://bundler.io/guides/creating_gem.html | ||
spec.add_development_dependency "appraisal" | ||
spec.add_development_dependency "bundler", "~> 2" | ||
spec.add_development_dependency "minitest", "~> 5.18" | ||
spec.add_development_dependency "puma", "~> 6" | ||
spec.add_development_dependency "standard", "~> 1" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<div> I have been implicity rendered </div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
class ImplicitRenderComponent < ViewComponent::Base | ||
ActionView::Base.register_renderable("implicit_render_component", ImplicitRenderComponent) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
class ApplicationController < ActionController::Base | ||
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has. | ||
allow_browser versions: :modern | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class TestController < ActionController::Base | ||
protect_from_forgery | ||
|
||
def component_implicit_render | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
module ApplicationHelper | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title><%= content_for(:title) || "Sandbox" %></title> | ||
<meta name="viewport" content="width=device-width,initial-scale=1"> | ||
<meta name="apple-mobile-web-app-capable" content="yes"> | ||
<%= csrf_meta_tags %> | ||
<%= csp_meta_tag %> | ||
|
||
<%= yield :head %> | ||
|
||
<link rel="manifest" href="/manifest.json"> | ||
<link rel="icon" href="/icon.png" type="image/png"> | ||
<link rel="icon" href="/icon.svg" type="image/svg+xml"> | ||
<link rel="apple-touch-icon" href="/icon.png"> | ||
<%= stylesheet_link_tag "application", "data-turbo-track": "reload" %> | ||
<%= javascript_importmap_tags %> | ||
</head> | ||
|
||
<body> | ||
<%= yield %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
<style> | ||
/* Email styles need to be inline */ | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<%= yield %> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<%= yield %> |
Oops, something went wrong.