Class: Ree::CLI::Indexing::IndexPackage

Inherits:
Object
  • Object
show all
Includes:
Ree::CLI::Indexing
Defined in:
lib/ree/cli/indexing/index_package.rb

Class Method Summary collapse

Methods included from Ree::CLI::Indexing

included

Class Method Details

.run(package_name:, project_path:) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ree/cli/indexing/index_package.rb', line 10

def run(package_name:, project_path:)
  ENV['REE_SKIP_ENV_VARS_CHECK'] = 'true'
  
  path = Ree.locate_packages_schema(project_path)
  dir = Pathname.new(path).dirname.to_s
  
  Ree.init(dir)
  
  facade = Ree.container.packages_facade
  
  hsh = {}
  hsh[:package_schema] = {}
  hsh[:classes] = {}
  hsh[:objects] = {}
  
  package_name = package_name.to_sym
  facade.load_entire_package(package_name)
  package = facade.get_loaded_package(package_name)
  package_hsh = index_package_entry(package)
  
  hsh[:package_schema] = package_hsh
  hsh = index_public_methods_for_package_classes(package, hsh)
  
  JSON.pretty_generate(hsh)
end