rake-terraform 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzQ2MGQyYjFkMTUzMGUwOTdkZGMzNzRkYmRiOTMzMjE5MGQ3NWMyNw==
4
+ ODNkNmUyNTk3ZWRiZDY4NTFjMjJmN2QwYWFjNTk3ODJlMmE3Y2I0YQ==
5
5
  data.tar.gz: !binary |-
6
- MGNhYmQwMWM5MDIyZGRiOGQ3ZTUyNDBkZDg5NDFjZWEyY2I5ZmEwOA==
6
+ ZTg2NTNhODcyZDU2M2JjMGJhMDllYTMxMGJiNjQ4NTk3NTJkOWVjNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- YWExY2YzZmUxNzgyYzRmOGM5N2VmZjc0M2ZjMWFkNjZlYjg4MmIzZGJiNjgw
10
- MTFhMjFkODZlODg4ODQ2ODU5MjkwOTAwY2ViNzdhOWViZDRjOTUwMjk0NTE3
11
- MTMyZTE4NTU2N2ZkMjFiYjJjYzBhOGQ5ZGRiN2U3YWY2YmFmYzU=
9
+ OGFhNTBiNTgwYmIzODRhZjhmZWU2YTE0NzdjZDFiNTA3YjgxNTlhMDNlMWQ1
10
+ OGM3NjQ4MDg1OWUxMjEwZWVkNTNjZjc4ODkzYWY0ZTI2YzE3MzEwY2Q4MGUw
11
+ ZTMwMTBkNjA0ZjY5NGVjYjliYjY4ZWJjY2Y2NzdlYjY1MjhlYmY=
12
12
  data.tar.gz: !binary |-
13
- NzNiNmVjM2RhNGNkZmNjZWQ2NDRhYjdhNThiYWRiNGQ5Y2Q0MzgzYjY3MmY0
14
- MjgyN2E0MmU4Y2U1OWE5ZTc4MDJkYzc2NDY5NTgzYTRiZWYwZTE4ZjQxMTNj
15
- NmFjMTliNjkxYTM5NDgxMzcwNDU0MTk3YzM1N2Q2ZWRhNzczNTY=
13
+ NjVkNTgzZjE4MjVjNDRlNTBkMjJlNjg4ODc1MDE4ODg5NzQ2NGYzYmVhYzRi
14
+ MDYwZDVkNDY3Njc3YTZmYTkwZGYxZjM1ZTg5M2M2NGFiMDI0YzI4MWE3ZmEx
15
+ MmRhMTA3ODhjOWUzYzg3YjI5YWUwZTYzYjYzNDJlNTZlOWY1OGQ=
@@ -1,4 +1,5 @@
1
1
  require 'rake_terraform'
2
+ require 'pathname'
2
3
 
3
4
  namespace :terraform do
4
5
  env_glob = ENV['TERRAFORM_ENVIRONMENT_GLOB'] || 'terraform/**/*.tf'
@@ -9,10 +10,19 @@ namespace :terraform do
9
10
  # Set to string 'false' instead of bool so users can more-easily override
10
11
  hide_tasks = ENV['TERRAFORM_HIDE_TASKS'] || 'false'
11
12
 
13
+ # Regex to determine the relative root path for env_glob
14
+ # Might need a more comprehenvise regex to cover all cases
15
+ # Example Input: test/path to/some-file/**/*.tf
16
+ # Output: test/path to/some-file/
17
+ env_root = env_glob.match(%r{^((\w|\s|-)+\/?)+}).to_s
12
18
  environments = (Dir.glob env_glob).map { |f| File.dirname f }.uniq
13
19
 
14
20
  environments.each do |env|
15
- short_name = File.basename env
21
+ relative_to_current = Pathname.new(env)
22
+ env_glob_root = Pathname.new(env_root)
23
+ abs_relative_path = relative_to_current.relative_path_from(env_glob_root)
24
+
25
+ short_name = abs_relative_path.to_s.gsub('/', '_')
16
26
  plan_path = File.expand_path File.join(output_base, "#{short_name}.tf")
17
27
 
18
28
  desc "Plan migration of #{short_name}" if hide_tasks == 'false'
@@ -1,4 +1,4 @@
1
1
  # Version of the gem
2
2
  module RakeTerraform
3
- VERSION = '0.0.6'
3
+ VERSION = '0.0.7'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rake-terraform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Norm MacLennan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-12 00:00:00.000000000 Z
11
+ date: 2015-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler