Module: QB
- Includes:
- SemanticLogger::Loggable
- Defined in:
- lib/qb.rb,
lib/qb/cli.rb,
lib/qb/util.rb,
lib/qb/errors.rb,
lib/qb/ansible.rb,
lib/qb/cli/run.rb,
lib/qb/options.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/util/stdio.rb,
lib/qb/ansible/env.rb,
lib/qb/role/errors.rb,
lib/qb/github/types.rb,
lib/qb/util/bundler.rb,
lib/qb/util/interop.rb,
lib/qb/util/logging.rb,
lib/qb/util/resource.rb,
lib/qb/ansible/module.rb,
lib/qb/ansible_module.rb,
lib/qb/options/option.rb,
lib/qb/package/version.rb,
lib/qb/role/default_dir.rb,
lib/qb/ansible/env/devel.rb,
lib/qb/util/docker_mixin.rb,
lib/qb/ansible/config_file.rb,
lib/qb/ansible/cmds/playbook.rb
Overview
Declarations
Defined Under Namespace
Modules: Ansible, CLI, GitHub, Labs, Util Classes: AnsibleVersionError, Error, 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'
- 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'
- AnsibleModule =
QB::Ansible::Module
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
Class Methods =====================================================================.
Class Method Details
.ansible_version ⇒ Gem::Version
Returns the Ansible executable version parsed into a Gem version so we can compare it.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/qb/version.rb', line 55 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.
76 77 78 79 80 81 82 83 84 85 |
# File 'lib/qb/version.rb', line 76 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.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/qb.rb', line 56 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.
46 47 48 |
# File 'lib/qb/version.rb', line 46 def self.gem_version Gem::Version.new VERSION end |
.gemspec ⇒ Object
Class Methods
37 38 39 |
# File 'lib/qb/version.rb', line 37 def self.gemspec Gem.loaded_specs[GEM_NAME] end |