lib/rspec/terraspace/ts.rb in rspec-terraspace-0.2.3 vs lib/rspec/terraspace/ts.rb in rspec-terraspace-0.3.0

- old
+ new

@@ -1,10 +1,11 @@ require "json" module RSpec::Terraspace class Ts extend Memoist + include Concern CLI = ::Terraspace::CLI def build_test_harness(options={}) project = Project.new(options) @@ -14,37 +15,18 @@ def up(args) run("up #{args} -y") mod = args.split(' ').first @mod = ::Terraspace::Mod.new(mod) - save_output end def down(args) run("down #{args} -y") end def run(command) - puts "=> terraspace #{command}".color(:green) + puts "=> TS_ENV=#{Terraspace.env} terraspace #{command}".color(:green) args = command.split(' ') CLI.start(args) - end - - # Note: a terraspace.down will remove the output.json since it does a clean - def save_output - FileUtils.mkdir_p(File.dirname(out_path)) - run("output #{@mod.name} --format json --out #{out_path}") - end - - def output(mod, name) - outputs.dig(name, "value") - end - - def outputs - JSON.load(IO.read(out_path)) - end - - def out_path - "#{Terraspace.tmp_root}/rspec/output.json" end end end