Module: Terraspace::Compiler::Basename

Included in:
Perform, Writer
Defined in:
lib/terraspace/compiler/basename.rb

Instance Method Summary collapse

Instance Method Details

#basename(path) ⇒ Object



3
4
5
6
7
8
# File 'lib/terraspace/compiler/basename.rb', line 3

def basename(path)
  # double escape of \\w is tricky
  regexp = Regexp.new(".*(app|vendor)\/\\w+\/#{@mod.name}\/")
  path.sub(%r{.*config/terraform/}, '')
      .sub(regexp,'')
end