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/package.rb,
lib/omnibus/project.rb,
lib/omnibus/reports.rb,
lib/omnibus/fetcher.rb,
lib/omnibus/library.rb,
lib/omnibus/logging.rb,
lib/omnibus/version.rb,
lib/omnibus/cli/base.rb,
lib/omnibus/metadata.rb,
lib/omnibus/s3_cache.rb,
lib/omnibus/software.rb,
lib/omnibus/packager.rb,
lib/omnibus/sugarable.rb,
lib/omnibus/cli/cache.rb,
lib/omnibus/publisher.rb,
lib/omnibus/generator.rb,
lib/omnibus/git_cache.rb,
lib/omnibus/compressor.rb,
lib/omnibus/templating.rb,
lib/omnibus/digestable.rb,
lib/omnibus/exceptions.rb,
lib/omnibus/file_syncer.rb,
lib/omnibus/cli/publish.rb,
lib/omnibus/thread_pool.rb,
lib/omnibus/health_check.rb,
lib/omnibus/packagers/bff.rb,
lib/omnibus/packagers/rpm.rb,
lib/omnibus/packagers/deb.rb,
lib/omnibus/packagers/pkg.rb,
lib/omnibus/build_version.rb,
lib/omnibus/packagers/msi.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/packagers/solaris.rb,
lib/omnibus/null_argumentable.rb,
lib/omnibus/build_version_dsl.rb,
lib/omnibus/packagers/makeself.rb,
lib/omnibus/fetchers/git_fetcher.rb,
lib/omnibus/fetchers/net_fetcher.rb,
lib/omnibus/fetchers/null_fetcher.rb,
lib/omnibus/fetchers/path_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, Sugarable, Templating, Util Classes: ArtifactoryPublisher, BuildVersion, BuildVersionDSL, Builder, CLI, ChecksumMismatch, Cleaner, CommandFailed, CommandTimeout, Config, Error, Fetcher, GemNotInstalled, Generator, GitCache, GitFetcher, HealthCheck, HealthCheckFailed, InsufficientSpecification, InvalidValue, Library, Logger, Metadata, MissingPatch, MissingProject, MissingRequiredAttribute, MissingSoftware, MissingTemplate, NetFetcher, NoPackageFile, NoPackageMetadataFile, NullFetcher, NullPublisher, Ohai, Package, PathFetcher, Project, ProjectAlreadyDirty, Publisher, S3Cache, S3Publisher, Software, ThreadPool, UnknownPlatform, UnknownPlatformVersion, UnresolvableGitReference

Constant Summary collapse

DEFAULT_CONFIG =

The path to the default configuration file.

'omnibus.rb'.freeze
VERSION =
'4.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.


146
147
148
# File 'lib/omnibus.rb', line 146

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

.loggerLogger

The logger for this Omnibus instance.

Examples:

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

114
115
116
# File 'lib/omnibus.rb', line 114

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.


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

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.


227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/omnibus.rb', line 227

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.


187
188
189
# File 'lib/omnibus.rb', line 187

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

.project_path(name) ⇒ String?

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


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

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

.projectsArray<:Project>

All Project instances that have been loaded.


173
174
175
176
177
# File 'lib/omnibus.rb', line 173

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.


94
95
96
97
98
99
100
101
102
103
104
# File 'lib/omnibus.rb', line 94

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.


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

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.


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

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

.uiThor::Shell

The UI class for Omnibus.


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

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

.which(executable) ⇒ String?

Locate an executable in the current $PATH.


156
157
158
159
160
161
162
163
164
165
166
# File 'lib/omnibus.rb', line 156

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