lib/pdk/util/changelog_generator.rb in pdk-1.18.1 vs lib/pdk/util/changelog_generator.rb in pdk-2.0.0

- old
+ new

@@ -7,14 +7,18 @@ VERSION_REGEX = %r{^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*)?(\+[0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*)?$} GEM = 'github_changelog_generator'.freeze # Raises if the github_changelog_generator is not available def self.github_changelog_generator_available! - require 'bundler' - return if ::Bundler.rubygems.find_name(GEM).any? + check_command = PDK::CLI::Exec::InteractiveCommand.new(PDK::CLI::Exec.bundle_bin, 'show', 'github_changelog_generator') + check_command.context = :module + result = check_command.execute! + + return if result[:exit_code].zero? + raise PDK::CLI::ExitWithError, _( - 'Unable to generate the changelog as the %{gem} gem is not installed', + 'Unable to generate the changelog as the %{gem} gem is not included in this module\'s Gemfile', ) % { gem: GEM } end # Runs the Changelog Generator gem (in the module's context) to automatically create a CHANGLELOG.MD file #