Module: Omnibus

Defined in:
lib/omnibus/logger.rb,
lib/omnibus.rb,
lib/omnibus/cli.rb,
lib/omnibus/util.rb,
lib/omnibus/ohai.rb,
lib/omnibus/config.rb,
lib/omnibus/library.rb,
lib/omnibus/reports.rb,
lib/omnibus/package.rb,
lib/omnibus/version.rb,
lib/omnibus/cleaner.rb,
lib/omnibus/logging.rb,
lib/omnibus/project.rb,
lib/omnibus/fetcher.rb,
lib/omnibus/builder.rb,
lib/omnibus/packager.rb,
lib/omnibus/software.rb,
lib/omnibus/s3_cache.rb,
lib/omnibus/manifest.rb,
lib/omnibus/cli/base.rb,
lib/omnibus/metadata.rb,
lib/omnibus/changelog.rb,
lib/omnibus/publisher.rb,
lib/omnibus/sugarable.rb,
lib/omnibus/git_cache.rb,
lib/omnibus/generator.rb,
lib/omnibus/cli/cache.rb,
lib/omnibus/compressor.rb,
lib/omnibus/templating.rb,
lib/omnibus/exceptions.rb,
lib/omnibus/digestable.rb,
lib/omnibus/s3_helpers.rb,
lib/omnibus/cli/publish.rb,
lib/omnibus/file_syncer.rb,
lib/omnibus/thread_pool.rb,
lib/omnibus/health_check.rb,
lib/omnibus/packagers/bff.rb,
lib/omnibus/cli/changelog.rb,
lib/omnibus/packagers/pkg.rb,
lib/omnibus/packagers/msi.rb,
lib/omnibus/build_version.rb,
lib/omnibus/manifest_diff.rb,
lib/omnibus/packagers/rpm.rb,
lib/omnibus/packagers/deb.rb,
lib/omnibus/packagers/base.rb,
lib/omnibus/git_repository.rb,
lib/omnibus/manifest_entry.rb,
lib/omnibus/compressors/tgz.rb,
lib/omnibus/instrumentation.rb,
lib/omnibus/compressors/dmg.rb,
lib/omnibus/semantic_version.rb,
lib/omnibus/compressors/null.rb,
lib/omnibus/compressors/base.rb,
lib/omnibus/changelog_printer.rb,
lib/omnibus/build_version_dsl.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/path_fetcher.rb,
lib/omnibus/fetchers/null_fetcher.rb,
lib/omnibus/publishers/s3_publisher.rb,
lib/omnibus/publishers/null_publisher.rb,
lib/omnibus/publishers/artifactory_publisher.rb

Overview

Copyright 2014 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, 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, FailedToTimestampMSI, Fetcher, GemNotInstalled, Generator, GitCache, GitFetcher, GitRepository, HealthCheck, HealthCheckFailed, InsufficientSpecification, InvalidValue, InvalidVersion, Library, 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 =
'5.0.0'

Class Method Summary collapse

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.



156
157
158
# File 'lib/omnibus.rb', line 156

def load_configuration(file)
  Config.load(file)
end

.loggerLogger

The logger for this Omnibus instance.

Examples:

Omnibus.logger.debug { 'This is a message!' }


124
125
126
# File 'lib/omnibus.rb', line 124

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.



135
136
137
# File 'lib/omnibus.rb', line 135

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.



237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
# File 'lib/omnibus.rb', line 237

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.



197
198
199
# File 'lib/omnibus.rb', line 197

def project(name)
  Project.load(name)
end

.project_path(name) ⇒ String?

The preferred filepath to a project with the given name on disk.



215
216
217
# File 'lib/omnibus.rb', line 215

def project_path(name)
  project_map[name.to_s]
end

.projectsArray<:Project>

All Project instances that have been loaded.



183
184
185
186
187
# File 'lib/omnibus.rb', line 183

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.



104
105
106
107
108
109
110
111
112
113
114
# File 'lib/omnibus.rb', line 104

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!
end

.software_path(name) ⇒ String?

The preferred filepath to a software with the given name on disk.



224
225
226
# File 'lib/omnibus.rb', line 224

def software_path(name)
  software_map[name.to_s]
end

.source_rootPathname

The source root is the path to the root directory of the `omnibus` gem.



206
207
208
# File 'lib/omnibus.rb', line 206

def source_root
  @source_root ||= Pathname.new(File.expand_path('../..', __FILE__))
end

.uiThor::Shell

The UI class for Omnibus.



144
145
146
# File 'lib/omnibus.rb', line 144

def ui
  @ui ||= Thor::Base.shell.new
end

.which(executable) ⇒ String?

Locate an executable in the current $PATH.



166
167
168
169
170
171
172
173
174
175
176
# File 'lib/omnibus.rb', line 166

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.expand_path(executable, path)
  end
end