Module: Omnibus
- Defined in:
- lib/omnibus/logger.rb,
lib/omnibus.rb,
lib/omnibus/cli.rb,
lib/omnibus/ohai.rb,
lib/omnibus/util.rb,
lib/omnibus/config.rb,
lib/omnibus/builder.rb,
lib/omnibus/cleaner.rb,
lib/omnibus/fetcher.rb,
lib/omnibus/library.rb,
lib/omnibus/logging.rb,
lib/omnibus/package.rb,
lib/omnibus/project.rb,
lib/omnibus/reports.rb,
lib/omnibus/version.rb,
lib/omnibus/cli/base.rb,
lib/omnibus/manifest.rb,
lib/omnibus/metadata.rb,
lib/omnibus/packager.rb,
lib/omnibus/s3_cache.rb,
lib/omnibus/software.rb,
lib/omnibus/changelog.rb,
lib/omnibus/cli/cache.rb,
lib/omnibus/generator.rb,
lib/omnibus/git_cache.rb,
lib/omnibus/licensing.rb,
lib/omnibus/publisher.rb,
lib/omnibus/sugarable.rb,
lib/omnibus/compressor.rb,
lib/omnibus/digestable.rb,
lib/omnibus/exceptions.rb,
lib/omnibus/s3_helpers.rb,
lib/omnibus/templating.rb,
lib/omnibus/cli/publish.rb,
lib/omnibus/file_syncer.rb,
lib/omnibus/thread_pool.rb,
lib/omnibus/health_check.rb,
lib/omnibus/build_version.rb,
lib/omnibus/cli/changelog.rb,
lib/omnibus/manifest_diff.rb,
lib/omnibus/packagers/bff.rb,
lib/omnibus/packagers/deb.rb,
lib/omnibus/packagers/ips.rb,
lib/omnibus/packagers/msi.rb,
lib/omnibus/packagers/pkg.rb,
lib/omnibus/packagers/rpm.rb,
lib/omnibus/git_repository.rb,
lib/omnibus/manifest_entry.rb,
lib/omnibus/packagers/appx.rb,
lib/omnibus/packagers/base.rb,
lib/omnibus/compressors/dmg.rb,
lib/omnibus/compressors/tgz.rb,
lib/omnibus/instrumentation.rb,
lib/omnibus/compressors/base.rb,
lib/omnibus/compressors/null.rb,
lib/omnibus/download_helpers.rb,
lib/omnibus/packagers/pkgsrc.rb,
lib/omnibus/semantic_version.rb,
lib/omnibus/build_version_dsl.rb,
lib/omnibus/changelog_printer.rb,
lib/omnibus/null_argumentable.rb,
lib/omnibus/packagers/solaris.rb,
lib/omnibus/packagers/makeself.rb,
lib/omnibus/fetchers/git_fetcher.rb,
lib/omnibus/fetchers/net_fetcher.rb,
lib/omnibus/fetchers/file_fetcher.rb,
lib/omnibus/fetchers/null_fetcher.rb,
lib/omnibus/fetchers/path_fetcher.rb,
lib/omnibus/packagers/windows_base.rb,
lib/omnibus/publishers/s3_publisher.rb,
lib/omnibus/publishers/null_publisher.rb,
lib/omnibus/publishers/artifactory_publisher.rb
Overview
Copyright 2014-2018 Chef Software, Inc.
Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Defined Under Namespace
Modules: Command, Compressor, Digestable, DownloadHelpers, FileSyncer, Instrumentation, Logging, NullArgumentable, Packager, Reports, S3Helpers, Sugar, Sugarable, Templating, Util Classes: ArtifactoryPublisher, BuildVersion, BuildVersionDSL, Builder, CLI, ChangeLog, ChangeLogPrinter, ChecksumMismatch, ChecksumMissing, Cleaner, CommandFailed, CommandTimeout, Config, EmptyManifestDiff, Error, FailedToSignWindowsPackage, Fetcher, FileFetcher, GemNotInstalled, Generator, GitCache, GitFetcher, GitRepository, HealthCheck, HealthCheckFailed, InsufficientSpecification, InvalidValue, InvalidVersion, Library, Licensing, LicensingError, Logger, Manifest, ManifestDiff, ManifestEntry, Metadata, MissingPatch, MissingProject, MissingRequiredAttribute, MissingSoftware, MissingTemplate, NetFetcher, NoPackageFile, NoPackageMetadataFile, NullFetcher, NullPublisher, Ohai, Package, PathFetcher, Project, ProjectAlreadyDirty, Publisher, S3Cache, S3Publisher, SemanticVersion, Software, ThreadPool, UnknownPlatform, UnknownPlatformVersion, UnresolvableGitReference
Constant Summary collapse
- DEFAULT_CONFIG =
The path to the default configuration file.
"omnibus.rb".freeze
- VERSION =
"9.0.3".freeze
Class Method Summary collapse
-
.load_configuration(file) ⇒ void
Load in an Omnibus configuration file.
-
.logger ⇒ Logger
The logger for this Omnibus instance.
-
.logger=(logger) ⇒ Object
private
Programatically set the logger for Omnibus.
-
.possible_paths_for(path) ⇒ Array<String>
The list of directories to search for the given
path
. -
.project(name) ⇒ Project
Load the Project instance with the given name.
-
.project_path(name) ⇒ String?
The preferred filepath to a project with the given name on disk.
-
.projects ⇒ Array<:Project>
All Project instances that have been loaded.
-
.reset!(include_logger = false) ⇒ void
Reset the current Omnibus configuration.
-
.software_path(name) ⇒ String?
The preferred filepath to a software with the given name on disk.
-
.source_root ⇒ Pathname
The source root is the path to the root directory of the `omnibus` gem.
-
.ui ⇒ Thor::Shell
The UI class for Omnibus.
-
.which(executable) ⇒ String?
Locate an executable in the current $PATH.
Class Method Details
.load_configuration(file) ⇒ void
This method returns an undefined value.
Load in an Omnibus configuration file. Values will be merged with and override the defaults defined in Config.
160 161 162 |
# File 'lib/omnibus.rb', line 160 def load_configuration(file) Config.load(file) end |
.logger ⇒ Logger
The logger for this Omnibus instance.
128 129 130 |
# File 'lib/omnibus.rb', line 128 def logger @logger ||= Logger.new end |
.logger=(logger) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Programatically set the logger for Omnibus.
139 140 141 |
# File 'lib/omnibus.rb', line 139 def logger=(logger) @logger = logger end |
.possible_paths_for(path) ⇒ Array<String>
The list of directories to search for the given path
. These paths are returned **in order** of specificity.
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/omnibus.rb', line 241 def possible_paths_for(path) possible_paths[path] ||= [ paths_from_project_root, paths_from_local_software_dirs, paths_from_software_gems, ].flatten.inject([]) do |array, directory| destination = File.join(directory, path) if File.directory?(destination) array << destination end array end end |
.project(name) ⇒ Project
Load the Project instance with the given name.
201 202 203 |
# File 'lib/omnibus.rb', line 201 def project(name) Project.load(name) end |
.project_path(name) ⇒ String?
The preferred filepath to a project with the given name on disk.
219 220 221 |
# File 'lib/omnibus.rb', line 219 def project_path(name) project_map[name.to_s] end |
.projects ⇒ Array<:Project>
All Project instances that have been loaded.
187 188 189 190 191 |
# File 'lib/omnibus.rb', line 187 def projects project_map.map do |name, _| Project.load(name) end end |
.reset!(include_logger = false) ⇒ void
This method returns an undefined value.
Reset the current Omnibus configuration. This is primary an internal API used in testing, but it can also be useful when Omnibus is used as a library.
Note - this persists the Logger
object by default.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/omnibus.rb', line 105 def reset!(include_logger = false) instance_variables.each do |instance_variable| unless include_logger next if instance_variable == :@logger end remove_instance_variable(instance_variable) end Config.reset! # Clear caches on Project and Software Project.reset! Software.reset! end |
.software_path(name) ⇒ String?
The preferred filepath to a software with the given name on disk.
228 229 230 |
# File 'lib/omnibus.rb', line 228 def software_path(name) software_map[name.to_s] end |
.source_root ⇒ Pathname
The source root is the path to the root directory of the `omnibus` gem.
210 211 212 |
# File 'lib/omnibus.rb', line 210 def source_root @source_root ||= Pathname.new(File.("..", __dir__)) end |
.ui ⇒ Thor::Shell
The UI class for Omnibus.
148 149 150 |
# File 'lib/omnibus.rb', line 148 def ui @ui ||= Thor::Base.shell.new end |
.which(executable) ⇒ String?
Locate an executable in the current $PATH.
170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/omnibus.rb', line 170 def which(executable) if File.file?(executable) && File.executable?(executable) executable elsif ENV["PATH"] path = ENV["PATH"].split(File::PATH_SEPARATOR).find do |path| File.executable?(File.join(path, executable)) end path && File.(executable, path) end end |