Sha256: 2db6ca2dbe0de27579ab6826cfd033a0d14a88a05e6d9fc1ae24126af1d71770

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

Execute.define_task do
  desc "redis-download", "Download redis package"
  def redis_download
  	if windows?
      require 'net/http'
      require 'zip/zip'
      puts "Installing redis to #{redis_home}."

	    Net::HTTP.start("cloud.github.com") do |http|
	      resp = http.get("/downloads/dmajkic/redis/#{$redis_ver}-win32-win64.zip")
	      open($redis_zip, "wb") do |file|
	        file.write(resp.body)
	      end #do
	    end #do

	    Zip::ZipFile.open($redis_zip) do |zip_file|
	    	zip_file.each do |f|
	    		f_path = File.join(redis_home, f.name)
          FileUtils.mkdir_p(File.dirname(f_path))
          zip_file.extract(f, f_path) { true }
    		end #do
    	end #do

    	FileUtils.mv Dir.glob(File.join(redis_home,'32bit','*')), redis_home
    	FileUtils.rm_rf File.join(redis_home, '64bit')
    	FileUtils.rm_f $redis_zip
    else
      sh 'rm -rf /tmp/redis/' if File.exists?("#{RedisRunner.redisdir}")
      sh 'git clone git://github.com/antirez/redis.git /tmp/redis -n'
      sh "cd #{RedisRunner.redisdir} && git reset --hard && git checkout #{REDIS_RELEASE}"
    end #if
  end #redis_download
end #do

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rhoconnect-3.2.0.beta3 commands/commands/redis_commands/redis_download.rb
rhoconnect-3.2.0.beta2 commands/commands/redis_commands/redis_download.rb
rhoconnect-3.2.0.beta1 commands/commands/redis_commands/redis_download.rb