Module: QB
- Includes:
- NRSER::Log::Mixin
- Defined in:
- lib/qb.rb,
lib/qb/cli.rb,
lib/qb/data.rb,
lib/qb/role.rb,
lib/qb/util.rb,
lib/qb/errors.rb,
lib/qb/ansible.rb,
lib/qb/cli/run.rb,
lib/qb/ipc/rpc.rb,
lib/qb/version.rb,
lib/qb/cli/help.rb,
lib/qb/cli/play.rb,
lib/qb/repo/git.rb,
lib/qb/cli/setup.rb,
lib/qb/docker/cli.rb,
lib/qb/ansible/env.rb,
lib/qb/role/errors.rb,
lib/qb/docker/image.rb,
lib/qb/github/types.rb,
lib/qb/util/bundler.rb,
lib/qb/options/types.rb,
lib/qb/util/resource.rb,
lib/qb/ansible/module.rb,
lib/qb/ansible/module.rb,
lib/qb/data/immutable.rb,
lib/qb/ipc/rpc/server.rb,
lib/qb/options/option.rb,
lib/qb/ansible/modules.rb,
lib/qb/package/version.rb,
lib/qb/util/decorators.rb,
lib/qb/docker/image/tag.rb,
lib/qb/role/default_dir.rb,
lib/qb/ansible/env/devel.rb,
lib/qb/docker/image/name.rb,
lib/qb/util/docker_mixin.rb,
lib/qb/ansible/config_file.rb,
lib/qb/ansible/cmd/playbook.rb,
lib/qb/ansible/plugins/filters.rb,
lib/qb/ansible/modules/docker/image.rb,
lib/qb/options/option/option_parser_concern.rb
Overview
Definitions
Defined Under Namespace
Modules: Ansible, CLI, Data, Docker, GitHub, IPC, Labs, Python, Util Classes: AnsibleVersionError, Error, Execution, FSStateError, Options, Package, Path, QBVersionError, Repo, Role, StateError, UserInputError, VersionError
Constant Summary collapse
- GEM_ROLES_DIR =
Absolute path to
//roles
. ROOT / 'roles'
- USER_ROLES_DIR =
Absolute path to the user's roles dir, which is
~/.ansible/roles
. ENV['HOME'].to_pn / '.ansible' / 'roles'
- YAML_FILE_EXTS =
Extensions we recognize for YAML files.
See Util.find_yaml_file!.
[ '.yaml', '.yml' ]
- ROOT =
Absolute path to the gem's root directory.
( Pathname.new( __FILE__ ).dirname / '..' / '..' ).
- GEM_NAME =
The gem's name.
'qb'
- VERSION =
String version read from
//VERSION
( ROOT / 'VERSION' ).read.chomp
- MIN_ANSIBLE_VERSION =
Minimum version of Ansible required. Encoded as a Gem::Version so we can compare it.
Gem::Version.new '2.1.2'
Class Method Summary collapse
-
.ansible_version ⇒ Gem::Version
The Ansible executable version parsed into a Gem version so we can compare it.
-
.check_ansible_version ⇒ Object
Check that the Ansible version is not less than MIN_ANSIBLE_VERSION.
-
.debug(*args) ⇒ Object
Support for the old custom debug logging, now sent to SemanticLogger.
-
.gem_version ⇒ Gem::Version
Get the Gem::Version parse of VERSION.
- .gemspec ⇒ Object
-
.local_dev? ⇒ Boolean
Are we running in local development? Looks for the
//dev
directory's presence. -
.testing? ⇒ Boolean
Are we running the tests (RSpec)?.
Class Method Details
.ansible_version ⇒ Gem::Version
Returns the Ansible executable version parsed into a Gem version so we can compare it.
77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/qb/version.rb', line 77 def self.ansible_version out = Cmds.out! 'ansible --version' version_str = out[/ansible\ ([\d\.]+)/, 1] if version_str.nil? raise NRSER.dedent <<-END could not parse ansible version from `ansible --version` output: #{ out } END end Gem::Version.new version_str end |
.check_ansible_version ⇒ Object
Check that the Ansible version is not less than MIN_ANSIBLE_VERSION.
98 99 100 101 102 103 104 105 106 107 |
# File 'lib/qb/version.rb', line 98 def self.check_ansible_version if ansible_version < QB::MIN_ANSIBLE_VERSION raise QB::AnsibleVersionError, NRSER.squish( <<-END QB #{ QB::VERSION } requires Ansible #{ QB::MIN_ANSIBLE_VERSION }, found version #{ version_str } at #{ `which ansible` } END ) end end |
.debug(*args) ⇒ Object
Support for the old custom debug logging, now sent to SemanticLogger.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/qb.rb', line 68 def self.debug *args if args[0].is_a? String logger.debug *args else # De-array if there's only one arg args = args[0] if args.length == 1 # And send the args to SM as the payload logger.debug payload: args end end |
.gem_version ⇒ Gem::Version
Get the Gem::Version parse of VERSION.
68 69 70 |
# File 'lib/qb/version.rb', line 68 def self.gem_version Gem::Version.new VERSION end |
.gemspec ⇒ Object
59 60 61 |
# File 'lib/qb/version.rb', line 59 def self.gemspec Gem.loaded_specs[GEM_NAME] end |
.local_dev? ⇒ Boolean
Are we running in local development? Looks for the //dev
directory's
presence.
42 43 44 |
# File 'lib/qb/version.rb', line 42 def self.local_dev? (QB::ROOT / 'dev').directory? end |
.testing? ⇒ Boolean
Are we running the tests (RSpec)?
Sees if the QB_IS_TEST_ENV
environment is "truthy".
53 54 55 56 |
# File 'lib/qb/version.rb', line 53 def self.testing? require 'nrser' ENV['QB_IS_TEST_ENV'].truthy? end |