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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c32f060df0bf1a9a76c62bdd35b60b272ec149324aaf19c7a0b4f5f63c1d3c82
4
- data.tar.gz: 89ac6e401839330e4f54cb3ec15cc2df8d863c15a1ef817d2bac6c373d939932
3
+ metadata.gz: 754004035abda42c6d92689e63dd8c2b5e58d0aa706097cd6a825decdbad36f3
4
+ data.tar.gz: 43c066a73992ff94ce014301d9dea2df68ab804f90ae580d7a3dfca36f9c59e5
5
5
  SHA512:
6
- metadata.gz: b2a03832d8f24ea278089396e14629f2cdfb40c2b9728cdddff2a5ebec8843edbb3acf03fc591941e9a5f46db844cf42055336786602d08900777ac5138c1e76
7
- data.tar.gz: 595b8a13b3816096ab458ca3bcefcbca4185841391e5d82a627b53a7cea0cb14fd0f61a45a00600dbb5d83778b3d2c7cd674dbdcf342ff719c1294fa61af97fb
6
+ metadata.gz: f126d959715dbf0c9e2c4bf01824c832a111e78385afe4573c2752c259f7b42ce108995eec25398f3fd3b0b8b32fee9d8edfdd382dd4799dcb6b467dbea2d741
7
+ data.tar.gz: b6663db03cca36ba13f6faddb54ae041a40d1e20f36ac426b55a126aae9f207c0d217a03527fd89951f0d91658db436ef5f995d9810205fd907f2562e46100af
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree (1.0.7)
4
+ ree (1.0.9)
5
5
  commander (~> 4.6.0)
6
6
 
7
7
  GEM
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]&.to_sym
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
@@ -25,7 +25,7 @@ module Ree
25
25
 
26
26
  facade = Ree.container.packages_facade
27
27
  facade.load_packages_schema
28
- Ree.load_package(package_name)
28
+ facade.load_entire_package(package_name)
29
29
  facade.write_package_schema(package_name)
30
30
 
31
31
  package = facade.get_package(package_name)
@@ -1,19 +1,61 @@
1
1
  module Ree::RSpecLinkDSL
2
- def link(obj_name, as: nil, from:)
3
- obj = Ree.container.compile(from, obj_name)
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
- if obj.nil?
6
- raise Ree::Error.new("object :#{obj_name} was not found for package :#{from}")
7
- end
8
-
9
- as ||= obj_name
10
-
11
- define_method as do |*args, **kwargs, &proc|
12
- if obj.object?
13
- obj.klass.new
14
- else
15
- obj.klass.new.call(*args, **kwargs, &proc)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ree
4
- VERSION = "1.0.7"
4
+ VERSION = "1.0.9"
5
5
  end
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.7
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-25 00:00:00.000000000 Z
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.7
212
+ rubygems_version: 3.3.24
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Ruby framework to create modular applications