rake_terraform 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5666becae9e21fad6de6ff2077a4fad1798708d4
4
- data.tar.gz: 1553af3c5176b87259d27a20fa022f0b7e4e7fe0
3
+ metadata.gz: 5edc08d5632b794f711a8c0461d38354575c43f9
4
+ data.tar.gz: 28f0cf2888f932797b51164b1088abfa8428af6a
5
5
  SHA512:
6
- metadata.gz: 4b5a4d08b511f65f4e2bc10bf415cf0c6c764d0e03943da607421ac5abea8526743b34c362a38c2a96d1f8e865884e6e7d0522a146f98ae1b16538fd69c47582
7
- data.tar.gz: 2439cd62cf0786b911a85ce99ffdf61322747e9fc90da6e54308f800bea28bac4e71189fa6a9cb81f6c437b2d041c1622c7d06ddc27a0cc35c3dfbd13a46ad09
6
+ metadata.gz: a2b6f2218275a495ec51780c536653c4df456cb5ca044d19ace35df66fd410c81fecc0986ed38fb51d3699c5fac962e10a5ed91fb187ce0355bd1fd41be3da20
7
+ data.tar.gz: 57edf33e6d2b655657ca8cf33749631bda24a82f5f4b1ce0f55a842f196c629acc648d17386d232575b1d99cf347ca078602c2af387a0763c44e5aca3c0d7444
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rake_terraform (0.1.1)
4
+ rake_terraform (0.2.0)
5
+ rake_dependencies (~> 0.15)
5
6
  ruby-terraform (~> 0.4)
6
7
 
7
8
  GEM
@@ -24,9 +25,14 @@ GEM
24
25
  lino (1.1.0)
25
26
  hamster (~> 3.0)
26
27
  open4 (~> 1.3)
28
+ minitar (0.6.1)
27
29
  minitest (5.10.1)
28
30
  open4 (1.3.4)
29
31
  rake (11.2.2)
32
+ rake_dependencies (0.15.0)
33
+ hamster (~> 3.0)
34
+ minitar (~> 0.6)
35
+ rubyzip (~> 1.1)
30
36
  rspec (3.5.0)
31
37
  rspec-core (~> 3.5.0)
32
38
  rspec-expectations (~> 3.5.0)
@@ -42,6 +48,7 @@ GEM
42
48
  rspec-support (3.5.0)
43
49
  ruby-terraform (0.4.0)
44
50
  lino (~> 1.1)
51
+ rubyzip (1.2.1)
45
52
  thread_safe (0.3.5)
46
53
  tzinfo (1.2.2)
47
54
  thread_safe (~> 0.1)
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
- # Rake::Terraform
1
+ # RakeTerraform
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/rake/terraform`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Provides rake tasks for executing terraform commands as part of a rake build.
6
4
 
7
5
  ## Installation
8
6
 
@@ -1,6 +1,52 @@
1
- require "rake_terraform/version"
2
- require "rake_terraform/tasklib"
3
- require "rake_terraform/tasks"
1
+ require 'rake_dependencies'
2
+ require 'rake_terraform/version'
3
+ require 'rake_terraform/tasklib'
4
+ require 'rake_terraform/tasks'
4
5
 
5
6
  module RakeTerraform
7
+ include RubyTerraform
8
+
9
+ def self.define_installation_tasks(opts = {})
10
+ RubyTerraform.configure do |c|
11
+ c.binary = File.join(
12
+ opts[:path] || File.join('vendor', 'terraform'),
13
+ 'bin', 'terraform')
14
+ end
15
+ RakeDependencies::Tasks::All.new do |t|
16
+ t.namespace = opts[:namespace] || :terraform
17
+ t.dependency = 'terraform'
18
+ t.version = opts[:version] || '0.9.0'
19
+ t.path = opts[:path] || File.join('vendor', 'terraform')
20
+ t.type = :zip
21
+
22
+ t.os_ids = {mac: 'darwin', linux: 'linux'}
23
+
24
+ t.uri_template =
25
+ 'https://releases.hashicorp.com/terraform/<%= @version %>/' +
26
+ 'terraform_<%= @version %>_<%= @os_id %>_amd64<%= @ext %>'
27
+ t.file_name_template =
28
+ 'terraform_<%= @version %>_<%= @os_id %>_amd64<%= @ext %>'
29
+
30
+ t.needs_fetch = lambda do |parameters|
31
+ terraform_binary = File.join(
32
+ parameters[:path],
33
+ parameters[:binary_directory],
34
+ 'terraform')
35
+ version_string = StringIO.new
36
+
37
+ if File.exist?(terraform_binary)
38
+ Lino::CommandLineBuilder.for_command(terraform_binary)
39
+ .with_flag('-version')
40
+ .build
41
+ .execute(stdout: version_string)
42
+
43
+ if version_string.string.lines.first =~ /#{version}/
44
+ return false
45
+ end
46
+ end
47
+
48
+ return true
49
+ end
50
+ end
51
+ end
6
52
  end
@@ -1,3 +1,3 @@
1
1
  module RakeTerraform
2
- VERSION = "0.1.1"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ['lib']
23
23
 
24
+ spec.add_dependency 'rake_dependencies', '~> 0.15'
24
25
  spec.add_dependency 'ruby-terraform', '~> 0.4'
25
26
 
26
27
  spec.add_development_dependency 'bundler', '~> 1.14'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake_terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Toby Clemson
@@ -10,6 +10,20 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2017-03-17 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake_dependencies
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '0.15'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '0.15'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: ruby-terraform
15
29
  requirement: !ruby/object:Gem::Requirement