ree 1.0.22 → 1.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ree/bean_dsl.rb +1 -0
- data/lib/ree/cli/indexing/index_package.rb +3 -3
- data/lib/ree/cli/indexing/index_project.rb +63 -63
- data/lib/ree/core/object.rb +7 -1
- data/lib/ree/core/object_schema.rb +2 -1
- data/lib/ree/core/object_schema_builder.rb +1 -0
- data/lib/ree/core/package_schema.rb +2 -1
- data/lib/ree/core/package_schema_builder.rb +1 -0
- data/lib/ree/core/package_schema_loader.rb +2 -0
- data/lib/ree/dsl/object_dsl.rb +4 -0
- data/lib/ree/fn_dsl.rb +1 -0
- data/lib/ree/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 75a8e8d614b00dc9aaba38993d3e2532f4189eca0f83e1dbc8cc5fa63fcee1a4
|
4
|
+
data.tar.gz: ebc2988db12701721dde74ffc845b5c608debf2255f9d9d57e52749c6458d7af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc915972d2b9306d431e8ef813b5105dc635f35826daaf59775385db5ca7a5f51b411d60d2ee82c4eaa9a6c0906aba94a3f79d4542551985c85b751d5e161a38
|
7
|
+
data.tar.gz: bc9f8776cfc0ae0b1d995d3ee3c40f0b27fd2d903391d7558263a2f0dd74bc1833589cb31837435bb97229cbcaaf58f2d45f064604364c87668905ee4a1b80dc
|
data/Gemfile.lock
CHANGED
data/lib/ree/bean_dsl.rb
CHANGED
@@ -25,7 +25,7 @@ module Ree
|
|
25
25
|
package_hsh = index_package_entry(package)
|
26
26
|
|
27
27
|
hsh[:package_schema] = package_hsh
|
28
|
-
hsh =
|
28
|
+
hsh = index_public_methods_for_package_classes(package, dir, hsh)
|
29
29
|
|
30
30
|
JSON.pretty_generate(hsh)
|
31
31
|
end
|
@@ -120,8 +120,8 @@ module Ree
|
|
120
120
|
]
|
121
121
|
end
|
122
122
|
|
123
|
-
def
|
124
|
-
Ree::CLI::IndexProject.send(:
|
123
|
+
def index_public_methods_for_package_classes(package, dir, index_hash)
|
124
|
+
Ree::CLI::IndexProject.send(:index_public_methods_for_package_classes, package, index_hash)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
@@ -53,14 +53,14 @@ module Ree
|
|
53
53
|
end
|
54
54
|
|
55
55
|
next if package.dir.nil?
|
56
|
-
|
56
|
+
|
57
57
|
facade.load_entire_package(package.name)
|
58
58
|
|
59
59
|
package_hsh = Ree::CLI::IndexPackage.send(:index_package_entry, package)
|
60
60
|
|
61
61
|
index_hash[:packages_schema][:packages] << package_hsh
|
62
62
|
|
63
|
-
index_hash =
|
63
|
+
index_hash = index_public_methods_for_package_classes(package, index_hash)
|
64
64
|
end
|
65
65
|
|
66
66
|
if facade.get_package(:ree_errors, false)
|
@@ -72,67 +72,71 @@ module Ree
|
|
72
72
|
|
73
73
|
private
|
74
74
|
|
75
|
-
def
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
next
|
97
|
-
end
|
98
|
-
|
99
|
-
if klass.include?(ReeDao::DSL)
|
100
|
-
hsh = index_dao(klass, file_name, package.name, dir, const_string_from_file_name)
|
101
|
-
obj_name_key = Ree::StringUtils.underscore(const_string_from_file_name)
|
102
|
-
index_hash[:objects][obj_name_key] ||= []
|
103
|
-
index_hash[:objects][obj_name_key] << hsh
|
104
|
-
|
105
|
-
next
|
106
|
-
end
|
107
|
-
|
108
|
-
if klass.include?(ReeMapper::DSL)
|
109
|
-
# TODO
|
110
|
-
next
|
111
|
-
end
|
112
|
-
|
113
|
-
if !objects_class_names.include?(const_string_with_module)
|
114
|
-
hsh = index_class(klass, file_name, package.name, dir, const_string_from_file_name)
|
115
|
-
hash_key = const_string_from_file_name
|
116
|
-
index_hash[:classes][hash_key] ||= []
|
117
|
-
index_hash[:classes][hash_key] << hsh
|
118
|
-
|
119
|
-
next
|
120
|
-
end
|
121
|
-
rescue NameError
|
122
|
-
next
|
75
|
+
def index_public_methods_for_package_classes(package, index_hash)
|
76
|
+
package.objects.each do |obj|
|
77
|
+
klass = obj.klass
|
78
|
+
klass_name = demodulize(klass.to_s)
|
79
|
+
obj_name = obj.name.to_s
|
80
|
+
rpath = obj.rpath
|
81
|
+
|
82
|
+
if obj.tags.include?("enum")
|
83
|
+
hsh = index_class(klass, rpath, package.name)
|
84
|
+
index_hash[:classes][klass_name] ||= []
|
85
|
+
index_hash[:classes][klass_name] << hsh
|
86
|
+
index_hash[:objects][obj_name] ||= []
|
87
|
+
index_hash[:objects][obj_name] << hsh
|
88
|
+
elsif obj.tags.include?("dao")
|
89
|
+
hsh = index_dao(klass, rpath, package.name)
|
90
|
+
index_hash[:objects][obj_name] ||= []
|
91
|
+
index_hash[:objects][obj_name] << hsh
|
92
|
+
elsif obj.tags.include?("object")
|
93
|
+
hsh = index_class(klass, rpath, package.name)
|
94
|
+
index_hash[:objects][obj_name] ||= []
|
95
|
+
index_hash[:objects][obj_name] << hsh
|
123
96
|
end
|
124
97
|
end
|
125
98
|
|
99
|
+
recursively_index_module(package.module, index_hash, package, {})
|
100
|
+
|
126
101
|
index_hash
|
127
102
|
end
|
128
103
|
|
129
|
-
def
|
104
|
+
def recursively_index_module(mod, index_hsh, package, mod_index)
|
105
|
+
return if !mod.is_a?(Module)
|
106
|
+
return if mod_index[mod]
|
107
|
+
|
108
|
+
mod_index[mod] = true
|
109
|
+
|
110
|
+
mod.constants.each do |const_name|
|
111
|
+
const = mod.const_get(const_name)
|
112
|
+
|
113
|
+
recursively_index_module(const, index_hsh, package, mod_index)
|
114
|
+
|
115
|
+
next if !const.is_a?(Class)
|
116
|
+
next if package.objects.any? { |o| o.klass == const }
|
117
|
+
next if index_hsh[:classes].has_key?(demodulize(const.name))
|
118
|
+
|
119
|
+
const_abs_path = mod.const_source_location(const.name).first
|
120
|
+
next if !const_abs_path
|
121
|
+
|
122
|
+
rpath = Pathname.new(const_abs_path).relative_path_from(Ree.root_dir).to_s
|
123
|
+
hsh = index_class(const, rpath, package.name)
|
124
|
+
class_name = demodulize(const.name)
|
125
|
+
|
126
|
+
index_hsh[:classes][class_name] ||= []
|
127
|
+
index_hsh[:classes][class_name] << hsh
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
def index_class(klass, rpath, package_name)
|
130
132
|
all_methods = klass.public_instance_methods(false)
|
131
133
|
orig_methods = all_methods.grep(/original/)
|
134
|
+
|
132
135
|
methods = (all_methods - orig_methods) # remove aliases defined by contracts
|
133
136
|
.map { |m|
|
134
137
|
orig_method_name = orig_methods.find { |om| om.match(/original_#{Regexp.escape(m.name)}_[0-9a-fA-F]+/) }
|
135
138
|
orig_method = orig_method_name ? klass.public_instance_method(orig_method_name) : nil
|
139
|
+
|
136
140
|
{
|
137
141
|
name: m,
|
138
142
|
parameters: orig_method&.parameters&.map { |param| { name: param.last, required: param.first } },
|
@@ -140,20 +144,14 @@ module Ree
|
|
140
144
|
}
|
141
145
|
}
|
142
146
|
|
143
|
-
rpath_from_root_file_path = Pathname.new(file_name).relative_path_from(Pathname.new(root_dir)).to_s
|
144
|
-
|
145
147
|
{
|
146
|
-
path:
|
148
|
+
path: rpath,
|
147
149
|
package: package_name,
|
148
150
|
methods: methods
|
149
151
|
}
|
150
152
|
end
|
151
153
|
|
152
|
-
def
|
153
|
-
index_class(klass, file_name, package_name, root_dir, hash_key)
|
154
|
-
end
|
155
|
-
|
156
|
-
def index_dao(klass, file_name, package_name, root_dir, hash_key)
|
154
|
+
def index_dao(klass, rpath, package_name)
|
157
155
|
filters = klass
|
158
156
|
.instance_variable_get(:@filters)
|
159
157
|
.map {
|
@@ -164,10 +162,8 @@ module Ree
|
|
164
162
|
}
|
165
163
|
}
|
166
164
|
|
167
|
-
rpath_from_root_file_path = Pathname.new(file_name).relative_path_from(Pathname.new(root_dir)).to_s
|
168
|
-
|
169
165
|
{
|
170
|
-
path:
|
166
|
+
path: rpath,
|
171
167
|
package: package_name,
|
172
168
|
methods: filters
|
173
169
|
}
|
@@ -175,7 +171,7 @@ module Ree
|
|
175
171
|
|
176
172
|
def index_exceptions(errors_package, index_hash)
|
177
173
|
errors_package.objects.each do |obj|
|
178
|
-
const_name = obj.class_name
|
174
|
+
const_name = demodulize(obj.class_name)
|
179
175
|
file_name = File.join(
|
180
176
|
Ree::PathHelper.abs_package_module_dir(errors_package),
|
181
177
|
obj.name.to_s + ".rb"
|
@@ -193,6 +189,10 @@ module Ree
|
|
193
189
|
|
194
190
|
index_hash
|
195
191
|
end
|
192
|
+
|
193
|
+
def demodulize(str)
|
194
|
+
str.split("::").last
|
195
|
+
end
|
196
196
|
end
|
197
197
|
end
|
198
198
|
end
|
data/lib/ree/core/object.rb
CHANGED
@@ -5,7 +5,7 @@ class Ree::Object
|
|
5
5
|
:package_name, :factory, :after_init,
|
6
6
|
:class_name, :links, :mount_as, :freeze,
|
7
7
|
:errors, :linked_const_list, :compiled_frozen,
|
8
|
-
:singleton
|
8
|
+
:singleton, :tags
|
9
9
|
|
10
10
|
# @param [Symbol] name Object name
|
11
11
|
# @param [String] schema_rpath Object schema path relative to project root dir
|
@@ -22,6 +22,7 @@ class Ree::Object
|
|
22
22
|
@singleton = false
|
23
23
|
@compiled_frozen = @freeze
|
24
24
|
@linked_const_list = []
|
25
|
+
@tags = []
|
25
26
|
end
|
26
27
|
|
27
28
|
def reset
|
@@ -129,4 +130,9 @@ class Ree::Object
|
|
129
130
|
def set_after_init(val)
|
130
131
|
@after_init = val; self
|
131
132
|
end
|
133
|
+
|
134
|
+
def add_tags(list)
|
135
|
+
@tags += list
|
136
|
+
@tags.uniq!
|
137
|
+
end
|
132
138
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal = true
|
2
2
|
|
3
3
|
module Ree::ObjectSchema
|
4
|
-
SCHEMA_VERSION_NUMBER = '1.
|
4
|
+
SCHEMA_VERSION_NUMBER = '1.1'
|
5
5
|
|
6
6
|
SCHEMA_TYPE = 'schema_type'
|
7
7
|
REE_VERSION = 'ree_version'
|
@@ -40,6 +40,7 @@ module Ree::ObjectSchema
|
|
40
40
|
|
41
41
|
module Args
|
42
42
|
ARG = 'arg'
|
43
|
+
ARG_TYPE = 'arg_type'
|
43
44
|
TYPE = 'type'
|
44
45
|
end
|
45
46
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal = true
|
2
2
|
|
3
3
|
module Ree::PackageSchema
|
4
|
-
SCHEMA_VERSION_NUMBER = '1.
|
4
|
+
SCHEMA_VERSION_NUMBER = '1.1'
|
5
5
|
|
6
6
|
SCHEMA_TYPE = 'schema_type'
|
7
7
|
REE_VERSION = 'ree_version'
|
@@ -17,6 +17,7 @@ module Ree::PackageSchema
|
|
17
17
|
module Objects
|
18
18
|
NAME = 'name'
|
19
19
|
SCHEMA = 'schema'
|
20
|
+
TAGS = 'tags'
|
20
21
|
end
|
21
22
|
|
22
23
|
module DependsOn
|
@@ -102,6 +102,7 @@ class Ree::PackageSchemaLoader
|
|
102
102
|
name = item[Schema::Objects::NAME].to_s
|
103
103
|
schema_rpath = item[Schema::Objects::SCHEMA].to_s
|
104
104
|
list = [name, schema_rpath]
|
105
|
+
tags = item[Schema::Objects::TAGS] || []
|
105
106
|
|
106
107
|
if list.reject(&:empty?).size != list.size
|
107
108
|
raise Ree::Error.new("invalid object data for #{item.inspect}: #{abs_schema_path}", :invalid_package_schema)
|
@@ -119,6 +120,7 @@ class Ree::PackageSchemaLoader
|
|
119
120
|
Ree::PathHelper.object_rpath(schema_rpath),
|
120
121
|
)
|
121
122
|
|
123
|
+
object.add_tags(tags)
|
122
124
|
object.set_package(package.name)
|
123
125
|
|
124
126
|
package.set_object(object)
|
data/lib/ree/dsl/object_dsl.rb
CHANGED
data/lib/ree/fn_dsl.rb
CHANGED
data/lib/ree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-02-
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|