Class: Ree::PackagesSchemaBuilder
- Defined in:
- lib/ree/core/packages_schema_builder.rb
Constant Summary collapse
- Schema =
Ree::PackagesSchema
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize ⇒ PackagesSchemaBuilder
constructor
A new instance of PackagesSchemaBuilder.
Constructor Details
#initialize ⇒ PackagesSchemaBuilder
Returns a new instance of PackagesSchemaBuilder.
9 10 11 |
# File 'lib/ree/core/packages_schema_builder.rb', line 9 def initialize @packages_detector = Ree::PackagesDetector.new end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/ree/core/packages_schema_builder.rb', line 14 def call packages = @packages_detector.call(Ree.root_dir) gem_packages = [] Ree.gems.each do |gem| gem_packages += @packages_detector.call(gem.dir, gem.name) end result = { Schema::SCHEMA_VERSION => Schema::SCHEMA_VERSION_NUMBER, Schema::SCHEMA_TYPE => Schema::PACKAGES, Schema::PACKAGES => packages.sort_by { _1[:name] }.map { { Schema::Packages::NAME => _1.fetch(:name), Schema::Packages::SCHEMA => _1.fetch(:package_schema_path), } }, Schema::GEM_PACKAGES => gem_packages.sort_by { [_1.fetch(:gem_name), _1.fetch(:name)] }.map { { Schema::Packages::GEM => _1.fetch(:gem_name), Schema::Packages::NAME => _1.fetch(:name), Schema::Packages::SCHEMA => _1.fetch(:package_schema_path), } }, } result end |