Sha256: 27cadfe4179c7747254c3faac19266ab1a076ac7265cbe8d376d837a0544327b

Contents?: true

Size: 668 Bytes

Versions: 2

Compression:

Stored size: 668 Bytes

Contents

module LazyNavigator
  class Opener
    STANDART_MSG = 'echo let the rspec to be with you'.freeze
    WEATHER = 'curl https://wttr.in?0'.freeze
    ACCEPT = 'y'.freeze

    class << self
      def lead(path:, ide: nil, command: STANDART_MSG)
        ask_question
        return unless yes?

        Dir.chdir(path) do
          system "gnome-terminal -- sh -c '#{command};#{WEATHER}; bash'"
          system ide if ide
        end
      end

      private

      def yes?
        gets.chomp.downcase == ACCEPT
      end

      def ask_question
        puts ('continue last project? '.cyan + "#{'y'.green}/#{'n'.magenta}".blink.bold).italic
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lazy_navigator-2.0.0 lib/entities/opener.rb
lazy_navigator-1.5.0 lib/entities/opener.rb