ree 1.0.41 → 1.0.43

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: c3718d079d89d559261699484fcf0386395bcd8f9aad0faa9aaa81dbd77f8b22
4
- data.tar.gz: f2ce896f83ea0f670a5a17279f84abbab3bbcb296cb90c58e4b367d827deed8a
3
+ metadata.gz: 2673db96f54aa11d629b50c4edd402fcf44caebc3f41f64b0214aed053a70ab7
4
+ data.tar.gz: b71fe02e9ef5c6394d122b9ca300ee6fcb71c72912eef455a75bd49ede91441d
5
5
  SHA512:
6
- metadata.gz: 368cbacf27970b8df6f0e4f7e527f2ef551b09660714464a33fb788b54672ab7b09ea22863e9ddd9c0ef2f5e44bface5bcfe0b1ea74d70d2cca60db1b62fcf43
7
- data.tar.gz: 011c48a7763e2fe8ca22830322402d41af35bd78e1794b11f320808800fd610a4d01ba35de4df0903353bfcc1b261b88991cf58caef71d6dfa6ae954417f4d07
6
+ metadata.gz: 5144f814a5dce7e8b2a6a552c9b34ffeec076284e19f6950e34f2b9c1d19b22ecbaebb32b943365823ed3125517c273e562e5fcbf9153a0b7b4b4abcf19716ee
7
+ data.tar.gz: 22ad163ff20029f24232be9b98b51503f15ba0ce1c273a1c0b33461776e6ac00abf1be91a1432d2f2e6f2060cceea2a451f91c661a1a49b54708e9f825d2084f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ree (1.0.41)
4
+ ree (1.0.43)
5
5
  commander (~> 5.0.0)
6
6
 
7
7
  GEM
data/exe/ree CHANGED
@@ -89,7 +89,6 @@ class ReeCliRunner
89
89
  Ree::CLI::GeneratePackageSchema.run(
90
90
  package_name: options_with_defaults[:package_name],
91
91
  project_path: options_with_defaults[:project_path],
92
- include_objects: false,
93
92
  silence: false
94
93
  )
95
94
  end
@@ -118,7 +117,6 @@ class ReeCliRunner
118
117
  c.description = 'generates Package.schema.json for specific package'
119
118
  c.summary = '> ' + c.description
120
119
  c.example 'ree gen.package_json PACKAGE_NAME', ''
121
- c.option '--skip_objects', String, 'Skip generation of object schemas'
122
120
  c.option '--silence', String, 'Silence all logs'
123
121
  c.option '--project_path [ROOT_PROJECT_DIR]', String, 'Root project dir path'
124
122
  c.action do |args, options|
@@ -132,7 +130,6 @@ class ReeCliRunner
132
130
  default_options = {
133
131
  package_name: package_name,
134
132
  project_path: options_hash[:project_path] || File.expand_path(Dir.pwd),
135
- include_objects: !options_hash.has_key?(:skip_objects),
136
133
  silence: options_hash.has_key?(:silence)
137
134
  }
138
135
 
@@ -4,7 +4,7 @@ module Ree
4
4
  module CLI
5
5
  class GeneratePackageSchema
6
6
  class << self
7
- def run(package_name:, project_path:, include_objects: false, silence: false)
7
+ def run(package_name:, project_path:, silence: false)
8
8
  ENV['REE_SKIP_ENV_VARS_CHECK'] = 'true'
9
9
 
10
10
  path = Ree.locate_packages_schema(project_path)
@@ -31,21 +31,6 @@ module Ree
31
31
  package = facade.get_package(package_name)
32
32
  schema_path = Ree::PathHelper.abs_package_schema_path(package)
33
33
 
34
- if include_objects
35
- schemas_path = Ree::PathHelper.abs_package_schemas_dir(package)
36
-
37
- FileUtils.rm_rf(schemas_path)
38
- FileUtils.mkdir_p(schemas_path)
39
-
40
- package.objects.each do |object|
41
- Ree.write_object_schema(package.name, object.name)
42
-
43
- path = Ree::PathHelper.abs_object_schema_path(object)
44
-
45
- puts(" #{object.name}: #{path}") if !silence
46
- end
47
- end
48
-
49
34
  puts("output: #{schema_path}") if !silence
50
35
  puts("done") if !silence
51
36
  end
@@ -113,31 +113,6 @@ class Ree::PackagesFacade
113
113
  end
114
114
  end
115
115
 
116
- # @param [Symbol] package_name
117
- # @param [Symbol] object_name
118
- # @return [String]
119
- def write_object_schema(package_name, object_name)
120
- Ree.logger.debug("write_object_schema(package_name: #{package_name}, object_name: #{object_name})")
121
- object = get_object(package_name, object_name)
122
-
123
- if !object || (object && !object&.schema_rpath)
124
- raise Ree::Error.new("Object :#{object_name} schema path not found")
125
- end
126
-
127
- schema_path = Ree::PathHelper.abs_object_schema_path(object)
128
-
129
- if !File.exist?(schema_path)
130
- only_dir_path = schema_path.split('/')[0..-2]
131
- FileUtils.mkdir_p(File.join(only_dir_path))
132
- end
133
-
134
- schema = Ree::ObjectSchemaBuilder.new.call(object)
135
- json = JSON.pretty_generate(schema)
136
- File.write(schema_path, json, mode: 'w')
137
-
138
- json
139
- end
140
-
141
116
  # @param [Symbol] package_name
142
117
  # @return nil
143
118
  def load_package_entry(package_name)
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.41"
4
+ VERSION = "1.0.43"
5
5
  end
data/lib/ree.rb CHANGED
@@ -27,7 +27,6 @@ module Ree
27
27
  autoload :ObjectError, 'ree/core/object_error'
28
28
  autoload :ObjectLink, 'ree/core/object_link'
29
29
  autoload :ObjectSchema, 'ree/core/object_schema'
30
- autoload :ObjectSchemaBuilder, 'ree/core/object_schema_builder'
31
30
  autoload :Package, 'ree/core/package'
32
31
  autoload :PackageDep, 'ree/core/package_dep'
33
32
  autoload :BuildPackageDsl, 'ree/dsl/build_package_dsl'
@@ -230,12 +229,6 @@ module Ree
230
229
  @root_dir || (raise Ree::Error.new(ROOT_DIR_MESSAGE, :invalid_root_dir))
231
230
  end
232
231
 
233
- def write_object_schema(package_name, object_name)
234
- check_arg(package_name, :package_name, Symbol)
235
- check_arg(object_name, :object_name, Symbol)
236
- container.packages_facade.write_object_schema(package_name, object_name)
237
- end
238
-
239
232
  def generate_schemas_for_all_packages(silence = false)
240
233
  Ree.logger.debug("generate_schemas_for_all_packages") if !silence
241
234
  facade = container.packages_facade
@@ -250,16 +243,6 @@ module Ree
250
243
 
251
244
  facade.load_entire_package(package.name)
252
245
  facade.write_package_schema(package.name)
253
-
254
- schemas_path = Ree::PathHelper.abs_package_schemas_dir(package)
255
-
256
- FileUtils.rm_rf(schemas_path)
257
- FileUtils.mkdir_p(schemas_path)
258
-
259
- package.objects.each do |object|
260
- next if !object.schema_rpath
261
- write_object_schema(package.name, object.name)
262
- end
263
246
  end
264
247
  end
265
248
  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.41
4
+ version: 1.0.43
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-07-30 00:00:00.000000000 Z
11
+ date: 2024-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commander
@@ -124,7 +124,6 @@ files:
124
124
  - lib/ree/core/object_error.rb
125
125
  - lib/ree/core/object_link.rb
126
126
  - lib/ree/core/object_schema.rb
127
- - lib/ree/core/object_schema_builder.rb
128
127
  - lib/ree/core/package.rb
129
128
  - lib/ree/core/package_dep.rb
130
129
  - lib/ree/core/package_env_var.rb
@@ -1,102 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class Ree::ObjectSchemaBuilder
4
- Schema = Ree::ObjectSchema
5
-
6
- # @param [Ree::Object] object
7
- # @return [Hash]
8
- def call(object)
9
- Ree.logger.debug("generating object schema for '#{object.name}' package")
10
-
11
- if !object.loaded?
12
- raise Ree::Error.new("object `#{object.name}` from package `#{object.package_name}` is not loaded", :invalid_schema)
13
- end
14
-
15
- data = {
16
- Schema::SCHEMA_TYPE => Schema::OBJECT,
17
- Schema::SCHEMA_VERSION => Schema::SCHEMA_VERSION_NUMBER,
18
- Schema::NAME => object.name,
19
- Schema::PATH => object.rpath,
20
- Schema::MOUNT_AS => object.mount_as,
21
- Schema::CLASS => object.klass.name,
22
- Schema::FACTORY => object.factory,
23
- Schema::METHODS => map_object_methods(object),
24
- Schema::LINKS => object.links.sort_by(&:object_name).map { |link|
25
- {
26
- Schema::Links::TARGET => link.object_name,
27
- Schema::Links::PACKAGE_NAME => link.package_name,
28
- Schema::Links::AS => link.as,
29
- Schema::Links::IMPORTS => link.constants
30
- }
31
- }
32
- }
33
-
34
- data
35
- end
36
-
37
- private
38
-
39
- Arg = Ree::Contracts::CalledArgsValidator::Arg
40
-
41
- def map_object_methods(object)
42
- if !object.fn?
43
- return []
44
- end
45
-
46
- klass = object.klass
47
-
48
- method_decorator = Ree::Contracts.get_method_decorator(
49
- klass, :call, scope: :instance
50
- )
51
-
52
- begin
53
- if method_decorator.nil?
54
- parameters = klass.instance_method(:call).parameters
55
-
56
- args = parameters.inject({}) do |res, param|
57
- res[param.last] = Arg.new(
58
- param.last, param.first, nil, nil
59
- )
60
-
61
- res
62
- end
63
- else
64
- parameters = method_decorator.args.params
65
- args = method_decorator.args.get_args
66
- end
67
- rescue NameError
68
- raise Ree::Error.new("method call is not defined for #{klass}")
69
- end
70
-
71
- arg_list = parameters.map do |param|
72
- arg = args[param.last]
73
- validator = arg.validator
74
- arg_type = arg.type
75
-
76
- type = if validator
77
- validator.to_s
78
- else
79
- if arg_type == :block
80
- "Block"
81
- else
82
- "Any"
83
- end
84
- end
85
-
86
- {
87
- Schema::Methods::Args::ARG => arg.name,
88
- Schema::Methods::Args::ARG_TYPE => arg.type,
89
- Schema::Methods::Args::TYPE => type
90
- }
91
- end
92
-
93
- [
94
- {
95
- Schema::Methods::DOC => method_decorator&.doc || "",
96
- Schema::Methods::THROWS => method_decorator&.errors&.map { _1.name } || [],
97
- Schema::Methods::RETURN => method_decorator&.contract_definition&.return_contract || "Any",
98
- Schema::Methods::ARGS => arg_list
99
- }
100
- ]
101
- end
102
- end