ree 1.0.43 → 1.0.44

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: 2673db96f54aa11d629b50c4edd402fcf44caebc3f41f64b0214aed053a70ab7
4
- data.tar.gz: b71fe02e9ef5c6394d122b9ca300ee6fcb71c72912eef455a75bd49ede91441d
3
+ metadata.gz: 8c43c3e1b979b49169f1b33067b14987b9871eea52b4925d31d952c7112dc05b
4
+ data.tar.gz: fc4d2351614b71835912930c7e971d587ae83d397277438bcfbc057dfdcf6d00
5
5
  SHA512:
6
- metadata.gz: 5144f814a5dce7e8b2a6a552c9b34ffeec076284e19f6950e34f2b9c1d19b22ecbaebb32b943365823ed3125517c273e562e5fcbf9153a0b7b4b4abcf19716ee
7
- data.tar.gz: 22ad163ff20029f24232be9b98b51503f15ba0ce1c273a1c0b33461776e6ac00abf1be91a1432d2f2e6f2060cceea2a451f91c661a1a49b54708e9f825d2084f
6
+ metadata.gz: db2e4e9846094f89f07dc3ac2ea2ff2a37f1ecccb245a5708d58dcc0274aa32d31f395e05e54d26fa7243b2004715e4e86a654b2fc842405d577a254622b5380
7
+ data.tar.gz: 2d39527fb3b6abd0b355794e8b485c154b04ba74d5acba2f3f2c1a751b08243a0bc20b219670668eb2c97095779c9d60f441c9a5988861efbcaf6bbf1b2d9e7e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree (1.0.43)
4
+ ree (1.0.44)
5
5
  commander (~> 5.0.0)
6
6
 
7
7
  GEM
@@ -107,7 +107,7 @@ module Ree
107
107
  def project_packages(packages)
108
108
  packages.reject(&:gem?)
109
109
  end
110
-
110
+
111
111
  def non_existent_packages
112
112
  @package_names ? @package_names - packages.map(&:name) : []
113
113
  end
@@ -148,7 +148,7 @@ module Ree
148
148
 
149
149
  unless acc.include?(package.name)
150
150
  acc << package.name
151
-
151
+
152
152
  package.deps.map(&:name).each do |pack|
153
153
  next if !packages_set.include?(pack)
154
154
  recursively_find_children_packages(pack, acc)
@@ -127,7 +127,7 @@ class Ree::BuildPackageDsl
127
127
  name = Ree::StringUtils.underscore(list[0]).to_sym
128
128
 
129
129
  if !Ree.irb_mode? && name != name_from_path
130
- raise Ree::Error.new("Package module '#{module_name}' does not correspond to package name 'name'. Fix file name or module name.")
130
+ raise Ree::Error.new("Package module '#{module_name}' does not correspond to package name '#{name}'. Fix file name or module name.")
131
131
  end
132
132
 
133
133
  package = @packages_facade.get_package(name, false)
@@ -207,6 +207,13 @@ class Ree::PackagesFacade
207
207
  @packages_store
208
208
  end
209
209
 
210
+ # @param [Symbol] package_name
211
+ # @return [Bool]
212
+ def has_package?(package_name)
213
+ check_arg(package_name, :package_name, Symbol)
214
+ !!@packages_store.get(package_name)
215
+ end
216
+
210
217
  # @param [Symbol] package_name
211
218
  # @return [Ree::Package]
212
219
  def get_package(package_name, raise_if_missing = true)
data/lib/ree/link_dsl.rb CHANGED
@@ -50,29 +50,18 @@ module Ree::LinkDSL
50
50
  raise Ree::Error.new("target should be one of [:object, :class, :both]", :invalid_dsl_usage)
51
51
  end
52
52
 
53
- package_name = Ree::StringUtils.underscore(self.name.split('::').first).to_sym
54
- link_package_name = from.nil? ? package_name : from
53
+ packages = Ree.container.packages_facade
54
+ link_package_name = get_link_package_name(from, object_name)
55
55
  link_object_name = object_name
56
56
  link_as = as ? as : object_name
57
57
 
58
- _check_package_dependency_added(link_package_name, package_name)
59
-
60
58
  if import
61
- Ree::LinkImportBuilder
62
- .new(Ree.container.packages_facade)
63
- .build(
64
- self,
65
- link_package_name,
66
- link_object_name,
67
- import
68
- )
59
+ Ree::LinkImportBuilder.new(packages).build(
60
+ self, link_package_name, link_object_name, import
61
+ )
69
62
  end
70
63
 
71
- obj = Ree
72
- .container
73
- .packages_facade
74
- .load_package_object(link_package_name, link_object_name)
75
-
64
+ obj = packages.load_package_object(link_package_name, link_object_name)
76
65
  target ||= obj.target
77
66
 
78
67
  if target == :both
@@ -133,12 +122,9 @@ module Ree::LinkDSL
133
122
 
134
123
  list = path.split('/')
135
124
  package_name = File.basename(list[0], ".*").to_sym
136
- current_package_name = Ree::StringUtils.underscore(self.name.split('::').first).to_sym
137
-
138
- _check_package_dependency_added(package_name, current_package_name)
139
-
140
- Ree.container.packages_facade.load_package_entry(package_name)
141
- package = Ree.container.packages_facade.get_package(package_name)
125
+ packages = Ree.container.packages_facade
126
+ packages.load_package_entry(package_name)
127
+ package = packages.get_package(package_name)
142
128
 
143
129
  file_path = File.join(
144
130
  Ree::PathHelper.abs_package_dir(package),
@@ -153,7 +139,7 @@ module Ree::LinkDSL
153
139
  end
154
140
  end
155
141
 
156
- Ree.container.packages_facade.load_file(file_path, package.name)
142
+ packages.load_file(file_path, package.name)
157
143
 
158
144
  const_list = path.split('/').map { |_| Ree::StringUtils.camelize(_) }
159
145
  const_short = [const_list[0], const_list.last].join("::")
@@ -168,13 +154,9 @@ module Ree::LinkDSL
168
154
  end
169
155
 
170
156
  if import_proc
171
- Ree::LinkImportBuilder
172
- .new(Ree.container.packages_facade)
173
- .build_for_const(
174
- self,
175
- file_const,
176
- import_proc
177
- )
157
+ Ree::LinkImportBuilder.new(packages).build_for_const(
158
+ self, file_const, import_proc
159
+ )
178
160
  end
179
161
 
180
162
  nil
@@ -182,33 +164,24 @@ module Ree::LinkDSL
182
164
 
183
165
  def _raise_error(text, code = :invalid_dsl_usage)
184
166
  msg = <<~DOC
185
- object: :#{@object.name}
186
- path: #{Ree::PathHelper.abs_object_path(@object)}
167
+ class: :#{self}
187
168
  error: #{text}
188
169
  DOC
189
170
 
190
171
  raise Ree::Error.new(msg, code)
191
172
  end
192
173
 
193
- def _check_package_dependency_added(package_name, current_package_name)
194
- return if package_name == current_package_name
195
-
196
- facade = Ree.container.packages_facade
197
- facade.load_package_entry(package_name)
198
- facade.load_package_entry(current_package_name)
174
+ def get_link_package_name(from, object_name)
175
+ return from if from
199
176
 
200
- current_package = facade.get_package(current_package_name)
177
+ package_name = Ree::StringUtils.underscore(self.name.split('::').first).to_sym
178
+ result = Ree.container.packages_facade.has_package?(package_name) ? package_name : nil
201
179
 
202
- dep_package = current_package.deps.detect do |d|
203
- d.name == package_name
180
+ if result.nil?
181
+ raise Ree::Error.new("package is not provided for link :#{object_name}", :invalid_dsl_usage)
204
182
  end
205
183
 
206
- if dep_package.nil?
207
- raise Ree::Error.new(
208
- "Package :#{package_name} is not added as dependency for :#{current_package_name} package\npackage path: #{File.join(Ree.root_dir, current_package.entry_rpath || "")}\nclass:#{self.name}",
209
- :invalid_dsl_usage
210
- )
211
- end
184
+ result
212
185
  end
213
186
  end
214
187
  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.43"
4
+ VERSION = "1.0.44"
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.43
4
+ version: 1.0.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ruslan Gatiyatov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-08-06 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander