lib/ruby/terraform/executable.rb in rake-terraform-wrapper-0.2.3 vs lib/ruby/terraform/executable.rb in rake-terraform-wrapper-0.3.0
- old
+ new
@@ -5,30 +5,28 @@
module Terraform
module_function
def config
@config ||= Configuration.new
+ yield @config if block_given?
+ @config
end
class Executable
class PlatformUnsupported < StandardError; end
def initialize(config = Ruby::Terraform.config)
@terraform_version = config.terraform_version
@download_path = config.download_path
+ @binary = config.binary
@download_filename = "#{@terraform_version}-terraform.zip"
-
FileUtils.mkdir_p(@download_path)
raise PlatformUnsupported unless supported?
end
def binary
- if OS.windows?
- "#{@download_path}/terraform.exe"
- else
- "#{@download_path}/terraform"
- end
+ @binary
end
def download(opts = {})
return if binary_exist?
opts[:uri] ||= ENV['TERRAFORM_DOWNLOAD_URL'] || "https://releases.hashicorp.com/#{download_uri}"