Module: CiConfigGenerator
- Defined in:
- lib/ci_config_generator.rb,
lib/ci_config_generator/version.rb
Constant Summary collapse
- VERSION =
"0.0.2"
Class Method Summary collapse
Class Method Details
.error(message) ⇒ Object
12 13 14 15 |
# File 'lib/ci_config_generator.rb', line 12 def self.error() STDERR.puts("Error: #{message}") exit 1 end |
.interpolate(file_name, variables) ⇒ Object
5 6 7 8 9 10 |
# File 'lib/ci_config_generator.rb', line 5 def self.interpolate(file_name, variables) File.read(file_name).gsub(/%{[^}]+}/) do |match| key = match.gsub(/^%{([^}]+)}/, '\1') variables[key] || error("Cannot interpolate unknown environment variable '#{key}' in '#{file_name}'") end end |