ree 1.0.7 → 1.0.9
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/exe/ree +1 -1
- data/lib/ree/cli/generate_object_schema.rb +1 -5
- data/lib/ree/cli/generate_package_schema.rb +1 -1
- data/lib/ree/rspec_link_dsl.rb +55 -13
- data/lib/ree/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 754004035abda42c6d92689e63dd8c2b5e58d0aa706097cd6a825decdbad36f3
|
4
|
+
data.tar.gz: 43c066a73992ff94ce014301d9dea2df68ab804f90ae580d7a3dfca36f9c59e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f126d959715dbf0c9e2c4bf01824c832a111e78385afe4573c2752c259f7b42ce108995eec25398f3fd3b0b8b32fee9d8edfdd382dd4799dcb6b467dbea2d741
|
7
|
+
data.tar.gz: b6663db03cca36ba13f6faddb54ae041a40d1e20f36ac426b55a126aae9f207c0d217a03527fd89951f0d91658db436ef5f995d9810205fd907f2562e46100af
|
data/Gemfile.lock
CHANGED
data/exe/ree
CHANGED
@@ -148,7 +148,7 @@ class ReeCliRunner
|
|
148
148
|
c.option '--silence', String, 'Silence all logs'
|
149
149
|
c.option '--project_path [ROOT_PROJECT_DIR]', String, 'Root project dir path'
|
150
150
|
c.action do |args, options|
|
151
|
-
package_name = args[0]
|
151
|
+
package_name = args[0]
|
152
152
|
object_path = args[1]
|
153
153
|
options_hash = options.__hash__
|
154
154
|
|
@@ -25,8 +25,7 @@ module Ree
|
|
25
25
|
if facade.has_object?(package_name, object_name)
|
26
26
|
object = facade.load_package_object(package_name, object_name)
|
27
27
|
Ree.write_object_schema(package.name, object.name)
|
28
|
-
|
29
|
-
obj_path = Ree::PathHelper.abs_object_schema_path(object)
|
28
|
+
facade.dump_package_schema(package_name)
|
30
29
|
else
|
31
30
|
file_path = File.join(dir, object_path)
|
32
31
|
|
@@ -42,9 +41,6 @@ module Ree
|
|
42
41
|
end
|
43
42
|
end
|
44
43
|
|
45
|
-
|
46
|
-
puts(" #{object.name}: #{obj_path}") if !silence
|
47
|
-
|
48
44
|
puts("done") if !silence
|
49
45
|
end
|
50
46
|
end
|
data/lib/ree/rspec_link_dsl.rb
CHANGED
@@ -1,19 +1,61 @@
|
|
1
1
|
module Ree::RSpecLinkDSL
|
2
|
-
def link(obj_name, as: nil, from:)
|
3
|
-
|
2
|
+
def link(obj_name, import_proc = nil, as: nil, from: nil)
|
3
|
+
if obj_name.is_a?(Symbol)
|
4
|
+
obj = link_object(from, obj_name)
|
4
5
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
6
|
+
if obj.nil?
|
7
|
+
raise Ree::Error.new("object :#{obj_name} was not found for package :#{from}")
|
8
|
+
end
|
9
|
+
|
10
|
+
as ||= obj_name
|
11
|
+
|
12
|
+
define_method as do |*args, **kwargs, &proc|
|
13
|
+
if obj.object?
|
14
|
+
obj.klass.new
|
15
|
+
else
|
16
|
+
obj.klass.new.call(*args, **kwargs, &proc)
|
17
|
+
end
|
16
18
|
end
|
19
|
+
elsif obj_name.is_a?(String)
|
20
|
+
const_list = link_file(from, obj_name, import_proc)
|
21
|
+
const_list.each do |const|
|
22
|
+
Object.const_set(const.name, self.const_get(const.name))
|
23
|
+
end
|
24
|
+
else
|
25
|
+
raise Ree::Error.new("Invalid link DSL usage. Args should be Hash or String")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def link_object(from_package_name, obj_name)
|
32
|
+
Ree.container.compile(from_package_name, obj_name)
|
33
|
+
end
|
34
|
+
|
35
|
+
def link_file(from_package_name, path, import_proc)
|
36
|
+
Ree.container.packages_facade.load_package_entry(from_package_name)
|
37
|
+
package = Ree.container.packages_facade.get_package(from_package_name)
|
38
|
+
|
39
|
+
file_path = File.join(
|
40
|
+
Ree::PathHelper.abs_package_dir(package),
|
41
|
+
Ree::PACKAGE, path
|
42
|
+
)
|
43
|
+
Ree.container.packages_facade.load_file(file_path, package.name)
|
44
|
+
|
45
|
+
const_list = path.split('/').map { |_| Ree::StringUtils.camelize(_) }
|
46
|
+
const_short = [const_list[0], const_list.last].join("::")
|
47
|
+
const_long = const_list.join("::")
|
48
|
+
|
49
|
+
file_const = if Object.const_defined?(const_long)
|
50
|
+
Object.const_get(const_long)
|
51
|
+
elsif Object.const_defined?(const_short)
|
52
|
+
Object.const_get(const_short)
|
53
|
+
else
|
54
|
+
raise Ree::Error.new("Unable to link '#{path}'. #{const_long} or #{const_short} was not defined in #{file_path}")
|
17
55
|
end
|
56
|
+
|
57
|
+
const_list = Ree::LinkImportBuilder
|
58
|
+
.new(Ree.container.packages_facade)
|
59
|
+
.build_for_const(self, file_const, import_proc)
|
18
60
|
end
|
19
61
|
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.9
|
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-10-
|
11
|
+
date: 2022-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|
212
|
-
rubygems_version: 3.3.
|
212
|
+
rubygems_version: 3.3.24
|
213
213
|
signing_key:
|
214
214
|
specification_version: 4
|
215
215
|
summary: Ruby framework to create modular applications
|