Class: Terraspace::Seeder::Where

Inherits:
Object
  • Object
show all
Defined in:
lib/terraspace/seeder/where.rb

Instance Method Summary collapse

Constructor Details

#initialize(mod, options = {}) ⇒ Where

Returns a new instance of Where.



3
4
5
# File 'lib/terraspace/seeder/where.rb', line 3

def initialize(mod, options={})
  @mod, @options = mod, options
end

Instance Method Details

#app_pathObject



22
23
24
# File 'lib/terraspace/seeder/where.rb', line 22

def app_path
  "#{Terraspace.root}/app/#{@mod.build_dir}/tfvars/#{seed_file}.tfvars"
end

#dest_pathObject



7
8
9
10
11
12
13
14
15
16
# File 'lib/terraspace/seeder/where.rb', line 7

def dest_path
  case @options[:where]
  when "app"
    app_path
  when "seed"
    seed_path
  else
    infer_dest_path
  end
end

#infer_dest_pathObject



18
19
20
# File 'lib/terraspace/seeder/where.rb', line 18

def infer_dest_path
  @mod.type == "stack" ? app_path : seed_path
end

#seed_fileObject



30
31
32
# File 'lib/terraspace/seeder/where.rb', line 30

def seed_file
  @options[:instance] || Terraspace.env
end

#seed_pathObject



26
27
28
# File 'lib/terraspace/seeder/where.rb', line 26

def seed_path
  "#{Terraspace.root}/seed/tfvars/#{@mod.build_dir}/#{seed_file}.tfvars"
end