diff --git a/lib/vanagon/platform/dsl.rb b/lib/vanagon/platform/dsl.rb index 7c66b268..c1535830 100644 --- a/lib/vanagon/platform/dsl.rb +++ b/lib/vanagon/platform/dsl.rb @@ -18,17 +18,23 @@ class Platform class DSL # Constructor for the DSL object # - # @param name [String] name of the platform + # @param basename [String] name of the platform # @return [Vanagon::Platform::DSL] A DSL object to describe the {Vanagon::Platform} - def initialize(platform_name) - @name = platform_name + def initialize(basename) + # This name is based on the file: configs/platform/.rb + @name = basename end # Primary way of interacting with the DSL. Also a simple factory to get the right platform object. # - # @param name [String] name of the platform + # @param platform_name [String] name of the platform + # @param override_name [Boolean] whether the specified `platform_name` should override the basename # @param block [Proc] DSL definition of the platform to call - def platform(platform_name, &block) + def platform(platform_name, override_name: false, &block) + # The platform name is specified in the platform definition using the + # `platform` DSL method and may not match the platform's basename + @name = platform_name if override_name + @platform = case platform_name when /^aix-/ Vanagon::Platform::RPM::AIX.new(@name)