nexoform 0.1.3 → 0.1.4

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
  SHA256:
3
- metadata.gz: 780f35d4f1af069004f3a37547f6d5c4dd0e629c80646eccf88dd60fe3cb6454
4
- data.tar.gz: 232eed045be457621c64406f82d4af5662396f7692124dc306bd574615838700
3
+ metadata.gz: dfb7b9a73c3539a07b5072c0cb8578070026159fd27d2309a6e253fa12252fa7
4
+ data.tar.gz: bfae58f03fcc3cc7a634f4afc365d54cca46530b97d3d6707b92926a3a7d87c6
5
5
  SHA512:
6
- metadata.gz: c5a764f74fead9a76e5be271323c16370d769af2eb78347125f8b0f55739949988344c5f783643e84c213c745690c028113e435c24474414dcecc714c87e0c9b
7
- data.tar.gz: 91f58b6fd91bd74a31ad52b34d36cdba93beb0fcfb5eb2e6041f837512830b90f28090d2a0c4f09e48fe2dc53c9142ef49a298eba98aa40987887f74da2d35fe
6
+ metadata.gz: 5f17bc2e9a4b4341ee9f8ab5be0f7e6033d75a3691e58c49dea8498a9dac55b411c063ada6294e48060060427243314d086720d9d82c768f30261dcdcb87f310
7
+ data.tar.gz: c62b66ae199833afd1057c76086f8f667c33856f67a887876c6a7ab26c5724cc50b2c4dee25e9a0b26a0d730283ff9d63e15769868f818477e2d6e076432dce5
data/bin/nexoform CHANGED
@@ -34,6 +34,7 @@ class NexoformBin < Thor
34
34
  class_option :environment, type: :string, aliases: 'e', required: false
35
35
  class_option :assume_yes, type: :boolean, aliases: 'y', default: false
36
36
  class_option :refresh, type: :boolean, aliases: 'r', default: true
37
+ class_option :debug, type: :boolean, aliases: 'd', default: false
37
38
 
38
39
  desc 'plan', 'Print out changes that will be made on next apply (runs a terraform plan)'
39
40
  long_desc <<-LONGDESC
@@ -349,7 +350,8 @@ class NexoformBin < Thor
349
350
  def terraform_apply(options)
350
351
  varfile = apply_with_plan_file?(options) ? '' : var_file_arg(options)
351
352
  planfile = apply_with_plan_file?(options) ? options[:plan] : ''
352
- "terraform apply #{varfile} #{planfile}"
353
+ yes = options[:assume_yes] ? "yes 'yes' | " : ''
354
+ "#{yes}terraform apply #{varfile} #{planfile}"
353
355
  end
354
356
 
355
357
  def exec_output(options)
@@ -549,12 +551,15 @@ class NexoformBin < Thor
549
551
  end
550
552
 
551
553
  def process_dir(options, directory)
554
+ puts "[DEBUG]: Processing directory '#{directory}'" if options['debug']
552
555
  Dir.chdir(directory) do
553
556
  # Go through and process ERB into output then delete the ERB file
554
557
  Dir.glob('*.erb').each do |f|
558
+ puts "Eval-ing ERB for file '#{f}'" if options['debug']
555
559
  header = "# This file was generated by nexoform. Changes will be lost\n"
556
560
  content = ERB.new(File.read(f), 0, "%<>").result(binding)
557
561
  File.write(f.gsub(/\.erb$/i, ''), "#{header}#{content}")
562
+ puts "Removing ERB file '#{f}'" if options['debug']
558
563
  FileUtils.rm([f])
559
564
  end
560
565
 
@@ -620,5 +625,8 @@ else
620
625
  rescue StandardError => e
621
626
  puts "* Encountered an error. Make sure your config-file isn't messed up".red
622
627
  puts "\n* Exception message: #{e.message}".yellow
628
+ if ARGV.any?{ |arg| arg =~ /debug/i }
629
+ puts e.backtrace.join("\n")
630
+ end
623
631
  end
624
632
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Nexoform
4
4
  def self.version
5
- '0.1.3'
5
+ '0.1.4'
6
6
  end
7
7
 
8
8
  def self.date
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nexoform
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Porter