class Zap::Package

Overview

A class that represents a package. It is used to store the information about a package and to resolve dependencies.

Serializable to:

Included Modules

Defined in:

package/dist.cr
package/kind.cr
package/lifecycle_scripts.cr
package/overrides.cr
package/package.cr
package/package_extensions.cr

Constant Summary

DEFAULT_ROOT = "@root"

Constructors

Class Method Summary

Instance Method Summary

Macro Summary

Instance methods inherited from module Zap::Package::Helpers::Dependencies

add_dependency_ref(package : Package, type : DependencyType | Nil = nil) add_dependency_ref, dependencies_refs dependencies_refs, dependencies_size(*, include_dev : Bool = true, include_optional : Bool = true) : Int dependencies_size, dependency_specifier(name : String, specifier : String | Zap::Package::Alias, type : DependencyType | Nil = nil) : Nil dependency_specifier, dependency_specifier?(name : String, *, include_dev : Bool = true, include_optional : Bool = true) : String | Zap::Package::Alias | Nil dependency_specifier?, dev_dependencies_refs dev_dependencies_refs, each_dependency(*, include_dev : Bool = true, include_optional : Bool = true, &block : String, String | Alias, DependencyType -> Nil) each_dependency, each_dependency_hash(*, include_dev : Bool = true, include_optional : Bool = true, &block : Hash(String, String | Alias) | Nil, DependencyType -> T) forall T each_dependency_hash, each_dependency_ref(*, include_dev : Bool = true, include_optional : Bool = true, &block : Package, DependencyType -> Nil) each_dependency_ref, has_dependency?(name : String, *, include_dev : Bool = true, include_optional : Bool = true) : Bool | Nil has_dependency?, map_dependencies(*, include_dev : Bool = true, include_optional : Bool = true, &block : String, String | Alias, DependencyType -> T) : Array(T) forall T map_dependencies, optional_dependencies_refs optional_dependencies_refs, trim_dependencies_fields trim_dependencies_fields

Instance methods inherited from class Object

or(other : T) : T | self forall T or, pipe(&) pipe

Constructor Detail

def self.init(path : Path, *, append_filename : Bool = true, name_if_nil : String | Nil = nil) : self #

[View source]
def self.init_root_package(path : Path, *, append_filename : Bool = true) : self #

[View source]
def self.new(ctx : YAML::ParseContext, node : YAML::Nodes::Node) #

[View source]
def self.new(pull : JSON::PullParser) #

[View source]
def self.new(pull : MessagePack::Unpacker) #

[View source]
def self.new(name : Nil | String = DEFAULT_ROOT, version : String = "0.0.0") #

[View source]
def self.read_package(config : Config) : Package #

[View source]
def self.read_package?(config : Config) : Package #

[View source]

Class Method Detail

def self.get_pkg_version_from_json(json_path : Path | String) : String | Nil #

[View source]
def self.hash_dependencies(peers : Iterable(Package)) #

[View source]
def self.init?(path : Path, *, append_filename : Bool = true) : self | Nil #

[View source]

Instance Method Detail

def ==(other : self) #
Description copied from class Reference

Returns true if this reference is the same as other. Invokes same?.


def add_dependency(name : String, version : String, type : DependencyType) #

[View source]
def after_initialize #

[View source]
def bin : String | Hash(String, String) | Nil #

[View source]
def bundle_dependencies : Hash(String, String) | Bool | Nil #

[View source]
def cpu : Array(String) | Nil #

[View source]
def dependencies : Hash(String, String | Zap::Package::Alias) | Nil #

[View source]
def dependencies=(dependencies : Hash(String, String | Zap::Package::Alias) | Nil) #

[View source]
def dependents : Set(Package) #

[View source]
def deprecated : String | Nil #

[View source]
def dev_dependencies : Hash(String, String | Zap::Package::Alias) | Nil #

[View source]
def dev_dependencies=(dev_dependencies : Hash(String, String | Zap::Package::Alias) | Nil) #

[View source]

[View source]

[View source]
def get_root_dependents? : Set(String) | Nil #

[View source]
def has_install_script : Bool | Nil #

[View source]
def has_install_script=(has_install_script : Bool | Nil) #

[View source]
def has_prepare_script : Bool | Nil #

[View source]
def has_prepare_script=(has_prepare_script : Bool | Nil) #

[View source]
def hash(hasher) #
Description copied from class Reference

See Object#hash(hasher)


def hashed_key : String #

[View source]
def key : String #

[View source]
def kind : Kind #

[View source]
def local_install? #

Attempt to replicate the "npm" definition of a local install Which seems to be packages pulled from git or linked locally


[View source]
def lock : Mutex #

[View source]
def match_os_and_cpu! : Nil #

Will raise if the package is not meant to be run on the current architecture and operating system.


[View source]
def match_os_and_cpu? : Bool #

Returns false if the package is not meant to be run on the current architecture and operating system.


[View source]
def name : String #

[View source]
def name? : String | Nil #

[View source]
def optional : Bool | Nil #

[View source]
def optional=(optional : Bool | Nil) #

[View source]
def optional_dependencies : Hash(String, String | Zap::Package::Alias) | Nil #

[View source]
def optional_dependencies=(optional_dependencies : Hash(String, String | Zap::Package::Alias) | Nil) #

[View source]
def os : Array(String) | Nil #

[View source]
def override_dependencies!(other : Package) #

[View source]
def overrides : Overrides | Nil #

[View source]
def overrides=(overrides : Overrides | Nil) #

[View source]
def package_extension_shasum : String | Nil #

[View source]
def package_extension_shasum=(package_extension_shasum : String | Nil) #

[View source]
def package_extensions_updated : Bool #

[View source]
def package_extensions_updated=(package_extensions_updated : Bool) #

[View source]
def peer_dependencies : Hash(String, String) | Nil #

[View source]
def peer_dependencies=(peer_dependencies : Hash(String, String) | Nil) #

[View source]
def peer_dependencies_meta : Hash(String, NamedTuple(optional: Bool | Nil)) | Nil #

[View source]
def peer_dependencies_meta=(peer_dependencies_meta : Hash(String, NamedTuple(optional: Bool | Nil)) | Nil) #

[View source]
def prepare #

[View source]
def prevent_pruning : Bool #

[View source]
def prevent_pruning=(prevent_pruning : Bool) #

[View source]
def propagate_meta_peer_dependencies! #

[View source]
def resolved : Atomic(Int8) #

[View source]
def roots : Set(String) #

[View source]
def roots=(roots : Set(String)) #

[View source]
def scripts : LifecycleScripts | Nil #

[View source]
def scripts=(scripts : LifecycleScripts | Nil) #

[View source]
def specifier : String #

[View source]
def transitive_overrides : SafeSet(Package::Overrides::Override) | Nil #

def transitive_overrides=(transitive_overrides : SafeSet(Package::Overrides::Override) | Nil) #

def transitive_overrides_init(&block : Proc(SafeSet(Package::Overrides::Override) | Nil)) #

[View source]
def transitive_peer_dependencies : Hash(String, Set(Utils::Semver::Range)) | Nil #

[View source]
def transitive_peer_dependencies=(transitive_peer_dependencies : Hash(String, Set(Utils::Semver::Range)) | Nil) #

[View source]
def version : String #

[View source]
def workspaces : Array(String) | Nil | NamedTuple(packages: Array(String) | Nil, nohoist: Array(String) | Nil) #

[View source]
def zap_config : ZapConfig | Nil #

[View source]
def zap_config=(zap_config : ZapConfig | Nil) #

[View source]

Macro Detail

macro __do_not_serialize__ #

[View source]