Skip to content

Commit

Permalink
Merge pull request #1394 from puppetlabs/cat_2040
Browse files Browse the repository at this point in the history
(CAT-2040) pdk spinner inconsistent on windows
  • Loading branch information
alex501212 committed Sep 13, 2024
2 parents 4ae45a0 + 2d57211 commit afeb5aa
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion lib/pdk/cli/exec/command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def add_spinner(message, opts = {})

require 'pdk/cli/util/spinner'

@spinner = TTY::Spinner.new("[:spinner] #{message}", opts.merge(PDK::CLI::Util.spinner_opts_for_platform))
@spinner = TTY::Spinner.new("[:spinner] #{message}")
end

def update_environment(additional_env)
Expand Down
12 changes: 0 additions & 12 deletions lib/pdk/cli/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,6 @@ def ensure_in_module!(opts = {})
end
module_function :ensure_in_module!

def spinner_opts_for_platform
windows_opts = {
success_mark: '*',
error_mark: 'X'
}

return windows_opts if Gem.win_platform?

{}
end
module_function :spinner_opts_for_platform

def prompt_for_yes(question_text, opts = {})
require 'tty/prompt'

Expand Down
4 changes: 2 additions & 2 deletions lib/pdk/validate/external_command_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,9 @@ def prepare_invoke!
if parent_validator.nil? || parent_validator.spinner.nil? || !parent_validator.spinner.is_a?(TTY::Spinner::Multi)
c.add_spinner(spinner_text_for_targets(invokation_targets))
else
spinner = TTY::Spinner.new("[:spinner] #{spinner_text_for_targets(invokation_targets)}", PDK::CLI::Util.spinner_opts_for_platform)
spinner = TTY::Spinner.new("[:spinner] #{spinner_text_for_targets(invokation_targets)}")
parent_validator.spinner.register(spinner)
c.register_spinner(spinner, PDK::CLI::Util.spinner_opts_for_platform)
c.register_spinner(spinner)
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pdk/validate/invokable_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def spinner

require 'pdk/cli/util/spinner'

@spinner = TTY::Spinner.new("[:spinner] #{spinner_text}", PDK::CLI::Util.spinner_opts_for_platform)
@spinner = TTY::Spinner.new("[:spinner] #{spinner_text}")
end

# Process any targets that were skipped by the validator and add the events to the validation report
Expand Down
2 changes: 1 addition & 1 deletion lib/pdk/validate/validator_group.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def spinner

require 'pdk/cli/util/spinner'

@spinner = TTY::Spinner::Multi.new("[:spinner] #{spinner_text}", PDK::CLI::Util.spinner_opts_for_platform)
@spinner = TTY::Spinner::Multi.new("[:spinner] #{spinner_text}")

# Register the child spinners
validator_instances.each do |instance|
Expand Down

0 comments on commit afeb5aa

Please sign in to comment.