Sha256: 5fd2394f6cc542cd41be7be63fcfbc56cba1bcdd3d56ffee2f8e285214268e45

Contents?: true

Size: 1.06 KB

Versions: 4

Compression:

Stored size: 1.06 KB

Contents

module InfinumSetup
  module Program
    module Helpers
      def prompt_pre_install_comment
        prompt.say("#{name} -- #{pre_install_comment}", color: :cyan) if pre_install_comment
      end

      def prompt_installing
        prompt.ok "#{name} -- Installing"
      end

      def prompt_post_install_comment
        prompt.say("#{name} -- #{post_install_comment}", color: :cyan) if post_install_comment
      end

      def will_install?
        mandatory? ||
          (!mandatory? && options.interactive) ||
          (!mandatory? && !options.interactive && install_if_not_interactive?)
      end

      def skip_install?
        !mandatory? && options.interactive && !prompt.yes?(install_question)
      end

      def install_question
        "Install #{name}"
      end

      def execute_command(cmd = command)
        options.simulate ? simulate(cmd) : execute(cmd)
      end

      def simulate(cmd)
        prompt.warn "#{name} -- #{cmd}"
      end

      def execute(cmd)
        prompt.warn cmd if options.verbose
        puts `#{cmd}`
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
infinum_setup-1.0.1 lib/infinum_setup/program/helpers.rb
infinum_setup-1.0.0 lib/infinum_setup/program/helpers.rb
infinum_setup-0.8.0 lib/infinum_setup/program/helpers.rb
infinum_setup-0.7.0 lib/infinum_setup/program/helpers.rb