Sha256: 1a24aeb41d6ffd271b8a30d34b07c6e11bfd6735f90d47c8d48d99f1e2505ca3

Contents?: true

Size: 568 Bytes

Versions: 1

Compression:

Stored size: 568 Bytes

Contents

module Brah

  def self.run(git_remote_output)
    Brah.new(git_remote_output).run
  end

  class Brah
    attr_reader :command

    def initialize(git_remote_output)
      raise("No remotes found!") if git_remote_output.empty?
      parsed_command = convert_ssh_to_http(git_remote_output)
      @command = "open #{parsed_command}"
    end

    def run
      system(command)
    end

    private

      def convert_ssh_to_http(git_remote_output)
        git_remote_output.match(/origin\t(.+)\.git/)[1].gsub("com:", "com/").gsub("git@", "https://")
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
brah-0.3.0 lib/brah.rb