Sha256: 3dedbe26be6d1e27b8a8d3d697d0e6a47310cf5fff9c678051956cd891358f07

Contents?: true

Size: 938 Bytes

Versions: 2

Compression:

Stored size: 938 Bytes

Contents

require 'tempfile'
require 'net/ssh/simple'

module Hobo
  module Helper

    def vm_shell command, opts = {}
      shell ::Hobo::Lib::Vm::Command.new(command, opts).to_s, opts
    end

    def vm_mysql opts = {}
      opts = {
        :auto_echo => true,
        :db => "",
        :user => maybe(Hobo.project_config.mysql.username) || "",
        :pass => maybe(Hobo.project_config.mysql.password) || "",
        :mysql => 'mysql'
      }.merge(opts)

      opts[:user] = "-u#{opts[:user].shellescape}" unless opts[:user].empty?
      opts[:pass] = "-p#{opts[:pass].shellescape}" unless opts[:pass].empty?
      opts[:db] = opts[:db].shellescape unless opts[:db].empty?

      ::Hobo::Lib::Vm::Command.new "#{opts[:mysql]} #{opts[:user]} #{opts[:pass]} #{opts[:db]}".strip, opts
    end

    def vm_command command = nil, opts = {}
      ::Hobo::Lib::Vm::Command.new command, opts
    end

    private


  end
end

include Hobo::Helper

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hobo-inviqa-0.0.9.pre.rc1 lib/hobo/helper/vm_command.rb
hobo-inviqa-0.0.9.pre.alpha lib/hobo/helper/vm_command.rb