lib/pdk/generate/puppet_object.rb in pdk-2.6.1 vs lib/pdk/generate/puppet_object.rb in pdk-2.7.0

- old
+ new

@@ -19,11 +19,11 @@ # @param module_dir [String] The path to the root of module that the # will contain the object. # @param object_name [String] The name of the object. # @param options [Hash{Symbol => Object}] def initialize(context, object_name, options) - raise ArgumentError, _('Expected PDK::Context::AbstractContext but got \'%{klass}\' for context') % { klass: context.class } unless context.is_a?(PDK::Context::AbstractContext) + raise ArgumentError, 'Expected PDK::Context::AbstractContext but got \'%{klass}\' for context' % { klass: context.class } unless context.is_a?(PDK::Context::AbstractContext) @context = context @options = options @object_name = object_name end @@ -59,11 +59,11 @@ # Raises an error if any pre-conditions are not met # # @return [void] # @abstract def check_preconditions - raise ArgumentError, _('Expected a module context but got %{context_name}') % { context_name: context.display_name } unless context.is_a?(PDK::Context::Module) + raise ArgumentError, 'Expected a module context but got %{context_name}' % { context_name: context.display_name } unless context.is_a?(PDK::Context::Module) end # Check the preconditions of this template group, behaving as a predicate rather than raising an exception. # # @return [Boolean] true if the generator is safe to run, otherwise false. @@ -120,11 +120,11 @@ # @return [void] # @api private def stage_change(relative_dest_path, content, update_manager) absolute_file_path = File.join(context.root_path, relative_dest_path) if PDK::Util::Filesystem.exist?(absolute_file_path) - raise PDK::CLI::ExitWithError, _("Unable to generate %{object_type}; '%{file}' already exists.") % { + raise PDK::CLI::ExitWithError, "Unable to generate %{object_type}; '%{file}' already exists." % { file: absolute_file_path, object_type: spec_only? ? 'unit test' : friendly_name, } end update_manager.add_file(absolute_file_path, content) @@ -158,22 +158,22 @@ require 'pdk/logger' require 'pdk/util/template_uri' templates.each do |template| if template[:uri].nil? - PDK.logger.debug(_('No %{dir_type} template found; trying next template directory.') % { dir_type: template[:type] }) + PDK.logger.debug('No %{dir_type} template found; trying next template directory.' % { dir_type: template[:type] }) next end PDK::Template.with(PDK::Util::TemplateURI.new(template[:uri]), context) do |template_dir| if template_files.any? { |source_file, _| template_dir.has_single_item?(source_file) } yield template_dir # TODO: refactor to a search-and-execute form instead return # work is done # rubocop:disable Lint/NonLocalExitFromIterator elsif template[:allow_fallback] - PDK.logger.debug(_('Unable to find a %{type} template in %{url}; trying next template directory.') % { type: friendly_name, url: template[:uri] }) + PDK.logger.debug('Unable to find a %{type} template in %{url}; trying next template directory.' % { type: friendly_name, url: template[:uri] }) else - raise PDK::CLI::FatalError, _('Unable to find the %{type} template in %{url}.') % { type: friendly_name, url: template[:uri] } + raise PDK::CLI::FatalError, 'Unable to find the %{type} template in %{url}.' % { type: friendly_name, url: template[:uri] } end end end rescue ArgumentError => e raise PDK::CLI::ExitWithError, e