view_component 3.0.0.rc4 → 3.0.0.rc5

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.

Potentially problematic release.


This version of view_component might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 53d058ef489a0f7230b3a83fe92d36fab42b9b8ccf0cd2bba0d12f7320f2c261
4
- data.tar.gz: de28dc5a7e3e9c34c3cf81bbd5d52f518c653950552547c86a547bb4a577bdfa
3
+ metadata.gz: 3746041e156447e727a9974ad435795bd08333c13f6004ba5a03f629764d301d
4
+ data.tar.gz: 47e3d85474b5cb69fbc12abb48a59a85776f14475508ff55f40f672f393bd309
5
5
  SHA512:
6
- metadata.gz: d6161e41e5b9b82ce20f9ffc624cfe2910e707d867e2ba0019bc960a02353e7d2b083700e3504ea1f84da83f9a31110eb581a07a16609d30c6a7737806f5986e
7
- data.tar.gz: c137ce79675ec78c4f31dff419b42fdf31d2af696e2275047d74058c7e1402be00e0e44df125ea6c5803b59e6931d8a7619c9c266376b02881965a778e60d784
6
+ metadata.gz: cc5edccc814c845eb63ce951e621365ec9ec3013363b32b0bc5f05db8a0fb15ea26688eae22f54fcc17bbc477c5e93350cd0b3fbf3af9bd1e27f1f3f9e53cbec
7
+ data.tar.gz: d87a2ee301acf5b4e67ec159bc3433ce2d46da343de5da26af975314b862b4befbfdd247a0046239b99bb322e26b4062625073424ba0fd7e54a1e973a2d56ebd
@@ -1,11 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class ViewComponentsSystemTestController < ActionController::Base # :nodoc:
4
- TEMP_DIR = FileUtils.mkdir_p("./tmp/view_components/").first
5
-
6
4
  before_action :validate_test_env
7
5
  before_action :validate_file_path
8
6
 
7
+ def self.temp_dir
8
+ @_tmpdir ||= FileUtils.mkdir_p("./tmp/view_components/").first
9
+ end
10
+
9
11
  def system_test_entrypoint
10
12
  render file: @path
11
13
  end
@@ -19,7 +21,7 @@ class ViewComponentsSystemTestController < ActionController::Base # :nodoc:
19
21
  # Ensure that the file path is valid and doesn't target files outside
20
22
  # the expected directory (e.g. via a path traversal or symlink attack)
21
23
  def validate_file_path
22
- base_path = ::File.realpath(TEMP_DIR)
24
+ base_path = ::File.realpath(self.class.temp_dir)
23
25
  @path = ::File.realpath(params.permit(:file)[:file], base_path)
24
26
  unless @path.start_with?(base_path)
25
27
  raise ArgumentError, "Invalid file path"
data/docs/CHANGELOG.md CHANGED
@@ -10,6 +10,20 @@ nav_order: 5
10
10
 
11
11
  ## main
12
12
 
13
+ ## v3.0.0.rc5
14
+
15
+ * Fix bug where `mkdir_p` failed due to incorrect permissions.
16
+
17
+ *Joel Hawksley*
18
+
19
+ * Check for inline `erb_template` calls when deciding whether or not to compile a component's superclass.
20
+
21
+ *Justin Kenyon*
22
+
23
+ * Protect against `SystemStackError` if `CaptureCompatibility` module is included more than once.
24
+
25
+ *Cameron Dutro*
26
+
13
27
  ## v3.0.0.rc4
14
28
 
15
29
  Run into an issue with this release candidate? [Let us know](https://github.com/ViewComponent/view_component/issues/1629).
@@ -17,6 +17,8 @@ module ViewComponent
17
17
  # the `capture` logic to the ViewComponent that created the block.
18
18
  module CaptureCompatibility
19
19
  def self.included(base)
20
+ return if base < InstanceMethods
21
+
20
22
  base.class_eval do
21
23
  alias_method :original_capture, :capture
22
24
  end
@@ -285,8 +285,7 @@ module ViewComponent
285
285
  end
286
286
 
287
287
  def should_compile_superclass?
288
- development? &&
289
- templates.empty? &&
288
+ development? && templates.empty? && !has_inline_template? &&
290
289
  !(
291
290
  component_class.instance_methods(false).include?(:call) ||
292
291
  component_class.private_instance_methods(false).include?(:call)
@@ -12,7 +12,7 @@ module ViewComponent
12
12
  def with_rendered_component_path(fragment, layout: false, &block)
13
13
  file = Tempfile.new(
14
14
  ["rendered_#{fragment.class.name}", ".html"],
15
- ViewComponentsSystemTestController::TEMP_DIR
15
+ ViewComponentsSystemTestController.temp_dir
16
16
  )
17
17
  begin
18
18
  file.write(vc_test_controller.render_to_string(html: fragment.to_html.html_safe, layout: layout))
@@ -5,7 +5,7 @@ module ViewComponent
5
5
  MAJOR = 3
6
6
  MINOR = 0
7
7
  PATCH = 0
8
- PRE = "rc4"
8
+ PRE = "rc5"
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, PRE].compact.join(".")
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: view_component
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.rc4
4
+ version: 3.0.0.rc5
5
5
  platform: ruby
6
6
  authors:
7
7
  - ViewComponent Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-09 00:00:00.000000000 Z
11
+ date: 2023-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport