Class: Sambot::Domain::Packer
- Inherits:
-
Object
- Object
- Sambot::Domain::Packer
- Defined in:
- lib/sambot/domain/packer.rb
Class Method Summary collapse
Class Method Details
.generate_config(cookbook_name, target_platform) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/sambot/domain/packer.rb', line 17 def self.generate_config(cookbook_name, target_platform) filename = TemplateProvider.get_path("packer.#{target_platform}.json") File.read(filename).gsub(/@@cookbook_name@@/, cookbook_name) File.write("packer.json", contents) UI.debug("The configuration file for Packer has been added.") end |
.prepare(config_file = nil) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/sambot/domain/packer.rb', line 7 def self.prepare(config_file = nil) config = Common::Config.new.read(config_file) cookbook_name = config['name'] target_platform = ENV['TARGET_IMAGE_PLATFORM'] unless target_platform == 'windows' || target_platform == 'linux' raise ApplicationError.new("The target image platform must be either 'windows' or 'linux'.") end generate_config(cookbook_name, target_platform) end |