brick 1.0.199 → 1.0.200
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/brick/extensions.rb +112 -602
- data/lib/brick/frameworks/rails/engine.rb +1 -29
- data/lib/brick/frameworks/rails/form_tags.rb +1 -1
- data/lib/brick/reflect_tables.rb +582 -0
- data/lib/brick/route_mapper.rb +20 -4
- data/lib/brick/version_number.rb +1 -1
- data/lib/brick.rb +1 -0
- metadata +3 -2
data/lib/brick/route_mapper.rb
CHANGED
@@ -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
|
-
|
55
|
-
|
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
|
-
|
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)
|
data/lib/brick/version_number.rb
CHANGED
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.
|
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-
|
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
|