Sha256: 03ef2690c585d4131008042f9e7808dbc42c6b3ae1766ce24bf6986aa904d2af

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

require 'fileutils'

module Ree
  module CLI
    class GeneratePackageSchema
      class << self
        def run(package_name:, project_path:, silence: false)
          ENV['REE_SKIP_ENV_VARS_CHECK'] = 'true'

          path = Ree.locate_packages_schema(project_path)
          dir = Pathname.new(path).dirname.to_s

          Ree.init(dir)
          Ree.set_dev_mode

          if package_name.strip.empty?
            puts("Generating Package.schema.json for all packages") if !silence
            Ree.generate_schemas_for_all_packages(silence)
            return
          end

          puts("Generating Package.schema.json for :#{package_name} package") if !silence

          package_name = package_name.to_sym

          facade = Ree.container.packages_facade
          facade.load_packages_schema
          facade.load_entire_package(package_name)
          facade.write_package_schema(package_name)

          package = facade.get_package(package_name)
          schema_path = Ree::PathHelper.abs_package_schema_path(package)

          puts("output: #{schema_path}") if !silence
          puts("done") if !silence
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ree-1.0.47 lib/ree/cli/generate_package_schema.rb
ree-1.0.46 lib/ree/cli/generate_package_schema.rb
ree-1.0.45 lib/ree/cli/generate_package_schema.rb
ree-1.0.44 lib/ree/cli/generate_package_schema.rb
ree-1.0.43 lib/ree/cli/generate_package_schema.rb