brick 1.0.199 → 1.0.200

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.
@@ -45,16 +45,23 @@ module Brick
45
45
  table_class_length = 38 # Length of "Classes that can be built from tables:"
46
46
  view_class_length = 37 # Length of "Classes that can be built from views:"
47
47
 
48
- brick_namespace_create = lambda do |path_names, res_name, options|
48
+ brick_namespace_create = lambda do |path_names, res_name, options, ind = 0|
49
49
  if path_names&.present?
50
50
  if (path_name = path_names.pop).is_a?(Array)
51
51
  module_name = path_name[1]
52
52
  path_name = path_name.first
53
53
  end
54
- send(:scope, { module: module_name || path_name, path: path_name, as: path_name }) do
55
- brick_namespace_create.call(path_names, res_name, options)
54
+ scope_options = { module: module_name || path_name, path: path_name, as: path_name }
55
+ # if module_name.nil? || module_name == path_name
56
+ # puts "#{' ' * ind}namespace :#{path_name}"
57
+ # else
58
+ # puts "#{' ' * ind}scope #{scope_options.inspect}"
59
+ # end
60
+ send(:scope, scope_options) do
61
+ brick_namespace_create.call(path_names, res_name, options, ind + 1)
56
62
  end
57
63
  else
64
+ # puts "#{' ' * ind}resources :#{res_name} #{options.inspect unless options.blank?}"
58
65
  send(:resources, res_name.to_sym, **options)
59
66
  end
60
67
  end
@@ -82,8 +89,16 @@ module Brick
82
89
 
83
90
  object_name = k.split('.').last # Take off any first schema part
84
91
 
92
+ # # What about:
93
+ # full_schema_prefix = if (aps2 = v.fetch(:auto_prefixed_schema, nil))
94
+ # # Used to be: aps = aps[0..-2] if aps[-1] == '_'
95
+ # aps2 = aps2[0..-2] if aps2[-1] == '_'
96
+ # aps = v[:auto_prefixed_class].underscore
97
+
85
98
  full_schema_prefix = if (aps = v.fetch(:auto_prefixed_schema, nil))
86
99
  aps = aps[0..-2] if aps[-1] == '_'
100
+ # %%% If this really is nil then should be an override
101
+ aps2 = v[:auto_prefixed_class]&.underscore
87
102
  (schema_prefix&.dup || +'') << "#{aps}."
88
103
  else
89
104
  schema_prefix
@@ -105,7 +120,8 @@ module Brick
105
120
 
106
121
  # First do the normal routes
107
122
  prefixes = []
108
- prefixes << [aps, v[:class_name]&.split('::')[-2]&.underscore] if aps
123
+ # Second term used to be: v[:class_name]&.split('::')[-2]&.underscore
124
+ prefixes << [aps, aps2] if aps
109
125
  prefixes << schema_name if schema_name
110
126
  prefixes << path_prefix if path_prefix
111
127
  brick_namespace_create.call(prefixes, resource_name, options)
@@ -5,7 +5,7 @@ module Brick
5
5
  module VERSION
6
6
  MAJOR = 1
7
7
  MINOR = 0
8
- TINY = 199
8
+ TINY = 200
9
9
 
10
10
  # PRE is nil unless it's a pre-release (beta, RC, etc.)
11
11
  PRE = nil
data/lib/brick.rb CHANGED
@@ -89,6 +89,7 @@ end
89
89
  # is first established), and then automatically creates models, controllers, views,
90
90
  # and routes based on those available relations.
91
91
  require 'brick/config'
92
+ require 'brick/reflect_tables'
92
93
  if Gem::Dependency.new('rails').matching_specs.present?
93
94
  require 'rails'
94
95
  require 'brick/frameworks/rails'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brick
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.199
4
+ version: 1.0.200
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lorin Thwaits
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-01-04 00:00:00.000000000 Z
11
+ date: 2024-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -248,6 +248,7 @@ files:
248
248
  - lib/brick/frameworks/rails/form_tags.rb
249
249
  - lib/brick/frameworks/rspec.rb
250
250
  - lib/brick/join_array.rb
251
+ - lib/brick/reflect_tables.rb
251
252
  - lib/brick/route_mapper.rb
252
253
  - lib/brick/serializers/json.rb
253
254
  - lib/brick/serializers/yaml.rb