Sha256: 20637be0644cfe9073241458ecc5d13c0dab8799ca987c0a8fe67841372f226e

Contents?: true

Size: 1.04 KB

Versions: 15

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

#
# Copyright 2019-Present Sonatype Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

require 'tty-spinner'
require 'pastel'

module Chelsea
  # the spinner we use in Chelsea, needs work
  class Spinner
    def initialize
      @pastel = Pastel.new
    end

    def spin_msg(msg)
      format = "[#{@pastel.green(':spinner')}] " + @pastel.white(msg)
      spinner = TTY::Spinner.new(
        format,
        success_mark: @pastel.green('+'),
        hide_cursor: true
      )
      spinner.auto_spin
      spinner
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
chelsea-0.0.43 lib/chelsea/spinner.rb
chelsea-0.0.42 lib/chelsea/spinner.rb
chelsea-0.0.41 lib/chelsea/spinner.rb
chelsea-0.0.40 lib/chelsea/spinner.rb
chelsea-0.0.38 lib/chelsea/spinner.rb
chelsea-0.0.37 lib/chelsea/spinner.rb
chelsea-0.0.36 lib/chelsea/spinner.rb
chelsea-0.0.35 lib/chelsea/spinner.rb
chelsea-0.0.34 lib/chelsea/spinner.rb
chelsea-0.0.33 lib/chelsea/spinner.rb
chelsea-0.0.32 lib/chelsea/spinner.rb
chelsea-0.0.31 lib/chelsea/spinner.rb
chelsea-0.0.30 lib/chelsea/spinner.rb
chelsea-0.0.29 lib/chelsea/spinner.rb
chelsea-0.0.28 lib/chelsea/spinner.rb