Sha256: bee760f7c1d40e88808a8aa84ef87340ec6d565c967ae5258cb303958372f68b

Contents?: true

Size: 833 Bytes

Versions: 7

Compression:

Stored size: 833 Bytes

Contents

require 'net/http'
require 'net/https'
require 'open-uri'
require 'fileutils'

module RocketFuel
  module Install
    class Download
      URL = 'https://codeload.github.com/LaunchAcademy/rocket-fuel-chef/tar.gz/master'

      def retrieve
        http = Net::HTTP.new(uri.host, uri.port)
        http.use_ssl = true
        resp = http.get(uri.request_uri)
        open(archive_path, "wb") do |file|
          file.write(resp.body)
        end
      end

      def extract
        FileUtils.mkdir_p(recipe_path)
        `tar xvfz #{archive_path} -C #{File.join(recipe_path, '..') }`
      end

      protected
      def archive_path
        RocketFuel::Install::ARCHIVE_PATH
      end

      def recipe_path
        RocketFuel::Install::RECIPE_PATH
      end

      def uri
        @uri = URI.parse(URL)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rocket_fuel-0.2.0 lib/rocket_fuel/install/download.rb
rocket_fuel-0.1.0 lib/rocket_fuel/install/download.rb
rocket_fuel-0.0.8 lib/rocket_fuel/install/download.rb
rocket_fuel-0.0.7 lib/rocket_fuel/install/download.rb
rocket_fuel-0.0.6 lib/rocket_fuel/install/download.rb
rocket_fuel-0.0.5 lib/rocket_fuel/install/download.rb
rocket_fuel-0.0.4 lib/rocket_fuel/install/download.rb