lib/pdk/cli/build.rb in pdk-akerl-1.9.1.1 vs lib/pdk/cli/build.rb in pdk-akerl-1.14.0.1

- old
+ new

@@ -1,7 +1,5 @@ -require 'pdk/cli/util' - module PDK::CLI @build_cmd = @base_cmd.define_command do name 'build' usage _('build [options]') summary _('Builds a package from the module that can be published to the Puppet Forge.') @@ -12,25 +10,33 @@ option nil, 'force', _('Skips the prompts and builds the module package.') run do |opts, _args, _cmd| require 'pdk/module/build' + require 'pdk/module/metadata' + require 'pdk/cli/util' # Make sure build is being run in a valid module directory with a metadata.json PDK::CLI::Util.ensure_in_module!( message: _('`pdk build` can only be run from inside a valid module with a metadata.json.'), log_level: :info, ) + PDK::CLI::Util.analytics_screen_view('build', opts) + module_metadata = PDK::Module::Metadata.from_file('metadata.json') # TODO: Ensure forge metadata has been set, or call out to interview # to set it. # unless module_metadata.forge_ready? if opts[:force] - PDK.logger.error _('This module is missing required fields in the metadata.json. Re-run the build command without --force to add this information.') - exit 1 + PDK.logger.warn _( + 'This module is missing the following fields in the metadata.json: %{fields}. ' \ + 'These missing fields may affect the visibility of the module on the Forge.', + ) % { + fields: module_metadata.missing_fields.join(', '), + } else module_metadata.interview_for_forge! module_metadata.write!('metadata.json') end end