lib/omnibus/config.rb in omnibus-3.2.2 vs lib/omnibus/config.rb in omnibus-4.0.0.beta.1
- old
+ new
@@ -72,29 +72,10 @@
public_method_defined?(key.to_sym)
end
alias_method :has_key?, :key?
#
- # Get a value from the config object.
- #
- # @deprecated Use direct method instead
- #
- # @param [Symbol] key
- # the key to fetch
- #
- # @return [Object]
- #
- def fetch(key)
- Omnibus.logger.deprecated('Config') do
- "fetch ([]). Please use `Config.#{key}' instead."
- end
-
- public_method_defined?(key.to_sym) && instance.send(key.to_sym)
- end
- alias_method :[], :fetch
-
- #
# Reset the current configuration values. This method will unset any
# "stored" or memorized configuration values.
#
# @return [true]
#
@@ -135,28 +116,13 @@
# The absolute path to the directory on the virtual machine where
# git caching will occur and software's will be progressively cached.
#
# @return [String]
default(:git_cache_dir) do
- if defined?(@install_path_cache_dir)
- @install_path_cache_dir
- else
- File.join(base_dir, 'cache', 'git_cache')
- end
+ File.join(base_dir, 'cache', 'git_cache')
end
- # @deprecated Use {#git_cache_dir} instead.
- #
- # @return [String]
- default(:install_path_cache_dir) do
- Omnibus.logger.deprecated('Config') do
- 'Config.install_path_cache_dir. Plase use Config.git_cache_dir instead.'
- end
-
- git_cache_dir
- end
-
# The absolute path to the directory on the virtual machine where
# source code will be downloaded.
#
# @return [String]
default(:source_dir) { File.join(base_dir, 'src') }
@@ -171,17 +137,18 @@
# packages will be constructed.
#
# @return [String]
default(:package_dir) { File.join(base_dir, 'pkg') }
- # The absolute path to the directory on the virtual machine where
- # packagers will store intermediate packaging products. Some packaging
- # methods (notably fpm) handle this internally so not all packagers will
- # use this setting.
+ # @deprecated Do not use this method.
#
# @return [String]
- default(:package_tmp) { File.join(base_dir, 'pkg-tmp') }
+ default(:package_tmp) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.package_tmp. This value is no longer used."
+ end
+ end
# The relative path of the directory containing {Omnibus::Project}
# DSL files. This is relative to {#project_root}.
#
# @return [String]
@@ -208,38 +175,91 @@
# --------------------------------------------------
# Package OSX pkg files inside a DMG
#
# @return [true, false]
- default(:build_dmg, true)
+ default(:build_dmg) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.build_dmg. This value is no longer part of the " \
+ "config and is implied when defining a `compressor' block in the project."
+ end
+ end
# The starting x,y and ending x,y positions for the created DMG window.
#
# @return [String]
- default(:dmg_window_bounds, '100, 100, 750, 600')
+ default(:dmg_window_bounds) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.dmg_window_bounds. This value is no longer part of the " \
+ "config and should be defined in the `compressor' block in the project."
+ end
+ end
# The starting x,y position where the .pkg file should live in the DMG
# window.
#
# @return [String]
- default(:dmg_pkg_position, '535, 50')
+ default(:dmg_pkg_position) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.dmg_pkg_position. This value is no longer part of the " \
+ "config and should be defined in the `compressor' block in the project."
+ end
+ end
# Sign the pkg package.
#
# @return [true, false]
- default(:sign_pkg, false)
+ default(:sign_pkg) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.sign_pkg. This value is no longer part of the config and " \
+ "should be defined in the `package' block in the project."
+ end
+ end
# The identity to sign the pkg with.
#
# @return [String]
- default(:signing_identity, nil)
+ default(:signing_identity) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.signing_identity. This value is no longer part of the " \
+ "config and should be defined in the `package' block in the project."
+ end
+ end
# --------------------------------------------------
# @!endgroup
#
#
+ # @!group RPM configuration options
+ # --------------------------------------------------
+
+ # Sign the rpm package.
+ #
+ # @return [true, false]
+ default(:sign_rpm) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.sign_rpm. This value is no longer part of the config and " \
+ "should be defined in the `package' block in the project."
+ end
+ end
+
+ # The passphrase to sign the RPM with.
+ #
+ # @return [String]
+ default(:rpm_signing_passphrase) do
+ Omnibus.logger.deprecated('Config') do
+ "Config.rpm_signing_passphrase. This value is no longer part of the " \
+ "config and should be defined in the `package' block in the project."
+ end
+ end
+
+ # --------------------------------------------------
+ # @!endgroup
+ #
+
+ #
# @!group S3 Caching Configuration Parameters
# --------------------------------------------------
# Indicate if you wish to cache software artifacts in S3 for
# quicker build times. Requires {#s3_bucket}, {#s3_access_key},
@@ -250,25 +270,25 @@
# The name of the S3 bucket you want to cache software artifacts in.
#
# @return [String]
default(:s3_bucket) do
- raise MissingConfigOption.new(:s3_bucket, "'my_bucket'")
+ raise MissingRequiredAttribute.new(self, :s3_bucket, "'my_bucket'")
end
# The S3 access key to use with S3 caching.
#
# @return [String]
default(:s3_access_key) do
- raise MissingConfigOption.new(:s3_access_key, "'ABCD1234'")
+ raise MissingRequiredAttribute.new(self, :s3_access_key, "'ABCD1234'")
end
# The S3 secret key to use with S3 caching.
#
# @return [String]
default(:s3_secret_key) do
- raise MissingConfigOption.new(:s3_secret_key, "'EFGH5678'")
+ raise MissingRequiredAttribute.new(self, :s3_secret_key, "'EFGH5678'")
end
# --------------------------------------------------
# @!endgroup
#
@@ -279,34 +299,34 @@
# The full URL where the artifactory instance is accessible.
#
# @return [String]
default(:artifactory_endpoint) do
- raise MissingConfigOption.new(:artifactory_endpoint, "'https://...'")
+ raise MissingRequiredAttribute.new(self, :artifactory_endpoint, "'https://...'")
end
# The username of the artifactory user to authenticate with.
#
# @return [String]
default(:artifactory_username) do
- raise MissingConfigOption.new(:artifactory_username, "'admin'")
+ raise MissingRequiredAttribute.new(self, :artifactory_username, "'admin'")
end
# The password of the artifactory user to authenticate with.
#
# @return [String]
default(:artifactory_password) do
- raise MissingConfigOption.new(:artifactory_password, "'password'")
+ raise MissingRequiredAttribute.new(self, :artifactory_password, "'password'")
end
# The base path artifacts are published to. This is usually maps to
# the artifacts's organization. AKA `orgPath` in the Artifactory
# world.
#
# @return [String]
default(:artifactory_base_path) do
- raise MissingConfigOption.new(:artifactory_base_path, "'com/mycompany'")
+ raise MissingRequiredAttribute.new(self, :artifactory_base_path, "'com/mycompany'")
end
# The path on disk to an SSL pem file to sign requests with.
#
# @return [String, nil]
@@ -347,39 +367,28 @@
# The S3 access key to use for S3 artifact release.
#
# @return [String]
default(:publish_s3_access_key) do
- raise MissingConfigOption.new(:publish_s3_access_key, "'ABCD1234'")
+ raise MissingRequiredAttribute.new(self, :publish_s3_access_key, "'ABCD1234'")
end
# The S3 secret key to use for S3 artifact release
#
# @return [String]
default(:publish_s3_secret_key) do
- raise MissingConfigOption.new(:publish_s3_secret_key, "'EFGH5678'")
+ raise MissingRequiredAttribute.new(self, :publish_s3_secret_key, "'EFGH5678'")
end
# --------------------------------------------------
# @!endgroup
#
#
# @!group Miscellaneous Configuration Parameters
# --------------------------------------------------
- # @deprecated The is no replacement for this configuration item
- #
- # @return [true, false]
- default(:override_file) do
- Omnibus.logger.deprecated('Config') do
- 'Config.override_file. Using an override file is deprecated.'
- end
-
- nil
- end
-
# An array of local disk paths that include software definitions to load
# from disk. The software definitions in these paths are pulled
# **in order**, so if multiple paths have the same software definition, the
# one that appears **first** in the list here is chosen.
#
@@ -391,22 +400,10 @@
# /PATH/config/software/*
#
# @return [Array<String>]
default(:local_software_dirs) { [] }
- # @deprecated Use {#software_gems} instead
- #
- # @return [String]
- default(:software_gem) do
- Omnibus.logger.deprecated('Config') do
- 'Config.software_gem. Plase use Config.software_gems (plural) and ' \
- 'specify an array of software gems instead.'
- end
-
- software_gems
- end
-
# The list of gems to pull software definitions from. The software
# definitions from these gems are pulled **in order**, so if multiple gems
# have the same software definition, the one that appears **first** in the
# list here is chosen.
#
@@ -417,15 +414,11 @@
#
# /GEM_ROOT/config/software/*
#
# @return [Array<String>]
default(:software_gems) do
- if defined?(@software_gem)
- Array(@software_gem)
- else
- ['omnibus-software']
- end
+ ['omnibus-software']
end
# The solaris compiler to use
#
# @return [String, nil]
@@ -445,17 +438,30 @@
default(:append_timestamp, true)
# The number of times to retry the build before failing.
#
# @return [Integer]
- default(:build_retries, 3)
+ default(:build_retries, 0)
# Use the incremental build caching implemented via git. This will
# drastically improve build times, but may result in hidden and
# unexpected bugs.
#
# @return [true, false]
default(:use_git_caching, true)
+
+ # The number of worker threads for make. If this is not set
+ # explicitly in config, it will attempt to determine via Ohai in
+ # the builder, and failing that will default to 3
+ #
+ # @return [Integer]
+ default(:workers) do
+ if Ohai['cpu'] && Ohai['cpu']['total']
+ Ohai['cpu']['total'].to_i + 1
+ else
+ 3
+ end
+ end
# --------------------------------------------------
# @!endgroup
#