Sha256: 52362cc2a5d8833ad5368bf44a2e5858b03ee6520d43895afa188cb255e9c0a0

Contents?: true

Size: 1.14 KB

Versions: 2

Compression:

Stored size: 1.14 KB

Contents

module VagrantPlugins
  module Ventriloquist
    module Services
      class Redis < Service
        def initialize(*args)
          super
          @config[:ports] ||= ['6379:6379']
        end

        def provision(machine)
          super
          install_client(machine)
        end

        protected

        def install_client(machine)
          return if machine.communicate.test('which redis-cli > /dev/null')

          redis_version = '2.8.2'
          machine.guest.tap do |guest|
            guest.capability(:install_build_tools)
            # TODO: Use the same version specified on the Vagrantfile
            guest.capability(:download, "http://download.redis.io/releases/redis-#{redis_version}.tar.gz", "/tmp/redis-#{redis_version}.tar.gz")
            guest.capability(:untar, "/tmp/redis-#{redis_version}.tar.gz", '/tmp')
            guest.capability(:make, "/tmp/redis-#{redis_version}", 'redis-cli')
          end

          machine.communicate.tap do |comm|
            comm.sudo("cp /tmp/redis-#{redis_version}/src/redis-cli /usr/local/bin")
            comm.execute('rm -rf /tmp/redis-*')
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ventriloquist-0.4.1 lib/ventriloquist/services/redis.rb
ventriloquist-0.4.0 lib/ventriloquist/services/redis.rb