Sha256: fe81974471ff7d023cbf3037c7cb6131275e06ab26883be1da43513be9a16fa1

Contents?: true

Size: 1.02 KB

Versions: 38

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

def package_require(path)
  list = path.split('/')
  package_name = list.shift.to_sym
  packages_facade = Ree.container.packages_facade
  package = packages_facade.get_package(package_name)

  return false if package.dir.nil?

  path = File.join(
    Ree::PathHelper.abs_package_module_dir(package), list.join('/')
  )

  if !File.exist?(path)
    path = path + '.rb'
  end

  if !File.exist?(path)
    raise Ree::Error.new("file not found: #{path}")
  end

  Ree.logger.debug("package_require(#{path})")
  packages_facade.load_package_entry(package_name)
  packages_facade.load_file(path, package_name)
end

def package_file_exists?(path)
  list = path.split('/')
  package_name = list.shift.to_sym
  packages_facade = Ree.container.packages_facade
  package = packages_facade.get_package(package_name)

  return false if package.dir.nil?

  path = File.join(
    Ree::PathHelper.abs_package_module_dir(package), list.join('/')
  )

  return true if File.exist?(path)

  path = path + '.rb'
  File.exist?(path)
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
ree-1.0.47 lib/ree/dsl/package_require.rb
ree-1.0.46 lib/ree/dsl/package_require.rb
ree-1.0.45 lib/ree/dsl/package_require.rb
ree-1.0.44 lib/ree/dsl/package_require.rb
ree-1.0.43 lib/ree/dsl/package_require.rb
ree-1.0.42 lib/ree/dsl/package_require.rb
ree-1.0.41 lib/ree/dsl/package_require.rb
ree-1.0.40 lib/ree/dsl/package_require.rb
ree-1.0.39 lib/ree/dsl/package_require.rb
ree-1.0.38 lib/ree/dsl/package_require.rb
ree-1.0.37 lib/ree/dsl/package_require.rb
ree-1.0.36 lib/ree/dsl/package_require.rb
ree-1.0.35 lib/ree/dsl/package_require.rb
ree-1.0.34 lib/ree/dsl/package_require.rb
ree-1.0.33 lib/ree/dsl/package_require.rb
ree-1.0.32 lib/ree/dsl/package_require.rb
ree-1.0.31 lib/ree/dsl/package_require.rb
ree-1.0.30 lib/ree/dsl/package_require.rb
ree-1.0.29 lib/ree/dsl/package_require.rb
ree-1.0.28 lib/ree/dsl/package_require.rb