Sha256: 21ad954542a27b9640daf3a8b71c6d7071c0bbc488ad02f868538095cf4cb7d5

Contents?: true

Size: 1.24 KB

Versions: 6

Compression:

Stored size: 1.24 KB

Contents

# frozen_string_literal: true

module InstallGemLocal
  class Action
    extend InstallGemLocal::InstallGem
    extend InstallGemLocal::CopyGem
    extend InstallGemLocal::RemoveGem
    extend InstallGemLocal::BuildGem
    extend InstallGemLocal::PushGem

    class << self
      def till_install
        remove_gem
        build_gem
        install_gem
      end

      def till_copy
        till_install
        copy_gem
      end

      private

      def tty_command
        @tty_command ||= TTY::Command.new(uuid: false, printer: :quiet)
      end

      def file_names
        file = tty_command.run('find -type f -name "*.gem"')
        file.entries
      end

      def multiple_version_selection(include_all: false)
        options =
          include_all ? { '*' => { 'value' => 'all', 'display' => 'All Versions' } } : {}
        file_names.each_with_index do |file_name, index|
          options[('a'..'z').to_a[index]] = { 'value' => file_name, 'display' => file_name }
        end
        options['/'] = { 'value' => 'exit', 'display' => 'Exit' }
        InstallGemLocal::Helper.prompt_options(
          flash_message: InstallGemLocal::Helper.flash_message(title: I18n.t(:choose_version)),
          options: options
        )
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
install_gem_local-0.1.17 lib/install_gem_local/action.rb
install_gem_local-0.1.16 lib/install_gem_local/action.rb
install_gem_local-0.1.15 lib/install_gem_local/action.rb
install_gem_local-0.1.14 lib/install_gem_local/action.rb
install_gem_local-0.1.13 lib/install_gem_local/action.rb
install_gem_local-0.1.12 lib/install_gem_local/action.rb