ree 1.0.21 → 1.0.23
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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ree/bean_dsl.rb +1 -0
- data/lib/ree/cli/delete_object_schema.rb +10 -0
- data/lib/ree/cli/{index_package.rb → indexing/index_package.rb} +16 -3
- data/lib/ree/cli/{index_project.rb → indexing/index_project.rb} +80 -73
- data/lib/ree/cli.rb +3 -3
- 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.rb +10 -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/core/path_helper.rb +16 -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 +5 -5
- /data/lib/ree/cli/{index_file.rb → indexing/index_file.rb} +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 60b602bd07b9adc8ba5cbcee420750e3b2d5266056c888ad750115cbb393c4ea
|
4
|
+
data.tar.gz: 1431632c86f3dacee9ad1f4fee6550e3a56b06dca780d0d3c6c46245c812b407
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58c730e7c3930abe99115bdaffa4175b886c29dd67ef7575b196f6284782f192722dfd706e5e6174808b1cdb0ab0126a216cfa1ccfa6d99fe0a287289e63d708
|
7
|
+
data.tar.gz: 67ebd3b56bed90000f00033e7a7cd9f2a5959df2dd4acc58f168e5830c49bf989b3ba74fdf77902d3e0ceec921de7180a55185e5665f33294316e8d0074f51ca
|
data/Gemfile.lock
CHANGED
data/lib/ree/bean_dsl.rb
CHANGED
@@ -22,6 +22,16 @@ module Ree
|
|
22
22
|
if File.exist?(abs_schema_path)
|
23
23
|
FileUtils.rm(abs_schema_path)
|
24
24
|
|
25
|
+
facade = Ree.container.packages_facade
|
26
|
+
package_name = Ree::PathHelper.package_name_from_dir(File.dirname(object_path))
|
27
|
+
if package_name
|
28
|
+
package_name = package_name.to_sym
|
29
|
+
facade.load_package_entry(package_name)
|
30
|
+
package = facade.get_package(package_name)
|
31
|
+
package.remove_object(object_name)
|
32
|
+
facade.dump_package_schema(package_name)
|
33
|
+
end
|
34
|
+
|
25
35
|
puts(" #{schema_path}: is deleted") if !silence
|
26
36
|
end
|
27
37
|
|
@@ -14,16 +14,25 @@ module Ree
|
|
14
14
|
|
15
15
|
facade = Ree.container.packages_facade
|
16
16
|
|
17
|
+
hsh = {}
|
18
|
+
hsh[:package_schema] = {}
|
19
|
+
hsh[:classes] = {}
|
20
|
+
hsh[:objects] = {}
|
21
|
+
|
17
22
|
package_name = package_name.to_sym
|
23
|
+
facade.load_entire_package(package_name)
|
18
24
|
package = facade.get_loaded_package(package_name)
|
19
|
-
package_hsh =
|
25
|
+
package_hsh = index_package_entry(package)
|
26
|
+
|
27
|
+
hsh[:package_schema] = package_hsh
|
28
|
+
hsh = index_public_methods_for_package_classes(package, dir, hsh)
|
20
29
|
|
21
|
-
JSON.pretty_generate(
|
30
|
+
JSON.pretty_generate(hsh)
|
22
31
|
end
|
23
32
|
|
24
33
|
private
|
25
34
|
|
26
|
-
def
|
35
|
+
def index_package_entry(package)
|
27
36
|
package_hsh = {}
|
28
37
|
package_hsh[:name] = package.name
|
29
38
|
package_hsh[:schema_rpath] = package.schema_rpath
|
@@ -110,6 +119,10 @@ module Ree
|
|
110
119
|
}
|
111
120
|
]
|
112
121
|
end
|
122
|
+
|
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
|
+
end
|
113
126
|
end
|
114
127
|
end
|
115
128
|
end
|
@@ -10,16 +10,15 @@ module Ree
|
|
10
10
|
|
11
11
|
Ree.init(dir)
|
12
12
|
|
13
|
-
|
13
|
+
index_hash = {}
|
14
14
|
# completion/etc data
|
15
|
-
|
16
|
-
|
15
|
+
index_hash[:classes] = {}
|
16
|
+
index_hash[:objects] = {}
|
17
17
|
|
18
18
|
# schema data
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
@index_hash[:packages_schema][:gem_packages] = []
|
19
|
+
index_hash[:packages_schema] = {}
|
20
|
+
index_hash[:packages_schema][:packages] = []
|
21
|
+
index_hash[:packages_schema][:gem_packages] = []
|
23
22
|
|
24
23
|
facade = Ree.container.packages_facade
|
25
24
|
|
@@ -48,7 +47,7 @@ module Ree
|
|
48
47
|
}
|
49
48
|
}
|
50
49
|
|
51
|
-
|
50
|
+
index_hash[:packages_schema][:gem_packages] << gem_package_hsh
|
52
51
|
|
53
52
|
next
|
54
53
|
end
|
@@ -57,68 +56,84 @@ module Ree
|
|
57
56
|
|
58
57
|
facade.load_entire_package(package.name)
|
59
58
|
|
60
|
-
package_hsh = Ree::CLI::IndexPackage.send(:
|
59
|
+
package_hsh = Ree::CLI::IndexPackage.send(:index_package_entry, package)
|
61
60
|
|
62
|
-
|
61
|
+
index_hash[:packages_schema][:packages] << package_hsh
|
63
62
|
|
64
|
-
|
63
|
+
index_hash = index_public_methods_for_package_classes(package, index_hash)
|
64
|
+
end
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
)
|
70
|
-
]
|
66
|
+
if facade.get_package(:ree_errors, false)
|
67
|
+
index_hash = index_exceptions(facade.get_package(:ree_errors), index_hash)
|
68
|
+
end
|
71
69
|
|
72
|
-
|
73
|
-
|
74
|
-
const_string_from_file_name = Ree::StringUtils.camelize(file_name.split('/')[-1].split('.rb')[0])
|
75
|
-
const_string_with_module = "#{package.module}::#{const_string_from_file_name}"
|
76
|
-
klass = Object.const_get(const_string_with_module)
|
70
|
+
JSON.pretty_generate(index_hash)
|
71
|
+
end
|
77
72
|
|
78
|
-
|
79
|
-
index_enum(klass, file_name, package.name, dir, const_string_from_file_name)
|
73
|
+
private
|
80
74
|
|
81
|
-
|
82
|
-
|
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
|
96
|
+
end
|
97
|
+
end
|
83
98
|
|
84
|
-
|
85
|
-
index_dao(klass, file_name, package.name, dir, const_string_from_file_name)
|
86
|
-
next
|
87
|
-
end
|
99
|
+
recursively_index_module(package.module, index_hash, package)
|
88
100
|
|
89
|
-
|
90
|
-
|
91
|
-
next
|
92
|
-
end
|
101
|
+
index_hash
|
102
|
+
end
|
93
103
|
|
94
|
-
|
95
|
-
|
104
|
+
def recursively_index_module(mod, index_hsh, package)
|
105
|
+
return if !mod.is_a?(Module)
|
96
106
|
|
97
|
-
|
98
|
-
|
99
|
-
rescue NameError
|
100
|
-
next
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
107
|
+
mod.constants.each do |const_name|
|
108
|
+
const = mod.const_get(const_name)
|
104
109
|
|
105
|
-
|
106
|
-
index_exceptions(facade.get_package(:ree_errors))
|
107
|
-
end
|
108
|
-
|
110
|
+
recursively_index_module(const, index_hsh, package)
|
109
111
|
|
110
|
-
|
111
|
-
|
112
|
+
next if !const.is_a?(Class)
|
113
|
+
next if package.objects.any? { |o| o.klass == const }
|
114
|
+
next if index_hsh[:classes].has_key?(demodulize(const.name))
|
112
115
|
|
113
|
-
|
116
|
+
const_abs_path = mod.const_source_location(const.name).first
|
117
|
+
next if !const_abs_path
|
114
118
|
|
115
|
-
|
119
|
+
rpath = Pathname.new(const_abs_path).relative_path_from(Ree.root_dir).to_s
|
120
|
+
hsh = index_class(const, rpath, package.name)
|
121
|
+
class_name = demodulize(const.name)
|
122
|
+
|
123
|
+
index_hsh[:classes][class_name] ||= []
|
124
|
+
index_hsh[:classes][class_name] << hsh
|
125
|
+
end
|
126
|
+
end
|
127
|
+
|
128
|
+
def index_class(klass, rpath, package_name)
|
116
129
|
all_methods = klass.public_instance_methods(false)
|
117
130
|
orig_methods = all_methods.grep(/original/)
|
131
|
+
|
118
132
|
methods = (all_methods - orig_methods) # remove aliases defined by contracts
|
119
133
|
.map { |m|
|
120
134
|
orig_method_name = orig_methods.find { |om| om.match(/original_#{Regexp.escape(m.name)}_[0-9a-fA-F]+/) }
|
121
135
|
orig_method = orig_method_name ? klass.public_instance_method(orig_method_name) : nil
|
136
|
+
|
122
137
|
{
|
123
138
|
name: m,
|
124
139
|
parameters: orig_method&.parameters&.map { |param| { name: param.last, required: param.first } },
|
@@ -126,22 +141,14 @@ module Ree
|
|
126
141
|
}
|
127
142
|
}
|
128
143
|
|
129
|
-
|
130
|
-
|
131
|
-
path: rpath_from_root_file_path,
|
144
|
+
{
|
145
|
+
path: rpath,
|
132
146
|
package: package_name,
|
133
147
|
methods: methods
|
134
148
|
}
|
135
|
-
|
136
|
-
@index_hash[:classes][hash_key] ||= []
|
137
|
-
@index_hash[:classes][hash_key] << hsh
|
138
149
|
end
|
139
150
|
|
140
|
-
def
|
141
|
-
index_class(klass, file_name, package_name, root_dir, hash_key)
|
142
|
-
end
|
143
|
-
|
144
|
-
def index_dao(klass, file_name, package_name, root_dir, hash_key)
|
151
|
+
def index_dao(klass, rpath, package_name)
|
145
152
|
filters = klass
|
146
153
|
.instance_variable_get(:@filters)
|
147
154
|
.map {
|
@@ -152,22 +159,16 @@ module Ree
|
|
152
159
|
}
|
153
160
|
}
|
154
161
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
hsh = {
|
159
|
-
path: rpath_from_root_file_path,
|
162
|
+
{
|
163
|
+
path: rpath,
|
160
164
|
package: package_name,
|
161
165
|
methods: filters
|
162
166
|
}
|
163
|
-
|
164
|
-
@index_hash[:objects][obj_name_key] ||= []
|
165
|
-
@index_hash[:objects][obj_name_key] << hsh
|
166
167
|
end
|
167
168
|
|
168
|
-
def index_exceptions(errors_package)
|
169
|
+
def index_exceptions(errors_package, index_hash)
|
169
170
|
errors_package.objects.each do |obj|
|
170
|
-
const_name = obj.class_name
|
171
|
+
const_name = demodulize(obj.class_name)
|
171
172
|
file_name = File.join(
|
172
173
|
Ree::PathHelper.abs_package_module_dir(errors_package),
|
173
174
|
obj.name.to_s + ".rb"
|
@@ -179,9 +180,15 @@ module Ree
|
|
179
180
|
methods: []
|
180
181
|
}
|
181
182
|
|
182
|
-
|
183
|
-
|
183
|
+
index_hash[:classes][const_name] ||= []
|
184
|
+
index_hash[:classes][const_name] << hsh
|
184
185
|
end
|
186
|
+
|
187
|
+
index_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
def demodulize(str)
|
191
|
+
str.split("::").last
|
185
192
|
end
|
186
193
|
end
|
187
194
|
end
|
data/lib/ree/cli.rb
CHANGED
@@ -9,9 +9,9 @@ module Ree
|
|
9
9
|
autoload :DeleteObjectSchema, 'ree/cli/delete_object_schema'
|
10
10
|
autoload :GeneratePackage, 'ree/cli/generate_package'
|
11
11
|
autoload :GenerateTemplate, 'ree/cli/generate_template'
|
12
|
-
autoload :IndexProject, 'ree/cli/index_project'
|
13
|
-
autoload :IndexFile, 'ree/cli/index_file'
|
14
|
-
autoload :IndexPackage, 'ree/cli/index_package'
|
12
|
+
autoload :IndexProject, 'ree/cli/indexing/index_project'
|
13
|
+
autoload :IndexFile, 'ree/cli/indexing/index_file'
|
14
|
+
autoload :IndexPackage, 'ree/cli/indexing/index_package'
|
15
15
|
autoload :SpecRunner, 'ree/cli/spec_runner'
|
16
16
|
end
|
17
17
|
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
|
data/lib/ree/core/package.rb
CHANGED
@@ -165,6 +165,16 @@ class Ree::Package
|
|
165
165
|
@objects_store[object.name] = object
|
166
166
|
end
|
167
167
|
|
168
|
+
# @param [Symbol] name
|
169
|
+
# @return [nil]
|
170
|
+
def remove_object(name)
|
171
|
+
if @objects_store[name]
|
172
|
+
@objects_store.delete(name)
|
173
|
+
end
|
174
|
+
|
175
|
+
nil
|
176
|
+
end
|
177
|
+
|
168
178
|
# @param [Symbol] name
|
169
179
|
# @return [Nilor[Ree::Object]]
|
170
180
|
def get_object(name)
|
@@ -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/core/path_helper.rb
CHANGED
@@ -52,6 +52,22 @@ class Ree::PathHelper
|
|
52
52
|
File.join(dir, "#{Ree::PACKAGE}/#{name}.rb")
|
53
53
|
end
|
54
54
|
|
55
|
+
# @param [String] directory inside package
|
56
|
+
# @return [String] name of package
|
57
|
+
def package_name_from_dir(dir)
|
58
|
+
package_schema = File.join(dir, Ree::PACKAGE_SCHEMA_FILE)
|
59
|
+
|
60
|
+
if File.exist?(package_schema)
|
61
|
+
return package_schema.split('/')[-2]
|
62
|
+
end
|
63
|
+
|
64
|
+
if dir == '/'
|
65
|
+
return nil
|
66
|
+
end
|
67
|
+
|
68
|
+
package_name_from_dir(File.expand_path('..', dir))
|
69
|
+
end
|
70
|
+
|
55
71
|
# @param [Ree::Package] package Package schema
|
56
72
|
# @return [String] Absolute package entry path (ex. /data/project/bc/accounts/package/accounts.rb)
|
57
73
|
def abs_package_entry_path(package)
|
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.23
|
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-
|
11
|
+
date: 2023-02-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -69,9 +69,9 @@ files:
|
|
69
69
|
- lib/ree/cli/generate_package_schema.rb
|
70
70
|
- lib/ree/cli/generate_packages_schema.rb
|
71
71
|
- lib/ree/cli/generate_template.rb
|
72
|
-
- lib/ree/cli/index_file.rb
|
73
|
-
- lib/ree/cli/index_package.rb
|
74
|
-
- lib/ree/cli/index_project.rb
|
72
|
+
- lib/ree/cli/indexing/index_file.rb
|
73
|
+
- lib/ree/cli/indexing/index_package.rb
|
74
|
+
- lib/ree/cli/indexing/index_project.rb
|
75
75
|
- lib/ree/cli/init.rb
|
76
76
|
- lib/ree/cli/spec_runner.rb
|
77
77
|
- lib/ree/container.rb
|
File without changes
|