Sha256: af4390828f14e9c057d6251e563adeaace4b81549bd09133804069583b3e9dd5
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
require 'rake_dependencies' require 'rake_terraform/version' require 'rake_terraform/tasklib' require 'rake_terraform/tasks' module RakeTerraform include RubyTerraform def self.define_command_tasks(&block) RakeTerraform::Tasks::All.new(&block) end def self.define_installation_tasks(opts = {}) RubyTerraform.configure do |c| c.binary = File.join( opts[:path] || File.join('vendor', 'terraform'), 'bin', 'terraform') end RakeDependencies::Tasks::All.new do |t| t.namespace = opts[:namespace] || :terraform t.dependency = 'terraform' t.version = opts[:version] || '0.9.0' t.path = opts[:path] || File.join('vendor', 'terraform') t.type = :zip t.os_ids = {mac: 'darwin', linux: 'linux'} t.uri_template = 'https://releases.hashicorp.com/terraform/<%= @version %>/' + 'terraform_<%= @version %>_<%= @os_id %>_amd64<%= @ext %>' t.file_name_template = 'terraform_<%= @version %>_<%= @os_id %>_amd64<%= @ext %>' t.needs_fetch = lambda do |parameters| terraform_binary = File.join( parameters[:path], parameters[:binary_directory], 'terraform') version_string = StringIO.new if File.exist?(terraform_binary) Lino::CommandLineBuilder.for_command(terraform_binary) .with_flag('-version') .build .execute(stdout: version_string) if version_string.string.lines.first =~ /#{version}/ return false end end return true end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rake_terraform-0.6.0 | lib/rake_terraform.rb |
rake_terraform-0.5.0 | lib/rake_terraform.rb |