para 0.12.0 → 0.12.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fe01ca1218169f3178bd25a9c3746a21395744dbf12e6d8066d0cbb9ffcda7c9
4
- data.tar.gz: ccee709b747dc51b11443e63c5cc8811ad2c1773c060b56e6702603a44353932
3
+ metadata.gz: 5ee25a77e578b14d822cbf8827991f6c6920c580acddeb2120d0e6a2570795fa
4
+ data.tar.gz: 41ee3d94327eeeacfb5ee1da6430956d5862ed0e242d0d09180bef828e46a921
5
5
  SHA512:
6
- metadata.gz: 8e5417ba55ba7d12c132390c3241f683cd198c151bdf220fb47bae4cfe7c2d4e71f967aea0a69e0e84c729133fd1f2e8f0f18b4a2bbe268d447dc4a2c5985eb2
7
- data.tar.gz: 9cd765135e8cd68246460275adb56b89f75c2c6c0377ec8290392480fba4480fb625e640413d55c5fc917598c7022cb1023a4ce2bae73494b3e60557c89c7d71
6
+ metadata.gz: acd659f13038e225325293d30820d115f5054ca6ba36cccc44e5404bc2e5d0e01226815b41aa38bc3f8c76f6299891c621c4e7d1d2306eaaa76a9f1c97f24891
7
+ data.tar.gz: 7da8328b9591a785d922ddd3f12c61f95d57f7c3e8a327b5667ad22cbfabeeaaabac1c7c8d0e6ed50dee7bc48ceb7e172aac92b3a9593b6919678e4b957bcc1a
@@ -60,13 +60,11 @@ module Para
60
60
  sections.each do |section|
61
61
  section.components.each do |component|
62
62
  # If one of the section component has the searched identifier return it
63
- if component.identifier.to_s == identifier.to_s
64
- return component
65
- else
66
- component.child_components.each do |child_component|
67
- # If one of the component children has the searched identifier return it
68
- return child_component if child_component.identifier.to_s == identifier.to_s
69
- end
63
+ return component if component.identifier.to_s == identifier.to_s
64
+
65
+ component.child_components.each do |child_component|
66
+ # If one of the component children has the searched identifier return it
67
+ return child_component if child_component.identifier.to_s == identifier.to_s
70
68
  end
71
69
  end
72
70
  end
@@ -139,7 +137,7 @@ module Para
139
137
  #
140
138
  def eager_load_components!
141
139
  $LOAD_PATH.each do |path|
142
- next unless path.match(%r{/(para_)?components$})
140
+ next unless path.match(%r{/#{Para.config.components_directory}$})
143
141
 
144
142
  glob = File.join(path, '**', '*_component.rb')
145
143
 
@@ -189,10 +187,10 @@ module Para
189
187
  # Build child components if a block is provided
190
188
  instance_eval(&block) if block
191
189
 
192
- unless type
193
- raise UndefinedComponentTypeError, "Undefined Para component : #{type_identifier}. " +
194
- 'Please ensure that your app or gems define this component type.'
195
- end
190
+ return if type
191
+
192
+ raise UndefinedComponentTypeError, "Undefined Para component : #{type_identifier}. " +
193
+ 'Please ensure that your app or gems define this component type.'
196
194
  end
197
195
 
198
196
  def component(*args, **child_options, &block)
data/lib/para/config.rb CHANGED
@@ -16,11 +16,15 @@ module Para
16
16
  @@default_tree_max_depth = 3
17
17
 
18
18
  mattr_accessor :resource_name_methods
19
- @@resource_name_methods = [:admin_name, :admin_title, :name, :title]
19
+ @@resource_name_methods = %i[admin_name admin_title name title]
20
20
 
21
21
  mattr_accessor :enable_app_breadcrumbs
22
22
  @@enable_app_breadcrumbs = true
23
23
 
24
+ # Allow changing this directory to allow using view_component gem
25
+ mattr_accessor :components_directory
26
+ @@para_components_directory = 'components'
27
+
24
28
  mattr_reader :plugins
25
29
  @@plugins = Para::Plugins::Set.new
26
30
 
@@ -64,7 +68,7 @@ module Para
64
68
  # that limit after writing new keys
65
69
  #
66
70
  mattr_accessor :database_cache_store_max_items
67
- @@database_cache_store_max_items = 10000
71
+ @@database_cache_store_max_items = 10_000
68
72
 
69
73
  # Allows accessing plugins root module to configure them through a method
70
74
  # from the Para::Config class.
data/lib/para/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Para
4
- VERSION = '0.12.0'
4
+ VERSION = '0.12.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: para
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Valentin Ballestrino