Sha256: 12d4907cce87623e410f1dbcef34dda7ba102f8ba64fc12505fa0a960b4387a8

Contents?: true

Size: 1.21 KB

Versions: 8

Compression:

Stored size: 1.21 KB

Contents

# Requirements
# =====================================================================

# package
require 'qb/ansible/cmds/playbook'


# Declarations
# =======================================================================

module QB; end


# Definitions
# =======================================================================

module QB::CLI 
  
  # Play `//dev/setup.yml`
  # 
  # @param [Array<String>] args
  #   CLI arguments to use.
  # 
  # @return [Fixnum]
  #   The `ansible-playbook` command exit code.
  # 
  def self.setup args = []
    project_root = NRSER.git_root '.'
    playbook_path = project_root / 'dev' / 'setup.qb.yml'
    
    unless playbook_path.file?
      raise "Can't find QB setup playbook at `#{ playbook_path.to_s }`"
    end
    
    cmd = QB::Ansible::Cmds::Playbook.new \
      chdir: project_root,
      extra_vars: {
        project_root: project_root,
        qb_dir: project_root,
        qb_cwd: Pathname.getwd,
        qb_user_roles_dir: QB::USER_ROLES_DIR,
      },
      playbook_path: playbook_path
    
    puts cmd.prepare
    
    status = cmd.stream
    
    if status != 0
      $stderr.puts "ERROR QB setup failed."
    end
    
    exit status
    
  end # .setup
  
end # module QB::CLI

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
qb-0.3.12 lib/qb/cli/setup.rb
qb-0.3.11 lib/qb/cli/setup.rb
qb-0.3.10 lib/qb/cli/setup.rb
qb-0.3.9 lib/qb/cli/setup.rb
qb-0.3.8 lib/qb/cli/setup.rb
qb-0.3.7 lib/qb/cli/setup.rb
qb-0.3.6 lib/qb/cli/setup.rb
qb-0.3.5 lib/qb/cli/setup.rb