rux-rails 1.5.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/Gemfile +3 -0
- data/README.md +56 -0
- data/app/components/rails/base_component.rb +16 -0
- data/app/components/rails/button.rb +14 -0
- data/app/components/rails/button_to.rb +21 -0
- data/app/components/rails/content_tag.rb +15 -0
- data/app/components/rails/form_input.rb +19 -0
- data/app/components/rails/form_with.html.erb +5 -0
- data/app/components/rails/form_with.rb +14 -0
- data/app/components/rails/hidden_field.rb +14 -0
- data/app/components/rails/label.rb +14 -0
- data/app/components/rails/link_to.rb +21 -0
- data/app/components/rails/password_field.rb +14 -0
- data/app/components/rails/text_field.rb +14 -0
- data/app/components/rux/component.rb +15 -0
- data/lib/rux-rails/{railtie.rb → engine.rb} +14 -4
- data/lib/rux-rails/tasks/transpile.rake +11 -10
- data/lib/rux-rails/version.rb +1 -1
- data/lib/rux-rails.rb +4 -1
- data/rux-rails.gemspec +5 -4
- data/spec/components/rails/button_spec.rb +18 -0
- data/spec/components/rails/button_to_spec.rb +24 -0
- data/spec/components/rails/content_tag_spec.rb +13 -0
- data/spec/components/rails/form_with_spec.rb +20 -0
- data/spec/components/rails/hidden_field_spec.rb +11 -0
- data/spec/components/rails/label_spec.rb +21 -0
- data/spec/components/rails/link_to_spec.rb +16 -0
- data/spec/components/rails/password_field_spec.rb +11 -0
- data/spec/components/rails/text_field_spec.rb +11 -0
- data/spec/components/rux/component_spec.rb +9 -0
- data/spec/controllers/home_controller_spec.rb +1 -1
- data/spec/dummy/app/components/image.rux +16 -0
- data/spec/dummy/log/test.log +534 -3384
- data/spec/dummy/tmp/local_secret.txt +1 -0
- data/spec/html_safety_spec.rb +1 -1
- data/spec/spec_helper.rb +5 -36
- metadata +49 -14
- data/lib/rux-rails/components/audio.rb +0 -18
- data/lib/rux-rails/components/image.rb +0 -18
- data/lib/rux-rails/components/video.rb +0 -18
- data/lib/rux-rails/components.rb +0 -5
|
@@ -0,0 +1 @@
|
|
|
1
|
+
2b59303eb0458badf9c071ca4daf818aea0197168a8f5e982f7259aac5b6a05c9782c9f3426636b3058fab160acd15bb29a2e4a1f6b9c037c2afcd6466b5530a
|
data/spec/html_safety_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
|
@@ -24,6 +24,10 @@ module RuxRails
|
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
|
27
|
+
def view_context
|
|
28
|
+
respond_to?(:vc_test_view_context) ? vc_test_view_context : vc_test_controller.view_context
|
|
29
|
+
end
|
|
30
|
+
|
|
27
31
|
def with_file_contents(path, contents)
|
|
28
32
|
old_contents = ::File.read(path)
|
|
29
33
|
::File.write(path, contents)
|
|
@@ -31,45 +35,10 @@ module RuxRails
|
|
|
31
35
|
ensure
|
|
32
36
|
::File.write(path, old_contents)
|
|
33
37
|
end
|
|
34
|
-
|
|
35
|
-
attr_reader :rendered_content
|
|
36
|
-
|
|
37
|
-
def page
|
|
38
|
-
@page ||= Capybara::Node::Simple.new(rendered_content)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
def render_inline(component, **args, &block)
|
|
42
|
-
@page = nil
|
|
43
|
-
@rendered_content =
|
|
44
|
-
if Rails.version.to_f >= 6.1
|
|
45
|
-
vc_test_controller.view_context.render(component, args, &block)
|
|
46
|
-
else
|
|
47
|
-
vc_test_controller.view_context.render_component(component, &block)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
Nokogiri::HTML.fragment(@rendered_content)
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
def vc_test_controller
|
|
54
|
-
@vc_test_controller ||= __vc_test_helpers_build_controller(ViewComponent::Base.test_controller.constantize)
|
|
55
|
-
end
|
|
56
|
-
|
|
57
|
-
def __vc_test_helpers_build_controller(klass)
|
|
58
|
-
klass.new.tap { |c| c.request = vc_test_request }.extend(Rails.application.routes.url_helpers)
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
def vc_test_request
|
|
62
|
-
@vc_test_request ||=
|
|
63
|
-
begin
|
|
64
|
-
out = ActionDispatch::TestRequest.create
|
|
65
|
-
out.session = ActionController::TestSession.new
|
|
66
|
-
out
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
38
|
end
|
|
70
39
|
end
|
|
71
40
|
|
|
72
41
|
RSpec.configure do |config|
|
|
73
42
|
config.include(RuxRails::SpecHelpers)
|
|
74
|
-
config.include
|
|
43
|
+
config.include ViewComponent::TestHelpers, type: :component
|
|
75
44
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rux-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Cameron Dutro
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2025-10-26 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rux
|
|
@@ -16,14 +16,14 @@ dependencies:
|
|
|
16
16
|
requirements:
|
|
17
17
|
- - "~>"
|
|
18
18
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '1.
|
|
19
|
+
version: '1.3'
|
|
20
20
|
type: :runtime
|
|
21
21
|
prerelease: false
|
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
23
|
requirements:
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '1.
|
|
26
|
+
version: '1.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: railties
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -47,7 +47,7 @@ dependencies:
|
|
|
47
47
|
version: '2'
|
|
48
48
|
- - "<"
|
|
49
49
|
- !ruby/object:Gem::Version
|
|
50
|
-
version: '
|
|
50
|
+
version: '5'
|
|
51
51
|
type: :runtime
|
|
52
52
|
prerelease: false
|
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -57,21 +57,35 @@ dependencies:
|
|
|
57
57
|
version: '2'
|
|
58
58
|
- - "<"
|
|
59
59
|
- !ruby/object:Gem::Version
|
|
60
|
-
version: '
|
|
60
|
+
version: '5'
|
|
61
61
|
- !ruby/object:Gem::Dependency
|
|
62
62
|
name: onload
|
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
|
64
64
|
requirements:
|
|
65
65
|
- - "~>"
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
|
-
version: '1.
|
|
67
|
+
version: '1.1'
|
|
68
68
|
type: :runtime
|
|
69
69
|
prerelease: false
|
|
70
70
|
version_requirements: !ruby/object:Gem::Requirement
|
|
71
71
|
requirements:
|
|
72
72
|
- - "~>"
|
|
73
73
|
- !ruby/object:Gem::Version
|
|
74
|
-
version: '1.
|
|
74
|
+
version: '1.1'
|
|
75
|
+
- !ruby/object:Gem::Dependency
|
|
76
|
+
name: use_context
|
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
|
78
|
+
requirements:
|
|
79
|
+
- - "~>"
|
|
80
|
+
- !ruby/object:Gem::Version
|
|
81
|
+
version: '1.2'
|
|
82
|
+
type: :runtime
|
|
83
|
+
prerelease: false
|
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - "~>"
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '1.2'
|
|
75
89
|
description: Rux view components on Rails.
|
|
76
90
|
email:
|
|
77
91
|
- camertron@gmail.com
|
|
@@ -84,13 +98,22 @@ files:
|
|
|
84
98
|
- LICENSE
|
|
85
99
|
- README.md
|
|
86
100
|
- Rakefile
|
|
101
|
+
- app/components/rails/base_component.rb
|
|
102
|
+
- app/components/rails/button.rb
|
|
103
|
+
- app/components/rails/button_to.rb
|
|
104
|
+
- app/components/rails/content_tag.rb
|
|
105
|
+
- app/components/rails/form_input.rb
|
|
106
|
+
- app/components/rails/form_with.html.erb
|
|
107
|
+
- app/components/rails/form_with.rb
|
|
108
|
+
- app/components/rails/hidden_field.rb
|
|
109
|
+
- app/components/rails/label.rb
|
|
110
|
+
- app/components/rails/link_to.rb
|
|
111
|
+
- app/components/rails/password_field.rb
|
|
112
|
+
- app/components/rails/text_field.rb
|
|
113
|
+
- app/components/rux/component.rb
|
|
87
114
|
- lib/rux-rails.rb
|
|
88
|
-
- lib/rux-rails/
|
|
89
|
-
- lib/rux-rails/components/audio.rb
|
|
90
|
-
- lib/rux-rails/components/image.rb
|
|
91
|
-
- lib/rux-rails/components/video.rb
|
|
115
|
+
- lib/rux-rails/engine.rb
|
|
92
116
|
- lib/rux-rails/output_buffer.rb
|
|
93
|
-
- lib/rux-rails/railtie.rb
|
|
94
117
|
- lib/rux-rails/rux_loader.rb
|
|
95
118
|
- lib/rux-rails/tag_builder.rb
|
|
96
119
|
- lib/rux-rails/tasks/transpile.rake
|
|
@@ -98,6 +121,16 @@ files:
|
|
|
98
121
|
- lib/rux-rails/version.rb
|
|
99
122
|
- lib/rux-rails/visitor.rb
|
|
100
123
|
- rux-rails.gemspec
|
|
124
|
+
- spec/components/rails/button_spec.rb
|
|
125
|
+
- spec/components/rails/button_to_spec.rb
|
|
126
|
+
- spec/components/rails/content_tag_spec.rb
|
|
127
|
+
- spec/components/rails/form_with_spec.rb
|
|
128
|
+
- spec/components/rails/hidden_field_spec.rb
|
|
129
|
+
- spec/components/rails/label_spec.rb
|
|
130
|
+
- spec/components/rails/link_to_spec.rb
|
|
131
|
+
- spec/components/rails/password_field_spec.rb
|
|
132
|
+
- spec/components/rails/text_field_spec.rb
|
|
133
|
+
- spec/components/rux/component_spec.rb
|
|
101
134
|
- spec/controllers/home_controller_spec.rb
|
|
102
135
|
- spec/dummy/app/assets/config/manifest.js
|
|
103
136
|
- spec/dummy/app/assets/images/cat.png
|
|
@@ -105,6 +138,7 @@ files:
|
|
|
105
138
|
- spec/dummy/app/components/home_component.rux
|
|
106
139
|
- spec/dummy/app/components/html_safety_component.rb
|
|
107
140
|
- spec/dummy/app/components/html_safety_component.rux
|
|
141
|
+
- spec/dummy/app/components/image.rux
|
|
108
142
|
- spec/dummy/app/controllers/application_controller.rb
|
|
109
143
|
- spec/dummy/app/controllers/home_controller.rb
|
|
110
144
|
- spec/dummy/app/views/home/index.html.ruxt
|
|
@@ -113,6 +147,7 @@ files:
|
|
|
113
147
|
- spec/dummy/config/routes.rb
|
|
114
148
|
- spec/dummy/config/secrets.yml
|
|
115
149
|
- spec/dummy/log/test.log
|
|
150
|
+
- spec/dummy/tmp/local_secret.txt
|
|
116
151
|
- spec/html_safety_spec.rb
|
|
117
152
|
- spec/spec_helper.rb
|
|
118
153
|
homepage: http://github.com/camertron/rux-rails
|
|
@@ -133,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
168
|
- !ruby/object:Gem::Version
|
|
134
169
|
version: '0'
|
|
135
170
|
requirements: []
|
|
136
|
-
rubygems_version: 3.
|
|
171
|
+
rubygems_version: 3.5.22
|
|
137
172
|
signing_key:
|
|
138
173
|
specification_version: 4
|
|
139
174
|
summary: Rux view components on Rails.
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module RuxRails
|
|
2
|
-
module Components
|
|
3
|
-
class Audio < ViewComponent::Base
|
|
4
|
-
include ActionView::Helpers::AssetUrlHelper
|
|
5
|
-
|
|
6
|
-
attr_reader :src, :params
|
|
7
|
-
|
|
8
|
-
def initialize(src:, **params)
|
|
9
|
-
@src = src
|
|
10
|
-
@params = params
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def call
|
|
14
|
-
audio_tag(src, **params)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module RuxRails
|
|
2
|
-
module Components
|
|
3
|
-
class Image < ViewComponent::Base
|
|
4
|
-
include ActionView::Helpers::AssetUrlHelper
|
|
5
|
-
|
|
6
|
-
attr_reader :src, :params
|
|
7
|
-
|
|
8
|
-
def initialize(src:, **params)
|
|
9
|
-
@src = src
|
|
10
|
-
@params = params
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def call
|
|
14
|
-
image_tag(src, **params)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
module RuxRails
|
|
2
|
-
module Components
|
|
3
|
-
class Video < ViewComponent::Base
|
|
4
|
-
include ActionView::Helpers::AssetUrlHelper
|
|
5
|
-
|
|
6
|
-
attr_reader :src, :params
|
|
7
|
-
|
|
8
|
-
def initialize(src:, **params)
|
|
9
|
-
@src = src
|
|
10
|
-
@params = params
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def call
|
|
14
|
-
video_tag(src, **params)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|