rux-rails 1.5.0 → 2.0.0
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 +18 -0
- data/Gemfile +3 -0
- data/README.md +56 -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 +4 -3
- 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 +36 -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.0
|
|
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
|
|
@@ -85,12 +99,8 @@ files:
|
|
|
85
99
|
- README.md
|
|
86
100
|
- Rakefile
|
|
87
101
|
- 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
|
|
102
|
+
- lib/rux-rails/engine.rb
|
|
92
103
|
- lib/rux-rails/output_buffer.rb
|
|
93
|
-
- lib/rux-rails/railtie.rb
|
|
94
104
|
- lib/rux-rails/rux_loader.rb
|
|
95
105
|
- lib/rux-rails/tag_builder.rb
|
|
96
106
|
- lib/rux-rails/tasks/transpile.rake
|
|
@@ -98,6 +108,16 @@ files:
|
|
|
98
108
|
- lib/rux-rails/version.rb
|
|
99
109
|
- lib/rux-rails/visitor.rb
|
|
100
110
|
- rux-rails.gemspec
|
|
111
|
+
- spec/components/rails/button_spec.rb
|
|
112
|
+
- spec/components/rails/button_to_spec.rb
|
|
113
|
+
- spec/components/rails/content_tag_spec.rb
|
|
114
|
+
- spec/components/rails/form_with_spec.rb
|
|
115
|
+
- spec/components/rails/hidden_field_spec.rb
|
|
116
|
+
- spec/components/rails/label_spec.rb
|
|
117
|
+
- spec/components/rails/link_to_spec.rb
|
|
118
|
+
- spec/components/rails/password_field_spec.rb
|
|
119
|
+
- spec/components/rails/text_field_spec.rb
|
|
120
|
+
- spec/components/rux/component_spec.rb
|
|
101
121
|
- spec/controllers/home_controller_spec.rb
|
|
102
122
|
- spec/dummy/app/assets/config/manifest.js
|
|
103
123
|
- spec/dummy/app/assets/images/cat.png
|
|
@@ -105,6 +125,7 @@ files:
|
|
|
105
125
|
- spec/dummy/app/components/home_component.rux
|
|
106
126
|
- spec/dummy/app/components/html_safety_component.rb
|
|
107
127
|
- spec/dummy/app/components/html_safety_component.rux
|
|
128
|
+
- spec/dummy/app/components/image.rux
|
|
108
129
|
- spec/dummy/app/controllers/application_controller.rb
|
|
109
130
|
- spec/dummy/app/controllers/home_controller.rb
|
|
110
131
|
- spec/dummy/app/views/home/index.html.ruxt
|
|
@@ -113,6 +134,7 @@ files:
|
|
|
113
134
|
- spec/dummy/config/routes.rb
|
|
114
135
|
- spec/dummy/config/secrets.yml
|
|
115
136
|
- spec/dummy/log/test.log
|
|
137
|
+
- spec/dummy/tmp/local_secret.txt
|
|
116
138
|
- spec/html_safety_spec.rb
|
|
117
139
|
- spec/spec_helper.rb
|
|
118
140
|
homepage: http://github.com/camertron/rux-rails
|
|
@@ -133,7 +155,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
133
155
|
- !ruby/object:Gem::Version
|
|
134
156
|
version: '0'
|
|
135
157
|
requirements: []
|
|
136
|
-
rubygems_version: 3.
|
|
158
|
+
rubygems_version: 3.5.22
|
|
137
159
|
signing_key:
|
|
138
160
|
specification_version: 4
|
|
139
161
|
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
|