Sha256: 18652086bdda243496fe2fc4782d843be49f5700be9959744a15448c34543b3b

Contents?: true

Size: 1.42 KB

Versions: 19

Compression:

Stored size: 1.42 KB

Contents

require 'nrser/extras'

require "qb/version"
require "qb/util"
require 'qb/util/stdio'
require "qb/ansible_module"

module QB
  ROOT = (Pathname.new(__FILE__).dirname + '..').expand_path
  GEM_ROLES_DIR = ROOT + 'roles'
  USER_ROLES_DIR = Pathname.new(ENV['HOME']).join '.ansible', 'roles'
  MIN_ANSIBLE_VERSION = Gem::Version.new '2.1.2'
  
  class Error < StandardError
  end
  
  def self.debug *args
    return unless ENV['QB_DEBUG'] && args.length > 0
    
    header = 'DEBUG'
    
    if args[0].is_a? String
      header += " " + args.shift
    end
    
    dumpObj = case args.length
    when 0
      header
    when 1
      {header => args[0]}
    else
      {header => args}
    end
    
    # $stderr.puts("DEBUG " + format(msg, values))
    $stderr.puts dumpObj.pretty_inspect
  end
  
  def self.check_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
    
    version = Gem::Version.new version_str
    
    if version < QB::MIN_ANSIBLE_VERSION
      raise NRSER.squish <<-END
        qb #{ QB::VERSION } requires ansible #{ QB::MIN_ANSIBLE_VERSION },
        found version #{ version_str } at #{ `which ansible` }
      END
    end
  end
end

# needs QB::*_ROLES_DIR
require 'qb/role'
require 'qb/options'

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
qb-0.1.69 lib/qb.rb
qb-0.1.68 lib/qb.rb
qb-0.1.67 lib/qb.rb
qb-0.1.66 lib/qb.rb
qb-0.1.65 lib/qb.rb
qb-0.1.64 lib/qb.rb
qb-0.1.63 lib/qb.rb
qb-0.1.62 lib/qb.rb
qb-0.1.61 lib/qb.rb
qb-0.1.60 lib/qb.rb
qb-0.1.59 lib/qb.rb
qb-0.1.58 lib/qb.rb
qb-0.1.57 lib/qb.rb
qb-0.1.56 lib/qb.rb
qb-0.1.55 lib/qb.rb
qb-0.1.54 lib/qb.rb
qb-0.1.53 lib/qb.rb
qb-0.1.52 lib/qb.rb
qb-0.1.51 lib/qb.rb