ree 1.0.11 → 1.0.12
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/cli/index_project.rb +102 -25
- 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: d37096dd01ecabedafbd59683f3c0f6d867b8a41b82ee60630b9164bd2455d91
|
4
|
+
data.tar.gz: c87aac73ee549100e17b233d73b91b4f473b52dca803e9fa47237e3e25a7c9bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb297cb39724d3b436cda7e327b7b39cc979208abfd50fa4b39b4a0ccf756218af253d412fd9523cef14daffac1601031f37a2e10579637f14a573ef5cb2f22a
|
7
|
+
data.tar.gz: 12ae484d56f55e9058c800fffa9030c33fcb6968007eaa3502f3db06b4e3aa98131f1597becf424f177ddcc3e19dfdc366909384601eb9c84154286d65da49a1
|
data/Gemfile.lock
CHANGED
@@ -10,8 +10,9 @@ module Ree
|
|
10
10
|
|
11
11
|
Ree.init(dir)
|
12
12
|
|
13
|
-
index_hash = {}
|
14
|
-
index_hash[:classes] = {}
|
13
|
+
@index_hash = {}
|
14
|
+
@index_hash[:classes] = {}
|
15
|
+
@index_hash[:objects] = {}
|
15
16
|
|
16
17
|
facade = Ree.container.packages_facade
|
17
18
|
|
@@ -31,38 +32,114 @@ module Ree
|
|
31
32
|
|
32
33
|
files.each do |file_name|
|
33
34
|
begin
|
34
|
-
|
35
|
-
const_string_with_module = "#{package.module}::#{
|
35
|
+
const_string_from_file_name = Ree::StringUtils.camelize(file_name.split('/')[-1].split('.rb')[0])
|
36
|
+
const_string_with_module = "#{package.module}::#{const_string_from_file_name}"
|
37
|
+
klass = Object.const_get(const_string_with_module)
|
36
38
|
|
37
|
-
|
39
|
+
if klass.include?(ReeEnum::DSL)
|
40
|
+
index_enum(klass, file_name, package.name, dir, const_string_from_file_name)
|
38
41
|
|
39
|
-
|
42
|
+
next
|
43
|
+
end
|
44
|
+
|
45
|
+
if klass.include?(ReeDao::DSL)
|
46
|
+
index_dao(klass, file_name, package.name, dir, const_string_from_file_name)
|
47
|
+
next
|
48
|
+
end
|
40
49
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
hsh = {
|
52
|
-
path: file_name,
|
53
|
-
package: package.name,
|
54
|
-
methods: methods
|
55
|
-
}
|
56
|
-
|
57
|
-
index_hash[:classes][file_name_const_string] ||= []
|
58
|
-
index_hash[:classes][file_name_const_string] << hsh
|
50
|
+
if klass.include?(ReeMapper::DSL)
|
51
|
+
# TODO
|
52
|
+
next
|
53
|
+
end
|
54
|
+
|
55
|
+
if !objects_class_names.include?(const_string_with_module)
|
56
|
+
index_class(klass, file_name, package.name, dir, const_string_from_file_name)
|
57
|
+
|
58
|
+
next
|
59
|
+
end
|
59
60
|
rescue NameError
|
60
61
|
next
|
61
62
|
end
|
62
63
|
end
|
63
64
|
end
|
64
65
|
|
65
|
-
|
66
|
+
if facade.get_package(:ree_errors, false)
|
67
|
+
index_exceptions(facade.get_package(:ree_errors))
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
JSON.pretty_generate(@index_hash)
|
72
|
+
end
|
73
|
+
|
74
|
+
private
|
75
|
+
|
76
|
+
def index_class(klass, file_name, package_name, root_dir, hash_key)
|
77
|
+
methods = klass
|
78
|
+
.public_instance_methods(false)
|
79
|
+
.reject { _1.match?(/original/) } # remove aliases defined by contracts
|
80
|
+
.map {
|
81
|
+
{
|
82
|
+
name: _1,
|
83
|
+
location: klass.public_instance_method(_1).source_location&.last,
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
rpath_from_root_file_path = Pathname.new(file_name).relative_path_from(Pathname.new(root_dir)).to_s
|
88
|
+
hsh = {
|
89
|
+
path: rpath_from_root_file_path,
|
90
|
+
package: package_name,
|
91
|
+
methods: methods
|
92
|
+
}
|
93
|
+
|
94
|
+
@index_hash[:classes][hash_key] ||= []
|
95
|
+
@index_hash[:classes][hash_key] << hsh
|
96
|
+
end
|
97
|
+
|
98
|
+
def index_enum(klass, file_name, package_name, root_dir, hash_key)
|
99
|
+
index_class(klass, file_name, package_name, root_dir, hash_key)
|
100
|
+
end
|
101
|
+
|
102
|
+
def index_dao(klass, file_name, package_name, root_dir, hash_key)
|
103
|
+
filters = klass
|
104
|
+
.instance_variable_get(:@filters)
|
105
|
+
.map {
|
106
|
+
{
|
107
|
+
name: _1.name,
|
108
|
+
parameters: _1.proc.parameters.map { |param| { name: param.last, required: param.first } },
|
109
|
+
location: _1.proc&.source_location&.last
|
110
|
+
}
|
111
|
+
}
|
112
|
+
|
113
|
+
obj_name_key = Ree::StringUtils.underscore(hash_key)
|
114
|
+
rpath_from_root_file_path = Pathname.new(file_name).relative_path_from(Pathname.new(root_dir)).to_s
|
115
|
+
|
116
|
+
hsh = {
|
117
|
+
path: rpath_from_root_file_path,
|
118
|
+
package: package_name,
|
119
|
+
methods: filters
|
120
|
+
}
|
121
|
+
|
122
|
+
@index_hash[:objects][obj_name_key] ||= []
|
123
|
+
@index_hash[:objects][obj_name_key] << hsh
|
124
|
+
end
|
125
|
+
|
126
|
+
def index_exceptions(errors_package)
|
127
|
+
errors_package.objects.each do |obj|
|
128
|
+
const_name = obj.class_name.split("::")[-1]
|
129
|
+
file_name = File.join(
|
130
|
+
Ree::PathHelper.abs_package_module_dir(errors_package),
|
131
|
+
obj.name.to_s + ".rb"
|
132
|
+
)
|
133
|
+
|
134
|
+
hsh = {
|
135
|
+
path: file_name,
|
136
|
+
package: errors_package.name,
|
137
|
+
methods: []
|
138
|
+
}
|
139
|
+
|
140
|
+
@index_hash[:classes][const_name] ||= []
|
141
|
+
@index_hash[:classes][const_name] << hsh
|
142
|
+
end
|
66
143
|
end
|
67
144
|
end
|
68
145
|
end
|
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.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ruslan Gatiyatov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|